quantum-space-buddies/QSB/QuantumSync/Messages/MultiStateChangeMessage.cs
2022-03-02 19:46:33 -08:00

22 lines
632 B
C#

using OWML.Common;
using QSB.Messaging;
using QSB.QuantumSync.WorldObjects;
using QSB.Utility;
namespace QSB.QuantumSync.Messages;
internal class MultiStateChangeMessage : QSBWorldObjectMessage<QSBMultiStateQuantumObject, int>
{
public MultiStateChangeMessage(int stateIndex) => Data = stateIndex;
public override void OnReceiveRemote()
{
if (WorldObject.ControllingPlayer != From)
{
DebugLog.ToConsole($"Error - Got MultiStateChangeEvent for {WorldObject.Name} from {From}, but it's currently controlled by {WorldObject.ControllingPlayer}!", MessageType.Error);
return;
}
WorldObject.ChangeState(Data);
}
}