void CJaw::Update(SEntityUpdateContext& ctx, int slot) { CWeapon::Update(ctx, slot); if (!IsSelected()) return; if(slot == eIUS_Zooming) { UpdateLaser(ctx); } if (slot != eIUS_General) return; UpdatePendingShot(); if (!IsInputFlagSet(CWeapon::eWeaponAction_Zoom) && IsInputFlagSet(CWeapon::eWeaponAction_Fire) && !IsZoomingIn()) AutoZoomOut(); if (m_controllingRocket && !IsZoomed() && !m_zoomTriggerDown) DoAutoDrop(); if (m_autoDropping) { m_autoDropPendingTimer += ctx.fFrameTime; if (CanAutoDrop()) { m_autoDropping = false; DoAutoDrop(); } } if (m_dropped) { m_dropTime += ctx.fFrameTime; if (m_dropTime > g_hideTimeAfterDrop) { if(gEnv->bServer) { if(gEnv->IsEditor()) Hide(true); else gEnv->pEntitySystem->RemoveEntity(GetEntity()->GetId()); } EnableUpdate(false); } else { RequireUpdate(); } } }
//------------------------------------------------------ void CWeapon::ForcePendingActions(uint8 blockedActions) { CItem::ForcePendingActions(blockedActions); CActor* pOwner = GetOwnerActor(); if(!pOwner || !pOwner->IsClient() || s_lockActionRequests) return; //--- Lock action requests to ensure that we don't recurse back into this function but also //--- block any recursive action requests to ensure we don't repeat the actions next frame s_lockActionRequests = true; //Force start firing, if needed and possible if(IsInputFlagSet(eWeaponAction_Fire) && !(blockedActions&eWeaponAction_Fire)) { ClearInputFlag(eWeaponAction_Fire); if(IsTargetOn() || (m_fm && !m_fm->AllowZoom())) { s_lockActionRequests = false; return; } OnAction(GetOwnerId(),CCryName("attack1"),eAAM_OnHold,0.0f); } //Force zoom in if needed if(IsInputFlagSet(eWeaponAction_Zoom) && !(blockedActions&eWeaponAction_Zoom)) { if(!IsZoomed() && !IsZoomingInOrOut()) OnActionZoom(GetOwnerId(), CCryName("zoom"), eAAM_OnPress, 0.0f); ClearInputFlag(eWeaponAction_Zoom); } if(IsInputFlagSet(eWeaponAction_Reload) && !(blockedActions&eWeaponAction_Reload)) { if (!IsBusy()) ReloadWeapon(); ClearInputFlag(eWeaponAction_Reload); } s_lockActionRequests = false; }