diff options
author | Hello=) <hello@themanaworld.org> | 2024-11-16 18:46:07 +0300 |
---|---|---|
committer | Hello=) <hello@themanaworld.org> | 2024-11-16 18:46:07 +0300 |
commit | 271b53b153c3a05b9604b365c7f4ba076fdbc8c4 (patch) | |
tree | 490b5c800ef81a6d5631f275ec671bda0b2d38da /src | |
parent | 7df2af70b994abc56f9178128e5d7549f04b712b (diff) | |
download | tmwa-271b53b153c3a05b9604b365c7f4ba076fdbc8c4.tar.gz tmwa-271b53b153c3a05b9604b365c7f4ba076fdbc8c4.tar.bz2 tmwa-271b53b153c3a05b9604b365c7f4ba076fdbc8c4.tar.xz tmwa-271b53b153c3a05b9604b365c7f4ba076fdbc8c4.zip |
Expose X and Y of killed mob to OnMobKillEvent script event (for slime split, etc)
Rationale:
OnMobKillEvent invoked under PLAYER's RID - so using e.g. POS_X and
POS_Y returns PLAYER's coordinates when kill occured. The only extra data
available been @mobID - giving killed mob's type (class).
However, to "split" slimes I need to spawn few new mobs right on location
where kill occured - or some area around this spot, not player's X/Y.
This commit exposes 2 new variables set by server, @mob_X and @mob_Y
containing mob's X and Y coordinates when kill happened.
This is server-code change needed by relevant scripts.
Scripts itself would be landed a bit later to serverdata.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/mob.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/map/mob.cpp b/src/map/mob.cpp index 996e2bb..065a517 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -2796,9 +2796,11 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, npc_event(sd, md->npc_event, 0); // TODO: in the future, OnPCKillEvent, OnMobKillEvent and OnPCDieEvent should be combined - argrec_t arg[1] = + argrec_t arg[3] = { {"@mobID"_s, static_cast<int32_t>(unwrap<Species>(md->mob_class))}, + {"@mob_X"_s, static_cast<int32_t>(md->bl_x)}, + {"@mob_Y"_s, static_cast<int32_t>(md->bl_y)}, }; npc_event_doall_l(stringish<ScriptLabel>("OnMobKillEvent"_s), sd->bl_id, arg); } |