The PlayerBase command handler calls super at the top. This calls the DayZPlayerImplement command handler, which may start another command, but PlayerBase CmdHandler keeps using the originally passed in pCurrentCommandID which may now be stale and can only be used to check for finished commands in PlayerBase CmdHandler. All other checks for current cmd should call GetMovementState after the super, and then use
m_MovementState.m_CommandTypeId instead.
Description
Details
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Category
- Scripting
Event Timeline
Hello lava76.
This is intended. When you need the current command ID, use 'Human.GetCurrentCommandID'. For a reference in scripts, see the comment above 'ActionManagerClient.Update'.
pCurrentCommandID is command ID at time of call command handler, some called methods can change actual true value (need call m_Player.GetCurrentCommandID() for actual command ID)
This is not my code, that is vanilla code. The vanilla PlayerBase::CommandHandler uses the stale pCurrentCommandID.
Is there any issue you have had in particular? All places in vanilla script that use the value from CommandHandler inside PlayerBase class are using it correctly where they are intended to be looking for the previously playing command. SymptomManager and ActionManager update their pCurrentCommandID to use 'Human.GetCurrentCommandID' to query for the current playing command and not the previously playing command
Vanilla PlayerBase::CommandHandler, line 2990 (1.27):
if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
This won't work as intended, since it uses the stale pCurrentCommandID.
Line 3000:
else if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH && pCurrentCommandID != DayZPlayerConstants.COMMANDID_FALL && !isTransitioning)
Death gate won't work. COMMANDID_DEATH is started in DayZPlayerImplement, but PlayerBase will not catch it until next CommandHandler tick because it uses the stale pCurrentCommandID. This can lead to awkward situations where player becomes "unconscious" after death, the very thing this death gate was supposed to prevent.
Line 3023:
if (hcu && pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
Same issue, stale pCurrentCommandID is used by the game.