Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
fireworksbase.c
Go to the documentation of this file.
1 
3 {
9 }
10 
12 {
13  protected EFireworksState m_State;
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();
62  OnStateChangedServer(state);
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  {
75  SetState(EFireworksState.DEFAULT);
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  {
98  SetState(EFireworksState.IGNITED);
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.LIGHT_GREY));
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 }
GetGame
proto native CGame GetGame()
GetWet
override float GetWet()
Definition: itembase.c:3602
m_TimerEvent
protected ref Timer m_TimerEvent
Definition: fireworksbase.c:15
m_RandomSeed
protected int m_RandomSeed
Definition: fireworksbase.c:16
ActionDeployObject
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Definition: actiondeployobject.c:9
OnIgnitedThis
override void OnIgnitedThis(EntityAI fire_source)
Executed on Server when some item ignited this one.
Definition: fireworksbase.c:96
EEOnCECreate
override void EEOnCECreate()
Definition: fireworksbase.c:23
FINISHED
@ FINISHED
Definition: fireworksbase.c:8
SetState
protected void SetState(EFireworksState state)
Definition: fireworksbase.c:56
OnStateChangedServer
protected void OnStateChangedServer(EFireworksState currentState)
m_StatePrev
protected EFireworksState m_StatePrev
Definition: fireworksbase.c:14
PLACED
@ PLACED
Definition: fireworksbase.c:5
EFireworksState
EFireworksState
Definition: fireworksbase.c:2
OnInventoryEnter
override protected void OnInventoryEnter(Man player)
Definition: fireworksbase.c:71
OnInventoryExit
override protected void OnInventoryExit(Man player)
Definition: fireworksbase.c:79
DEFAULT
@ DEFAULT
Definition: fireworksbase.c:4
ActionTogglePlaceObject
Definition: actiontoggleplaceobject.c:1
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
GetMaxAllowedWetness
protected float GetMaxAllowedWetness()
Definition: fireworksbase.c:46
vector
Definition: enconvert.c:105
HasFlammableMaterial
override bool HasFlammableMaterial()
Definition: fireworksbase.c:41
ActionLightItemOnFire
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
Definition: actionlightitemonfire.c:11
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
SetActions
override protected void SetActions()
Definition: fireworksbase.c:32
FIRING
@ FIRING
Definition: fireworksbase.c:7
GetDebugActions
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition: edible_base.c:744
EActions
EActions
Definition: eactions.c:1
OnAction
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition: edible_base.c:755
m_State
enum EFireworksState m_State
Init
protected void Init()
Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside o...
Definition: uihintpanel.c:46
IsBeingPlaced
override bool IsBeingPlaced()
Definition: itembase.c:946
OnStateChangedClient
protected void OnStateChangedClient(EFireworksState currentState)
OnVariablesSynchronized
override protected void OnVariablesSynchronized()
Definition: fireworksbase.c:129
Timer
Definition: dayzplayerimplement.c:62
SAT_DEBUG_ACTION
const int SAT_DEBUG_ACTION
Definition: constants.c:424
Inventory_Base
Definition: barbedbaseballbat.c:1
GetEventDelay
protected float GetEventDelay()
Definition: fireworksbase.c:124
FireworksBase
void FireworksBase()
Definition: fireworksbase.c:18
TSelectableActionInfoWithColor
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition: entityai.c:97
GetState
protected EFireworksState GetState()
returns one of STATE_...
Definition: fireworksbase.c:51
CanBeIgnitedBy
override protected bool CanBeIgnitedBy(EntityAI igniter=NULL)
Definition: fireworksbase.c:102
EntityAI
Definition: building.c:5
StandUp
protected void StandUp()
Definition: fireworksbase.c:87
IGNITED
@ IGNITED
Definition: fireworksbase.c:6
OnEventServer
protected void OnEventServer(int type)
Called periodically after the entity gets ignited.