From: Mario Date: Wed, 13 Jul 2016 07:53:56 +0000 (+1000) Subject: Add a hook to customize entities post-update X-Git-Tag: xonotic-v0.8.2~700^2~76 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=da13bb9cdead46e4774f3469de233dda4a7ba4a9;p=xonotic%2Fxonotic-data.pk3dir.git Add a hook to customize entities post-update --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 53cf24b53..7c39500c0 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -825,6 +825,7 @@ void CSQC_Ent_Update(entity this, bool isnew) if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Update(%d) at %f with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)\n", isnew, savetime, this, this.entnum, this.enttype, this.classname, t); done = it.m_read(this, NULL, isnew); + MUTATOR_CALLHOOK(Ent_Update, this, isnew); break; }); time = savetime; diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 2c55bed1b..b72f7abe1 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -135,3 +135,10 @@ MUTATOR_HOOKABLE(HUD_Command, EV_HUD_Command); /** team */ i(float, MUTATOR_ARGV_3_float) \ /**/ MUTATOR_HOOKABLE(DrawGrapplingHook, EV_DrawGrapplingHook); + +/** Called when an entity is updated (either by SVQC networking or PVS) */ +#define EV_Ent_Update(i, o) \ + /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \ + /** is new to client */ i(bool, MUTATOR_ARGV_1_bool) \ + /**/ +MUTATOR_HOOKABLE(Ent_Update, EV_Ent_Update);