DayZ 1.24
Loading...
Searching...
No Matches
ActionUnMountBarbedWire.c
Go to the documentation of this file.
8
10{
12 string m_SlotName;
13
15 {
17 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
18 m_FullBody = true;
19 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
20
23 m_Text = "#unmount_barbed_wire";
24 }
25
31
32 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
33 {
34 Object targetObject = target.GetObject();
35
36 if (targetObject && targetObject.CanUseConstruction())
37 {
39 if (!base_building.IsPlayerInside(player, ""))
40 return false;
41
42 string selection = targetObject.GetActionComponentName(target.GetComponentIndex());
43
44 if (selection.Length() > 0)
45 {
46 int delimiter_index = selection.IndexOfFrom(0, "_mounted");
47 if (delimiter_index > -1)
48 {
49 selection = selection.Substring(0, delimiter_index);
50
51 BarbedWire barbed_wire = BarbedWire.Cast(base_building.FindAttachmentBySlotName(selection));
52 if (barbed_wire && barbed_wire.IsMounted())
53 {
54 m_SlotName = selection;
55
56 return true;
57 }
58 }
59 }
60 }
61
62 return false;
63 }
64
66 {
68 BarbedWire barbed_wire = BarbedWire.Cast(base_building.FindAttachmentBySlotName(m_SlotName));
69
70 //unmount and refresh parent
71 barbed_wire.SetMountedState(false);
72
73 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
74 }
75
77 {
78 string message = string.Format("Player %1 Unmounted BarbedWire from %2", action_data.m_Player, action_data.m_Target.GetObject().ClassName());
79 return message;
80 }
81}
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 CreateConditionComponents()
override void OnFinishProgressServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override string GetAdminLogMessage(ActionData action_data)
const float BASEBUILDING
const float DEFAULT_CONSTRUCT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native int Length()
Returns length of string.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto native int IndexOfFrom(int start, string sample)
Finds 'sample' in 'str' from 'start' position. Returns -1 when not found.