[Quest API] Export targets to EVENT_CONSIDER and EVENT_CONSIDER_CORPSE (#2908)

# Perl
- Export `$target` to `EVENT_CONSIDER`.
- Export `$corpse` to `EVENT_CONSIDER_CORPSE`.

# Lua
- Export `e.other` to `EVENT_CONSIDER`.
- Export `e.corpse` to `EVENT_CONSIDER_CORPSE`.

 # Notes
- Allows operators to grab the target or corpse a player is considering.
This commit is contained in:
Alex King
2023-02-12 23:32:04 -05:00
committed by GitHub
parent 93f19d3971
commit 2dcff247c8
3 changed files with 104 additions and 72 deletions
+14
View File
@@ -1105,6 +1105,13 @@ void handle_player_consider(
) {
lua_pushinteger(L, Strings::ToInt(data));
lua_setfield(L, -2, "entity_id");
if (extra_pointers && extra_pointers->size() == 1) {
Lua_NPC l_npc(std::any_cast<NPC*>(extra_pointers->at(0)));
luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc);
l_npc_o.push(L);
lua_setfield(L, -2, "other");
}
}
void handle_player_consider_corpse(
@@ -1117,6 +1124,13 @@ void handle_player_consider_corpse(
) {
lua_pushinteger(L, Strings::ToInt(data));
lua_setfield(L, -2, "corpse_entity_id");
if (extra_pointers && extra_pointers->size() == 1) {
Lua_Corpse l_corpse(std::any_cast<Corpse *>(extra_pointers->at(0)));
luabind::adl::object l_corpse_o = luabind::adl::object(L, l_corpse);
l_corpse_o.push(L);
lua_setfield(L, -2, "corpse");
}
}
void handle_player_inspect(