Skip to content

Commit 9820672

Browse files
authored
Enable save/load in MP for any PC client (#34)
1 parent 5b39c3d commit 9820672

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[BaseContainerProps(), SCR_BaseContainerCustomTitleUIInfo("m_Info")]
2+
modded class SCR_LoadSessionToolbarAction : SCR_EditorToolbarAction
3+
{
4+
//---------------------------------------------------------------------------------------------
5+
//! Enable loading for clients on PC (disabled on Xbox, since broken)
6+
override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
7+
{
8+
//--- Disallow if editor save struct is not configured
9+
SCR_SaveLoadComponent saveLoadComponent = SCR_SaveLoadComponent.GetInstance();
10+
if (!saveLoadComponent || !saveLoadComponent.ContainsStruct(SCR_EditorStruct))
11+
return false;
12+
13+
if (Replication.IsServer())
14+
{
15+
//--- Loading is always available for the host and in singleplayer
16+
return true;
17+
}
18+
else
19+
{
20+
//--- Loading is only available on PC in MP
21+
return (System.GetPlatform() == EPlatform.WINDOWS);
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[BaseContainerProps(), SCR_BaseContainerCustomTitleUIInfo("m_Info")]
2+
modded class SCR_SaveSessionToolbarAction : SCR_EditorToolbarAction
3+
{
4+
//---------------------------------------------------------------------------------------------
5+
//! Enable saving for clients on PC (disabled on Xbox, since broken)
6+
override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
7+
{
8+
//--- Disallow on client if not PC, or in MP for "Save" version ("Save As" is allowed in MP)
9+
if ((!Replication.IsServer() && System.GetPlatform() != EPlatform.WINDOWS) || (!m_bSaveAs && Replication.IsRunning()))
10+
return false;
11+
12+
//--- Disallow if editor save struct is not configured
13+
SCR_SaveLoadComponent saveLoadComponent = SCR_SaveLoadComponent.GetInstance();
14+
return saveLoadComponent && saveLoadComponent.ContainsStruct(SCR_EditorStruct);
15+
}
16+
};

0 commit comments

Comments
 (0)