From: Mario Date: Fri, 10 Jun 2016 16:32:50 +0000 (+1000) Subject: Allow changing other/toucher from item and buff touch mutator hooks X-Git-Tag: xonotic-v0.8.2~836 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=3e5e2db24d892bb131ecff623a18c6f83ca82f08;p=xonotic%2Fxonotic-data.pk3dir.git Allow changing other/toucher from item and buff touch mutator hooks --- diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index e2cb8b318..b89871c84 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -244,6 +244,7 @@ void buff_Touch(entity this) if(MUTATOR_CALLHOOK(BuffTouch, this, other)) return; + other = M_ARGV(1, entity); if(!IS_PLAYER(other)) return; // incase mutator changed other diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 8967fba42..0829464d2 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -785,9 +785,11 @@ void Item_Touch(entity this) switch (MUTATOR_CALLHOOK(ItemTouch, this, other)) { case MUT_ITEMTOUCH_RETURN: { return; } - case MUT_ITEMTOUCH_PICKUP: { goto pickup; } + case MUT_ITEMTOUCH_PICKUP: { other = M_ARGV(1, entity); goto pickup; } } + other = M_ARGV(1, entity); + if (this.classname == "droppedweapon") { this.strength_finished = max(0, this.strength_finished - time); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 826af04b1..dd5781984 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -383,7 +383,7 @@ void FixPlayermodel(entity player) defaultskin = autocvar_sv_defaultplayerskin; } - MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin); + MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin, player); defaultmodel = M_ARGV(0, string); defaultskin = M_ARGV(1, int); diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 7f3406bf4..4c25477c3 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -545,6 +545,7 @@ MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun); #define EV_ItemTouch(i, o) \ /** item */ i(entity, MUTATOR_ARGV_0_entity) \ /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \ + /**/ o(entity, MUTATOR_ARGV_1_entity) \ /**/ MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch); @@ -631,6 +632,7 @@ MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize); #define EV_BuffTouch(i, o) \ /** buff */ i(entity, MUTATOR_ARGV_0_entity) \ /** player */ i(entity, MUTATOR_ARGV_1_entity) \ + /**/ o(entity, MUTATOR_ARGV_1_entity) \ /**/ MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);