mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-07 13:05:41 +00:00
36 lines
885 B
C#
36 lines
885 B
C#
using QSB.ConversationSync.Messages;
|
|
using QSB.ConversationSync.Patches;
|
|
using QSB.Messaging;
|
|
using System.Linq;
|
|
|
|
namespace QSB.SaveSync.Messages
|
|
{
|
|
/// <summary>
|
|
/// always sent to host
|
|
/// </summary>
|
|
internal class RequestGameStateMessage : QSBMessage
|
|
{
|
|
public RequestGameStateMessage() => To = 0;
|
|
|
|
public override void OnReceiveRemote()
|
|
{
|
|
new GameStateMessage(From).Send();
|
|
|
|
var gameSave = PlayerData._currentGameSave;
|
|
|
|
var factSaves = gameSave.shipLogFactSaves;
|
|
foreach (var item in factSaves)
|
|
{
|
|
new ShipLogFactSaveMessage(item.Value).Send();
|
|
}
|
|
|
|
var dictConditions = gameSave.dictConditions;
|
|
var dictConditionsToSend = dictConditions.Where(x => ConversationPatches.PersistentConditionsToSync.Contains(x.Key));
|
|
foreach (var item in dictConditionsToSend)
|
|
{
|
|
new PersistentConditionMessage(item.Key, item.Value).Send();
|
|
}
|
|
}
|
|
}
|
|
}
|