diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 771638a6..b79c0c2c 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -1444,4 +1444,13 @@ void SlashCommandHandler::Startup() { .requiredLevel = eGameMasterLevel::CIVILIAN }; RegisterCommand(removeIgnoreCommand); + + Command shutdownCommand{ + .help = "Shuts this world down", + .info = "Shuts this world down", + .aliases = {"shutdown"}, + .handle = DEVGMCommands::Shutdown, + .requiredLevel = eGameMasterLevel::DEVELOPER + }; + RegisterCommand(shutdownCommand); } diff --git a/dGame/dUtilities/SlashCommands/DEVGMCommands.cpp b/dGame/dUtilities/SlashCommands/DEVGMCommands.cpp index 43f46746..33cbe70a 100644 --- a/dGame/dUtilities/SlashCommands/DEVGMCommands.cpp +++ b/dGame/dUtilities/SlashCommands/DEVGMCommands.cpp @@ -1622,4 +1622,10 @@ namespace DEVGMCommands { } } } + + void Shutdown(Entity* entity, const SystemAddress& sysAddr, const std::string args) { + auto* character = entity->GetCharacter(); + if (character) LOG("Mythran (%s) has shutdown the world", character->GetName().c_str()); + Game::OnSignal(-1); + } }; diff --git a/dGame/dUtilities/SlashCommands/DEVGMCommands.h b/dGame/dUtilities/SlashCommands/DEVGMCommands.h index e03fd4de..811979f9 100644 --- a/dGame/dUtilities/SlashCommands/DEVGMCommands.h +++ b/dGame/dUtilities/SlashCommands/DEVGMCommands.h @@ -73,6 +73,7 @@ namespace DEVGMCommands { void RollLoot(Entity* entity, const SystemAddress& sysAddr, const std::string args); void CastSkill(Entity* entity, const SystemAddress& sysAddr, const std::string args); void DeleteInven(Entity* entity, const SystemAddress& sysAddr, const std::string args); + void Shutdown(Entity* entity, const SystemAddress& sysAddr, const std::string args); } #endif //!DEVGMCOMMANDS_H diff --git a/tests/dGameTests/GameDependencies.cpp b/tests/dGameTests/GameDependencies.cpp index ef58e367..a6c84ec5 100644 --- a/tests/dGameTests/GameDependencies.cpp +++ b/tests/dGameTests/GameDependencies.cpp @@ -12,4 +12,5 @@ namespace Game { SystemAddress chatSysAddr; EntityManager* entityManager = nullptr; std::string projectVersion; + Game::signal_t lastSignal = 0; }