DayZ 1.24
Loading...
Searching...
No Matches
ActionTurnOnWeaponFlashlight.c
Go to the documentation of this file.
2{
4
6 {
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ITEM_ON;//CMD_ACTIONMOD_INTERACTONCE
8 m_Text = "#switch_on";
9 }
10
16
17 override bool HasTarget()
18 {
19 return false;
20 }
21
22 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
23 {
24 if (item.IsInherited(Rifle_Base))
25 {
26 //m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_LIGHTFLARE;
27 m_flashlight = ItemBase.Cast(item.FindAttachmentBySlotName("weaponFlashlight"));
28 }
29 else if (item.IsInherited(Pistol_Base))
30 {
31 //m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_LITCHEMLIGHT;
32 m_flashlight = ItemBase.Cast(item.FindAttachmentBySlotName("pistolFlashlight"));
33 }
34 else //is not valid item
35 return false;
36
37 if (m_flashlight && m_flashlight.HasEnergyManager() && m_flashlight.GetCompEM().CanSwitchOn() && m_flashlight.GetCompEM().CanWork()) //TODO review conditions for turning off
38 return true;
39
40 return false;
41 }
42
44 {
45 if (m_flashlight.HasEnergyManager())
46 {
47 if (m_flashlight.GetCompEM().CanWork())
48 m_flashlight.GetCompEM().SwitchOn();
49 Weapon_Base.Cast(action_data.m_MainItem).FlashlightOn(); //currently seems to be doing nothing
50 }
51 }
52};
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 ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnExecuteServer(ActionData action_data)
base for semi auto weapons @NOTE name copies config base class
base for rifles @NOTE name copies config base class
Definition SKS.c:70
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597