DayZ 1.24
Loading...
Searching...
No Matches
ActionMountBarbedWire.c
Go to the documentation of this file.
8
10{
12 string m_SlotName;
13
25
31
32 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
33 {
34 Object targetObject = target.GetObject();
35
36 if (targetObject && targetObject.CanUseConstruction() && targetObject.CanUseConstructionBuild())
37 {
39
40 string selection = targetObject.GetActionComponentName(target.GetComponentIndex());
41
42 if (selection.Length() > 0)
43 {
44 BarbedWire barbed_wire = BarbedWire.Cast(base_building.FindAttachmentBySlotName(selection));
45 if (barbed_wire && !barbed_wire.IsMounted() && !barbed_wire.IsRuined())
46 {
47 m_SlotName = selection;
48
49 return true;
50 }
51 }
52 }
53
54 return false;
55 }
56
58 {
60 BarbedWire barbed_wire = BarbedWire.Cast(base_building.FindAttachmentBySlotName(m_SlotName));
61
62 //mount and refresh parent
63 barbed_wire.SetMountedState(true);
64
65 //solution for DamageSystem's case sensitivity
66 string zone = "invalid";
68 zones.Copy(base_building.GetEntityDamageZoneMap().GetKeyArray());
69
70 string tmp = "";
71 string test = "";
72 for (int i = 0; i < zones.Count(); i++)
73 {
74 tmp = zones.Get(i);
75 test = tmp;
76 test.ToLower();
77
78 if (test == m_SlotName)
79 {
80 zone = tmp;
81 break;
82 }
83 }
84
85 base_building.SetHealth01(zone, "Health", barbed_wire.GetHealth01("", "Health")); //attachment slot names and damagezone names must match
86
87 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
88 }
89
91 {
92 string message = string.Format("Player %1 Mounted BarbedWire on %2", action_data.m_Player, action_data.m_Target.GetObject().ClassName());
93 return message;
94 }
95}
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override void OnFinishProgressServer(ActionData action_data)
override string GetAdminLogMessage(ActionData action_data)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const float BASEBUILDING
const float DEFAULT_CONSTRUCT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native int Length()
Returns length of string.