DayZ 1.24
Loading...
Searching...
No Matches
FireworksBase.c
Go to the documentation of this file.
1
10
11class FireworksBase: Inventory_Base
12{
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 override protected void SetActions()
32 {
33 super.SetActions();
34
36 AddAction(ActionDeployObject);
38 }
39
40 override bool HasFlammableMaterial()
41 {
42 return true;
43 }
44
45 protected float GetMaxAllowedWetness()
46 {
47 return 0.1;
48 }
49
51 {
52 return m_State;
53 }
54
56 {
57 if (state != m_StatePrev && GetGame().IsServer())
58 {
59 m_State = state;
60 SetSynchDirty();
63 }
64 }
65
66 protected void OnStateChangedServer(EFireworksState currentState);
67 protected void OnStateChangedClient(EFireworksState currentState);
68
69
70 override protected void OnInventoryEnter(Man player)
71 {
72 if (GetState() == EFireworksState.PLACED)
74 }
75
76 override protected void OnInventoryExit(Man player)
77 {
78 super.OnInventoryExit(player);
79
80 if (!IsBeingPlaced())
81 StandUp();
82 }
83
84 protected void StandUp()
85 {
86 if (!IsRuined())
87 SetOrientation(vector.Zero);
88 }
89
92 {
94 }
95
96 // Checkes if Torch can be ignited
97 override protected bool CanBeIgnitedBy(EntityAI igniter = NULL)
98 {
100 return false;
101
102 if (MiscGameplayFunctions.IsUnderRoofEx(this, 60))
103 return false;
104
105 if ((GetState() <= EFireworksState.PLACED) && vector.Dot(vector.Up, GetDirectionUp()) > 0.95)
106 return true;
107 return false;
108 }
109
111 protected void OnEventServer(int type);
112
113 protected float GetEventDelay()
114 {
115 return 0;
116 }
117
118 override protected void OnVariablesSynchronized()
119 {
120 //Print("new state client: " + m_State);
121 super.OnVariablesSynchronized();
122 if (m_State != m_StatePrev)
123 {
126 }
127 }
128
129#ifdef DEVELOPER
130
132 {
133 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ACTIVATE_ENTITY, "Ignite", FadeColors.LIGHT_GREY));
134 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
135
136 super.GetDebugActions(outputList);
137 }
138
139 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
140 {
141 if (super.OnAction(action_id, player, ctx))
142 return true;
143 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
144 {
145 if (action_id == EActions.ACTIVATE_ENTITY)
147
148 }
149 return false;
150 }
151#endif
152}
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition EntityAI.c:97
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
void AddAction(typename actionName)
void SetActions()
override void OnVariablesSynchronized()
int m_StatePrev
Definition ClockBase.c:17
override Widget Init()
Definition DayZGame.c:120
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
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition ItemBase.c:6834
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:8449
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:8462
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition ItemBase.c:6792
override bool IsBeingPlaced()
Definition ItemBase.c:5625
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Definition ItemBase.c:8656
override float GetWet()
Definition ItemBase.c:8281
void SetState(bool state)
bool m_State
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
static const vector Zero
Definition EnConvert.c:110
static const vector Up
Definition EnConvert.c:107
proto native CGame GetGame()
const int SAT_DEBUG_ACTION
Definition constants.c:424
proto native int GetState()
returns one of STATE_...