DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
FireworksBase.c
Go to the documentation of this file.
1
3{
10
12{
15 protected ref Timer m_TimerEvent;
16 protected int m_RandomSeed;
17
19 {
20 Init();
21 }
22
23 override void EEOnCECreate()
24 {
25 StandUp();
26 }
27
28 protected void Init();
29
30
31
32 override protected void SetActions()
33 {
34 super.SetActions();
35
39 }
40
41 override bool HasFlammableMaterial()
42 {
43 return true;
44 }
45
46 protected float GetMaxAllowedWetness()
47 {
48 return 0.1;
49 }
50
52 {
53 return m_State;
54 }
55
56 protected void SetState(EFireworksState state)
57 {
58 if (state != m_StatePrev && GetGame().IsServer())
59 {
60 m_State = state;
61 SetSynchDirty();
63 m_StatePrev = state;
64 }
65 }
66
67 protected void OnStateChangedServer(EFireworksState currentState);
68 protected void OnStateChangedClient(EFireworksState currentState);
69
70
71 override protected void OnInventoryEnter(Man player)
72 {
73 if (GetState() == EFireworksState.PLACED)
74 {
76 }
77 }
78
79 override protected void OnInventoryExit(Man player)
80 {
81 super.OnInventoryExit(player);
82
83 if (!IsBeingPlaced())
84 StandUp();
85 }
86
87 protected void StandUp()
88 {
89 if (!IsRuined())
90 {
91 SetOrientation(vector.Zero);
92 }
93 }
94
96 override protected void OnIgnitedThis( EntityAI fire_source)
97 {
99 }
100
101 // Checkes if Torch can be ignited
102 override protected bool CanBeIgnitedBy(EntityAI igniter = NULL)
103 {
104 if (GetWet() >= GetMaxAllowedWetness())
105 {
106 return false;
107 }
108
109 if (MiscGameplayFunctions.IsUnderRoofEx(this, 60))
110 {
111 return false;
112 }
113
114 if ((GetState() <= EFireworksState.PLACED) && vector.Dot(vector.Up,GetDirectionUp()) > 0.95)
115 {
116 return true;
117 }
118 return false;
119 }
120
122 protected void OnEventServer(int type);
123
124 protected float GetEventDelay()
125 {
126 return 0;
127 }
128
129 override protected void OnVariablesSynchronized()
130 {
131 //Print("new state client: " + m_State);
132 super.OnVariablesSynchronized();
133 if (m_State != m_StatePrev)
134 {
137 }
138 }
139
140 #ifdef DEVELOPER
141 override void GetDebugButtonNames(out string button1, out string button2, out string button3, out string button4)
142 {
143 button1 = "Ignite";
144 }
145
146 override void OnDebugButtonPressServer(int button_index)
147 {
148 if (button_index == 1)
149 {
150 OnIgnitedThis(null);
151 }
152 }
153 #endif
154}
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
void AddAction(typename actionName)
int m_StatePrev
Definition ClockBase.c:17
override Widget Init()
Definition DayZGame.c:122
override void OnDebugButtonPressServer(int button_index)
override void GetDebugButtonNames(out string button1, out string button2, out string button3, out string button4)
protected void OnEventServer(int type)
Called periodically after the entity gets ignited.
protected float GetMaxAllowedWetness()
protected ref Timer m_TimerEvent
protected void OnStateChangedClient(EFireworksState currentState)
protected int m_RandomSeed
EFireworksState
@ FIRING
@ DEFAULT
@ IGNITED
@ PLACED
@ FINISHED
override bool HasFlammableMaterial()
protected float GetEventDelay()
protected void OnStateChangedServer(EFireworksState currentState)
override protected bool CanBeIgnitedBy(EntityAI igniter=NULL)
void FireworksBase()
protected void StandUp()
override protected void OnIgnitedThis(EntityAI fire_source)
Executed on Server when some item ignited this one.
override bool IsBeingPlaced()
Definition ItemBase.c:5540
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Definition ItemBase.c:8594
void OnInventoryEnter(Man player)
Event called on item when it is placed in the player(Man) inventory, passes the owner as a parameter.
Definition ItemBase.c:8390
override float GetWet()
Definition ItemBase.c:8233
void OnInventoryExit(Man player)
Event called on item when it is removed from the player(Man) inventory, passes the old owner as a par...
Definition ItemBase.c:8403
protected float m_DrainThreshold protected bool m_State
protected int m_State
Definition HescoBox.c:11
int GetState()
Definition HescoBox.c:74
override void OnVariablesSynchronized()
Definition HescoBox.c:47
override void SetActions()
Definition Mace.c:3
void SetState(int state)
Definition HescoBox.c:79
static const vector Up
Definition EnConvert.c:107
static const vector Zero
Definition EnConvert.c:110
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
proto native CGame GetGame()