35 override void CreateConditionComponents()
49 BarbedWire barbed_wire = GetBarbedWire(target);
50 return (barbed_wire && !barbed_wire.IsMounted() && !barbed_wire.IsRuined());
56 override ActionData CreateActionData()
58 BarbedWireActionData action_data =
new BarbedWireActionData();
62 override bool SetupAction(
PlayerBase player, ActionTarget target,
ItemBase item, out ActionData action_data,
Param extra_data = null)
64 if (super.SetupAction(player, target, item, action_data, extra_data))
67 BarbedWireActionData actionDataBW = BarbedWireActionData.Cast(action_data);
68 actionDataBW.m_SlotName = GetZoneSelection(target);
79 super.WriteToContext(ctx, action_data);
80 BarbedWireActionData actionDataBW
82 if (
Class.CastTo(actionDataBW,action_data))
84 ctx.Write(actionDataBW.m_SlotName);
88 override bool ReadFromContext(
ParamsReadContext ctx, out ActionReciveData action_recive_data )
90 if (!action_recive_data)
94 super.ReadFromContext(ctx, action_recive_data);
100 receiveDataBW.m_SlotName =
slotName;
105 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
107 super.HandleReciveData(action_recive_data, action_data);
110 BarbedWireActionData.Cast(action_data).m_SlotName = receiveDataBW.m_SlotName;
113 override void OnStartServer(ActionData action_data)
115 super.OnStartServer(action_data);
117 BarbedWire wire = GetBarbedWire(action_data.m_Target);
118 if (wire && wire.GetLoopDeploySoundset() !=
string.Empty)
119 wire.StartItemSoundServer(SoundConstants.ITEM_DEPLOY_LOOP);
122 override void OnEndServer(ActionData action_data)
124 BarbedWire wire = GetBarbedWire(action_data.m_Target);
125 if (wire && wire.GetLoopDeploySoundset() !=
string.Empty)
126 wire.StopItemSoundServer(SoundConstants.ITEM_DEPLOY_LOOP);
128 super.OnEndServer(action_data);
131 override void OnFinishProgressServer(ActionData action_data)
133 BarbedWireActionData actionDataBW = BarbedWireActionData.Cast(action_data);
137 BarbedWire wire = BarbedWire.Cast(base_building.FindAttachmentBySlotName(actionDataBW.m_SlotName));
138 wire.SetMountedState(
true);
140 if (wire.GetDeploySoundset() !=
string.Empty)
141 wire.StartItemSoundServer(SoundConstants.ITEM_DEPLOY);
144 string zone =
"invalid";
146 zones.Copy(base_building.GetEntityDamageZoneMap().GetKeyArray());
150 for (
int i = 0; i < zones.Count(); i++)
156 if (test == actionDataBW.m_SlotName)
163 base_building.SetHealth01(zone,
"Health",wire.GetHealth01(
"",
"Health"));
166 BarbedWire GetBarbedWire(ActionTarget target)
170 if (
Class.CastTo(wire,base_building.FindAttachmentBySlotName(GetZoneSelection(target))))
178 string GetZoneSelection(ActionTarget target)
181 return base_building.GetActionComponentName(target.GetComponentIndex());
184 override string GetAdminLogMessage(ActionData action_data)
186 string message =
string.Format(
"Player %1 Mounted BarbedWire on %2", action_data.m_Player, action_data.m_Target.GetObject().ClassName());