1 #ifndef CORE_SYSTEMS_WORLD_HPP
2 #define CORE_SYSTEMS_WORLD_HPP
4 #include <BLIB/Engine/System.hpp>
5 #include <BLIB/Events.hpp>
6 #include <BLIB/Serialization/JSON.hpp>
22 :
public bl::engine::System
23 ,
public bl::event::Listener<event::GameSaveInitializing, event::GameSaveLoaded> {
44 bool switchMaps(
const std::string& newMap,
int spawnId);
52 void whiteout(
const std::string& newMap,
int spawnId);
83 bl::resource::Ref<map::Map> currentMap;
84 bl::resource::Ref<map::Map> previousMap;
86 std::string currentMapFile;
87 std::string prevMapFile;
88 bl::tmap::Position playerPos;
89 bl::tmap::Position prevPlayerPos;
91 virtual void init(bl::engine::Engine&)
override;
92 virtual void update(std::mutex&,
float dt,
float,
float,
float)
override;
93 virtual void earlyCleanup()
override;
Core classes and functionality for both the editor and game.
Fired when the game is saving or loading. Allows systems to hook in their data.
Fired when a game save is loaded. Fired after the load is complete.
The primary map class that represents a usable map in the game.
Owns all primary systems and a reference to the engine.
System for managing the current map and previous maps.
virtual ~World()=default
Destroys the system.
World(Systems &systems)
Creates the world system.
void setWhiteoutMap(unsigned int spawn)
Sets the respawn point to the given spawn in the current map.
void whiteout(const std::string &newMap, int spawnId)
Switches to the new map and resets the last map to empty.
bool switchMaps(const std::string &newMap, int spawnId)
Switches the current map to the map in the given file.
map::Map & activeMap()
Returns a reference to the active map.
virtual void observe(const event::GameSaveInitializing &save) override
Adds saved world data to the save file.