2022-01-14 22:30:54 +00:00
|
|
|
|
using Mirror;
|
|
|
|
|
using QSB.Messaging;
|
2022-01-08 11:41:55 +00:00
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
|
2022-02-27 12:40:44 +00:00
|
|
|
|
namespace QSB.ConversationSync.Messages
|
2022-01-08 11:41:55 +00:00
|
|
|
|
{
|
2022-02-28 21:20:51 +00:00
|
|
|
|
internal class PersistentConditionMessage : QSBMessage<string, bool>
|
2022-01-08 11:41:55 +00:00
|
|
|
|
{
|
2022-02-27 12:40:44 +00:00
|
|
|
|
public PersistentConditionMessage(string condition, bool state)
|
2022-01-08 11:41:55 +00:00
|
|
|
|
{
|
2022-02-28 21:20:51 +00:00
|
|
|
|
Value1 = condition;
|
|
|
|
|
Value2 = state;
|
2022-01-08 11:41:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-27 12:40:44 +00:00
|
|
|
|
public override void OnReceiveRemote()
|
2022-01-08 11:41:55 +00:00
|
|
|
|
{
|
2022-02-27 12:40:44 +00:00
|
|
|
|
if (QSBCore.IsHost)
|
|
|
|
|
{
|
2022-02-28 21:20:51 +00:00
|
|
|
|
QSBWorldSync.SetPersistentCondition(Value1, Value2);
|
2022-02-27 12:40:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var gameSave = PlayerData._currentGameSave;
|
2022-02-28 21:20:51 +00:00
|
|
|
|
if (gameSave.dictConditions.ContainsKey(Value1))
|
2022-02-27 12:40:44 +00:00
|
|
|
|
{
|
2022-02-28 21:20:51 +00:00
|
|
|
|
gameSave.dictConditions[Value1] = Value2;
|
2022-02-27 12:40:44 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-02-28 21:20:51 +00:00
|
|
|
|
gameSave.dictConditions.Add(Value1, Value2);
|
2022-02-27 12:40:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-28 21:20:51 +00:00
|
|
|
|
if (Value1
|
|
|
|
|
is not "LAUNCH_CODES_GIVEN"
|
2022-02-27 12:40:44 +00:00
|
|
|
|
and not "PLAYER_ENTERED_TIMELOOPCORE"
|
|
|
|
|
and not "PROBE_ENTERED_TIMELOOPCORE"
|
|
|
|
|
and not "PLAYER_ENTERED_TIMELOOPCORE_MULTIPLE")
|
|
|
|
|
{
|
|
|
|
|
PlayerData.SaveCurrentGame();
|
|
|
|
|
}
|
2022-01-08 11:41:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-27 12:40:44 +00:00
|
|
|
|
public override void OnReceiveLocal()
|
2022-01-08 11:41:55 +00:00
|
|
|
|
{
|
2022-02-27 12:40:44 +00:00
|
|
|
|
if (QSBCore.IsHost)
|
|
|
|
|
{
|
2022-02-28 21:20:51 +00:00
|
|
|
|
QSBWorldSync.SetPersistentCondition(Value1, Value2);
|
2022-02-27 12:40:44 +00:00
|
|
|
|
}
|
2022-01-08 11:41:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-25 06:04:54 +00:00
|
|
|
|
}
|