-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable save/load in MP for any PC client (#34)
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
Scripts/Game/ODIN/Editor/Containers/Actions/ToolbarActions/SCR_LoadSessionToolbarAction.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[BaseContainerProps(), SCR_BaseContainerCustomTitleUIInfo("m_Info")] | ||
modded class SCR_LoadSessionToolbarAction : SCR_EditorToolbarAction | ||
{ | ||
//--------------------------------------------------------------------------------------------- | ||
//! Enable loading for clients on PC (disabled on Xbox, since broken) | ||
override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags) | ||
{ | ||
//--- Disallow if editor save struct is not configured | ||
SCR_SaveLoadComponent saveLoadComponent = SCR_SaveLoadComponent.GetInstance(); | ||
if (!saveLoadComponent || !saveLoadComponent.ContainsStruct(SCR_EditorStruct)) | ||
return false; | ||
|
||
if (Replication.IsServer()) | ||
{ | ||
//--- Loading is always available for the host and in singleplayer | ||
return true; | ||
} | ||
else | ||
{ | ||
//--- Loading is only available on PC in MP | ||
return (System.GetPlatform() == EPlatform.WINDOWS); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Scripts/Game/ODIN/Editor/Containers/Actions/ToolbarActions/SCR_SaveSessionToolbarAction.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[BaseContainerProps(), SCR_BaseContainerCustomTitleUIInfo("m_Info")] | ||
modded class SCR_SaveSessionToolbarAction : SCR_EditorToolbarAction | ||
{ | ||
//--------------------------------------------------------------------------------------------- | ||
//! Enable saving for clients on PC (disabled on Xbox, since broken) | ||
override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags) | ||
{ | ||
//--- Disallow on client if not PC, or in MP for "Save" version ("Save As" is allowed in MP) | ||
if ((!Replication.IsServer() && System.GetPlatform() != EPlatform.WINDOWS) || (!m_bSaveAs && Replication.IsRunning())) | ||
return false; | ||
|
||
//--- Disallow if editor save struct is not configured | ||
SCR_SaveLoadComponent saveLoadComponent = SCR_SaveLoadComponent.GetInstance(); | ||
return saveLoadComponent && saveLoadComponent.ContainsStruct(SCR_EditorStruct); | ||
} | ||
}; |