Emergency 20 Dokumentation  4.2.0
FiremanLogic.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
16 
17 #include <qsf/asset/AssetProxy.h>
19 #include <qsf/job/JobProxy.h>
21 
22 
23 //[-------------------------------------------------------]
24 //[ Namespace ]
25 //[-------------------------------------------------------]
26 namespace em5
27 {
28 
29 
30  //[-------------------------------------------------------]
31  //[ Classes ]
32  //[-------------------------------------------------------]
38  {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Public definitions ]
43  //[-------------------------------------------------------]
44  public:
45  static const uint32 GAMELOGIC_TYPE_ID; // "em5::FiremanLogic" game logic type ID
46 
47  static const std::string ASSET_ABC_SUIT;
48  static const std::string ASSET_DUST_MASK;
49 
50  enum Clothing
51  {
54  CLOTHING_DUST_MASK
55  };
56 
57 
58  //[-------------------------------------------------------]
59  //[ Public methods ]
60  //[-------------------------------------------------------]
61  public:
62  FiremanLogic();
63 
71  // TODO(mz): Pulling persons belongs in its own logic
72  uint64 getPullingPersonId() const;
73 
81  // TODO(mz): Pulling persons belongs in its own logic
82  void setPullingPersonId(uint64 id);
83 
91  bool isConnectedToHydrant() const;
92 
100  qsf::Entity* getConnectedHydrant() const;
101 
106  void connectToHydrant(qsf::Entity& hydrant);
107 
112  void disconnectFromHydrant();
113 
121  SimpleFireHoseComponent* getFireHose() const;
122 
123  void createFireHose();
124  void destroyFireHose();
125 
133  void performAutomatism();
134 
139  Clothing getActiveClothing() const;
140 
145  void setActiveClothing(Clothing clothing, bool changeMesh = true);
146 
147 
148  //[-------------------------------------------------------]
149  //[ Public virtual qsf::GameLogic methods ]
150  //[-------------------------------------------------------]
151  public:
152  virtual bool onStartup() override;
153  virtual void onShutdown() override;
154 
155 
156  //[-------------------------------------------------------]
157  //[ Protected virtual qsf::Component methods ]
158  //[-------------------------------------------------------]
159  protected:
160  virtual void onSetDebug(bool debug) override;
161 
162 
163  //[-------------------------------------------------------]
164  //[ Private methods ]
165  //[-------------------------------------------------------]
166  private:
167  // Job updates
168  void updateSimulation(const qsf::JobArguments& jobArguments);
169  void updateAnimation(const qsf::JobArguments& jobArguments);
170  void postInitialize(const qsf::JobArguments& jobArguments);
171 
172  void onReceiveHeatEnergy(const qsf::MessageParameters& parameters);
173  void updateHydrantVisualisation();
174  void performExtinguisherAutomatism();
175  void performExtinguishWithHoseAutomatism();
176  void performPullObjectFromPersonAutomatism();
177  void performRescueCutterAutomatism();
178  void performCuttingblockingTreesAutomatism();
179  void performDecontaminatePersonAutomatism();
180 
181  void onPersonInjured(const qsf::MessageParameters& parameters);
182 
183 
184  //[-------------------------------------------------------]
185  //[ Private data ]
186  //[-------------------------------------------------------]
187  private:
188  qsf::WeakPtr<qsf::Entity> mPullingPersonEntity;
189  qsf::Time mTimeWaiting;
190 
191  // Hydrant, fire hose
192  qsf::WeakPtr<HydrantComponent> mConnectedHydrant;
193  qsf::WeakPtr<SimpleFireHoseComponent> mConnectedFireHose;
194 
195  // Debug proxies for debug draw
196  qsf::DebugDrawProxy mDebugDrawProxyRange;
197  qsf::DebugDrawProxy mDebugDrawProxyHose;
198 
199  // Job proxies for regular update
200  qsf::JobProxy mAnimationJobProxy;
201  qsf::JobProxy mSimulationJobProxy;
202  qsf::JobProxy mFirstUpdateJobProxy;
203 
204  // Contamination
205  Clothing mActiveClothing;
206  qsf::AssetProxy mAssetDefaultSuit;
207  qsf::MessageProxy mMessageProxyInjured;
208  qsf::MessageProxy mHeatEnergyProxy;
209  qsf::MessageProxy mContaminationAreaProxy;
210  qsf::Time mTimeRemoveDustMask;
211 
212 
213  //[-------------------------------------------------------]
214  //[ CAMP reflection system ]
215  //[-------------------------------------------------------]
216  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
217 
218 
219  };
220 
221 
222 //[-------------------------------------------------------]
223 //[ Namespace ]
224 //[-------------------------------------------------------]
225 } // em5
226 
227 
228 //[-------------------------------------------------------]
229 //[ CAMP reflection system ]
230 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
static const uint32 GAMELOGIC_TYPE_ID
Definition: FiremanLogic.h:45
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
Carry person logic.
Definition: CarryPersonLogic.h:33
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
Definition: FiremanLogic.h:52
uint64_t uint64
Definition: PlatformTypes.h:184
Clothing
Definition: FiremanLogic.h:50
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
static const std::string ASSET_DUST_MASK
Definition: FiremanLogic.h:48
Debug draw proxy class.
Definition: DebugDrawProxy.h:46
Asset proxy class.
Definition: AssetProxy.h:57
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Definition: FiremanLogic.h:53
static const std::string ASSET_ABC_SUIT
Definition: FiremanLogic.h:47
Simple fire hose component based on existing implementation.
Definition: SimpleFireHoseComponent.h:56
Fireman logic.
Definition: FiremanLogic.h:37
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32