DayZ 1.24
Loading...
Searching...
No Matches
ActionLockAttachment Class Reference
Inheritance diagram for ActionLockAttachment:
[legend]
Collaboration diagram for ActionLockAttachment:
[legend]

Private Member Functions

void ActionLockAttachment ()
 
override void OnActionInfoUpdate (PlayerBase player, ActionTarget target, ItemBase item)
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnStartAnimationLoop (ActionData action_data)
 
override void OnEnd (ActionData action_data)
 
override void OnEndAnimationLoop (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 
- Private Member Functions inherited from ActionContinuousBase
void OnStartAnimationLoopServer (ActionData action_data)
 
void OnStartAnimationLoopClient (ActionData action_data)
 
void OnEndAnimationLoopServer (ActionData action_data)
 
void OnEndAnimationLoopClient (ActionData action_data)
 
void OnFinishProgressServer (ActionData action_data)
 
void OnFinishProgressClient (ActionData action_data)
 

Private Attributes

const string LOCK_VERSION = "#widget_lock"
 
const string UNLOCK_VERSION = "#widget_unlock"
 
string m_Name = LOCK_VERSION
 

Detailed Description

Definition at line 20 of file ActionLockAttachment.c.

Constructor & Destructor Documentation

◆ ActionLockAttachment()

void ActionLockAttachment::ActionLockAttachment ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

override bool ActionLockAttachment::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 53 of file ActionLockAttachment.c.

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
69 if (targetDoor)
70 {
72 bool isPresent = targetDoor.GetInventory().GetCurrentInventoryLocation(loc);
73
74 if (!isPresent || loc.GetSlot() == -1)
75 return false;
76
77 string slotName = InventorySlots.GetSlotName(loc.GetSlot());
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 return true;
97 }
98 }
99 return false;
100 }
CarDoorState
Definition CarScript.c:2
PlayerSpawnPreset slotName
override int GetCarDoorsState(string slotType)
InventoryLocation.
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string

References CarScript::GetCarDoorsState(), InventorySlots::GetSlotName(), LOCK_VERSION, m_Name, slotName, and UNLOCK_VERSION.

◆ CreateConditionComponents()

override void ActionLockAttachment::CreateConditionComponents ( )
inlineprivate

◆ OnActionInfoUpdate()

override void ActionLockAttachment::OnActionInfoUpdate ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 36 of file ActionLockAttachment.c.

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 }
string m_Text
Definition ActionBase.c:49

References LOCK_VERSION, m_Text, and UNLOCK_VERSION.

◆ OnEnd()

override void ActionLockAttachment::OnEnd ( ActionData action_data)
inlineprivate

Definition at line 114 of file ActionLockAttachment.c.

115 {
116 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
117 {
118 ItemBase target_IB = ItemBase.Cast(action_data.m_Target.GetObject());
119 Param2<bool, string> play = new Param2<bool, string>(false, action_data.m_MainItem.GetLockSoundSet());
120 GetGame().RPCSingleParam(target_IB, ERPCs.RPC_SOUND_LOCK_ATTACH, play, true);
121 }
122 }
ERPCs
Definition ERPCs.c:2
proto native CGame GetGame()

References GetGame().

◆ OnEndAnimationLoop()

override void ActionLockAttachment::OnEndAnimationLoop ( ActionData action_data)
inlineprivate

Definition at line 124 of file ActionLockAttachment.c.

125 {
126 super.OnEndAnimationLoop(action_data);
127
128 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
129 {
130 ItemBase target_IB = ItemBase.Cast(action_data.m_Target.GetObject());
131 Param2<bool, string> play = new Param2<bool, string>(false, action_data.m_MainItem.GetLockSoundSet());
132 GetGame().RPCSingleParam(target_IB, ERPCs.RPC_SOUND_LOCK_ATTACH, play, true);
133 }
134 }

References GetGame().

◆ OnFinishProgressServer()

override void ActionLockAttachment::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 136 of file ActionLockAttachment.c.

137 {
138 ItemBase target_IB = ItemBase.Cast(action_data.m_Target.GetObject());
139
140 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 5);
141
142 if (target_IB.IsLockedInSlot())
143 {
144 target_IB.UnlockFromParent();
145 return;
146 }
147
148 target_IB.LockToParent();
149 }

◆ OnStartAnimationLoop()

override void ActionLockAttachment::OnStartAnimationLoop ( ActionData action_data)
inlineprivate

Definition at line 102 of file ActionLockAttachment.c.

103 {
104 super.OnStartAnimationLoop(action_data);
105
106 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
107 {
108 ItemBase target_IB = ItemBase.Cast(action_data.m_Target.GetObject());
109 Param2<bool, string> play = new Param2<bool, string>(true, action_data.m_MainItem.GetLockSoundSet());
110 GetGame().RPCSingleParam(target_IB, ERPCs.RPC_SOUND_LOCK_ATTACH, play, true);
111 }
112 }

References GetGame().

Member Data Documentation

◆ LOCK_VERSION

const string ActionLockAttachment::LOCK_VERSION = "#widget_lock"
private

Definition at line 22 of file ActionLockAttachment.c.

Referenced by ActionCondition(), and OnActionInfoUpdate().

◆ m_Name

string ActionLockAttachment::m_Name = LOCK_VERSION
private

Definition at line 24 of file ActionLockAttachment.c.

Referenced by ActionCondition().

◆ UNLOCK_VERSION

const string ActionLockAttachment::UNLOCK_VERSION = "#widget_unlock"
private

Definition at line 23 of file ActionLockAttachment.c.

Referenced by ActionCondition(), and OnActionInfoUpdate().


The documentation for this class was generated from the following file: