Skip to content

Commit

Permalink
[Quest API] Add GMMove Overloads to Perl/Lua (#3719)
Browse files Browse the repository at this point in the history
# Perl
- Add `$mob->GMMove(x, y, z, heading, save_guard_spot)`.

# Lua
- Add `mob:GMMove(x, y, z, heading, save_guard_spot)`.

# Notes
- Operators weren't able to disable saving guard spots, so moving with `GMMove` meant NPCs stayed where they were moved.
  • Loading branch information
Kinglykrab committed Nov 25, 2023
1 parent 56be69d commit fdc5c27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zone/lua_mob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ void Lua_Mob::GMMove(double x, double y, double z, double heading) {
self->GMMove(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), static_cast<float>(heading));
}

void Lua_Mob::GMMove(double x, double y, double z, double heading, bool save_guard_spot) {
Lua_Safe_Call_Void();
self->GMMove(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), static_cast<float>(heading), save_guard_spot);
}

void Lua_Mob::TryMoveAlong(float distance, float angle) {
Lua_Safe_Call_Void();
self->TryMoveAlong(distance, angle);
Expand Down Expand Up @@ -3350,6 +3355,7 @@ luabind::scope lua_register_mob() {
.def("FindType", (bool(Lua_Mob::*)(int,bool,int))&Lua_Mob::FindType)
.def("GMMove", (void(Lua_Mob::*)(double,double,double))&Lua_Mob::GMMove)
.def("GMMove", (void(Lua_Mob::*)(double,double,double,double))&Lua_Mob::GMMove)
.def("GMMove", (void(Lua_Mob::*)(double,double,double,double,bool))&Lua_Mob::GMMove)
.def("GetAA", (int(Lua_Mob::*)(int))&Lua_Mob::GetAA)
.def("GetAABonuses", &Lua_Mob::GetAABonuses)
.def("GetAAByAAID", (int(Lua_Mob::*)(int))&Lua_Mob::GetAAByAAID)
Expand Down
1 change: 1 addition & 0 deletions zone/lua_mob.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class Lua_Mob : public Lua_Entity
bool RandomizeFeatures(bool send_illusion, bool save_variables);
void GMMove(double x, double y, double z);
void GMMove(double x, double y, double z, double heading);
void GMMove(double x, double y, double z, double heading, bool save_guard_spot);
void TryMoveAlong(float distance, float heading);
void TryMoveAlong(float distance, float heading, bool send);
bool HasProcs();
Expand Down
6 changes: 6 additions & 0 deletions zone/perl_mob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ void Perl_Mob_GMMove(Mob* self, float x, float y, float z, float heading) // @ca
self->GMMove(x, y, z, heading);
}

void Perl_Mob_GMMove(Mob* self, float x, float y, float z, float heading, bool save_guard_spot) // @categories Script Utility
{
self->GMMove(x, y, z, heading, save_guard_spot);
}

bool Perl_Mob_HasProcs(Mob* self) // @categories Stats and Attributes
{
return self->HasProcs();
Expand Down Expand Up @@ -3469,6 +3474,7 @@ void perl_register_mob()
package.add("FindType", (bool(*)(Mob*, uint16_t, bool, uint16_t))&Perl_Mob_FindType);
package.add("GMMove", (void(*)(Mob*, float, float, float))&Perl_Mob_GMMove);
package.add("GMMove", (void(*)(Mob*, float, float, float, float))&Perl_Mob_GMMove);
package.add("GMMove", (void(*)(Mob*, float, float, float, float, bool))&Perl_Mob_GMMove);
package.add("Gate", &Perl_Mob_Gate);
package.add("GetAA", &Perl_Mob_GetAA);
package.add("GetAABonuses", &Perl_Mob_GetAABonuses);
Expand Down

0 comments on commit fdc5c27

Please sign in to comment.