DayZ 1.24
Loading...
Searching...
No Matches
ActionToggleNVMode.c
Go to the documentation of this file.
1
3{
5 {
6 //m_CallbackClass = ActionTurnOnTransmitterCB;
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ITEM_ON;
8 m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_ITEM_ON;
9 m_Text = "#switch_mode";
10 }
11
17
18 override bool HasTarget()
19 {
20 return false;
21 }
22
23 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
24 {
26 if (Class.CastTo(optics, item) && optics.IsNVOptic())
27 return true;
28
29 return false;
30 }
31
36
41
43 {
44 ItemOptics optics = ItemOptics.Cast(action_data.m_MainItem);
45 switch (optics.GetCurrentOpticMode())
46 {
49 //TODO: animate
50 break;
51
53 optics.SetCurrentOpticMode(GameConstants.OPTICS_STATE_DAY);
54 //TODO: animate
55 break;
56 }
57 }
58}
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
override bool HasTarget()
override void OnExecuteClient(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void SwitchMode(ActionData action_data)
override void CreateConditionComponents()
override void OnExecuteServer(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
const int OPTICS_STATE_DAY
Definition constants.c:800
const int OPTICS_STATE_NIGHTVISION
Definition constants.c:801
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.