From: terencehill Date: Tue, 13 Sep 2016 10:51:16 +0000 (+0200) Subject: Rename VehicleSpawn mutator hook to VehicleInit and invert the returned value as... X-Git-Tag: xonotic-v0.8.2~591 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ba479caf23cd515c9741eb6595dad2044a1fa826;p=xonotic%2Fxonotic-data.pk3dir.git Rename VehicleSpawn mutator hook to VehicleInit and invert the returned value as it makes more sense --- diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 60a8ee077..cd62f0746 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -900,7 +900,7 @@ bool vehicle_impulse(entity this, int imp) void vehicles_enter(entity pl, entity veh) { - // Remove this when bots know how to use vehicles + // Remove this when bots know how to use vehicles if((IS_BOT_CLIENT(pl) && !autocvar_g_vehicles_allow_bots)) return; @@ -1224,7 +1224,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop) else this.nextthink = time + game_starttime; - if(MUTATOR_CALLHOOK(VehicleSpawn, this)) + if(!MUTATOR_CALLHOOK(VehicleInit, this)) return false; return true; diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 3743c6b94..cc593ad5d 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -529,12 +529,12 @@ MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing); /** * called when a vehicle initializes - * return true to remove the vehicle + * return false to remove the vehicle */ -#define EV_VehicleSpawn(i, o) \ +#define EV_VehicleInit(i, o) \ /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ -MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn); +MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit); /** * called when a player enters a vehicle diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index a91af90f0..b032ab019 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -531,11 +531,13 @@ MUTATOR_HOOKFUNCTION(as, TurretSpawn) turret.team = 5; // this gets reversed when match starts? } -MUTATOR_HOOKFUNCTION(as, VehicleSpawn) +MUTATOR_HOOKFUNCTION(as, VehicleInit) { entity veh = M_ARGV(0, entity); - veh.nextthink = time + 0.5; + if(veh.active != ACTIVE_NOT) + veh.nextthink = time + 0.5; + return true; } MUTATOR_HOOKFUNCTION(as, HavocBot_ChooseRole)