#include "quake3.qh"
-#include <server/client.qh>
-#include <common/weapons/_all.qh>
-#include <common/stats.qh>
-#include <server/miscfunctions.qh>
-#include <server/items/items.qh>
-#include <server/items/spawning.qh>
-#include <server/resources.qh>
#include <common/gamemodes/_mod.qh>
#include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
-#include <common/mapobjects/triggers.qh>
#include <common/mapobjects/trigger/counter.qh>
+#include <common/mapobjects/triggers.qh>
#include <common/mutators/mutator/buffs/buffs.qh>
+#include <common/mutators/mutator/buffs/sv_buffs.qh>
+#include <common/mutators/mutator/powerups/_mod.qh>
+#include <common/mutators/mutator/status_effects/_mod.qh>
#include <common/notifications/all.qh>
+#include <common/stats.qh>
+#include <common/weapons/_all.qh>
+#include <common/weapons/_all.qh>
+#include <server/client.qh>
+#include <server/items/items.qh>
+#include <server/items/spawning.qh>
+#include <server/resources.qh>
+#include <server/world.qh>
/***********************
* QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
***********************
* Map entities NOT handled in this file:
- holdable_invulnerability Q3TA currently unsupported
- holdable_kamikaze Q3TA currently unsupported
+ holdable_invulnerability Q3TA buffs mutator
+ holdable_kamikaze Q3TA buffs mutator
+ holdable_teleporter Q3A buffs mutator
item_ammoregen Q3TA buffs mutator
item_doubler Q3TA buffs mutator
item_guard Q3TA buffs mutator
// BFG -> Crylink || Fireball
SPAWNFUNC_Q3_COND(weapon_bfg, ammo_bfg, cvar_string("g_mod_balance") == "XDF", WEP_CRYLINK, WEP_FIREBALL)
+ // FIXME: WEP_FIREBALL has no ammo_type field so ammo_bfg is deleted by SPAWNFUNC_BODY
// grappling hook -> hook
SPAWNFUNC_WEAPON(weapon_grapplinghook, WEP_HOOK)
if (!(this.spawnflags & 8))
{
- STAT(STRENGTH_FINISHED, actor) = 0;
- STAT(INVINCIBLE_FINISHED, actor) = 0;
- if(STAT(BUFFS, actor)) // TODO: make a dropbuffs function to handle this
+ FOREACH(StatusEffect, it.instanceOfPowerups,
{
- int buffid = buff_FirstFromFlags(STAT(BUFFS, actor)).m_id;
+ it.m_remove(it, actor, STATUSEFFECT_REMOVE_NORMAL);
+ });
+ entity heldbuff = buff_FirstFromFlags(actor);
+ if(heldbuff) // TODO: make a dropbuffs function to handle this
+ {
+ int buffid = heldbuff.m_id;
Send_Notification(NOTIF_ONE, actor, MSG_MULTI, ITEM_BUFF_DROP, buffid);
sound(actor, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
if(!IS_INDEPENDENT_PLAYER(actor))
Send_Notification(NOTIF_ALL_EXCEPT, actor, MSG_INFO, INFO_ITEM_BUFF_LOST, actor.netname, buffid);
- STAT(BUFFS, actor) = 0;
- STAT(BUFF_TIME, actor) = 0;
+ buff_RemoveAll(actor, STATUSEFFECT_REMOVE_NORMAL);
}
}
{
if (it.classname == "item_buff")
{
- entity buff = buff_FirstFromFlags(STAT(BUFFS, it));
+ entity buff = it.buffdef;
this.netname = cons(this.netname, buff.netname);
- STAT(BUFF_TIME, this) = it.count;
+ this.buffs_finished += it.count;
}
else
{
if (it.ammo_rockets)
- this.ammo_rockets = it.ammo_rockets;
+ this.ammo_rockets += it.ammo_rockets;
else if (it.ammo_cells)
- this.ammo_cells = it.ammo_cells;
+ this.ammo_cells += it.ammo_cells;
else if (it.ammo_shells)
- this.ammo_shells = it.ammo_shells;
+ this.ammo_shells += it.ammo_shells;
else if (it.ammo_nails)
- this.ammo_nails = it.ammo_nails;
+ this.ammo_nails += it.ammo_nails;
else if (it.invincible_finished)
- this.invincible_finished = it.invincible_finished;
+ this.invincible_finished += it.invincible_finished;
else if (it.strength_finished)
- this.strength_finished = it.strength_finished;
- else if (it.classname == "item_armor_mega")
- SetResourceExplicit(this, RES_ARMOR, 100);
- else if (it.classname == "item_health_mega")
- SetResourceExplicit(this, RES_HEALTH, 200);
-
- this.netname = cons(this.netname, it.netname);
+ this.strength_finished += it.strength_finished;
+ else if (it.speed_finished)
+ this.speed_finished += it.speed_finished;
+ else if (it.invisibility_finished)
+ this.invisibility_finished += it.invisibility_finished;
+ else if (it.health)
+ this.health += it.health;
+ else if (it.armorvalue)
+ this.armorvalue += it.armorvalue;
+
+ this.netname = cons(this.netname, (it.itemdef.m_weapon) ? it.itemdef.m_weapon.netname : it.itemdef.netname);
}
//remove(it); // removing ents in init functions causes havoc, workaround:
if(this.notta)
return true;
+ // FIXME: singleplayer does not use maxclients 1 as that would prevent bots
if(this.notsingle)
if(maxclients == 1)
return true;
return false;
}
+
+int GetAmmoConsumptionQ3(string netname)
+// Returns ammo consumed per shot by the primary/default fire mode
+// Returns 0 if the netname has no ammo cvar
+{
+ switch (netname)
+ {
+ case "arc": return autocvar_g_balance_arc_beam_ammo;
+ case "devastator": return autocvar_g_balance_devastator_ammo;
+ case "machinegun": return autocvar_g_balance_machinegun_sustained_ammo;
+ case "minelayer": return autocvar_g_balance_minelayer_ammo;
+ case "seeker": return autocvar_g_balance_seeker_tag_ammo;
+ default: return cvar(strcat("g_balance_", netname, "_primary_ammo"));
+ }
+}
+