quantum-space-buddies/QSB/MeteorSync/Messages/FragmentInitialStateMessage.cs

28 lines
754 B
C#
Raw Normal View History

using OWML.Common;
2021-12-23 06:59:08 +00:00
using QSB.Messaging;
using QSB.MeteorSync.WorldObjects;
using QSB.Utility;
2021-11-14 04:41:46 +00:00
2022-03-03 03:46:33 +00:00
namespace QSB.MeteorSync.Messages;
2022-03-11 04:20:37 +00:00
/// <summary>
/// original integrity, leash length
/// </summary>
public class FragmentInitialStateMessage : QSBWorldObjectMessage<QSBFragment, (float OrigIntegrity, float LeashLength)>
2021-11-14 04:41:46 +00:00
{
2022-03-11 04:20:37 +00:00
public FragmentInitialStateMessage(float origIntegrity, float leashLength) : base((origIntegrity, leashLength)) { }
2021-12-23 06:59:08 +00:00
2022-03-03 03:46:33 +00:00
public override void OnReceiveRemote()
{
WorldObject.AttachedObject._origIntegrity = Data.OrigIntegrity;
2022-03-11 04:20:37 +00:00
if (WorldObject.LeashLength == null)
{
WorldObject.LeashLength = Data.LeashLength;
}
else
{
DebugLog.ToConsole($"leash length for {WorldObject} already set", MessageType.Warning);
2022-03-03 03:46:33 +00:00
}
2021-11-14 04:41:46 +00:00
}
}