1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- class ActionLockDoorsCB : ActionContinuousBaseCB
- {
- override void CreateActionComponent()
- {
- m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.LOCK);
- }
- };
- class ActionLockDoors: ActionContinuousBase
- {
- protected const float APPLIED_DMG = 6;
-
- void ActionLockDoors()
- {
- m_CallbackClass = ActionLockDoorsCB;
- m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
- m_FullBody = true;
- m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
- m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_HIGH;
- m_Text = "#lock_door";
- }
-
- override void CreateConditionComponents()
- {
- m_ConditionItem = new CCINonRuined;
- m_ConditionTarget = new CCTCursor;
- }
-
- override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
- {
- if( !target ) return false;
- //if( IsDamageDestroyed(action_data.m_Target) ) return false;
- if( !IsBuilding(target) ) return false;
- if( !IsInReach(player, target, UAMaxDistances.DEFAULT) ) return false;
- Building building;
- if( Class.CastTo(building, target.GetObject()) )
- {
- int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
- if ( doorIndex != -1 )
- return building.CanDoorBeLocked(doorIndex);
- }
- return false;
- }
- protected void LockDoor(ActionTarget target)
- {
- Building building;
- if ( Class.CastTo(building, target.GetObject()) )
- {
- int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
- if ( doorIndex != -1 )
- {
- building.LockDoor(doorIndex);
- }
- }
- }
- override void OnFinishProgressServer( ActionData action_data )
- {
- LockDoor(action_data.m_Target);
-
- MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, APPLIED_DMG);
- }
-
- override bool IsLockTargetOnUse()
- {
- return false;
- }
- };
|