DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionLockAttachment.c
См. документацию.
1//Transfer locktypes from BasicDefines.hpp here. This is mostly for readability
2//NONE must be 0 as it is actively used below
4{
5 NONE = 0,
6 LOCK_SCREW = 1,
7 LOCK_BOLT = 2,
8 LOCK_NUT = 3,
9 LOCK_WIRE = 4
10}
11
12class ActionLockAttachmentCB : ActionContinuousBaseCB
13{
14 override void CreateActionComponent()
15 {
16 m_ActionData.m_ActionComponent = new CAContinuousTime( UATimeSpent.BASEBUILDING_REPAIR_FAST );
17 }
18};
21{
22 private const string LOCK_VERSION = "#widget_lock";
23 private const string UNLOCK_VERSION = "#widget_unlock";
24 private string m_Name = LOCK_VERSION;
25
27 {
28 m_CallbackClass = ActionLockAttachmentCB;
29 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
30
31 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
32 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
33 m_FullBody = true;
34 }
35
36 override void OnActionInfoUpdate( PlayerBase player, ActionTarget target, ItemBase item )
37 {
38 ItemBase target_IB = ItemBase.Cast(target.GetObject());
39 if ( target_IB.IsLockedInSlot() )
41 else if ( target_IB.IsAlive() )
43 else
44 m_Text = "";
45 }
46
52
53 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
54 {
55 if ( !target )
56 return false;
57
58 EntityAI parent_EAI = EntityAI.Cast(target.GetParent());
59 ItemBase target_IB = ItemBase.Cast(target.GetObject());
60
61 array<int> compLock = item.m_CompatibleLocks;
62 int targetType = eLockTypes.NONE;
63
64 if ( target_IB && parent_EAI )
65 {
66 //CAR DOOR HANDLING
67 //I don't really like this, but sometimes specifics have to be handled in generics
68 CarDoor targetDoor = CarDoor.Cast(target_IB);
69 if ( targetDoor )
70 {
72 bool isPresent = targetDoor.GetInventory().GetCurrentInventoryLocation( loc );
73
74 if ( !isPresent || loc.GetSlot() == -1 )
75 return false;
76
78 if ( slotName && CarScript.Cast( parent_EAI ).GetCarDoorsState( slotName ) != CarDoorState.DOORS_OPEN )
79 return false;
80 }
81 //END OF CAR DOOR SPECIFICS
82
83
84 if ( target_IB.IsLockedInSlot() )
86 else if ( target_IB.IsAlive() )
88 else if ( !target_IB.IsLockedInSlot() )
89 return false;
90
91 targetType = target_IB.GetLockType();
92
93 for (int i = 0; i < compLock.Count(); i++)
94 {
95 if ( targetType == compLock[i] && targetType != eLockTypes.NONE)
96 {
97 return true;
98 }
99 }
100 }
101 return false;
102 }
103
104 override void OnStartAnimationLoop( ActionData action_data )
105 {
106 super.OnStartAnimationLoop( action_data );
107
108 if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
109 {
110 ItemBase target_IB = ItemBase.Cast( action_data.m_Target.GetObject() );
111 Param2<bool, string> play = new Param2<bool, string>( true, action_data.m_MainItem.GetLockSoundSet() );
112 GetGame().RPCSingleParam( target_IB, ERPCs.RPC_SOUND_LOCK_ATTACH, play, true );
113 }
114 }
115
116 override void OnEnd( ActionData action_data )
117 {
118 if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
119 {
120 ItemBase target_IB = ItemBase.Cast( action_data.m_Target.GetObject() );
121 Param2<bool, string> play = new Param2<bool, string>( false, action_data.m_MainItem.GetLockSoundSet() );
122 GetGame().RPCSingleParam( target_IB, ERPCs.RPC_SOUND_LOCK_ATTACH, play, true );
123 }
124 }
125
126 override void OnEndAnimationLoop( ActionData action_data )
127 {
128 super.OnEndAnimationLoop( action_data );
129
130 if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
131 {
132 ItemBase target_IB = ItemBase.Cast( action_data.m_Target.GetObject() );
133 Param2<bool, string> play = new Param2<bool, string>( false, action_data.m_MainItem.GetLockSoundSet() );
134 GetGame().RPCSingleParam( target_IB, ERPCs.RPC_SOUND_LOCK_ATTACH, play, true );
135 }
136 }
137
138 override void OnFinishProgressServer( ActionData action_data )
139 {
140 ItemBase target_IB = ItemBase.Cast(action_data.m_Target.GetObject());
141
142 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 5);
143
144 if (target_IB.IsLockedInSlot())
145 {
146 target_IB.UnlockFromParent();
147 return;
148 }
149
150 target_IB.LockToParent();
151 }
152}
ActionBase ActionData
Определения ActionBase.c:30
LOCK_SCREW
Определения ActionLockAttachment.c:16
LOCK_NUT
Определения ActionLockAttachment.c:18
LOCK_BOLT
Определения ActionLockAttachment.c:17
eLockTypes
Определения ActionLockAttachment.c:4
LOCK_WIRE
Определения ActionLockAttachment.c:19
class ActionTargets ActionTarget
CarDoorState
Определения CarScript.c:2
PlayerSpawnPreset slotName
ERPCs
Определения ERPCs.c:2
float m_SpecialtyWeight
Определения ActionBase.c:77
int m_StanceMask
Определения ActionBase.c:62
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
bool m_FullBody
Определения ActionBase.c:61
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
void CreateActionComponent()
Определения AnimatedActionBase.c:61
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
override void CreateConditionComponents()
Определения ActionLockAttachment.c:47
override void OnStartAnimationLoop(ActionData action_data)
Определения ActionLockAttachment.c:104
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionLockAttachment.c:36
const string UNLOCK_VERSION
Определения ActionLockAttachment.c:23
void ActionLockAttachment()
Определения ActionLockAttachment.c:26
override void OnFinishProgressServer(ActionData action_data)
Определения ActionLockAttachment.c:138
string m_Name
Определения ActionLockAttachment.c:24
override void OnEnd(ActionData action_data)
Определения ActionLockAttachment.c:116
const string LOCK_VERSION
Определения ActionLockAttachment.c:22
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionLockAttachment.c:53
override void OnEndAnimationLoop(ActionData action_data)
Определения ActionLockAttachment.c:126
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINonRuined.c:2
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
Определения InventoryItem.c:496
override int GetCarDoorsState(string slotType)
Определения CivilianSedan.c:163
Определения CivilianSedan.c:2
Определения Building.c:6
proto native int GetSlot()
returns slot id if current type is Attachment
InventoryLocation.
Определения InventoryLocation.c:29
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
Определения InventorySlots.c:6
Определения InventoryItem.c:731
Определения PPEConstants.c:68
Определения PlayerBaseClient.c:2
const float SMALL
Определения ActionConstants.c:111
const float BASEBUILDING_REPAIR_FAST
Определения ActionConstants.c:67
Определения ActionConstants.c:28
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
@ NONE
No flags.
Определения EnProfiler.c:11