set g_ctf_flag_return_dropped 100
set g_ctf_flag_return_damage 0
set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
+set g_ctf_flagcarrier_allow_vehicle_carry 1
set g_ctf_flagcarrier_selfdamagefactor 1
set g_ctf_flagcarrier_selfforcefactor 1
set g_ctf_flagcarrier_damagefactor 1
float autocvar_g_ctf_flag_return_when_unreachable;
float autocvar_g_ctf_flag_return_damage;
float autocvar_g_ctf_flag_return_dropped;
+float autocvar_g_ctf_flagcarrier_allow_vehicle_carry;
float autocvar_g_ctf_flagcarrier_selfdamagefactor;
float autocvar_g_ctf_flagcarrier_selfforcefactor;
float autocvar_g_ctf_flagcarrier_damagefactor;
// but if your mutator uses something different then you can handle it
// in a special manner using this hook
// INPUT
- entity self; // the player who pressed impulse 33
\ No newline at end of file
+ entity self; // the player who pressed impulse 33
+
+MUTATOR_HOOKABLE(VehicleEnter);
+ // called when a player enters a vehicle
+ // allows mutators to set special settings in this event
+ // INPUT
+ entity other; // the player
+ entity self; // the vehicle
+
+MUTATOR_HOOKABLE(VehicleExit);
+ // called when a player exits a vehicle
+ // allows mutators to set special settings in this event
+ // INPUT
+ entity other; // the player
+ entity self; // the vehicle
\ No newline at end of file
return 1;
}
+MUTATOR_HOOKFUNCTION(ctf_VehicleEnter)
+{
+ if(other.flagcarried)
+ {
+ if(!autocvar_g_ctf_flagcarrier_allow_vehicle_carry)
+ {
+ ctf_Handle_Throw(self, world, DROP_NORMAL);
+ }
+ else
+ {
+ setattachment(other.flagcarried, self, "");
+ setorigin(other, VEHICLE_FLAG_OFFSET);
+ other.flagcarried.scale = VEHICLE_FLAG_SCALE;
+ }
+ }
+
+ return 0;
+}
+
+MUTATOR_HOOKFUNCTION(ctf_VehicleExit)
+{
+ if(self.owner.flagcarried)
+ {
+ setattachment(self.owner.flagcarried, self.owner, "");
+ setorigin(self.owner.flagcarried, FLAG_CARRY_OFFSET);
+ self.owner.flagcarried.scale = FLAG_SCALE;
+ }
+
+ return 0;
+}
+
// ==========
// Spawnfuncs
MUTATOR_HOOK(PlayerDamage_Calculate, ctf_PlayerDamage, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerUseKey, ctf_PlayerUseKey, CBC_ORDER_ANY);
MUTATOR_HOOK(HelpMePing, ctf_HelpMePing, CBC_ORDER_ANY);
-
+ MUTATOR_HOOK(VehicleEnter, ctf_VehicleEnter, CBC_ORDER_ANY);
+ MUTATOR_HOOK(VehicleExit, ctf_VehicleExit, CBC_ORDER_ANY);
+
MUTATOR_ONADD
{
if(time > 1) // game loads at time 1
// flag constants // for most of these, there is just one question to be asked: WHYYYYY?
#define FLAG_MIN (PL_MIN + '0 0 -13')
#define FLAG_MAX (PL_MAX + '0 0 -13')
+
#define FLAG_SCALE 0.6
#define FLAG_THINKRATE 0.2
#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13))
#define FLAG_WAYPOINT_OFFSET ('0 0 64')
+#define VEHICLE_FLAG_OFFSET ('0 0 96')
+#define VEHICLE_FLAG_SCALE 1.0
+
// waypoint colors
#define WPCOLOR_ENEMYFC(t) (colormapPaletteColor(t - 1, FALSE) * 0.75)
#define WPCOLOR_FLAGCARRIER(t) (('0 0.75 0' + colormapPaletteColor(t - 1, FALSE)) * 0.5)
float autocvar_g_vehicles_crush_force;
float autocvar_g_vehicles_delayspawn;
float autocvar_g_vehicles_delayspawn_jitter;
-float autocvar_g_vehicles_allow_flagcarry;
void vehicles_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
void vehicles_return();
CSQCVehicleSetup(self.owner, self.hud);
- /* FIXCTF // THIS IS A BIG NO-NO, NO GAME MODE SPECIFIC CODE IN VEHICLES.
- if(other.flagcarried)
- {
- if(!autocvar_g_vehicles_allow_flagcarry)
- DropFlag(other.flagcarried, world, world);
- else
- {
- other.flagcarried.scale = 1;
- setattachment(other.flagcarried, self, "");
- setorigin(other, '0 0 96');
- }
- }
- */
+ MUTATOR_CALLHOOK(VehicleEnter);
self.vehicle_enter();
antilag_clear(other);
self.team = 0;
else
self.team = self.tur_head.team;
-
- /* FIXCTF // THIS IS A BIG NO-NO, NO GAME MODE SPECIFIC CODE IN VEHICLES.
- if(self.owner.flagcarried)
- {
- self.owner.flagcarried.scale = 0.6;
- setattachment(self.owner.flagcarried, self.owner, "");
- setorigin(self.owner.flagcarried, FLAG_CARRY_POS);
- }
- */
+
+ MUTATOR_CALLHOOK(VehicleExit);
sound (self, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTN_NORM);
self.vehicle_exit(eject);
set g_vehicles_delayspawn 1
set g_vehicles_delayspawn_jitter 10
-set g_vehicles_allow_flagcarry 1