[Quest API] Export target to EVENT_TARGET_CHANGE in Perl/Lua. (#2870)

* [Quest API] Export target to EVENT_TARGET_CHANGE in Perl/Lua.

- Export `$target` to `EVENT_TARGET_CHANGE`.

- Export `e.other` to `event_target_change`.

- Allows operators to not have to grab bot, Client, or NPC's target in Perl with `GetTarget()`.
- Allows operators to not have to grab Client's target in Lua with `GetTarget()`.

* Update mob.cpp

* Update mob.cpp

* Update mob.cpp
This commit is contained in:
Alex King
2023-02-13 01:03:52 -05:00
committed by GitHub
parent d4afc78982
commit 8c363320d8
5 changed files with 61 additions and 11 deletions
+7
View File
@@ -1561,6 +1561,13 @@ void PerlembParser::ExportEventVariables(
break;
}
case EVENT_TARGET_CHANGE: {
if (extra_pointers && extra_pointers->size() == 1) {
ExportVar(package_name.c_str(), "target", "Mob", std::any_cast<Mob*>(extra_pointers->at(0)));
}
break;
}
case EVENT_WAYPOINT_ARRIVE:
case EVENT_WAYPOINT_DEPART: {
ExportVar(package_name.c_str(), "wp", data);