DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionLockDoors.c
См. документацию.
2{
3 override void CreateActionComponent()
4 {
5 m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.LOCK);
6 }
7};
8
10{
11 protected const float APPLIED_DMG = 6;
12
14 {
16 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
17 m_FullBody = true;
18 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
19 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_HIGH;
20 m_Text = "#lock_door";
21 }
22
28
29 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
30 {
31 if( !IsBuilding(target) ) return false;
32 if( !IsInReach(player, target, UAMaxDistances.DEFAULT) ) return false;
33
34 Building building;
35 ToolBase tool;
36 if (Class.CastTo(building, target.GetObject())&& Class.CastTo(tool, item))
37 {
38 int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
39
40 // Check door for related lock inventory attachments
41 AdditionalDoorInfo doorInfo = building.GetDoorInfo(doorIndex);
42 if (doorInfo && doorInfo.m_RelatedInventorySlotNames)
43 {
44 foreach(string relatedSlotName: doorInfo.m_RelatedInventorySlotNames)
45 {
46 EntityAI attachmentEntity = building.FindAttachmentBySlotName(relatedSlotName);
47 if (!attachmentEntity)
48 continue;
49
50 ItemBase attachment = ItemBase.Cast(attachmentEntity);
51 if (attachment && attachment.IsExternalLockType())
52 return false;
53 }
54 }
55
56 if (doorIndex != -1 && tool.GetKeyCompatibilityType() & building.GetLockCompatibilityType(doorIndex))
57 return building.CanDoorBeLocked(doorIndex);
58 }
59 return false;
60 }
61
62 protected void LockDoor(ActionTarget target)
63 {
64 Building building;
65
66 if ( Class.CastTo(building, target.GetObject()) )
67 {
68 int doorIndex = building.GetDoorIndex(target.GetComponentIndex());
69 if ( doorIndex != -1 )
70 {
71 building.LockDoor(doorIndex);
72 }
73 }
74 }
75
76 override void OnFinishProgressServer( ActionData action_data )
77 {
78 LockDoor(action_data.m_Target);
79
80 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, APPLIED_DMG);
81 }
82
83 override bool IsLockTargetOnUse()
84 {
85 return false;
86 }
87};
bool m_FullBody
Определения ActionBase.c:60
string m_Text
Определения ActionBase.c:57
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Определения ActionBase.c:1290
bool IsBuilding(ActionTarget target)
Определения ActionBase.c:1280
ref CCIBase m_ConditionItem
Определения ActionBase.c:63
float m_SpecialtyWeight
Определения ActionBase.c:77
ref CCTBase m_ConditionTarget
Определения ActionBase.c:64
int m_StanceMask
Определения ActionBase.c:61
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
ActionData m_ActionData
Определения AnimatedActionBase.c:3
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
ref ActionTarget m_Target
Определения ActionBase.c:39
ItemBase m_MainItem
Определения ActionBase.c:35
Определения ActionBase.c:22
void LockDoor(ActionTarget target)
Определения ActionLockDoors.c:62
override void CreateConditionComponents()
Определения ActionLockDoors.c:23
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionLockDoors.c:29
override void OnFinishProgressServer(ActionData action_data)
Определения ActionLockDoors.c:76
const float APPLIED_DMG
Определения ActionLockDoors.c:11
override bool IsLockTargetOnUse()
Определения ActionLockDoors.c:83
void ActionLockDoors()
Определения ActionLockDoors.c:13
override void CreateActionComponent()
Определения ActionLockDoors.c:3
ref TStringArray m_RelatedInventorySlotNames
Lock compatibility type, now in door config. Lockpick enabled by default if undefined.
Определения AdditionalDoorsInfo.c:12
Single door info.
Определения AdditionalDoorsInfo.c:3
int m_CommandUID
Определения AnimatedActionBase.c:147
proto native void LockDoor(int index, bool force=false)
Locks the door if not already locked, resets the door health. 'force = true' will close the door if o...
AdditionalDoorInfo GetDoorInfo(int doorIdx)
bool CanDoorBeLocked(int doorIndex)
Check if the door is closed and if the door is unlocked.
int GetLockCompatibilityType(int doorIdx)
Which door is compatible with which key (door idx supplied). Bitwise.
proto native int GetDoorIndex(int componentIndex)
Gets the index of the door based on the view geometry component index.
Определения CCINonRuined.c:2
Определения CCTCursor.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения PlayerBaseClient.c:2
Определения Akinaka.c:2
const float DEFAULT
Определения ActionConstants.c:114
const float LOCK
Определения ActionConstants.c:84
Определения ActionConstants.c:28
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.