DayZ 1.24
Loading...
Searching...
No Matches
XmasLights.c
Go to the documentation of this file.
1class XmasLights extends Inventory_Base
2{
3 private ItemBase m_AttachedTo = NULL;
4
5 void XmasLights()
6 {
7 TurnOffItem(this);
8 }
9
10 override bool IsElectricAppliance()
11 {
12 return true;
13 }
14
15 override void OnWorkStart()
16 {
17 TurnOnItem(m_AttachedTo);
18 TurnOnItem(this);
19 }
20
21 override void OnWorkStop()
22 {
23 TurnOffItem(m_AttachedTo);
24 TurnOffItem(this);
25 }
26
28 {
29 //SetPilotLight( false );
30
31 m_AttachedTo = parent;
32 TurnOnItem(parent);
33
34 if (GetCompEM().IsPlugged())
35 {
36 parent.SetAnimationPhase("Cord_plugged", 0);
37 parent.SetAnimationPhase("Cord_folded", 1);
38 }
39 else
40 {
41 parent.SetAnimationPhase("Cord_plugged", 1);
42 parent.SetAnimationPhase("Cord_folded", 0);
43 }
44 }
45
47 {
48 m_AttachedTo = NULL;
49 HideOnItem(parent);
50 TurnOnItem(this);
51
52 GetCompEM().UnplugThis();
53 }
54
56 {
57 if (item != NULL)
58 {
59 if (GetCompEM().IsWorking())
60 {
61 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_r"), "dz\\gear\\camping\\data\\christmas_lights_red_on.rvmat");
62 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_g"), "dz\\gear\\camping\\data\\christmas_lights_green_on.rvmat");
63 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_b"), "dz\\gear\\camping\\data\\christmas_lights_blue_on.rvmat");
64 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_y"), "dz\\gear\\camping\\data\\christmas_lights_yellow_on.rvmat");
65 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_r"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa");
66 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_g"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa");
67 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_b"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa");
68 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_y"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa");
69 //item.SetPilotLight(true);
70 }
71 else
73 }
74 }
75
77 {
78 if (item != NULL)
79 {
80 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_r"), "dz\\gear\\camping\\data\\christmass_ligths_string.rvmat");
81 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_g"), "dz\\gear\\camping\\data\\christmass_ligths_string.rvmat");
82 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_b"), "dz\\gear\\camping\\data\\christmass_ligths_string.rvmat");
83 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_y"), "dz\\gear\\camping\\data\\christmass_ligths_string.rvmat");
84 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_r"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa");
85 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_g"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa");
86 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_b"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa");
87 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_y"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa");
88 //item.SetPilotLight(false);
89 }
90 }
91
93 {
94 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_r"), "");
95 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_g"), "");
96 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_b"), "");
97 item.SetObjectMaterial(item.GetHiddenSelectionIndex("xlights_glass_y"), "");
98 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_r"), "");
99 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_g"), "");
100 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_b"), "");
101 item.SetObjectTexture(item.GetHiddenSelectionIndex("xlights_glass_y"), "");
102 // item.SetPilotLight(false);
103 item.SetAnimationPhase("Cord_plugged", 1);
104 item.SetAnimationPhase("Cord_folded", 1);
105 }
106
107 // --------------------------------------------------
108 // Advanced placement
109 //---------------------------------------------------
110
111 override void SetActions()
112 {
113 super.SetActions();
114
118 }
119
120}
void AddAction(typename actionName)
override bool IsElectricAppliance()
Definition XmasLights.c:10
void TurnOffItem(ItemBase item)
Definition XmasLights.c:76
override void OnWorkStart()
Definition XmasLights.c:15
override void OnWorkStop()
Definition XmasLights.c:21
void HideOnItem(ItemBase item)
Definition XmasLights.c:92
void AttachToObject(ItemBase parent)
Definition XmasLights.c:27
void TurnOnItem(ItemBase item)
Definition XmasLights.c:55
override void SetActions()
Definition XmasLights.c:111
void DetachFromObject(ItemBase parent)
Definition XmasLights.c:46
void XmasLights()
Definition XmasLights.c:5