Improved critter.psc fix

This commit is contained in:
Eddoursul 2024-01-21 15:15:07 +01:00
parent 5401437976
commit d0512f2177
2 changed files with 12 additions and 4 deletions

Binary file not shown.

View File

@ -230,14 +230,14 @@ Event OnUpdateGameTime()
DisableAndDelete(false)
endEvent
Event OnLoad()
bAttached = true
endEvent
Event OnUnload()
bAttached = false
endEvent
Event OnAttachedToCell()
bAttached = true
endEvent
;/ Match OnCellDetach() for all critters, to clean up old critters [USKP 2.0.1]
/;
EVENT OnCellAttach()
@ -260,6 +260,10 @@ endEVENT
/;
EVENT OnCellDetach()
bAttached = false
Cell parentCell = GetParentCell()
if parentCell && parentCell.IsAttached()
bAttached = true
endif
;~ Trace(self + "OnCellDetach() Killing self", 2)
;! DisableAndDelete()
; Parentcell usually removed by the time this event triggers,
@ -1129,6 +1133,9 @@ endFunction
/;
Bool Function CheckCellAttached(ObjectReference AnyItemRef)
return bAttached && AnyItemRef
;/
if ! bAttached || ! AnyItemRef
return false
endif
@ -1141,6 +1148,7 @@ Bool Function CheckCellAttached(ObjectReference AnyItemRef)
EndIf
Return parentCell.IsAttached()
/;
EndFunction