[Quest API] Add Entity Variable Methods to Perl/Lua. (#2609)

* [Quest API] Add Entity Variable Methods to Perl/Lua.

# Perl
- Add `$mob->ClearEntityVariables()`.
- Add `$mob->DeleteEntityVariable(variable_name)`.
- Add `$object->ClearEntityVariables()`.
- Add `$object->DeleteEntityVariable(variable_name)`.

# Lua
- Add `mob:ClearEntityVariables()`.
- Add `mob:DeleteEntityVariable(variable_name)`.
- Add `object:ClearEntityVariables()`.
- Add `object:DeleteEntityVariable(variable_name)`.

# Notes
- Allows operators to clear all entity variables or delete one by name, previously you just had to set to an empty value to clear after being set.

* Cleanup.
This commit is contained in:
Alex King
2022-12-04 12:18:27 -05:00
committed by GitHub
parent 5d5c2a4194
commit 7abc084cd1
10 changed files with 126 additions and 4 deletions
+12
View File
@@ -2699,6 +2699,16 @@ luabind::object Lua_Mob::GetEntityVariables(lua_State* L) {
return t;
}
bool Lua_Mob::ClearEntityVariables() {
Lua_Safe_Call_Bool();
return self->ClearEntityVariables();
}
bool Lua_Mob::DeleteEntityVariable(std::string variable_name) {
Lua_Safe_Call_Bool();
return self->DeleteEntityVariable(variable_name);
}
void Lua_Mob::SetEntityVariable(std::string variable_name, std::string variable_value) {
Lua_Safe_Call_Void();
self->SetEntityVariable(variable_name, variable_value);
@@ -2855,6 +2865,7 @@ luabind::scope lua_register_mob() {
.def("CheckLoSToLoc", (bool(Lua_Mob::*)(double,double,double))&Lua_Mob::CheckLoSToLoc)
.def("CheckLoSToLoc", (bool(Lua_Mob::*)(double,double,double,double))&Lua_Mob::CheckLoSToLoc)
.def("CheckNumHitsRemaining", &Lua_Mob::CheckNumHitsRemaining)
.def("ClearEntityVariables", (bool(Lua_Mob::*)(void))&Lua_Mob::ClearEntityVariables)
.def("ClearSpecialAbilities", (void(Lua_Mob::*)(void))&Lua_Mob::ClearSpecialAbilities)
.def("CloneAppearance", (void(Lua_Mob::*)(Lua_Mob))&Lua_Mob::CloneAppearance)
.def("CloneAppearance", (void(Lua_Mob::*)(Lua_Mob,bool))&Lua_Mob::CloneAppearance)
@@ -2901,6 +2912,7 @@ luabind::scope lua_register_mob() {
.def("DamageHateListPercentage", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageHateListPercentage)
.def("DelGlobal", (void(Lua_Mob::*)(const char*))&Lua_Mob::DelGlobal)
.def("DeleteBucket", (void(Lua_Mob::*)(std::string))&Lua_Mob::DeleteBucket)
.def("DeleteEntityVariable", (bool(Lua_Mob::*)(std::string))&Lua_Mob::DeleteEntityVariable)
.def("Depop", (void(Lua_Mob::*)(bool))&Lua_Mob::Depop)
.def("Depop", (void(Lua_Mob::*)(void))&Lua_Mob::Depop)
.def("DivineAura", (bool(Lua_Mob::*)(void))&Lua_Mob::DivineAura)