Add ability to remove items (WIP)

This commit is contained in:
Phillip Stephens 2019-02-06 17:26:53 -08:00
parent 2b022c7d72
commit 6ead37804b
2 changed files with 19 additions and 0 deletions

View File

@ -438,6 +438,21 @@ void CMain::Give(hecl::Console* console, const std::vector<std::string>& args) {
console->report(hecl::Console::Level::Info, "Cheater....., Greatly increasing Metroid encounters, have fun!"); console->report(hecl::Console::Level::Info, "Cheater....., Greatly increasing Metroid encounters, have fun!");
} }
void CMain::Remove(hecl::Console*, const std::vector<std::string>& args) {
if (args.size() < 1 || (!g_GameState || !g_GameState->GetPlayerState()))
return;
std::string type = args[0];
athena::utility::tolower(type);
std::shared_ptr<CPlayerState> pState = g_GameState->GetPlayerState();
CPlayerState::EItemType eType = CPlayerState::ItemNameToType(type);
if (eType != CPlayerState::EItemType::Invalid) {
pState->ReInitalizePowerUp(eType, 0);
if (g_StateManager)
g_StateManager->Player()->AsyncLoadSuit(*g_StateManager);
}
}
void CMain::God(hecl::Console* con, const std::vector<std::string>&) { void CMain::God(hecl::Console* con, const std::vector<std::string>&) {
if (g_GameState && g_GameState->GetPlayerState()) { if (g_GameState && g_GameState->GetPlayerState()) {
g_GameState->GetPlayerState()->SetCanTakeDamage(!g_GameState->GetPlayerState()->CanTakeDamage()); g_GameState->GetPlayerState()->SetCanTakeDamage(!g_GameState->GetPlayerState()->CanTakeDamage());
@ -631,6 +646,9 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana
m_console->registerCommand("Give"sv, "Gives the player the specified item, maxing it out"sv, ""sv, m_console->registerCommand("Give"sv, "Gives the player the specified item, maxing it out"sv, ""sv,
std::bind(&CMain::Give, this, std::placeholders::_1, std::placeholders::_2), std::bind(&CMain::Give, this, std::placeholders::_1, std::placeholders::_2),
hecl::SConsoleCommand::ECommandFlags::Cheat); hecl::SConsoleCommand::ECommandFlags::Cheat);
m_console->registerCommand("Remove"sv, "Removes the specified item from the player"sv, ""sv,
std::bind(&CMain::Remove, this, std::placeholders::_1, std::placeholders::_2),
hecl::SConsoleCommand::ECommandFlags::Cheat);
m_console->registerCommand( m_console->registerCommand(
"Teleport"sv, "Teleports the player to the specified coordinates in worldspace"sv, "x y z [dX dY dZ]"sv, "Teleport"sv, "Teleports the player to the specified coordinates in worldspace"sv, "x y z [dX dY dZ]"sv,
std::bind(&CMain::Teleport, this, std::placeholders::_1, std::placeholders::_2), std::bind(&CMain::Teleport, this, std::placeholders::_1, std::placeholders::_2),

View File

@ -303,6 +303,7 @@ public:
size_t GetExpectedIdSize() const { return sizeof(u32); } size_t GetExpectedIdSize() const { return sizeof(u32); }
void quit(hecl::Console*, const std::vector<std::string>&) { m_doQuit = true; } void quit(hecl::Console*, const std::vector<std::string>&) { m_doQuit = true; }
void Give(hecl::Console*, const std::vector<std::string>&); void Give(hecl::Console*, const std::vector<std::string>&);
void Remove(hecl::Console*, const std::vector<std::string>&);
void God(hecl::Console*, const std::vector<std::string>&); void God(hecl::Console*, const std::vector<std::string>&);
void Teleport(hecl::Console*, const std::vector<std::string>&); void Teleport(hecl::Console*, const std::vector<std::string>&);
void ListWorlds(hecl::Console*, const std::vector<std::string>&); void ListWorlds(hecl::Console*, const std::vector<std::string>&);