Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
ObjectInteractAction.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../object/Object.hpp"
4 #include "../world/Coordinates.hpp"
5 #include "Action.hpp"
6 #include "MoveAction.hpp"
7 
12 {
13 public:
14  ObjectInteractAction(std::chrono::system_clock::time_point startTime, std::shared_ptr<Object> pTarget, std::shared_ptr<Entity> pEntity);
15 
16  ~ObjectInteractAction() = default;
17 
22  void act();
23 
29  CurrentAction getActionInfo();
30 
31 private:
32  std::shared_ptr<Object> pTargetM;
33 
34  std::chrono::milliseconds actionTimeM = std::chrono::milliseconds(3000);
35  std::chrono::milliseconds moveTimeM;
36 
37  const ActionType actionTypeM = ActionType::ObjectInteract;
38 
39  std::vector<std::pair<int, int>> pathToTargetM;
40  std::optional<Coordinates> nextMoveM;
41  bool targetInRangeM = true;
42 };
Represents an action that an entity can perform.
Definition: Action.hpp:15
Actions used for interacting with objects.
Definition: ObjectInteractAction.hpp:12
std::vector< std::pair< int, int > > pathToTargetM
Path to the target.
Definition: ObjectInteractAction.hpp:39
std::chrono::milliseconds moveTimeM
Definition: ObjectInteractAction.hpp:35
CurrentAction getActionInfo()
Returns information about the current action.
Definition: ObjectInteractAction.cpp:89
void act()
Objecct interact functionality, which performs target object's interact functionality,...
Definition: ObjectInteractAction.cpp:9
std::optional< Coordinates > nextMoveM
Next move to be taken.
Definition: ObjectInteractAction.hpp:40
ObjectInteractAction(std::chrono::system_clock::time_point startTime, std::shared_ptr< Object > pTarget, std::shared_ptr< Entity > pEntity)
Definition: ObjectInteractAction.cpp:7
const ActionType actionTypeM
Definition: ObjectInteractAction.hpp:37
std::shared_ptr< Object > pTargetM
Definition: ObjectInteractAction.hpp:32
std::chrono::milliseconds actionTimeM
Definition: ObjectInteractAction.hpp:34
bool targetInRangeM
True if the target is in range.
Definition: ObjectInteractAction.hpp:41
~ObjectInteractAction()=default