DayZ 1.24
Loading...
Searching...
No Matches
Switchable_Base Class Reference
Collaboration diagram for Switchable_Base:
[legend]

Private Member Functions

override bool CanPutInCargo (EntityAI parent)
 
override void SetActions ()
 
override ScriptedLightBase GetLight ()
 
override bool CanPutAsAttachment (EntityAI parent)
 
override void OnWorkStart ()
 
override void OnWork (float consumed_energy)
 
override void OnWorkStop ()
 
override void OnInventoryExit (Man player)
 
override void SetActions ()
 
override bool IsLightSource ()
 
void UniversalLight ()
 
override ScriptedLightBase GetLight ()
 
override bool CanPutAsAttachment (EntityAI parent)
 
override void OnWorkStart ()
 
override void OnWork (float consumed_energy)
 
override void OnWorkStop ()
 
override void OnInventoryExit (Man player)
 
override void SetActions ()
 
override bool IsLightSource ()
 
void InitAttachmentsSlotsToCheck (out array< int > AttSlots)
 Enter att slot types to check on attach.
 

Private Attributes

PistollightLight m_Light
 
UniversallightLight m_Light
 
ref array< intm_AttachmentSlotsCheck
 

Static Private Attributes

static int REFLECTOR_ID = 1
 
static int GLASS_ID = 0
 
static string LIGHT_OFF_GLASS = "dz\\gear\\tools\\data\\flashlight_glass.rvmat"
 
static string LIGHT_OFF_REFLECTOR = "dz\\weapons\\attachments\\data\\TLS3.rvmat"
 
static string LIGHT_ON_GLASS = "dz\\gear\\tools\\data\\flashlight_glass_on.rvmat"
 
static string LIGHT_ON_REFLECTOR = "dz\\weapons\\attachments\\data\\TLS3_on.rvmat"
 

Detailed Description

Definition at line 1 of file Chainsaw.c.

Member Function Documentation

◆ CanPutAsAttachment() [1/2]

override bool Switchable_Base::CanPutAsAttachment ( EntityAI parent)
inlineprivate

Definition at line 18 of file TLRLight.c.

19 {
20 if (!super.CanPutAsAttachment(parent)) return false;
21 if (!parent.IsKindOf("PlateCarrierHolster") && !parent.IsKindOf("PlateCarrierComplete") && !parent.IsKindOf("CarrierHolsterSolo") && !parent.IsKindOf("ChestHolster"))
22 return true;
23
24 return false;
25 }

◆ CanPutAsAttachment() [2/2]

override bool Switchable_Base::CanPutAsAttachment ( EntityAI parent)
inlineprivate

Definition at line 25 of file UniversalLight.c.

26 {
27 if (!super.CanPutAsAttachment(parent)) return false;
28
29 bool req_attachment = false;
30 bool rail_attachment_found = false;
31 int slot_id;
33 for (int i = 0; i < parent.GetInventory().GetAttachmentSlotsCount(); i++)
34 {
35 slot_id = parent.GetInventory().GetAttachmentSlotId(i);
36 if (m_AttachmentSlotsCheck.Find(slot_id) != -1)
37 {
38 req_attachment = true;
39 attachment = ItemBase.Cast(parent.GetInventory().FindAttachment(slot_id));
40 if (attachment && attachment.ConfigIsExisting("hasRailFunctionality") && attachment.ConfigGetBool("hasRailFunctionality"))
42 }
43 }
45 }
ref array< int > m_AttachmentSlotsCheck

◆ CanPutInCargo()

override bool Switchable_Base::CanPutInCargo ( EntityAI parent)
inlineprivate

Definition at line 3 of file Chainsaw.c.

4 {
5 if (!super.CanPutInCargo(parent)) return false;
6 if (!GetCompEM().IsSwitchedOn())
7 return true;
8 return false;
9 }

◆ GetLight() [1/2]

override ScriptedLightBase Switchable_Base::GetLight ( )
inlineprivate

Definition at line 13 of file TLRLight.c.

14 {
15 return m_Light;
16 }
PistollightLight m_Light
Definition TLRLight.c:3

References m_Light.

Referenced by ItemBase::EEItemLocationChanged().

◆ GetLight() [2/2]

override ScriptedLightBase Switchable_Base::GetLight ( )
inlineprivate

Definition at line 20 of file UniversalLight.c.

21 {
22 return m_Light;
23 }

References m_Light.

◆ InitAttachmentsSlotsToCheck()

void Switchable_Base::InitAttachmentsSlotsToCheck ( out array< int > AttSlots)
inlineprivate

Enter att slot types to check on attach.

Definition at line 119 of file UniversalLight.c.

120 {
121 if (!AttSlots)
122 {
123 AttSlots = new array<int>;
124 AttSlots.Insert(InventorySlots.GetSlotIdFromString("weaponHandguardM4"));
125 AttSlots.Insert(InventorySlots.GetSlotIdFromString("weaponHandguardAK"));
126 AttSlots.Insert(InventorySlots.GetSlotIdFromString("weaponHandguardMP5"));
127 }
128 }
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

References InventorySlots::GetSlotIdFromString().

Referenced by UniversalLight().

◆ IsLightSource() [1/2]

override bool Switchable_Base::IsLightSource ( )
inlineprivate

Definition at line 93 of file TLRLight.c.

94 {
95 return true;
96 }

◆ IsLightSource() [2/2]

override bool Switchable_Base::IsLightSource ( )
inlineprivate

Definition at line 113 of file UniversalLight.c.

114 {
115 return true;
116 }

◆ OnInventoryExit() [1/2]

override void Switchable_Base::OnInventoryExit ( Man player)
inlineprivate

Definition at line 71 of file TLRLight.c.

72 {
73 super.OnInventoryExit(player);
74
75 if (GetCompEM().IsWorking())
76 {
77 if (player)
78 {
79 vector ori_rotate = player.GetOrientation();
80 ori_rotate = ori_rotate + Vector(270, 0, 0);
81 SetOrientation(ori_rotate);
82 }
83 }
84 }
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

References Vector().

◆ OnInventoryExit() [2/2]

override void Switchable_Base::OnInventoryExit ( Man player)
inlineprivate

Definition at line 91 of file UniversalLight.c.

92 {
93 super.OnInventoryExit(player);
94
95 if (GetCompEM().IsWorking())
96 {
97 if (player)
98 {
99 vector ori_rotate = player.GetOrientation();
100 ori_rotate = ori_rotate + Vector(270, 0, 0);
101 SetOrientation(ori_rotate);
102 }
103 }
104 }

References Vector().

◆ OnWork() [1/2]

override void Switchable_Base::OnWork ( float consumed_energy)
inlineprivate

Definition at line 38 of file TLRLight.c.

39 {
40 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
41 {
42 Battery9V battery = Battery9V.Cast(GetCompEM().GetEnergySource());
43
44 if (battery && m_Light)
45 {
46 float efficiency = battery.GetEfficiency0To1();
47
48 if (efficiency < 1)
49 m_Light.SetIntensity(efficiency, GetCompEM().GetUpdateInterval());
50 else
51 m_Light.SetIntensity(1, 0);
52 }
53 }
54 }
proto native CGame GetGame()

References GetGame(), m_Light, and PointLightBase::SetIntensity().

◆ OnWork() [2/2]

override void Switchable_Base::OnWork ( float consumed_energy)
inlineprivate

Definition at line 58 of file UniversalLight.c.

59 {
60 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
61 {
62 Battery9V battery = Battery9V.Cast(GetCompEM().GetEnergySource());
63
64 if (battery && m_Light)
65 {
66 float efficiency = battery.GetEfficiency0To1();
67
68 if (efficiency < 1)
69 m_Light.SetIntensity(efficiency, GetCompEM().GetUpdateInterval());
70 else
71 m_Light.SetIntensity(1, 0);
72 }
73 }
74 }

References GetGame(), m_Light, and PointLightBase::SetIntensity().

◆ OnWorkStart() [1/2]

override void Switchable_Base::OnWorkStart ( )
inlineprivate

Definition at line 27 of file TLRLight.c.

28 {
29 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
30 {
31 m_Light = PistollightLight.Cast(ScriptedLightBase.CreateLight(PistollightLight, "0 0 0", 0.08)); // Position is zero because light is attached on parent immediately.
32 m_Light.AttachOnMemoryPoint(this, "beamStart", "beamEnd");
33 SetObjectMaterial(GLASS_ID, LIGHT_ON_GLASS);
34 SetObjectMaterial(REFLECTOR_ID, LIGHT_ON_REFLECTOR);
35 }
36 }
static int GLASS_ID
Definition TLRLight.c:6
static int REFLECTOR_ID
Definition TLRLight.c:5
static string LIGHT_ON_GLASS
Definition TLRLight.c:10
static string LIGHT_ON_REFLECTOR
Definition TLRLight.c:11

References GetGame(), and m_Light.

◆ OnWorkStart() [2/2]

override void Switchable_Base::OnWorkStart ( )
inlineprivate

Definition at line 47 of file UniversalLight.c.

48 {
49 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
50 {
51 m_Light = UniversallightLight.Cast(ScriptedLightBase.CreateLight(UniversallightLight, "0 0 0", 0.08)); // Position is zero because light is attached on parent immediately.
52 m_Light.AttachOnMemoryPoint(this, "beamStart", "beamEnd");
53 SetObjectMaterial(GLASS_ID, LIGHT_ON_GLASS);
54 SetObjectMaterial(REFLECTOR_ID, LIGHT_ON_REFLECTOR);
55 }
56 }

References GetGame(), and m_Light.

◆ OnWorkStop() [1/2]

override void Switchable_Base::OnWorkStop ( )
inlineprivate

Definition at line 56 of file TLRLight.c.

57 {
58 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
59 {
60 if (m_Light)
61 m_Light.FadeOut();
62
63 m_Light = NULL;
64
65 SetObjectMaterial(GLASS_ID, LIGHT_OFF_GLASS);
66 SetObjectMaterial(REFLECTOR_ID, LIGHT_OFF_REFLECTOR);
67 }
68 }
static string LIGHT_OFF_GLASS
Definition TLRLight.c:8
static string LIGHT_OFF_REFLECTOR
Definition TLRLight.c:9

References GetGame(), and m_Light.

◆ OnWorkStop() [2/2]

override void Switchable_Base::OnWorkStop ( )
inlineprivate

Definition at line 76 of file UniversalLight.c.

77 {
78 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
79 {
80 if (m_Light)
81 m_Light.FadeOut();
82
83 m_Light = NULL;
84
85 SetObjectMaterial(GLASS_ID, LIGHT_OFF_GLASS);
86 SetObjectMaterial(REFLECTOR_ID, LIGHT_OFF_REFLECTOR);
87 }
88 }

References GetGame(), and m_Light.

◆ SetActions() [1/3]

override void Switchable_Base::SetActions ( )
inlineprivate

Definition at line 11 of file Chainsaw.c.

12 {
13 super.SetActions();
16 }
void AddAction(typename actionName)

References AddAction().

◆ SetActions() [2/3]

override void Switchable_Base::SetActions ( )
inlineprivate

◆ SetActions() [3/3]

override void Switchable_Base::SetActions ( )
inlineprivate

Definition at line 106 of file UniversalLight.c.

107 {
108 super.SetActions();
111 }

References AddAction().

◆ UniversalLight()

void Switchable_Base::UniversalLight ( )
inlineprivate

Definition at line 15 of file UniversalLight.c.

16 {
18 }
void InitAttachmentsSlotsToCheck(out array< int > AttSlots)
Enter att slot types to check on attach.

References InitAttachmentsSlotsToCheck().

Member Data Documentation

◆ GLASS_ID

static int Switchable_Base::GLASS_ID = 0
staticprivate

Definition at line 6 of file TLRLight.c.

◆ LIGHT_OFF_GLASS

static string Switchable_Base::LIGHT_OFF_GLASS = "dz\\gear\\tools\\data\\flashlight_glass.rvmat"
staticprivate

Definition at line 8 of file TLRLight.c.

◆ LIGHT_OFF_REFLECTOR

static string Switchable_Base::LIGHT_OFF_REFLECTOR = "dz\\weapons\\attachments\\data\\TLS3.rvmat"
staticprivate

Definition at line 9 of file TLRLight.c.

◆ LIGHT_ON_GLASS

static string Switchable_Base::LIGHT_ON_GLASS = "dz\\gear\\tools\\data\\flashlight_glass_on.rvmat"
staticprivate

Definition at line 10 of file TLRLight.c.

◆ LIGHT_ON_REFLECTOR

static string Switchable_Base::LIGHT_ON_REFLECTOR = "dz\\weapons\\attachments\\data\\TLS3_on.rvmat"
staticprivate

Definition at line 11 of file TLRLight.c.

◆ m_AttachmentSlotsCheck

ref array<int> Switchable_Base::m_AttachmentSlotsCheck
private

Definition at line 13 of file UniversalLight.c.

◆ m_Light [1/2]

PistollightLight Switchable_Base::m_Light
private

Definition at line 3 of file TLRLight.c.

Referenced by GetLight().

◆ m_Light [2/2]

UniversallightLight Switchable_Base::m_Light
private

Definition at line 3 of file UniversalLight.c.

◆ REFLECTOR_ID

static int Switchable_Base::REFLECTOR_ID = 1
staticprivate

Definition at line 5 of file TLRLight.c.


The documentation for this class was generated from the following files: