Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | List of all members
core::system::Position Class Reference

The primary entity positioning system. Handles determining which entities get updated as well as tracking where entities are for collisions. More...

#include <Position.hpp>

+ Inheritance diagram for core::system::Position:

Public Member Functions

 Position (Systems &owner)
 Construct the Position system. More...
 
virtual ~Position ()=default
 Destroy the Position system. More...
 
bl::ecs::Entity getEntity (const bl::tmap::Position &pos) const
 Returns the entity at the given position or InvalidEntity if not found. More...
 
bool spaceFree (const bl::tmap::Position &position) const
 Returns whether or not a tile is currently occupied. More...
 
bl::ecs::Entity search (const bl::tmap::Position &start, bl::tmap::Direction dir, unsigned int range)
 Searches for an entity from the starting position in the given direction for the given number of spaces. Note that start position should be the position of a searching entity and is not included in the search results. More...
 
void editorPushLevel ()
 Called by the editor when a level is added. More...
 
void editorPopLevel ()
 Called by the editor when a level is removed. More...
 

Detailed Description

The primary entity positioning system. Handles determining which entities get updated as well as tracking where entities are for collisions.

Definition at line 26 of file Position.hpp.

Constructor & Destructor Documentation

◆ Position()

core::system::Position::Position ( Systems owner)

Construct the Position system.

Parameters
ownerThe primary Systems object

Definition at line 13 of file Position.cpp.

◆ ~Position()

virtual core::system::Position::~Position ( )
virtualdefault

Destroy the Position system.

Member Function Documentation

◆ editorPopLevel()

void core::system::Position::editorPopLevel ( )

Called by the editor when a level is removed.

Definition at line 116 of file Position.cpp.

◆ editorPushLevel()

void core::system::Position::editorPushLevel ( )

Called by the editor when a level is added.

Definition at line 111 of file Position.cpp.

◆ getEntity()

bl::ecs::Entity core::system::Position::getEntity ( const bl::tmap::Position &  pos) const

Returns the entity at the given position or InvalidEntity if not found.

Parameters
posThe position to check
Returns
bl::ecs::Entity The entity at the given position or bl::ecs::InvalidEntity

Definition at line 96 of file Position.cpp.

◆ search()

bl::ecs::Entity core::system::Position::search ( const bl::tmap::Position &  start,
bl::tmap::Direction  dir,
unsigned int  range 
)

Searches for an entity from the starting position in the given direction for the given number of spaces. Note that start position should be the position of a searching entity and is not included in the search results.

Parameters
startThe position to start at. Is not searched
rangeNumber of spaces to search. Must be greater than 1
Returns
bl::ecs::Entity The entity that was found, or bl::ecs::InvalidEntity if none

Definition at line 39 of file Position.cpp.

◆ spaceFree()

bool core::system::Position::spaceFree ( const bl::tmap::Position &  position) const

Returns whether or not a tile is currently occupied.

Parameters
positionThe tile position to check
Returns
True if no entity is on the tile, false if an entity is currently there

Definition at line 28 of file Position.cpp.


The documentation for this class was generated from the following files: