Rename a few things to help bring more consistency

This commit is contained in:
Diavolo 2022-02-01 13:29:27 +01:00
parent f79bddb4c3
commit e014dd9a2a
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
4 changed files with 23 additions and 23 deletions

View File

@ -126,8 +126,8 @@ namespace Components
return; return;
} }
const auto* gentity = Script::GetEntFromEntRef(entref); const auto* gentity = Script::GetEntity(entref);
auto* client = Script::GetClientFromEnt(gentity); auto* client = Script::GetClient(gentity);
if (!client->bIsTestClient) if (!client->bIsTestClient)
{ {
@ -138,18 +138,18 @@ namespace Components
client->ping = static_cast<int16_t>(ping); client->ping = static_cast<int16_t>(ping);
}); });
Script::AddFunction("IsBot", [](Game::scr_entref_t entref) // Usage: <bot> IsBot(); Script::AddFunction("IsTestClient", [](Game::scr_entref_t entref) // Usage: <bot> IsTestClient();
{ {
const auto* gentity = Script::GetEntFromEntRef(entref); const auto* gentity = Script::GetEntity(entref);
const auto* client = Script::GetClientFromEnt(gentity); const auto* client = Script::GetClient(gentity);
Game::Scr_AddBool(client->bIsTestClient == 1); Game::Scr_AddBool(client->bIsTestClient == 1);
}); });
Script::AddFunction("BotStop", [](Game::scr_entref_t entref) // Usage: <bot> BotStop(); Script::AddFunction("BotStop", [](Game::scr_entref_t entref) // Usage: <bot> BotStop();
{ {
const auto* gentity = Script::GetEntFromEntRef(entref); const auto* gentity = Script::GetEntity(entref);
const auto* client = Script::GetClientFromEnt(gentity); const auto* client = Script::GetClient(gentity);
if (!client->bIsTestClient) if (!client->bIsTestClient)
{ {
@ -165,8 +165,8 @@ namespace Components
{ {
const auto* weapon = Game::Scr_GetString(0); const auto* weapon = Game::Scr_GetString(0);
const auto* gentity = Script::GetEntFromEntRef(entref); const auto* gentity = Script::GetEntity(entref);
const auto* client = Script::GetClientFromEnt(gentity); const auto* client = Script::GetClient(gentity);
if (!client->bIsTestClient) if (!client->bIsTestClient)
{ {
@ -194,8 +194,8 @@ namespace Components
return; return;
} }
const auto* gentity = Script::GetEntFromEntRef(entref); const auto* gentity = Script::GetEntity(entref);
const auto* client = Script::GetClientFromEnt(gentity); const auto* client = Script::GetClient(gentity);
if (!client->bIsTestClient) if (!client->bIsTestClient)
{ {
@ -230,8 +230,8 @@ namespace Components
auto forwardInt = Game::Scr_GetInt(0); auto forwardInt = Game::Scr_GetInt(0);
auto rightInt = Game::Scr_GetInt(1); auto rightInt = Game::Scr_GetInt(1);
const auto* gentity = Script::GetEntFromEntRef(entref); const auto* gentity = Script::GetEntity(entref);
const auto* client = Script::GetClientFromEnt(gentity); const auto* client = Script::GetClient(gentity);
if (!client->bIsTestClient) if (!client->bIsTestClient)
{ {

View File

@ -142,7 +142,7 @@ namespace Components
{ {
Script::AddFunction("Noclip", [](Game::scr_entref_t entref) // gsc: Noclip(<optional int toggle>); Script::AddFunction("Noclip", [](Game::scr_entref_t entref) // gsc: Noclip(<optional int toggle>);
{ {
const auto* ent = Script::GetEntFromEntRef(entref); const auto* ent = Script::GetEntity(entref);
if (ent->client == nullptr) if (ent->client == nullptr)
{ {
@ -169,7 +169,7 @@ namespace Components
Script::AddFunction("Ufo", [](Game::scr_entref_t entref) // gsc: Ufo(<optional int toggle>); Script::AddFunction("Ufo", [](Game::scr_entref_t entref) // gsc: Ufo(<optional int toggle>);
{ {
const auto* ent = Script::GetEntFromEntRef(entref); const auto* ent = Script::GetEntity(entref);
if (ent->client == nullptr) if (ent->client == nullptr)
{ {
@ -196,7 +196,7 @@ namespace Components
Script::AddFunction("God", [](Game::scr_entref_t entref) // gsc: God(<optional int toggle>); Script::AddFunction("God", [](Game::scr_entref_t entref) // gsc: God(<optional int toggle>);
{ {
auto* ent = Script::GetEntFromEntRef(entref); auto* ent = Script::GetEntity(entref);
if (Game::Scr_GetNumParam() >= 1u) if (Game::Scr_GetNumParam() >= 1u)
{ {
@ -217,7 +217,7 @@ namespace Components
Script::AddFunction("Demigod", [](Game::scr_entref_t entref) // gsc: Demigod(<optional int toggle>); Script::AddFunction("Demigod", [](Game::scr_entref_t entref) // gsc: Demigod(<optional int toggle>);
{ {
auto* ent = Script::GetEntFromEntRef(entref); auto* ent = Script::GetEntity(entref);
if (Game::Scr_GetNumParam() >= 1u) if (Game::Scr_GetNumParam() >= 1u)
{ {
@ -238,7 +238,7 @@ namespace Components
Script::AddFunction("Notarget", [](Game::scr_entref_t entref) // gsc: Notarget(<optional int toggle>); Script::AddFunction("Notarget", [](Game::scr_entref_t entref) // gsc: Notarget(<optional int toggle>);
{ {
auto* ent = Script::GetEntFromEntRef(entref); auto* ent = Script::GetEntity(entref);
if (Game::Scr_GetNumParam() >= 1u) if (Game::Scr_GetNumParam() >= 1u)
{ {

View File

@ -521,7 +521,7 @@ namespace Components
} }
} }
Game::gentity_t* Script::GetEntFromEntRef(const Game::scr_entref_t entref) Game::gentity_t* Script::GetEntity(const Game::scr_entref_t entref)
{ {
if (entref.classnum != 0 || entref.entnum >= Game::MAX_GENTITIES) if (entref.classnum != 0 || entref.entnum >= Game::MAX_GENTITIES)
{ {
@ -532,7 +532,7 @@ namespace Components
return &Game::g_entities[entref.entnum]; return &Game::g_entities[entref.entnum];
} }
Game::client_t* Script::GetClientFromEnt(const Game::gentity_t* gentity) Game::client_t* Script::GetClient(const Game::gentity_t* gentity)
{ {
if (gentity->client == nullptr) if (gentity->client == nullptr)
{ {
@ -663,7 +663,7 @@ namespace Components
// PlayerCmd_AreControlsFrozen GSC function from Black Ops 2 // PlayerCmd_AreControlsFrozen GSC function from Black Ops 2
Script::AddFunction("AreControlsFrozen", [](Game::scr_entref_t entref) // Usage: self AreControlsFrozen(); Script::AddFunction("AreControlsFrozen", [](Game::scr_entref_t entref) // Usage: self AreControlsFrozen();
{ {
const auto* ent = Script::GetEntFromEntRef(entref); const auto* ent = Script::GetEntity(entref);
if (ent->client == nullptr) if (ent->client == nullptr)
{ {

View File

@ -29,8 +29,8 @@ namespace Components
static void OnVMShutdown(Utils::Slot<Scheduler::Callback> callback); static void OnVMShutdown(Utils::Slot<Scheduler::Callback> callback);
static Game::gentity_t* GetEntFromEntRef(const Game::scr_entref_t entref); static Game::gentity_t* GetEntity(const Game::scr_entref_t entref);
static Game::client_t* GetClientFromEnt(const Game::gentity_t* gentity); static Game::client_t* GetClient(const Game::gentity_t* gentity);
private: private:
static std::string ScriptName; static std::string ScriptName;