Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiontogglenvmode.c
Go to the documentation of this file.
1 
3 {
4  void ActionToggleNVMode()
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 
12  override void CreateConditionComponents()
13  {
16  }
17 
18  override bool HasTarget()
19  {
20  return false;
21  }
22 
23  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
24  {
25  ItemOptics optics;
26  if ( Class.CastTo(optics,item) && optics.IsNVOptic() )
27  {
28  return true;
29  }
30 
31  return false;
32  }
33 
34  override void OnExecuteServer( ActionData action_data )
35  {
36  SwitchMode(action_data);
37  }
38 
39  override void OnExecuteClient( ActionData action_data )
40  {
41  SwitchMode(action_data);
42  }
43 
44  void SwitchMode( ActionData action_data )
45  {
46  ItemOptics optics = ItemOptics.Cast(action_data.m_MainItem);
47  switch (optics.GetCurrentOpticMode())
48  {
49  case GameConstants.OPTICS_STATE_DAY:
50  optics.SetCurrentOpticMode(GameConstants.OPTICS_STATE_NIGHTVISION);
51  //TODO: animate
52  break;
53 
54  case GameConstants.OPTICS_STATE_NIGHTVISION:
55  optics.SetCurrentOpticMode(GameConstants.OPTICS_STATE_DAY);
56  //TODO: animate
57  break;
58  }
59  }
60 }
ItemBase
Definition: inventoryitem.c:730
CCTNone
Definition: cctnone.c:1
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
m_Text
protected string m_Text
Definition: actionbase.c:49
GameConstants
Definition: constants.c:612
ActionSingleUseBase
Definition: actionsingleusebase.c:41
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionToggleNVMode
Definition: actiontogglenvmode.c:2
ItemOptics
Definition: itemoptics.c:1
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10