Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionturnonpowergenerator.c
Go to the documentation of this file.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6 m_Text = "#switch_on";
7 }
8
9 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
10 {
11 PowerGeneratorBase pg = PowerGeneratorBase.Cast(target.GetObject());
12
13 if (pg)
14 {
15 if (pg.HasEnergyManager() && pg.GetCompEM().CanSwitchOn() && pg.HasSparkplug() && pg.GetCompEM().CanWork())
16 {
17 return true;
18 }
19 }
20
21 return false;
22 }
23
24 override void OnExecuteServer(ActionData action_data)
25 {
26 Object targetObject = action_data.m_Target.GetObject();
27 if (targetObject)
28 {
29 ItemBase target_IB = ItemBase.Cast(targetObject);
30 target_IB.GetCompEM().SwitchOn();
31 target_IB.GetCompEM().InteractBranch(target_IB);
32 }
33 }
34};
string m_Text
Definition actionbase.c:58
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602