mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-04 02:47:22 +00:00
44 lines
1.0 KiB
C#
44 lines
1.0 KiB
C#
using QSB.Messaging;
|
|
using QSB.WorldSync;
|
|
|
|
namespace QSB.ConversationSync.Messages;
|
|
|
|
internal class PersistentConditionMessage : QSBMessage<(string Condition, bool State)>
|
|
{
|
|
public PersistentConditionMessage(string condition, bool state) : base((condition, state)) { }
|
|
|
|
public override void OnReceiveRemote()
|
|
{
|
|
if (QSBCore.IsHost)
|
|
{
|
|
QSBWorldSync.SetPersistentCondition(Data.Condition, Data.State);
|
|
}
|
|
|
|
var gameSave = PlayerData._currentGameSave;
|
|
if (gameSave.dictConditions.ContainsKey(Data.Condition))
|
|
{
|
|
gameSave.dictConditions[Data.Condition] = Data.State;
|
|
}
|
|
else
|
|
{
|
|
gameSave.dictConditions.Add(Data.Condition, Data.State);
|
|
}
|
|
|
|
if (Data.Condition
|
|
is not "LAUNCH_CODES_GIVEN"
|
|
and not "PLAYER_ENTERED_TIMELOOPCORE"
|
|
and not "PROBE_ENTERED_TIMELOOPCORE"
|
|
and not "PLAYER_ENTERED_TIMELOOPCORE_MULTIPLE")
|
|
{
|
|
PlayerData.SaveCurrentGame();
|
|
}
|
|
}
|
|
|
|
public override void OnReceiveLocal()
|
|
{
|
|
if (QSBCore.IsHost)
|
|
{
|
|
QSBWorldSync.SetPersistentCondition(Data.Condition, Data.State);
|
|
}
|
|
}
|
|
} |