Another update for unloaded smokers

This commit is contained in:
Eddoursul 2024-01-23 03:41:33 +01:00
parent 627fa71a4e
commit a3560e8e65
4 changed files with 67 additions and 52 deletions

Binary file not shown.

View File

@ -12,36 +12,77 @@ Event OnEffectStart(Actor akTarget, Actor akCaster)
; Debug.Trace(self + ": OnEffectStart, " + akTarget) ; Debug.Trace(self + ": OnEffectStart, " + akTarget)
Target = akTarget Target = akTarget
AnimationStage = 0 GotoState("Smoking")
RegisterForSingleUpdate(1.5)
RegisterForSleep()
EndEvent EndEvent
Event OnUpdate() state Smoking
_LockAnimationUpdates()
If AnimationStage == 0 && Target.GetSitState() != 3 event OnBeginState()
; Debug.Trace(self + ": OnUpdate, " + Target + ", stage " + AnimationStage + ", waiting...") ; Debug.Trace(self + ": Registering for updates, " + Target)
RegisterForSingleUpdate(1.0) AnimationStage = 0
ElseIf bIsFinished == False RegisterForSingleUpdate(1.5)
AnimationStage += 1 RegisterForSleep()
endevent
; Debug.Trace(self + ": OnUpdate, " + Target + ", stage " + AnimationStage) Event OnUpdate()
_LockAnimationUpdates()
If AnimationStage == 1 If AnimationStage == 0 && Target.GetSitState() != 3
Target.SetHeadtracking(False) ; Debug.Trace(self + ": OnUpdate, " + Target + ", stage " + AnimationStage + ", waiting...")
Target.SetDontMove(True) RegisterForSingleUpdate(1.0)
Debug.SendAnimationEvent(Target, "pipesmokingcrossleggedstartblaze") ElseIf bIsFinished == False
Debug.SendAnimationEvent(Target, "pipesmokingcrossleggedblazed") AnimationStage += 1
RegisterForSingleUpdate(2.5)
ElseIf AnimationStage == 2 ; Debug.Trace(self + ": OnUpdate, " + Target + ", stage " + AnimationStage)
Debug.SendAnimationEvent(Target, "pipesmokingcrosslegged")
_00E_Smoking_PipeSmokingSmokeExhaleEffect.Play(Target, -1 as Float, none) If AnimationStage == 1
Target.SetHeadtracking(False)
Target.SetDontMove(True)
Debug.SendAnimationEvent(Target, "pipesmokingcrossleggedstartblaze")
Debug.SendAnimationEvent(Target, "pipesmokingcrossleggedblazed")
RegisterForSingleUpdate(2.5)
ElseIf AnimationStage == 2
Debug.SendAnimationEvent(Target, "pipesmokingcrosslegged")
_00E_Smoking_PipeSmokingSmokeExhaleEffect.Play(Target, -1 as Float, none)
EndIf
EndIf EndIf
EndIf
_UnlockAnimationUpdates() _UnlockAnimationUpdates()
EndEvent EndEvent
Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)
; Debug.Trace(self + ": OnSleepStart, " + Target)
; Force reset of the animations to make the NPC re-enter the furniture (if it wishes).
; Fixes NPCs creeping away from the furniture while the player is sleeping in the same location.
_LockAnimationUpdates()
If bIsFinished == False
UnregisterForUpdate()
StopAnimations(True)
Target.RemoveSpell(_00E_Smoking_CrossLeggedMarkerSP)
EndIf
_UnlockAnimationUpdates()
EndEvent
Event OnCellDetach()
GotoState("")
endEvent
event OnEndState()
; Debug.Trace(self + ": Unregistering for updates, " + Target)
UnregisterForUpdate()
UnregisterForSleep()
endevent
endstate
Event OnCellAttach()
If ! bIsFinished
GotoState("Smoking")
endif
endEvent
Event OnPackageChange(Package akOldPackage) Event OnPackageChange(Package akOldPackage)
; Debug.Trace(self + ": OnPackageChange, " + Target + ", old package " + akOldPackage) ; Debug.Trace(self + ": OnPackageChange, " + Target + ", old package " + akOldPackage)
@ -50,34 +91,6 @@ Event OnPackageChange(Package akOldPackage)
Target.RemoveSpell(_00E_Smoking_CrossLeggedMarkerSP) Target.RemoveSpell(_00E_Smoking_CrossLeggedMarkerSP)
EndEvent EndEvent
Event OnCellAttach()
If ! bIsFinished
RegisterForSingleUpdate(1.0)
RegisterForSleep()
endif
endEvent
Event OnCellDetach()
UnregisterForUpdate()
UnregisterForSleep()
endEvent
Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)
; Debug.Trace(self + ": OnSleepStart, " + Target)
; Force reset of the animations to make the NPC re-enter the furniture (if it wishes).
; Fixes NPCs creeping away from the furniture while the player is sleeping in the same location.
_LockAnimationUpdates()
If bIsFinished == False
UnregisterForUpdate()
StopAnimations(True)
Target.RemoveSpell(_00E_Smoking_CrossLeggedMarkerSP)
EndIf
_UnlockAnimationUpdates()
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster) Event OnEffectFinish(Actor akTarget, Actor akCaster)
; Debug.Trace(self + ": OnEffectFinish, " + Target) ; Debug.Trace(self + ": OnEffectFinish, " + Target)

View File

@ -37,7 +37,9 @@ EVENT onActivate(objectReference actronaut)
UnlockMeMSG.show() UnlockMeMSG.show()
endif endif
; either way, play a nice ker-chunk sound to feedback why door isn't opening ; either way, play a nice ker-chunk sound to feedback why door isn't opening
barredSFX.play(self) if barredSFX
barredSFX.play(self)
endif
; add a tiny rumble bump for good measure ; add a tiny rumble bump for good measure
game.shakeController(0.1, 0.1, 0.1) game.shakeController(0.1, 0.1, 0.1)
else else