InfoMessage(s);
}
+ MUTATOR_CALLHOOK(DrawInfoMessages, pos, mySize);
+
if(!warmup_stage && gametype == MAPINFO_TYPE_LMS)
{
entity sk;
/** Return true to not draw scoreboard */
MUTATOR_HOOKABLE(DrawScoreboard, EV_NO_ARGS);
+
+/** Called when drawing info messages, allows adding new info messages */
+#define EV_DrawInfoMessages(i, o) \
+ /** pos */ i(vector, MUTATOR_ARGV_0_vector) \
+ /** mySize */ i(vector, MUTATOR_ARGV_1_vector) \
+ /**/
+MUTATOR_HOOKABLE(DrawInfoMessages, EV_DrawInfoMessages);
#endif
return output;
}
+
+string Item_Sound(string it_snd)
+{
+ string output = strcat("misc/", it_snd);
+#ifdef SVQC
+ MUTATOR_CALLHOOK(ItemSound, it_snd, output);
+ return M_ARGV(1, string);
+#else
+ return output;
+#endif
+}
#ifdef GAMEQC
MODEL(ArmorSmall_ITEM, Item_Model("item_armor_small.md3"));
-SOUND(ArmorSmall, "misc/armor1");
+SOUND(ArmorSmall, Item_Sound("armor1"));
#endif
REGISTER_ITEM(ArmorSmall, Armor) {
#ifdef GAMEQC
MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
-SOUND(ArmorMedium, "misc/armor10");
+SOUND(ArmorMedium, Item_Sound("armor10"));
#endif
REGISTER_ITEM(ArmorMedium, Armor) {
#ifdef GAMEQC
MODEL(ArmorBig_ITEM, Item_Model("item_armor_big.md3"));
-SOUND(ArmorBig, "misc/armor17_5");
+SOUND(ArmorBig, Item_Sound("armor17_5"));
#endif
REGISTER_ITEM(ArmorBig, Armor) {
#ifdef GAMEQC
MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
-SOUND(ArmorMega, "misc/armor25");
+SOUND(ArmorMega, Item_Sound("armor25"));
#endif
REGISTER_ITEM(ArmorMega, Armor) {
#ifdef GAMEQC
MODEL(HealthSmall_ITEM, Item_Model("g_h1.md3"));
-SOUND(HealthSmall, "misc/minihealth");
+SOUND(HealthSmall, Item_Sound("minihealth"));
#endif
REGISTER_ITEM(HealthSmall, Health) {
#ifdef GAMEQC
MODEL(HealthMedium_ITEM, Item_Model("g_h25.md3"));
-SOUND(HealthMedium, "misc/mediumhealth");
+SOUND(HealthMedium, Item_Sound("mediumhealth"));
#endif
REGISTER_ITEM(HealthMedium, Health) {
#ifdef GAMEQC
MODEL(HealthBig_ITEM, Item_Model("g_h50.md3"));
-SOUND(HealthBig, "misc/mediumhealth");
+SOUND(HealthBig, Item_Sound("mediumhealth"));
#endif
REGISTER_ITEM(HealthBig, Health) {
#ifdef GAMEQC
MODEL(HealthMega_ITEM, Item_Model("g_h100.md3"));
-SOUND(HealthMega, "misc/megahealth");
+SOUND(HealthMega, Item_Sound("megahealth"));
#endif
REGISTER_ITEM(HealthMega, Health) {
#ifdef GAMEQC
MODEL(Strength_ITEM, Item_Model("g_strength.md3"));
-SOUND(Strength, "misc/powerup");
+SOUND(Strength, Item_Sound("powerup"));
#endif
REGISTER_ITEM(Strength, Powerup) {
#ifdef GAMEQC
MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
-SOUND(Shield, "misc/powerup_shield");
+SOUND(Shield, Item_Sound("powerup_shield"));
#endif
REGISTER_ITEM(Shield, Powerup) {
#ifdef GAMEQC
MODEL(VaporizerCells_ITEM, Item_Model("a_cells.md3"));
-SOUND(VaporizerCells, "misc/itempickup");
+SOUND(VaporizerCells, Item_Sound("itempickup"));
#endif
REGISTER_ITEM(VaporizerCells, Ammo) {
#ifdef GAMEQC
MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3"));
-SOUND(ExtraLife, "misc/megahealth");
+SOUND(ExtraLife, Item_Sound("megahealth"));
#endif
REGISTER_ITEM(ExtraLife, Powerup) {
#ifdef GAMEQC
MODEL(Invisibility_ITEM, Item_Model("g_strength.md3"));
-SOUND(Invisibility, "misc/powerup");
+SOUND(Invisibility, Item_Sound("powerup"));
#endif
REGISTER_ITEM(Invisibility, Powerup) {
#ifdef GAMEQC
MODEL(Speed_ITEM, Item_Model("g_invincible.md3"));
-SOUND(Speed, "misc/powerup_shield");
+SOUND(Speed, Item_Sound("powerup_shield"));
#endif
REGISTER_ITEM(Speed, Powerup) {
REGISTER_WAYPOINT(RaceStart, _("Start"), '1 0.5 0', 1);
REGISTER_WAYPOINT(RaceStartFinish, _("Start"), '1 0.5 0', 1);
-REGISTER_WAYPOINT(Assault, _("<placeholder>"), '1 0.5 0', 1);
REGISTER_WAYPOINT(AssaultDefend, _("Defend"), '1 0.5 0', 1);
REGISTER_WAYPOINT(AssaultDestroy, _("Destroy"), '1 0.5 0', 1);
REGISTER_WAYPOINT(AssaultPush, _("Push"), '1 0.5 0', 1);
#include "../teams.qh"
string W_Sound(string w_snd);
+string Item_Sound(string it_snd);
SOUND(ARC_FIRE, W_Sound("arc_fire"));
SOUND(ARC_LOOP, W_Sound("arc_loop"));
SOUND(BUFF_LOST, "relics/relic_effect");
-SOUND(POWEROFF, "misc/poweroff");
-SOUND(POWERUP, "misc/powerup");
-SOUND(SHIELD_RESPAWN, "misc/shield_respawn");
-SOUND(STRENGTH_RESPAWN, "misc/strength_respawn");
+SOUND(POWEROFF, Item_Sound("poweroff"));
+SOUND(POWERUP, Item_Sound("powerup"));
+SOUND(SHIELD_RESPAWN, Item_Sound("shield_respawn"));
+SOUND(STRENGTH_RESPAWN, Item_Sound("strength_respawn"));
-SOUND(ARMOR25, "misc/armor25");
+SOUND(ARMOR25, Item_Sound("armor25"));
SOUND(ARMORIMPACT, "misc/armorimpact");
SOUND(BODYIMPACT1, "misc/bodyimpact1");
SOUND(BODYIMPACT2, "misc/bodyimpact2");
-SOUND(ITEMPICKUP, "misc/itempickup");
-SOUND(ITEMRESPAWNCOUNTDOWN, "misc/itemrespawncountdown");
-SOUND(ITEMRESPAWN, "misc/itemrespawn");
-SOUND(MEGAHEALTH, "misc/megahealth");
+SOUND(ITEMPICKUP, Item_Sound("itempickup"));
+SOUND(ITEMRESPAWNCOUNTDOWN, Item_Sound("itemrespawncountdown"));
+SOUND(ITEMRESPAWN, Item_Sound("itemrespawn"));
+SOUND(MEGAHEALTH, Item_Sound("megahealth"));
SOUND(LAVA, "player/lava");
SOUND(SLIME, "player/slime");
void ReadyRestart()
{
- // no assault support yet...
- if (g_assault || gameover || race_completing) localcmd("restart\n");
+ if (MUTATOR_CALLHOOK(ReadyRestart_Deny) || gameover || race_completing) localcmd("restart\n");
else localcmd("\nsv_hook_gamerestart\n");
// Reset ALL scores, but only do that at the beginning of the countdown if sv_ready_restart_after_countdown is off!
/**/
MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
+/** called when an item sound is about to be played, allows custom paths etc. */
+#define EV_ItemSound(i, o) \
+ /** sound */ i(string, MUTATOR_ARGV_0_string) \
+ /** output */ i(string, MUTATOR_ARGV_1_string) \
+ /**/ o(string, MUTATOR_ARGV_1_string) \
+ /**/
+MUTATOR_HOOKABLE(ItemSound, EV_ItemSound);
+
/** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
#define EV_GiveFragsForKill(i, o) \
/** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
/** sender */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
+
+/** return true to just restart the match, for modes that don't support readyrestart */
+MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
it.sprite = NULL; // TODO: just unsetting it?!
}
- spr = WaypointSprite_SpawnFixed(WP_Assault, 0.5 * (it.absmin + it.absmax), it, assault_sprite, RADARICON_OBJECTIVE);
+ spr = WaypointSprite_SpawnFixed(WP_AssaultDefend, 0.5 * (it.absmin + it.absmax), it, assault_sprite, RADARICON_OBJECTIVE);
spr.assault_decreaser = this;
spr.waypointsprite_visible_for_player = assault_decreaser_sprite_visible;
spr.classname = "sprite_waypoint";
}
}
+MUTATOR_HOOKFUNCTION(as, ReadyRestart_Deny)
+{
+ // readyrestart not supported (yet)
+ return true;
+}
+
// scoreboard setup
void assault_ScoreRules()
{
}
}
+bool ctf_Immediate_Return_Allowed(entity flag, entity toucher)
+{
+ int num_perteam = 0;
+ FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(toucher, it), { ++num_perteam; });
+
+ // automatically return if there's only 1 player on the team
+ return ((autocvar_g_ctf_flag_return || num_perteam <= 1 || (autocvar_g_ctf_flag_return_carrying && toucher.flagcarried))
+ && flag.team);
+}
+
bool ctf_Return_Customize(entity this, entity client)
{
// only to the carrier
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
if(autocvar_g_ctf_flag_return_damage_delay)
- {
- this.ctf_flagdamaged = true;
- }
+ this.ctf_flagdamaged_byworld = true;
else
{
this.health = 0;
LOG_TRACE("wtf the flag got squashed?");
tracebox(this.origin, CTF_FLAG.m_mins, CTF_FLAG.m_maxs, this.origin, MOVE_NOMONSTERS, this);
if(!trace_startsolid || this.noalign) // can we resize it without getting stuck?
- setsize(this, CTF_FLAG.m_mins, CTF_FLAG.m_maxs); }
-
- switch(this.ctf_status) // reset flag angles in case warpzones adjust it
- {
- case FLAG_DROPPED:
- {
- this.angles = '0 0 0';
- break;
- }
-
- default: break;
+ setsize(this, CTF_FLAG.m_mins, CTF_FLAG.m_maxs);
}
// main think method
case FLAG_DROPPED:
{
+ this.angles = '0 0 0'; // reset flag angles in case warpzones adjust it
+
if(autocvar_g_ctf_flag_dropped_floatinwater)
{
vector midpoint = ((this.absmin + this.absmax) * 0.5);
return;
}
}
- if(this.ctf_flagdamaged)
+ if(this.ctf_flagdamaged_byworld)
{
this.health -= ((this.max_flag_health / autocvar_g_ctf_flag_return_damage_delay) * FLAG_THINKRATE);
ctf_CheckFlagReturn(this, RETURN_NEEDKILL);
flag.health = 0;
ctf_CheckFlagReturn(flag, RETURN_NEEDKILL);
}
- if(!flag.ctf_flagdamaged) { return; }
+ if(!flag.ctf_flagdamaged_byworld) { return; }
}
- int num_perteam = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(toucher, it), LAMBDA(++num_perteam));
-
// special touch behaviors
if(STAT(FROZEN, toucher)) { return; }
else if(IS_VEHICLE(toucher))
case FLAG_DROPPED:
{
- if(CTF_SAMETEAM(toucher, flag) && (autocvar_g_ctf_flag_return || num_perteam <= 1 || (autocvar_g_ctf_flag_return_carrying && toucher.flagcarried)) && flag.team) // automatically return if there's only 1 player on the team
+ if(CTF_SAMETEAM(toucher, flag) && ctf_Immediate_Return_Allowed(flag, toucher))
ctf_Handle_Return(flag, toucher); // toucher just returned his own flag
else if(is_not_monster && (!toucher.flagcarried) && ((toucher != flag.ctf_dropper) || (time > flag.ctf_droptime + autocvar_g_ctf_flag_collect_delay)))
ctf_Handle_Pickup(flag, toucher, PICKUP_DROPPED); // toucher just picked up a dropped enemy flag
if((IS_PLAYER(toucher)) && !IS_DEAD(toucher) && (toucher != flag.pass_sender))
{
if(DIFF_TEAM(toucher, flag.pass_sender))
- ctf_Handle_Return(flag, toucher);
+ {
+ if(ctf_Immediate_Return_Allowed(flag, toucher))
+ ctf_Handle_Return(flag, toucher);
+ else if(is_not_monster && (!toucher.flagcarried))
+ ctf_Handle_Pickup(flag, toucher, PICKUP_DROPPED);
+ }
else
ctf_Handle_Retrieve(flag, toucher);
}
flag.ctf_dropper = NULL;
flag.ctf_pickuptime = 0;
flag.ctf_droptime = 0;
- flag.ctf_flagdamaged = 0;
+ flag.ctf_flagdamaged_byworld = false;
ctf_CheckStalemate();
}
.entity ctf_dropper; // don't allow spam of dropping the flag
.int max_flag_health;
.float next_take_time;
-.bool ctf_flagdamaged;
+.bool ctf_flagdamaged_byworld;
int ctf_teams;
// passing/throwing properties
spawnfunc(target_checkpoint) // defrag entity
{
- vector o;
if(!g_race && !g_cts) { delete(this); return; }
defrag_ents = 1;
- EXACTTRIGGER_INIT;
+ // if this is targeted, then it probably isn't a trigger
+ bool is_trigger = !boolean(!this.nottargeted && this.targetname != "");
+
+ if(is_trigger)
+ EXACTTRIGGER_INIT;
this.use = checkpoint_use;
- if (!(this.spawnflags & 1))
+ if (is_trigger && !(this.spawnflags & 1))
settouch(this, checkpoint_touch);
- o = (this.absmin + this.absmax) * 0.5;
- tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
- waypoint_spawnforitem_force(this, trace_endpos);
- this.nearestwaypointtimeout = time + 1000000000;
+ vector org = this.origin;
+
+ // bots should only pathfind to this if it is a valid touchable trigger
+ if(is_trigger)
+ {
+ org = (this.absmin + this.absmax) * 0.5;
+ tracebox(org, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), org - '0 0 1' * (org.z - this.absmin.z), MOVE_NORMAL, this);
+ waypoint_spawnforitem_force(this, trace_endpos);
+ this.nearestwaypointtimeout = time + 1000000000;
+ }
if(this.message == "")
this.message = "went backwards";
race_timed_checkpoint = 1;
if(this.race_checkpoint == 0)
- WaypointSprite_SpawnFixed(WP_RaceStart, o, this, sprite, RADARICON_NONE);
+ WaypointSprite_SpawnFixed(WP_RaceStart, org, this, sprite, RADARICON_NONE);
else
- WaypointSprite_SpawnFixed(WP_RaceCheckpoint, o, this, sprite, RADARICON_NONE);
+ WaypointSprite_SpawnFixed(WP_RaceCheckpoint, org, this, sprite, RADARICON_NONE);
this.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player;
spawnfunc(weapon_hagar);
spawnfunc(weapon_machinegun);
spawnfunc(item_bullets);
-spawnfunc(item_armor_large);
-spawnfunc(item_armor_large);
+spawnfunc(item_armor_mega);
spawnfunc(item_health_mega);
spawnfunc(item_health_medium);
spawnfunc(item_spikes) {spawnfunc_item_bullets(this);}
//spawnfunc(item_armor1) {spawnfunc_item_armor_medium(this);} // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-spawnfunc(item_armor2) {spawnfunc_item_armor_large(this);}
-spawnfunc(item_armorInv) {spawnfunc_item_armor_large(this);} // TODO: make sure we actually want this
+spawnfunc(item_armor2) {spawnfunc_item_armor_mega(this);}
+spawnfunc(item_armorInv) {spawnfunc_item_armor_mega(this);} // TODO: make sure we actually want this
spawnfunc(item_health) {if (this.spawnflags & 2) spawnfunc_item_health_mega(this);else spawnfunc_item_health_medium(this);}
//spawnfunc_item_spikes
spawnfunc(item_jetpack);
spawnfunc(item_armor_big);
-spawnfunc(item_armor_large);
+spawnfunc(item_armor_mega);
spawnfunc(item_armor_small);
spawnfunc(item_health_medium);
spawnfunc(ammo_rockets) { spawnfunc_item_rockets(this); }
// Armor
-spawnfunc(item_armor_body) { spawnfunc_item_armor_large(this); }
+spawnfunc(item_armor_body) { spawnfunc_item_armor_mega(this); }
spawnfunc(item_armor_combat) { spawnfunc_item_armor_big(this); }
spawnfunc(item_armor_shard) { spawnfunc_item_armor_small(this); }
spawnfunc(item_enviro) { spawnfunc_item_invincible(this); }
void Weapon_whereis(Weapon this, entity cl)
{
if (!autocvar_g_showweaponspawns) return;
- IL_EACH(g_items, it.weapon == this.m_id && (it.ItemStatus & ITS_AVAILABLE),
+ IL_EACH(g_items, it.weapon == this.m_id && (!it.team || (it.ItemStatus & ITS_AVAILABLE)),
{
if (it.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2)
continue;