File tree 2 files changed +21
-6
lines changed
wadsrc/static/zscript/actors
2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -509,6 +509,11 @@ class Actor : Thinker native
509
509
native clearscope void DisableLocalRendering(uint playerNum, bool disable);
510
510
native ui bool ShouldRenderLocally(); // Only clients get to check this, never the playsim.
511
511
512
+ // Called when the Actor is being used within a PSprite. This happens before potentially changing PSprite
513
+ // state so that any custom actions based on things like player input can be done before moving to the next
514
+ // state of something like a weapon.
515
+ virtual void PSpriteTick(PSprite psp) {}
516
+
512
517
// Called by inventory items to see if this actor is capable of touching them.
513
518
// If true, the item will attempt to be picked up. Useful for things like
514
519
// allowing morphs to pick up limited items such as keys while preventing
Original file line number Diff line number Diff line change @@ -2708,13 +2708,23 @@ class PSprite : Object native play
2708
2708
{
2709
2709
if (processPending)
2710
2710
{
2711
- // drop tic count and possibly change state
2712
- if (Tics != -1 ) // a -1 tic count never changes
2711
+ if (Caller)
2713
2712
{
2714
- Tics--;
2715
- // [BC] Apply double firing speed.
2716
- if (bPowDouble && Tics && (Owner . mo. FindInventory (" PowerDoubleFiringSpeed" , true ))) Tics--;
2717
- if (!Tics && Caller != null ) SetState(CurState . NextState);
2713
+ Caller . PSpriteTick(self);
2714
+ if (bDestroyed)
2715
+ return ;
2716
+ }
2717
+
2718
+ if (processPending)
2719
+ {
2720
+ // drop tic count and possibly change state
2721
+ if (Tics != -1 ) // a -1 tic count never changes
2722
+ {
2723
+ Tics--;
2724
+ // [BC] Apply double firing speed.
2725
+ if (bPowDouble && Tics && (Owner . mo. FindInventory (" PowerDoubleFiringSpeed" , true ))) Tics--;
2726
+ if (!Tics && Caller != null ) SetState(CurState . NextState);
2727
+ }
2718
2728
}
2719
2729
}
2720
2730
}
You can’t perform that action at this time.
0 commit comments