mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
cf7f7c1952
This reverts commit a97e869850
.
39 lines
840 B
C#
39 lines
840 B
C#
using QSB.ConversationSync.Messages;
|
|
using QSB.Messaging;
|
|
using QSB.Player;
|
|
using QSB.Utility;
|
|
|
|
namespace QSB.SaveSync.Messages;
|
|
|
|
/// <summary>
|
|
/// always sent to host
|
|
/// </summary>
|
|
internal class RequestGameStateMessage : QSBMessage
|
|
{
|
|
public RequestGameStateMessage() => To = 0;
|
|
|
|
public override void OnReceiveRemote() => Delay.RunFramesLater(100, () =>
|
|
{
|
|
if (!QSBPlayerManager.PlayerExists(From))
|
|
{
|
|
// player was kicked
|
|
return;
|
|
}
|
|
|
|
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;
|
|
foreach (var item in dictConditions)
|
|
{
|
|
new PersistentConditionMessage(item.Key, item.Value).Send();
|
|
}
|
|
});
|
|
} |