[Script] Remove builtin God, demigod, notarget
This commit is contained in:
parent
13d1c23b99
commit
725c08afeb
@ -26,11 +26,11 @@ namespace Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientCommand::Add(const char* name, std::function<void(Game::gentity_s*, Command::ServerParams*)> callback)
|
void ClientCommand::Add(const char* name, const std::function<void(Game::gentity_s*, Command::ServerParams*)>& callback)
|
||||||
{
|
{
|
||||||
const auto command = Utils::String::ToLower(name);
|
const auto command = Utils::String::ToLower(name);
|
||||||
|
|
||||||
ClientCommand::HandlersSV[command] = std::move(callback);
|
ClientCommand::HandlersSV[command] = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientCommand::ClientCommandStub(const int clientNum)
|
void ClientCommand::ClientCommandStub(const int clientNum)
|
||||||
@ -52,7 +52,7 @@ namespace Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Hook::Call<void(const int)>(0x416790)(clientNum);
|
Utils::Hook::Call<void(int)>(0x416790)(clientNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientCommand::AddCheatCommands()
|
void ClientCommand::AddCheatCommands()
|
||||||
@ -351,69 +351,6 @@ namespace Components
|
|||||||
|
|
||||||
void ClientCommand::AddScriptFunctions()
|
void ClientCommand::AddScriptFunctions()
|
||||||
{
|
{
|
||||||
Script::AddMethod("God", [](Game::scr_entref_t entref) // gsc: God(<optional int toggle>);
|
|
||||||
{
|
|
||||||
auto* ent = Game::GetEntity(entref);
|
|
||||||
|
|
||||||
if (Game::Scr_GetNumParam() >= 1)
|
|
||||||
{
|
|
||||||
if (Game::Scr_GetInt(0))
|
|
||||||
{
|
|
||||||
ent->flags |= Game::FL_GODMODE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->flags &= ~Game::FL_GODMODE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->flags ^= Game::FL_GODMODE;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Script::AddMethod("Demigod", [](Game::scr_entref_t entref) // gsc: Demigod(<optional int toggle>);
|
|
||||||
{
|
|
||||||
auto* ent = Game::GetEntity(entref);
|
|
||||||
|
|
||||||
if (Game::Scr_GetNumParam() >= 1)
|
|
||||||
{
|
|
||||||
if (Game::Scr_GetInt(0))
|
|
||||||
{
|
|
||||||
ent->flags |= Game::FL_DEMI_GODMODE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->flags &= ~Game::FL_DEMI_GODMODE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->flags ^= Game::FL_DEMI_GODMODE;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Script::AddMethod("Notarget", [](Game::scr_entref_t entref) // gsc: Notarget(<optional int toggle>);
|
|
||||||
{
|
|
||||||
auto* ent = Game::GetEntity(entref);
|
|
||||||
|
|
||||||
if (Game::Scr_GetNumParam() >= 1)
|
|
||||||
{
|
|
||||||
if (Game::Scr_GetInt(0))
|
|
||||||
{
|
|
||||||
ent->flags |= Game::FL_NOTARGET;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->flags &= ~Game::FL_NOTARGET;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->flags ^= Game::FL_NOTARGET;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Script::AddFunction("DropAllBots", [] // gsc: DropAllBots();
|
Script::AddFunction("DropAllBots", [] // gsc: DropAllBots();
|
||||||
{
|
{
|
||||||
Game::SV_DropAllBots();
|
Game::SV_DropAllBots();
|
||||||
|
@ -7,13 +7,13 @@ namespace Components
|
|||||||
public:
|
public:
|
||||||
ClientCommand();
|
ClientCommand();
|
||||||
|
|
||||||
static void Add(const char* name, std::function<void(Game::gentity_s*, Command::ServerParams*)> callback);
|
static void Add(const char* name, const std::function<void(Game::gentity_s*, Command::ServerParams*)>& callback);
|
||||||
static bool CheatsOk(const Game::gentity_s* ent);
|
static bool CheatsOk(const Game::gentity_s* ent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::unordered_map<std::string, std::function<void(Game::gentity_s*, Command::ServerParams*)>> HandlersSV;
|
static std::unordered_map<std::string, std::function<void(Game::gentity_s*, Command::ServerParams*)>> HandlersSV;
|
||||||
|
|
||||||
static void ClientCommandStub(const int clientNum);
|
static void ClientCommandStub(int clientNum);
|
||||||
static void AddCheatCommands();
|
static void AddCheatCommands();
|
||||||
static void AddDevelopmentCommands();
|
static void AddDevelopmentCommands();
|
||||||
static void AddScriptFunctions();
|
static void AddScriptFunctions();
|
||||||
|
@ -296,7 +296,7 @@ namespace Game
|
|||||||
CON_BUILTIN_CHANNEL_COUNT,
|
CON_BUILTIN_CHANNEL_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum entityFlag
|
enum
|
||||||
{
|
{
|
||||||
FL_GODMODE = 0x1,
|
FL_GODMODE = 0x1,
|
||||||
FL_DEMI_GODMODE = 0x2,
|
FL_DEMI_GODMODE = 0x2,
|
||||||
|
Loading…
Reference in New Issue
Block a user