2022-01-26 21:00:12 -08:00
using OWML.Common ;
2021-12-25 22:04:46 -08:00
using QSB.Messaging ;
using QSB.QuantumSync.WorldObjects ;
using QSB.Utility ;
2020-12-23 10:43:13 +00:00
2021-12-23 16:26:31 -08:00
namespace QSB.QuantumSync.Messages
2020-12-23 10:43:13 +00:00
{
2022-01-26 21:00:12 -08:00
internal class MultiStateChangeMessage : QSBWorldObjectMessage < QSBMultiStateQuantumObject , int >
2020-12-23 10:43:13 +00:00
{
2022-01-26 21:00:12 -08:00
public MultiStateChangeMessage ( int stateIndex ) = > Value = stateIndex ;
2020-12-23 10:43:13 +00:00
2021-12-25 22:04:46 -08:00
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 ;
}
2022-01-26 21:00:12 -08:00
WorldObject . ChangeState ( Value ) ;
2020-12-23 10:43:13 +00:00
}
}
}