The events used to handle changing an object’s state fire in such a way that scripts can lose the stated object, basically throwing the whole state system out the window. When an object changes state, the handler fires onObjectLeaveZone, onObjectDestroyed, onObjectSpawn, onObjectEnterZone, etc, and onObjectStateChange only fires in the global script. onObjectStateChange should be the only event firing, and for QoL it needs to be able to fire in an object’s script.
States act as variations on one object, and only one object can be bound to a given state on one object. Intuitively, this tells the user that these states are the same object when it is in any state. When the object is destroyed, all of its states should be destroyed. When the object is rotated, all of its states should have knowledge of that rotation when they swap into the table. When the object changes, it isn’t being destroyed or spawned, its previous existence should still exist as a state on the object. The object shouldn’t leave or enter any zones when it changes, since its position is still inside the zone. Players handling states manually creates the illusion of these effects, but in scripting almost none of it is true. Please fix, thanks.