Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
fireworksbase.c
Go to the documentation of this file.
1
10
11class FireworksBase: Inventory_Base
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
51 protected EFireworksState GetState()
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 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
142 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
143 {
144 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ACTIVATE_ENTITY, "Ignite", FadeColors.LIGHT_GREY));
145 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
146
147 super.GetDebugActions(outputList);
148 }
149
150 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
151 {
152 if (super.OnAction(action_id, player, ctx))
153 return true;
154 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
155 {
156 if (action_id == EActions.ACTIVATE_ENTITY)
157 {
158 OnIgnitedThis(null);
159 }
160
161 }
162 return false;
163 }
164 #endif
165}
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition entityai.c:97
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
void AddAction(typename actionName)
void SetActions()
Serialization general interface. Serializer API works with:
Definition serializer.c:56
int m_StatePrev
Definition clockbase.c:17
override void EEOnCECreate()
override void OnVariablesSynchronized()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition dayzanimal.c:136
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition dayzanimal.c:125
override Widget Init()
Definition dayzgame.c:127
EActions
Definition eactions.c:2
ref Timer m_TimerEvent
void StandUp()
void OnStateChangedClient(EFireworksState currentState)
void OnStateChangedServer(EFireworksState currentState)
override void OnIgnitedThis(EntityAI fire_source)
Executed on Server when some item ignited this one.
float GetMaxAllowedWetness()
EFireworksState
@ FIRING
@ DEFAULT
@ IGNITED
@ PLACED
@ FINISHED
override bool HasFlammableMaterial()
void OnEventServer(int type)
Called periodically after the entity gets ignited.
void FireworksBase()
float GetEventDelay()
bool CanBeIgnitedBy(EntityAI igniter=NULL)
int m_RandomSeed
proto native CGame GetGame()
const int SAT_DEBUG_ACTION
Definition constants.c:454
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:8708
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:8721
override float GetWet()
Definition itembase.c:8516
enum EObjectTemperatureState m_State
void SetState(bool state)