Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionturnoffweaponflashlight.c
Go to the documentation of this file.
2{
3 ItemBase m_flashlight;
4
6 {
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ITEM_OFF;//CMD_ACTIONMOD_INTERACTONCE
8 m_Text = "#switch_off";
9 }
10
11 override void CreateConditionComponents()
12 {
15 }
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().CanSwitchOff() ) //TODO review conditions for turning off
38 {
39 return true;
40 }
41
42 return false;
43 }
44
45 override void OnExecuteServer( ActionData action_data )
46 {
47 if ( m_flashlight.HasEnergyManager() )
48 {
49 if ( m_flashlight.GetCompEM().IsSwitchedOn() )
50 {
51 m_flashlight.GetCompEM().SwitchOff();
52 }
53 Weapon_Base.Cast(action_data.m_MainItem).FlashlightOff(); //currently seems to be doing nothing
54 }
55 }
56};
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
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:602