MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
{SELFPARAM();
- if(self.weapon == WEP_NEXBALL.m_id)
- return true;
+ return self.weapon == WEP_NEXBALL.m_id;
+}
- return false;
+MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
+{SELFPARAM();
+ return self.weapon == WEP_MORTAR.m_id; // TODO: what is this for?
}
MUTATOR_HOOKFUNCTION(nb, FilterItem)
(MapInfo_LoadedGametype == MAPINFO_TYPE_##NAME)
REGISTER_GAMETYPE(_("Deathmatch"),dm,g_dm,DEATHMATCH,false,"timelimit=20 pointlimit=30 leadlimit=0",_("Score as many frags as you can."));
-#define g_dm IS_GAMETYPE(DEATHMATCH)
REGISTER_GAMETYPE(_("Last Man Standing"),lms,g_lms,LMS,false,"timelimit=20 lives=9 leadlimit=0",_("Survive and kill until the enemies have no lives left."));
-#define g_lms IS_GAMETYPE(LMS)
REGISTER_GAMETYPE(_("Race"),rc,g_race,RACE,false,"timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0",_("Race against other players to the finish line."));
#define g_race IS_GAMETYPE(RACE)
#define g_ca IS_GAMETYPE(CA)
REGISTER_GAMETYPE(_("Domination"),dom,g_domination,DOMINATION,true,"timelimit=20 pointlimit=200 teams=2 leadlimit=0",_("Capture and defend all the control points to win."));
-#define g_domination IS_GAMETYPE(DOMINATION)
REGISTER_GAMETYPE(_("Key Hunt"),kh,g_keyhunt,KEYHUNT,true,"timelimit=20 pointlimit=1000 teams=3 leadlimit=0",_("Gather all the keys to win the round."));
-#define g_keyhunt IS_GAMETYPE(KEYHUNT)
REGISTER_GAMETYPE(_("Assault"),as,g_assault,ASSAULT,true,"timelimit=20",_("Destroy obstacles to find and destroy the enemy power core before time runs out."));
#define g_assault IS_GAMETYPE(ASSAULT)
REGISTER_GAMETYPE(_("Onslaught"),ons,g_onslaught,ONSLAUGHT,true,"pointlimit=1 timelimit=20",_("Capture control points to reach and destroy the enemy generator."));
-#define g_onslaught IS_GAMETYPE(ONSLAUGHT)
REGISTER_GAMETYPE(_("Nexball"),nb,g_nexball,NEXBALL,true,"timelimit=20 pointlimit=5 leadlimit=0",_("Shoot and kick the ball into the enemies goal, keep your goal clean."));
#define g_nexball IS_GAMETYPE(NEXBALL)
#define g_freezetag IS_GAMETYPE(FREEZETAG)
REGISTER_GAMETYPE(_("Keepaway"),ka,g_keepaway,KEEPAWAY,true,"timelimit=20 pointlimit=30",_("Hold the ball to get points for kills."));
-#define g_keepaway IS_GAMETYPE(KEEPAWAY)
REGISTER_GAMETYPE(_("Invasion"),inv,g_invasion,INVASION,false,"pointlimit=50 teams=0",_("Survive against waves of monsters."));
-#define g_invasion IS_GAMETYPE(INVASION)
const int MAPINFO_FEATURE_WEAPONS = 1; // not defined for instagib-only maps
const int MAPINFO_FEATURE_VEHICLES = 2;
{SELFPARAM();
// if a WP wants to time out, let it time out immediately; other WPs ought to be reset/killed by their owners
- if (self.fade_time) // was there before: || g_keyhunt, do we really need this?
+ if (self.fade_time)
WaypointSprite_Kill(self);
}
string format_message;
MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
-/** returns 1 if throwing the current weapon shall not be allowed */
+/** returns true if throwing the current weapon shall not be allowed */
MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_NO_ARGS);
+/** returns true if dropping the current weapon shall not be allowed at any time including death */
+MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_NO_ARGS);
+
/** allows changing attack rate */
#define EV_WeaponRateFactor(i, o) \
/**/ i(float, weapon_rate) \
return true;
}
-REGISTER_MUTATOR(dm, g_dm)
+REGISTER_MUTATOR(dm, IS_GAMETYPE(DEATHMATCH))
{
MUTATOR_ONADD
{
#include "../teamplay.qh"
+bool g_domination;
+
int autocvar_g_domination_default_teams;
bool autocvar_g_domination_disable_frags;
int autocvar_g_domination_point_amt;
void dom_Initialize()
{
+ g_domination = true;
InitializeEntity(world, dom_DelayedInit, INITPRIO_GAMETYPE);
}
-REGISTER_MUTATOR(dom, g_domination)
+REGISTER_MUTATOR(dom, IS_GAMETYPE(DOMINATION))
{
int fraglimit_override = autocvar_g_domination_point_limit;
if(autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit)
#include "../teamplay.qh"
+bool g_invasion;
+
float autocvar_g_invasion_round_timelimit;
int autocvar_g_invasion_teams;
bool autocvar_g_invasion_team_spawns;
InitializeEntity(world, invasion_DelayedInit, INITPRIO_GAMETYPE);
}
-REGISTER_MUTATOR(inv, g_invasion)
+REGISTER_MUTATOR(inv, IS_GAMETYPE(INVASION))
{
SetLimits(autocvar_g_invasion_point_limit, -1, -1, -1);
if(autocvar_g_invasion_teams >= 2)
{
if(time > 1) // game loads at time 1
error("This is a game type and it cannot be added at runtime.");
+ g_invasion = true;
invasion_Initialize();
cvar_settemp("g_monsters", "1");
void ka_SpawnBall() // loads various values for the ball, runs only once at start of match
{
- if(!g_keepaway) { return; }
-
entity e;
e = spawn();
e.model = "models/orbs/orbblue.md3";
void ka_Initialize() // run at the start of a match, initiates game mode
{
- if(!g_keepaway)
- return;
-
ka_ScoreRules();
ka_SpawnBall();
}
-REGISTER_MUTATOR(ka, g_keepaway)
+REGISTER_MUTATOR(ka, IS_GAMETYPE(KEEPAWAY))
{
MUTATOR_ONADD
{
return false;
}
-REGISTER_MUTATOR(kh, g_keyhunt)
+REGISTER_MUTATOR(kh, IS_GAMETYPE(KEYHUNT))
{
ActivateTeamplay();
SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, -1, -1);
lms_ScoreRules();
}
-REGISTER_MUTATOR(lms, g_lms)
+REGISTER_MUTATOR(lms, IS_GAMETYPE(LMS))
{
SetLimits(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override), 0, -1, -1);
#include "../controlpoint.qh"
#include "../generator.qh"
+bool g_onslaught;
+
float autocvar_g_onslaught_debug;
float autocvar_g_onslaught_teleport_wait;
bool autocvar_g_onslaught_spawn_at_controlpoints;
void ons_Initialize()
{
+ g_onslaught = true;
ons_captureshield_force = autocvar_g_onslaught_shield_force;
addstat(STAT_ROUNDLOST, AS_INT, ons_roundlost);
InitializeEntity(world, ons_DelayedInit, INITPRIO_GAMETYPE);
}
-REGISTER_MUTATOR(ons, g_onslaught)
+REGISTER_MUTATOR(ons, IS_GAMETYPE(ONSLAUGHT))
{
ActivateTeamplay();
SetLimits(autocvar_g_onslaught_point_limit, -1, -1, -1);
return 0;
if (g_cts)
return 0;
- if (g_nexball && w == WEP_MORTAR.m_id)
- return 0;
if(w == 0)
return 0;
w = self.weapon;
if (w == 0)
return; // just in case
- if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon))
+ if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon) || MUTATOR_CALLHOOK(ForbidDropCurrentWeapon))
return;
if(!autocvar_g_weapon_throwable)
return;
void SpawnThrownWeapon(vector org, float w)
{SELFPARAM();
if(self.weapons & WepSet_FromWeapon(self.weapon))
- if(W_IsWeaponThrowable(self.weapon))
+ if(!MUTATOR_CALLHOOK(ForbidDropCurrentWeapon) && W_IsWeaponThrowable(self.weapon))
W_ThrowNewWeapon(self, self.weapon, false, org, randomvec() * 125 + '0 0 200');
}