4
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
1.0 KiB

scriptName defaultDisableOnResetIfLocWasCleared extends objectReference
{This script disables its object on reset if the location has been cleared once
it requires a linkRef to an xmarker to track this state}
event onCellDetach()
; ;debug.Trace(self + ": has run onCellDetach")
;USKP 2.0.1 - Sanity check needed. None locations can't be cleared.
if( self.GetCurrentLocation() != None )
if self.getCurrentLocation().isCleared()
; ;debug.Trace(self + ": cell is cleared - setting hasBeenCleared")
getLinkedRef().disable()
endIf
EndIf
endEvent
;;;;;;;;;;;;;This uses a linkedRef instead of a property because properties are reset when the cell is;;;;;;;;;;
event onReset()
; ;debug.Trace(self + ": has called onReset - hasBeenCleared = " + hasBeenCleared)
if getLinkedRef().isEnabled()
; ;debug.Trace(self + ": has found that my linkedRef is enabled, enabling self")
Self.Enable()
Else
; ;debug.Trace(self + ": has found that my linkedRef is disabled, disabling self")
Self.Disable()
EndIf
endEvent