Emergency 20 Dokumentation  4.2.0
GetEquipmentAction.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 //[-------------------------------------------------------]
14 
16 
17 
18 //[-------------------------------------------------------]
19 //[ Forward declarations ]
20 //[-------------------------------------------------------]
21 namespace qsf
22 {
23  class MeshAnimationChannel;
24 }
25 
26 
27 //[-------------------------------------------------------]
28 //[ Namespace ]
29 //[-------------------------------------------------------]
30 namespace em5
31 {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Classes ]
36  //[-------------------------------------------------------]
45  {
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public definitions ]
50  //[-------------------------------------------------------]
51  public:
53 
54  enum State
55  {
62  STATE_DONE
63  };
64 
65 
66  //[-------------------------------------------------------]
67  //[ Public methods ]
68  //[-------------------------------------------------------]
69  public:
75  explicit GetEquipmentAction(uint32 identifier);
76 
81  virtual ~GetEquipmentAction();
82 
87  void init(const qsf::Entity& targetEntity, const std::string& equipmentName);
88 
93  void init(const std::string& equipmentName, int forceTintColorIndex = -1);
94 
95  State getState();
96 
97  const std::string& getEquipmentName() const;
98 
99 
100  //[-------------------------------------------------------]
101  //[ Public virtual qsf::Actions methods ]
102  //[-------------------------------------------------------]
103  public:
104  virtual void serialize(qsf::BinarySerializer& serializer) override;
105 
106 
107  //[-------------------------------------------------------]
108  //[ Protected virtual qsf::Action methods ]
109  //[-------------------------------------------------------]
110  protected:
111  virtual bool onStartup() override;
112  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
113 
114 
115  //[-------------------------------------------------------]
116  //[ Protected methods ]
117  //[-------------------------------------------------------]
118  protected:
119  void getAndTurnToClosestEquipmentDoor();
120  void getAndTurnToClosestEquipmentDoor(bool faceAway, qsf::action::Priority actionPriority);
121  DoorComponent* getNearestDoorFromList(const std::vector<DoorComponent*>& doorComponents) const;
122  bool checkForNextUserInArea();
123  void playUseAnimation();
124 
125 
126  //[-------------------------------------------------------]
127  //[ Protected virtual em5::GetEquipmentAction methods ]
128  //[-------------------------------------------------------]
129  protected:
130  virtual std::vector<DoorComponent*> getEquipmentDoorsFromTarget() const;
131 
132 
133  //[-------------------------------------------------------]
134  //[ Protected data ]
135  //[-------------------------------------------------------]
136  protected:
137  // Configuration
139  std::string mEquipmentName;
146 
147 
148  //[-------------------------------------------------------]
149  //[ CAMP reflection system ]
150  //[-------------------------------------------------------]
151  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
152 
153 
154  };
155 
156 
157 //[-------------------------------------------------------]
158 //[ Namespace ]
159 //[-------------------------------------------------------]
160 } // em5
161 
162 
163 //[-------------------------------------------------------]
164 //[ CAMP reflection system ]
165 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
bool mDoctorUsesBackDoor
"true" if the owner is "doctor", "engineer" and "rescuedogleader" and working with the backdoor of th...
Definition: GetEquipmentAction.h:144
int mForceTintColorIndex
Definition: GetEquipmentAction.h:145
State mCurrentState
Current action progress state.
Definition: GetEquipmentAction.h:141
unsigned int uint32
Definition: PlatformTypes.h:181
Clock class.
Definition: Clock.h:33
Definition: GetEquipmentAction.h:58
#define EM5_API_EXPORT
Definition: Export.h:28
uint32 Priority
Definition: ActionPriority.h:21
Definition: GetEquipmentAction.h:61
State
Definition: GetEquipmentAction.h:54
uint64_t uint64
Definition: PlatformTypes.h:184
DoorComponent::DoorType mUsedDoorType
Type of the used door.
Definition: GetEquipmentAction.h:140
bool mNeedsTarget
If "true" a target vehicle is needed to get the equipment from, otherwise the equipment may be switch...
Definition: GetEquipmentAction.h:142
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: GetEquipmentAction.h:57
Definition: PickupPersonByParamedicAction.h:21
State
Definition: ProcessState.h:20
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
uint64 mTargetEntityId
ID of the target entity.
Definition: GetEquipmentAction.h:138
qsf::WeakPtr< qsf::MeshAnimationChannel > mUseAnimationChannel
Definition: GetEquipmentAction.h:143
Definition: GetEquipmentAction.h:56
DoorType
Definition: DoorComponent.h:63
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Abstract action base class.
Definition: Action.h:59
EMERGENCY 5 door component class.
Definition: DoorComponent.h:41
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
EMERGENCY 5 get equipment action.
Definition: GetEquipmentAction.h:44
static const qsf::NamedIdentifier ACTION_ID
"em5::GetEquipmentAction" unique action identifier
Definition: GetEquipmentAction.h:52
Definition: GetEquipmentAction.h:59
std::string mEquipmentName
Name of the equipment.
Definition: GetEquipmentAction.h:139
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20
Definition: GetEquipmentAction.h:60