Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
xmaslights.c
Go to the documentation of this file.
1 class 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 
27  void AttachToObject(ItemBase parent)
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 
46  void DetachFromObject(ItemBase parent)
47  {
48  m_AttachedTo = NULL;
49  HideOnItem( parent );
50  TurnOnItem( this );
51 
52  GetCompEM().UnplugThis();
53  }
54 
55  void TurnOnItem(ItemBase item)
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
72  {
73  TurnOffItem( item );
74  }
75  }
76  }
77 
78  void TurnOffItem(ItemBase item)
79  {
80  if ( item != NULL )
81  {
82  item.SetObjectMaterial( item.GetHiddenSelectionIndex("xlights_glass_r"), "dz\\gear\\camping\\data\\christmass_ligths_string.rvmat" );
83  item.SetObjectMaterial( item.GetHiddenSelectionIndex("xlights_glass_g"), "dz\\gear\\camping\\data\\christmass_ligths_string.rvmat" );
84  item.SetObjectMaterial( item.GetHiddenSelectionIndex("xlights_glass_b"), "dz\\gear\\camping\\data\\christmass_ligths_string.rvmat" );
85  item.SetObjectMaterial( item.GetHiddenSelectionIndex("xlights_glass_y"), "dz\\gear\\camping\\data\\christmass_ligths_string.rvmat" );
86  item.SetObjectTexture( item.GetHiddenSelectionIndex("xlights_glass_r"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa" );
87  item.SetObjectTexture( item.GetHiddenSelectionIndex("xlights_glass_g"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa" );
88  item.SetObjectTexture( item.GetHiddenSelectionIndex("xlights_glass_b"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa" );
89  item.SetObjectTexture( item.GetHiddenSelectionIndex("xlights_glass_y"), "dz\\gear\\camping\\data\\christmas_lights_string_ca.paa" );
90  //item.SetPilotLight(false);
91  }
92  }
93 
94  void HideOnItem(ItemBase item)
95  {
96  item.SetObjectMaterial( item.GetHiddenSelectionIndex("xlights_glass_r"), "" );
97  item.SetObjectMaterial( item.GetHiddenSelectionIndex("xlights_glass_g"), "" );
98  item.SetObjectMaterial( item.GetHiddenSelectionIndex("xlights_glass_b"), "" );
99  item.SetObjectMaterial( item.GetHiddenSelectionIndex("xlights_glass_y"), "" );
100  item.SetObjectTexture( item.GetHiddenSelectionIndex("xlights_glass_r"), "" );
101  item.SetObjectTexture( item.GetHiddenSelectionIndex("xlights_glass_g"), "" );
102  item.SetObjectTexture( item.GetHiddenSelectionIndex("xlights_glass_b"), "" );
103  item.SetObjectTexture( item.GetHiddenSelectionIndex("xlights_glass_y"), "" );
104 // item.SetPilotLight(false);
105  item.SetAnimationPhase( "Cord_plugged", 1);
106  item.SetAnimationPhase( "Cord_folded", 1);
107  }
108 
109  // --------------------------------------------------
110  // Advanced placement
111  //---------------------------------------------------
112 
113  override void SetActions()
114  {
115  super.SetActions();
116 
120  }
121 
122 }
ItemBase
Definition: inventoryitem.c:730
ActionPlugIn
Definition: actionplugin.c:1
OnWorkStop
override void OnWorkStop()
Definition: m18smokegrenade_colorbase.c:2
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
SetActions
void SetActions()
Definition: advancedcommunication.c:79
ActionUnplugThisByCord
Definition: actionunplugthisbycord.c:1
Inventory_Base
Definition: barbedbaseballbat.c:1
ActionAttachOnProxy
Definition: actionattachonproxy.c:1
OnWorkStart
override void OnWorkStart()
Definition: smokegrenadebase.c:175