Fixed Papyrus spam on unloaded critters
This commit is contained in:
parent
1911ec2434
commit
0f7fde96b4
Binary file not shown.
@ -77,6 +77,7 @@ objectReference property hunter auto hidden
|
|||||||
{if being hunted, by whom?}
|
{if being hunted, by whom?}
|
||||||
bool bKilled = false
|
bool bKilled = false
|
||||||
; if been killed once, don't do Die() a second time
|
; if been killed once, don't do Die() a second time
|
||||||
|
bool bAttached = false
|
||||||
|
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
; Properties set by the spawner
|
; Properties set by the spawner
|
||||||
@ -229,9 +230,18 @@ Event OnUpdateGameTime()
|
|||||||
DisableAndDelete(false)
|
DisableAndDelete(false)
|
||||||
endEvent
|
endEvent
|
||||||
|
|
||||||
|
Event OnLoad()
|
||||||
|
bAttached = true
|
||||||
|
endEvent
|
||||||
|
|
||||||
|
Event OnUnload()
|
||||||
|
bAttached = false
|
||||||
|
endEvent
|
||||||
|
|
||||||
;/ Match OnCellDetach() for all critters, to clean up old critters [USKP 2.0.1]
|
;/ Match OnCellDetach() for all critters, to clean up old critters [USKP 2.0.1]
|
||||||
/;
|
/;
|
||||||
EVENT OnCellAttach()
|
EVENT OnCellAttach()
|
||||||
|
bAttached = true
|
||||||
;~ Trace(self + "OnCellAttach() had failed to kill self OnCellDetach", 2)
|
;~ Trace(self + "OnCellAttach() had failed to kill self OnCellDetach", 2)
|
||||||
; kick the OnUpdate in hopes it will clean up.
|
; kick the OnUpdate in hopes it will clean up.
|
||||||
RegisterForSingleUpdate(0.70711); [USKP 2.0.3]
|
RegisterForSingleUpdate(0.70711); [USKP 2.0.3]
|
||||||
@ -249,6 +259,7 @@ endEVENT
|
|||||||
; duplicate code from various critters moved here. [USKP 2.0.3]
|
; duplicate code from various critters moved here. [USKP 2.0.3]
|
||||||
/;
|
/;
|
||||||
EVENT OnCellDetach()
|
EVENT OnCellDetach()
|
||||||
|
bAttached = false
|
||||||
;~ Trace(self + "OnCellDetach() Killing self", 2)
|
;~ Trace(self + "OnCellDetach() Killing self", 2)
|
||||||
;! DisableAndDelete()
|
;! DisableAndDelete()
|
||||||
; Parentcell usually removed by the time this event triggers,
|
; Parentcell usually removed by the time this event triggers,
|
||||||
@ -273,6 +284,7 @@ endEVENT
|
|||||||
Event OnInit()
|
Event OnInit()
|
||||||
; We know default properties are good
|
; We know default properties are good
|
||||||
bDefaultPropertiesInitialized = true
|
bDefaultPropertiesInitialized = true
|
||||||
|
bAttached = true
|
||||||
; If everything else is also good, start doing stuff
|
; If everything else is also good, start doing stuff
|
||||||
CheckStateAndStart()
|
CheckStateAndStart()
|
||||||
endEvent
|
endEvent
|
||||||
@ -307,7 +319,7 @@ Function SetSpawnerProperties()
|
|||||||
fSpawnerX = Spawner.X
|
fSpawnerX = Spawner.X
|
||||||
fSpawnerY = Spawner.Y
|
fSpawnerY = Spawner.Y
|
||||||
fSpawnerZ = Spawner.Z
|
fSpawnerZ = Spawner.Z
|
||||||
PlayerRef = Game.GetPlayer()
|
PlayerRef = Game.GetForm(0x14) as Actor
|
||||||
endFunction
|
endFunction
|
||||||
|
|
||||||
Function SetPositionVariance(float xVar, float yVar, float minZVar, float maxZVar)
|
Function SetPositionVariance(float xVar, float yVar, float minZVar, float maxZVar)
|
||||||
@ -388,6 +400,14 @@ endFunction
|
|||||||
Function DisableAndDelete(bool abFadeOut = true)
|
Function DisableAndDelete(bool abFadeOut = true)
|
||||||
bKilled = true ; BUGFIX BY STEVE40+USKP
|
bKilled = true ; BUGFIX BY STEVE40+USKP
|
||||||
|
|
||||||
|
; vanilla code doesn't have this variable. Use it to detect
|
||||||
|
; earlier partially disabled/deleted critters, and also as the
|
||||||
|
; StopNowWeReallyMeanIt flag! The advantage over isDisabled() is
|
||||||
|
; non-interruptible idempotent run-time testing.
|
||||||
|
PlayerRef = None
|
||||||
|
|
||||||
|
UnregisterForUpdate()
|
||||||
|
|
||||||
if bCalculating && abFadeOut
|
if bCalculating && abFadeOut
|
||||||
; interlock [UKSP 2.0.3]
|
; interlock [UKSP 2.0.3]
|
||||||
;~ TraceStack(self + " bCalculating && abFadeOut true")
|
;~ TraceStack(self + " bCalculating && abFadeOut true")
|
||||||
@ -395,6 +415,8 @@ Function DisableAndDelete(bool abFadeOut = true)
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
UnregisterForUpdateGameTime()
|
||||||
|
|
||||||
if bDeleting
|
if bDeleting
|
||||||
; interlock [UKSP 2.0.1]
|
; interlock [UKSP 2.0.1]
|
||||||
;~ TraceStack(self + " bDeleting true")
|
;~ TraceStack(self + " bDeleting true")
|
||||||
@ -414,11 +436,6 @@ Function DisableAndDelete(bool abFadeOut = true)
|
|||||||
DisableNoWait()
|
DisableNoWait()
|
||||||
endIf
|
endIf
|
||||||
|
|
||||||
; vanilla code doesn't have this variable. Use it to detect
|
|
||||||
; earlier partially disabled/deleted critters, and also as the
|
|
||||||
; StopNowWeReallyMeanIt flag! The advantage over isDisabled() is
|
|
||||||
; non-interruptible idempotent run-time testing.
|
|
||||||
PlayerRef = None
|
|
||||||
|
|
||||||
; Stop Any movement
|
; Stop Any movement
|
||||||
CurrentMovementState = "Idle"
|
CurrentMovementState = "Idle"
|
||||||
@ -471,12 +488,6 @@ Function DisableAndDelete(bool abFadeOut = true)
|
|||||||
; STEVE40+USKP fix persistent reference to deleted object
|
; STEVE40+USKP fix persistent reference to deleted object
|
||||||
dummyMarker = none
|
dummyMarker = none
|
||||||
|
|
||||||
; StopTranslation must be called before UnregisterForUpdate,
|
|
||||||
; because OnCritterGoalFailed() can now RegisterForSingleUpdate()
|
|
||||||
; Unregister for any kind of update
|
|
||||||
UnregisterForUpdate()
|
|
||||||
UnregisterForUpdateGameTime()
|
|
||||||
|
|
||||||
; And delete ourselves
|
; And delete ourselves
|
||||||
;~ Debug.Trace("Critter " + self + " will kill itself.")
|
;~ Debug.Trace("Critter " + self + " will kill itself.")
|
||||||
; Delete must be called, is not dependent on parent cell [USKP 1.3.3]
|
; Delete must be called, is not dependent on parent cell [USKP 1.3.3]
|
||||||
@ -1030,7 +1041,9 @@ endEvent
|
|||||||
Event OnTranslationFailed()
|
Event OnTranslationFailed()
|
||||||
; Trigger event
|
; Trigger event
|
||||||
; Debug.Trace("Critter " + self + " Translation Failed", 1)
|
; Debug.Trace("Critter " + self + " Translation Failed", 1)
|
||||||
|
if bAttached && ! bKilled
|
||||||
OnCritterGoalFailed()
|
OnCritterGoalFailed()
|
||||||
|
endif
|
||||||
endEvent
|
endEvent
|
||||||
|
|
||||||
; Debugging
|
; Debugging
|
||||||
@ -1116,7 +1129,7 @@ endFunction
|
|||||||
/;
|
/;
|
||||||
Bool Function CheckCellAttached(ObjectReference AnyItemRef)
|
Bool Function CheckCellAttached(ObjectReference AnyItemRef)
|
||||||
|
|
||||||
if ! AnyItemRef
|
if ! bAttached || ! AnyItemRef
|
||||||
return false
|
return false
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user