quantum-space-buddies/QSB/QuantumSync/Messages/MultiStateChangeMessage.cs

22 lines
633 B
C#
Raw Normal View History

2022-01-27 05:00:12 +00:00
using OWML.Common;
2021-12-26 06:04:46 +00:00
using QSB.Messaging;
using QSB.QuantumSync.WorldObjects;
using QSB.Utility;
2020-12-23 10:43:13 +00:00
2022-03-03 03:46:33 +00:00
namespace QSB.QuantumSync.Messages;
internal class MultiStateChangeMessage : QSBWorldObjectMessage<QSBMultiStateQuantumObject, int>
2020-12-23 10:43:13 +00:00
{
2022-03-11 01:57:50 +00:00
public MultiStateChangeMessage(int stateIndex) : base(stateIndex) { }
2022-03-03 03:46:33 +00:00
public override void OnReceiveRemote()
{
if (WorldObject.ControllingPlayer != From)
2021-12-26 06:04:46 +00:00
{
2022-03-03 03:46:33 +00:00
DebugLog.ToConsole($"Error - Got MultiStateChangeEvent for {WorldObject.Name} from {From}, but it's currently controlled by {WorldObject.ControllingPlayer}!", MessageType.Error);
return;
}
2022-03-03 03:46:33 +00:00
WorldObject.ChangeState(Data);
2020-12-23 10:43:13 +00:00
}
}