The Move class provides the capability to move a ship in space. More...
#include <capability_move.h>
Public Member Functions | |
| Capability_move (ObjectId id) | |
| void | tick (double delta_time_s, double total_time_s) |
Public Member Functions inherited from Capability | |
| Capability (ObjectId id, const std::string &type) | |
Public Member Functions inherited from GameObject | |
| nlohmann::json | toJson () |
| serialize the current object to JSON object | |
| bool | writeToJsonFile () |
| Write to the storage folder a file (see _create_filename() below) containing the object in JSON format. | |
| DataItem & | addDataItem (const std::string &dataItem) |
| Add a dataItem, and return a reference to it. | |
| bool | hasDataItem (const std::string &dataItem) const |
| Check if a specific data item exist. | |
| DataItem & | accessDataItem (const std::string &dataItem) |
| get a reference to the dataItem | |
| const DataItem & | accessDataItem (const std::string &dataItem) const |
| get a const reference to the dataItem | |
| void | dataItemsFromTemplate (const nlohmann::json &template_data) |
| Initialize a list of dataitems from a JSON template. | |
| const std::string & | category () const |
| return the object category (starsystemobject, module, command...) | |
| const std::string & | type () const |
| return the type (ship_xxx, station_xxx, planet_xxx...) | |
| ObjectId | id () const |
| return the object unique ID | |
| void | reparent (std::shared_ptr< GameObject > new_parent) |
| reparent from the current parent, to a new one | |
| void | lock () |
| void | unlock () |
| std::shared_ptr< GameObject > | getParent () const |
| return pointer to this object parent | |
| template<typename T> | |
| std::shared_ptr< T > | getParent () const |
| return pointer to this object parent | |
| std::shared_ptr< GameObject > | getSibling (ObjectId id) |
| get sibling with given ID | |
| template<typename T> | |
| std::shared_ptr< T > | getSibling (ObjectId id) |
| get sibling with given ID | |
| std::shared_ptr< GameObject > | getChild (ObjectId id) |
| return the child to match the id | |
| template<typename T> | |
| std::shared_ptr< T > | getChild (ObjectId id) |
| return the child to match the id | |
| bool | hasChild (ObjectId id) |
| check if current object has a child with this id | |
| std::map< ObjectId, std::shared_ptr< GameObject > > & | childrenMap () |
| get a direct reference to the children map | |
Static Public Member Functions | |
| static Capability * | createFromTemplate (std::shared_ptr< GameObject > future_parent, const nlohmann::json &template_data) |
| static Capability * | createFromDump (ObjectId id) |
Static Public Member Functions inherited from Capability | |
| static std::shared_ptr< Capability > | createFromTemplate (std::shared_ptr< GameObject > owner, const std::string &capability, const nlohmann::json &template_data) |
| static std::shared_ptr< GameObject > | createFromDump (ObjectId id, const std::string &type) |
Static Public Member Functions inherited from GameObject | |
| static bool | initialize (const std::string &storage_path) |
| initialize the disk serialization process | |
| static void | registerSubtype (const std::string &category, undumpFactory undumpCb) |
| Static function that needs to be called for each derived class to create types autmatically while undumping from JSON. | |
| template<typename T> | |
| static std::shared_ptr< T > | createFromJsonFile (const std::string &category, ObjectId id) |
| create a GameObject object from a JSON file | |
Static Public Attributes | |
| static constexpr char | capabilityName [] = "move" |
Static Public Attributes inherited from Capability | |
| static constexpr char | capabilityCategory [] = "capability" |
Static Public Attributes inherited from GameObject | |
| static DataItem | invalidDataItem = DataItem() |
Additional Inherited Members | |
Public Types inherited from Capability | |
| using | undumpFactory = Capability*(*)(ObjectId id) |
| using | createFactory = Capability*(*)(std::shared_ptr<GameObject> future_parent, const nlohmann::json& template_data) |
| using | deleteFactory = void(*)( Capability* ptr ) |
Public Types inherited from GameObject | |
| using | undumpFactory = std::function<std::shared_ptr<GameObject>(ObjectId, const std::string &)> |
Protected Member Functions inherited from GameObject | |
| virtual void | _finalizeDump () |
| Gives the object an opportunity to perform some additional stuff after the object had been serialized to disk. | |
| virtual void | _finalizeUndump (std::shared_ptr< GameObject >) |
| Gives the object an opportunity to perform some cleanup/inizialization after the specific child has been deserialized from disk. | |
| virtual void | _finalizeUndump () |
| Gives the object an opportunity to perform some cleanup/inizialization after the entire object has been deserialized from disk. | |
| GameObject (const std::string &category, ObjectId id, const std::string &type) | |
| Create a GameObject object. | |
The Move class provides the capability to move a ship in space.
This capability must be applied to a Ship object only.
It depends on modules providing the following dataitems:
|
virtual |
Reimplemented from GameObject.