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
2022-03-02 19:46:33 -08:00
namespace QSB.QuantumSync.Messages ;
internal class MultiStateChangeMessage : QSBWorldObjectMessage < QSBMultiStateQuantumObject , int >
2020-12-23 10:43:13 +00:00
{
2022-03-02 19:46:33 -08:00
public MultiStateChangeMessage ( int stateIndex ) = > Data = stateIndex ;
2022-02-27 04:40:44 -08:00
2022-03-02 19:46:33 -08:00
public override void OnReceiveRemote ( )
{
if ( WorldObject . ControllingPlayer ! = From )
2021-12-25 22:04:46 -08:00
{
2022-03-02 19:46:33 -08:00
DebugLog . ToConsole ( $"Error - Got MultiStateChangeEvent for {WorldObject.Name} from {From}, but it's currently controlled by {WorldObject.ControllingPlayer}!" , MessageType . Error ) ;
return ;
2022-02-27 04:40:44 -08:00
}
2022-03-02 19:46:33 -08:00
WorldObject . ChangeState ( Data ) ;
2020-12-23 10:43:13 +00:00
}
}