From: Mario Date: Fri, 17 May 2013 01:26:44 +0000 (+1000) Subject: Fixes for some vehicle related issues X-Git-Tag: xonotic-v0.7.0~41^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c4b053e720b715a0149315d469efd42a32470f61;p=xonotic%2Fxonotic-data.pk3dir.git Fixes for some vehicle related issues --- diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index a6c6f3a7e..ee0da7e0c 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -276,6 +276,13 @@ MUTATOR_HOOKABLE(VehicleEnter); entity vh_player; // player entity vh_vehicle; // vehicle +MUTATOR_HOOKABLE(VehicleTouch); + // called when a player touches a vehicle + // return TRUE to stop player from entering the vehicle + // INPUT + entity self; // vehicle + entity other; // player + MUTATOR_HOOKABLE(VehicleExit); // called when a player exits a vehicle // allows mutators to set special settings in this event diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index d1f123a89..82147826e 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -583,6 +583,14 @@ MUTATOR_HOOKFUNCTION(freezetag_GetTeamCount) return 0; } +MUTATOR_HOOKFUNCTION(freezetag_VehicleTouch) +{ + if(other.freezetag_frozen) + return TRUE; + + return FALSE; +} + void freezetag_Initialize() { precache_model("models/ice/ice.md3"); @@ -616,6 +624,7 @@ MUTATOR_DEFINITION(gamemode_freezetag) MUTATOR_HOOK(HavocBot_ChooseRule, freezetag_BotRoles, CBC_ORDER_ANY); MUTATOR_HOOK(SpectateCopy, freezetag_SpectateCopy, CBC_ORDER_ANY); MUTATOR_HOOK(GetTeamCount, freezetag_GetTeamCount, CBC_ORDER_EXCLUSIVE); + MUTATOR_HOOK(VehicleTouch, freezetag_VehicleTouch, CBC_ORDER_ANY); MUTATOR_ONADD { diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index 40c90943e..dc78b0545 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -507,7 +507,7 @@ float vehicles_crushable(entity e) return TRUE; if(e.flags & FL_MONSTER) - return TRUE; // more bitflags for everyone! + return TRUE; return FALSE; } @@ -585,6 +585,9 @@ void vehicles_enter() if(self.team) if(self.team != other.team) return; + + if(MUTATOR_CALLHOOK(VehicleTouch)) + return; RemoveGrapplingHook(other); @@ -798,7 +801,6 @@ void vehicles_exit(float eject) if(!teamplay) _vehicle.team = 0; - else vh_player = _player; vh_vehicle = _vehicle; @@ -1275,11 +1277,14 @@ float vehicle_initialize(string net_name, self.vehicle_respawntime = _respawntime; self.vehicle_spawn = spawnproc; self.effects = EF_NODRAW; + self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID; if(!autocvar_g_vehicles_delayspawn) - self.nextthink = time + 0.5; + self.nextthink = time + game_starttime; else self.nextthink = time + _respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter); + if(autocvar_g_playerclip_collisions) + self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP; if(autocvar_g_nodepthtestplayers) self.effects = self.effects | EF_NODEPTHTEST;