Emergency 20 Dokumentation  4.2.0
TreatPersonAction.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 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
17 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24  class HealthComponent;
25 }
26 
27 
28 //[-------------------------------------------------------]
29 //[ Namespace ]
30 //[-------------------------------------------------------]
31 namespace em5
32 {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Classes ]
37  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public definitions ]
48  //[-------------------------------------------------------]
49  public:
51 
52  enum State
53  {
63  STATE_GET_UP
64  };
65 
66 
67  //[-------------------------------------------------------]
68  //[ Public methods ]
69  //[-------------------------------------------------------]
70  public:
76 
81  virtual ~TreatPersonAction();
82 
87  void init(qsf::Entity& targetEntity);
88 
89  uint64 getTargetEntityId() const;
90 
91  uint64 getMedikitId() const;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Public virtual qsf::Actions methods ]
96  //[-------------------------------------------------------]
97  public:
98  virtual void serialize(qsf::BinarySerializer& serializer) override;
99 
100 
101  //[-------------------------------------------------------]
102  //[ Protected virtual qsf::Action methods ]
103  //[-------------------------------------------------------]
104  protected:
105  virtual bool onStartup() override;
106  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
107  virtual void onShutdown() override;
108 
109 
110  //[-------------------------------------------------------]
111  //[ Private methods ]
112  //[-------------------------------------------------------]
113  private:
114  glm::vec3 calculateOptimalDoctorPosition(bool originalSide = true) const;
115  void checkAndMoveDoctorToOptimalPosition();
116  void checkAndMoveTargetToOptimalPosition() const;
117  void placeMedikit();
118  void takeMedikit();
119  void openMedikit() const;
120  void closeMedikit() const;
121  bool checkReanimationState() const;
122  void bringTargetInPosition() const;
123  void startDoctorDiagnosis() const;
124  void stopDoctorDiagnosis() const;
125  void startDoctorMedicalCare() const;
126  bool isDoctorMedicalCareFinished() const;
127  void stopDoctorMedicalCare() const;
128  void startReanimationTreatment() const;
129  void stopReanimationTreatment() const;
130  bool isTreatmentLogicActive() const;
131  void setGloves(bool hasGloves) const;
132  void deleteTreatmentLogic() const;
133  void showDebug();
134 
135 
136  //[-------------------------------------------------------]
137  //[ Private data ]
138  //[-------------------------------------------------------]
139  private:
140  State mState;
141  bool mMedikitPlaced;
142  qsf::WeakPtr<qsf::Entity> mMedikitEntity;
143  qsf::WeakPtr<qsf::Entity> mTargetEntity;
144  qsf::WeakPtr<HealthComponent> mTargetHealthComponent;
145  glm::vec3 mOptimalDoctorPosition;
146  bool mDoctorIsMovedToMirroredTargetSide;
147 
148  // Debug
149  qsf::DebugDrawProxy mDebugDrawProxy;
150 
151 
152  //[-------------------------------------------------------]
153  //[ CAMP reflection system ]
154  //[-------------------------------------------------------]
155  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
156 
157 
158  };
159 
160 
161 //[-------------------------------------------------------]
162 //[ Namespace ]
163 //[-------------------------------------------------------]
164 } // em5
165 
166 
167 //[-------------------------------------------------------]
168 //[ CAMP reflection system ]
169 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Definition: TreatPersonAction.h:62
Entity class.
Definition: Entity.h:46
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: TreatPersonAction.h:57
uint64_t uint64
Definition: PlatformTypes.h:184
EMERGENCY 5 treat person action.
Definition: TreatPersonAction.h:42
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: TreatPersonAction.h:58
State
Definition: ProcessState.h:20
Debug draw proxy class.
Definition: DebugDrawProxy.h:46
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
Definition: TreatPersonAction.h:59
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
State
Definition: TreatPersonAction.h:52
Definition: TreatPersonAction.h:54
Definition: TreatPersonAction.h:56
Abstract action base class.
Definition: Action.h:59
static const qsf::NamedIdentifier ACTION_ID
"em5::TreatPersonAction" unique action identifier
Definition: TreatPersonAction.h:50
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Definition: TreatPersonAction.h:60
Definition: TreatPersonAction.h:61
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20
Definition: TreatPersonAction.h:55