Fix stop taken joystick value when player dead

This commit is contained in:
HungDK
2026-05-19 14:10:11 +07:00
parent 8a7829e038
commit e4cf76d8ed
3 changed files with 32 additions and 1 deletions
+22
View File
@@ -876,11 +876,33 @@ namespace BrewMonster
// Mark host player as corpse so CECPlayer.IsDead() returns true
m_dwStates |= (uint)PlayerNPCState.GP_STATE_CORPSE;
// Mobile joystick keeps input while held; stop move work immediately (mirror HOST_NOTIFY_ROOT).
StopHostMovementOnDeath();
EventBus.PublishChannel(GetCharacterID(), new ClearComActFlagAllRankNodesEvent(true));
PlayAction((int)PLAYER_ACTION_TYPE.ACT_GROUNDDIE);
PopupManager.NotifyPlayerDied();
}
/// <summary>
/// Cancel active locomotion when host dies. Push-move reads joystick directly in GetPushDir,
/// so finishing WORK_MOVETOPOS alone is not enough until m_dwMoveRelDir is cleared.
/// </summary>
private void StopHostMovementOnDeath()
{
m_dwMoveRelDir = 0;
if (m_pWorkMan == null)
return;
if (m_pWorkMan.IsFollowing())
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_FOLLOW);
if (m_pWorkMan.IsMovingToPosition())
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_MOVETOPOS);
if (m_pWorkMan.IsTracing())
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_TRACEOBJECT);
}
private bool NormalAttackObject(int idTarget, bool bForceAttack, bool bMoreClose = false)
{
if (idTarget == 0 || idTarget == m_PlayerInfo.cid)
+4 -1
View File
@@ -2384,7 +2384,10 @@ namespace BrewMonster
public bool GetPushDir(ref Vector3 vPushDir, uint dwMask, float deltaTime)
{
vPushDir = Vector3.zero;
if (joystick.Horizontal == 0 && joystick.Vertical == 0)
if (IsDead())
return false;
if (joystick == null || (joystick.Horizontal == 0 && joystick.Vertical == 0))
{
if (isPressMoveUp)
{