Skip to content

Commit

Permalink
Enable save/load in MP for any PC client (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kexanone authored Jan 17, 2024
1 parent 5b39c3d commit 9820672
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
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);
}
}
}
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);
}
};

0 comments on commit 9820672

Please sign in to comment.