set g_overkill_filter_armorbig 0
set g_overkill_filter_armorlarge 0
-set g_overkill_ammo_charge 0
-set g_overkill_ammo_charge_notice 1
-set g_overkill_ammo_charge_limit 1
-set g_overkill_ammo_charge_rate 0.5
-set g_overkill_ammo_charge_rate_vortex 0.5
-set g_overkill_ammo_charge_rate_machinegun 0.5
-set g_overkill_ammo_charge_rate_shotgun 0.5
-set g_overkill_ammo_charge_rate_hmg 0.25
-set g_overkill_ammo_charge_rate_rpc 1.5
-set g_overkill_ammo_decharge 0.1
-set g_overkill_ammo_decharge_machinegun 0.025
-set g_overkill_ammo_decharge_shotgun 0.15
-set g_overkill_ammo_decharge_vortex 0.2
-set g_overkill_ammo_decharge_rpc 1
-set g_overkill_ammo_decharge_hmg 0.01
-
// =========
// vampire
set g_spawn_near_teammate 0 "if set, players prefer spawns near a team mate"
set g_spawn_near_teammate_distance 640 "max distance to consider a spawn to be near a team mate"
set g_spawn_near_teammate_ignore_spawnpoint 0 "ignore spawnpoints and spawn right at team mates, if 2, clients can ignore this option"
+ set g_spawn_near_teammate_ignore_spawnpoint_max 10 "if set, test at most this many of the available teammates"
set g_spawn_near_teammate_ignore_spawnpoint_delay 2.5 "how long to wait before its OK to spawn at a player after someone just spawned at this player"
- set g_spawn_near_teammate_ignore_spawnpoint_delay_death 0 "how long to wait before its OK to spawn at a player after death"
+ set g_spawn_near_teammate_ignore_spawnpoint_delay_death 3 "how long to wait before its OK to spawn at a player after death"
set g_spawn_near_teammate_ignore_spawnpoint_check_health 1 "only allow spawn at this player if their health is full"
set g_spawn_near_teammate_ignore_spawnpoint_closetodeath 1 "spawn as close to death location as possible"
set g_walljump_delay 1 "Minimum delay between wall jumps"
set g_walljump_force 300 "How far to bounce/jump off the wall"
set g_walljump_velocity_xy_factor 1.15 "How much to slow down along horizontal axis, higher value = higher deceleration, if factor is < 1, you accelerate by wall jumping"
- set g_walljump_velocity_z_factor 0.5 "Upwards velocity factor, multiplied by normal jump velocity"
+ set g_walljump_velocity_z_factor 0.5 "Upwards velocity factor, multiplied by normal jump velocity"
IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
{
- RemoveGrapplingHook(it.realowner);
+ RemoveHook(it);
});
delete(this);
{
IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
{
- RemoveGrapplingHook(it.realowner);
+ RemoveHook(it);
});
delete(this);
return;
makevectors(e.v_angle);
// NOTE: always throw from first weapon entity?
- W_SetupShot(e, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
+ W_SetupShot(e, _nade.weaponentity_fld, false, false, SND_Null, CH_WEAPON_A, 0);
Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
if(Nades_from(n.nade_type) == NADE_TYPE_Null)
n.nade_type = NADE_TYPE_NORMAL.m_id;
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+
setmodel(n, MDL_PROJECTILE_NADE);
//setattachment(n, player, "bip01 l hand");
n.exteriormodeltoclient = player;
setthink(n, nade_beep);
n.nextthink = max(n.wait - 3, time);
n.projectiledeathtype = DEATH_NADE.m_id;
+ n.weaponentity_fld = weaponentity;
setmodel(fn, MDL_NADE_VIEW);
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
setattachment(fn, player.(weaponentity), "");
fn.realowner = fn.owner = player;
fn.colormod = Nades_from(n.nade_type).m_color;
fn.glowmod = player.glowmod;
setthink(fn, SUB_Remove);
fn.nextthink = n.wait;
+ fn.weaponentity_fld = weaponentity;
player.nade = n;
player.fake_nade = fn;
METHOD(NadeOffhand, offhand_think, void(NadeOffhand this, entity player, bool key_pressed))
{
entity held_nade = player.nade;
- if (held_nade)
- {
- player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / autocvar_g_nades_nade_lifetime, 1);
- // LOG_TRACEF("%d %d", player.nade_timer, time - held_nade.nade_time_primed);
- makevectors(player.angles);
- held_nade.velocity = player.velocity;
- setorigin(held_nade, player.origin + player.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0);
- held_nade.angles_y = player.angles.y;
-
- if (time + 0.1 >= held_nade.wait)
- toss_nade(player, false, '0 0 0', time + 0.05);
- }
if (!CanThrowNade(player)) return;
if (!(time > player.nade_refire)) return;
if (player.nade && (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton);
+ entity held_nade = player.nade;
+ if (held_nade)
+ {
+ player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / autocvar_g_nades_nade_lifetime, 1);
+ // LOG_TRACEF("%d %d", player.nade_timer, time - held_nade.nade_time_primed);
+ makevectors(player.angles);
+ held_nade.velocity = player.velocity;
+ setorigin(held_nade, player.origin + player.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0);
+ held_nade.angles_y = player.angles.y;
+
+ if (time + 0.1 >= held_nade.wait)
+ toss_nade(player, false, '0 0 0', time + 0.05);
+ }
+
if(IS_PLAYER(player))
{
if ( autocvar_g_nades_bonus && autocvar_g_nades )
#include "rpc.qh"
bool autocvar_g_overkill_powerups_replace;
-bool autocvar_g_overkill_ammo_charge;
-float autocvar_g_overkill_ammo_charge_notice;
-float autocvar_g_overkill_ammo_charge_limit;
bool autocvar_g_overkill_filter_healthmega;
bool autocvar_g_overkill_filter_armormedium;
bool autocvar_g_overkill_filter_armorbig;
bool autocvar_g_overkill_filter_armorlarge;
-.float ok_lastwep;
.float ok_item;
-.float ok_notice_time;
-.float ammo_charge[Weapons_MAX];
-.float ok_use_ammocharge = _STAT(OK_AMMO_CHARGE);
-.float ok_ammo_charge = _STAT(OK_AMMO_CHARGEPOOL);
-
-void(entity ent, float wep) ok_DecreaseCharge;
+.Weapon ok_lastwep[MAX_WEAPONSLOTS];
void ok_Initialize();
}
}
-MUTATOR_HOOKFUNCTION(ok, W_DecreaseAmmo)
-{
- entity actor = M_ARGV(0, entity);
- if (actor.ok_use_ammocharge)
- {
- ok_DecreaseCharge(actor, PS(actor).m_weapon.m_id);
- return true;
- }
-}
-
-MUTATOR_HOOKFUNCTION(ok, W_Reload)
-{
- entity actor = M_ARGV(0, entity);
- return actor.ok_use_ammocharge;
-}
-
void W_Blaster_Attack(entity, .entity, float, float, float, float, float, float, float, float, float, float);
spawnfunc(weapon_hmg);
spawnfunc(weapon_rpc);
-void ok_DecreaseCharge(entity ent, int wep)
-{
- if(!ent.ok_use_ammocharge) return;
-
- entity wepent = Weapons_from(wep);
-
- if (wepent == WEP_Null) return; // dummy
-
- ent.ammo_charge[wep] -= max(0, cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname)));
-}
-
-void ok_IncreaseCharge(entity ent, int wep)
-{
- entity wepent = Weapons_from(wep);
-
- if (wepent == WEP_Null) return; // dummy
-
- if(ent.ok_use_ammocharge)
- if(!PHYS_INPUT_BUTTON_ATCK(ent)) // not while attacking?
- ent.ammo_charge[wep] = min(autocvar_g_overkill_ammo_charge_limit, ent.ammo_charge[wep] + cvar(sprintf("g_overkill_ammo_charge_rate_%s", wepent.netname)) * frametime / W_TICSPERFRAME);
-}
-
-float ok_CheckWeaponCharge(entity ent, int wep)
-{
- if(!ent.ok_use_ammocharge) return true;
-
- entity wepent = Weapons_from(wep);
-
- if(wepent == WEP_Null) return false; // dummy
-
- return (ent.ammo_charge[wep] >= cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname)));
-}
-
MUTATOR_HOOKFUNCTION(ok, PlayerDamage_Calculate, CBC_ORDER_LAST)
{
entity frag_attacker = M_ARGV(1, entity);
ok_DropItem(frag_target, targ);
- frag_target.ok_lastwep = PS(frag_target).m_switchweapon.m_id;
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+
+ frag_target.ok_lastwep[slot] = frag_target.(weaponentity).m_switchweapon;
+ }
}
MUTATOR_HOOKFUNCTION(ok, MonsterDropItem)
if(IS_DEAD(player) || !IS_PLAYER(player) || STAT(FROZEN, player))
return;
- if(player.ok_lastwep)
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
- Weapon newwep = Weapons_from(player.ok_lastwep);
- if(player.ok_lastwep == WEP_HMG.m_id)
- newwep = WEP_MACHINEGUN;
- if(player.ok_lastwep == WEP_RPC.m_id)
- newwep = WEP_VORTEX;
- PS(player).m_switchweapon = newwep;
- player.ok_lastwep = 0;
- }
+ .entity weaponentity = weaponentities[slot];
+ entity thiswep = player.(weaponentity);
- ok_IncreaseCharge(player, PS(player).m_weapon.m_id);
+ if(player.ok_lastwep[slot] && player.ok_lastwep[slot] != WEP_Null)
+ {
+ Weapon newwep = player.ok_lastwep[slot];
+ if(player.ok_lastwep[slot] == WEP_HMG)
+ newwep = WEP_MACHINEGUN;
+ if(player.ok_lastwep[slot] == WEP_RPC)
+ newwep = WEP_VORTEX;
+ thiswep.m_switchweapon = newwep;
+ player.ok_lastwep[slot] = WEP_Null;
+ }
+ }
if(PHYS_INPUT_BUTTON_ATCK2(player))
if( !forbidWeaponUse(player) || player.weapon_blocked // allow if weapon is blocked
player.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor(player);
makevectors(player.v_angle);
- Weapon oldwep = PS(player).m_weapon;
- PS(player).m_weapon = WEP_BLASTER;
- W_Blaster_Attack(
- player,
- weaponentities[0], // TODO: unhardcode
- WEP_BLASTER.m_id | HITTYPE_SECONDARY,
- WEP_CVAR_SEC(vaporizer, shotangle),
- WEP_CVAR_SEC(vaporizer, damage),
- WEP_CVAR_SEC(vaporizer, edgedamage),
- WEP_CVAR_SEC(vaporizer, radius),
- WEP_CVAR_SEC(vaporizer, force),
- WEP_CVAR_SEC(vaporizer, speed),
- WEP_CVAR_SEC(vaporizer, spread),
- WEP_CVAR_SEC(vaporizer, delay),
- WEP_CVAR_SEC(vaporizer, lifetime)
- );
- PS(player).m_weapon = oldwep;
- }
-
- player.weapon_blocked = false;
-
- player.ok_ammo_charge = player.ammo_charge[PS(player).m_weapon.m_id];
-
- if(player.ok_use_ammocharge)
- if(!ok_CheckWeaponCharge(player, PS(player).m_weapon.m_id))
- {
- if(autocvar_g_overkill_ammo_charge_notice && time > player.ok_notice_time && PHYS_INPUT_BUTTON_ATCK(player) && IS_REAL_CLIENT(player) && PS(player).m_weapon == PS(player).m_switchweapon)
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
- //Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERKILL_CHARGE);
- player.ok_notice_time = time + 2;
- play2(player, SND(DRYFIRE));
+ .entity weaponentity = weaponentities[slot];
+
+ if(player.(weaponentity).m_weapon == WEP_Null && slot != 0)
+ continue;
+
+ Weapon oldwep = player.(weaponentity).m_weapon;
+ player.(weaponentity).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ player,
+ weaponentity,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(vaporizer, shotangle),
+ WEP_CVAR_SEC(vaporizer, damage),
+ WEP_CVAR_SEC(vaporizer, edgedamage),
+ WEP_CVAR_SEC(vaporizer, radius),
+ WEP_CVAR_SEC(vaporizer, force),
+ WEP_CVAR_SEC(vaporizer, speed),
+ WEP_CVAR_SEC(vaporizer, spread),
+ WEP_CVAR_SEC(vaporizer, delay),
+ WEP_CVAR_SEC(vaporizer, lifetime)
+ );
+ player.(weaponentity).m_weapon = oldwep;
}
- Weapon wpn = PS(player).m_weapon;
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- if(player.(weaponentity).state != WS_CLEAR)
- w_ready(wpn, player, weaponentity, PHYS_INPUT_BUTTON_ATCK(player) | (PHYS_INPUT_BUTTON_ATCK2(player) << 1));
-
- player.weapon_blocked = true;
}
PHYS_INPUT_BUTTON_ATCK2(player) = false;
{
entity player = M_ARGV(0, entity);
- if(autocvar_g_overkill_ammo_charge)
- {
- FOREACH(Weapons, it != WEP_Null, LAMBDA(player.ammo_charge[it.m_id] = autocvar_g_overkill_ammo_charge_limit));
-
- player.ok_use_ammocharge = 1;
- player.ok_notice_time = time;
- }
- else
- player.ok_use_ammocharge = 0;
-
// if player changed their weapon while dead, don't switch to their death weapon
if(player.impulse)
- player.ok_lastwep = 0;
+ {
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ player.ok_lastwep[slot] = WEP_Null;
+ }
+ }
}
void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); }
return true;
}
-MUTATOR_HOOKFUNCTION(ok, SpectateCopy)
-{
- entity spectatee = M_ARGV(0, entity);
- entity client = M_ARGV(1, entity);
-
- client.ammo_charge[PS(client).m_weapon.m_id] = spectatee.ammo_charge[PS(spectatee).m_weapon.m_id];
- client.ok_use_ammocharge = spectatee.ok_use_ammocharge;
-}
-
MUTATOR_HOOKFUNCTION(ok, SetStartItems, CBC_ORDER_LAST)
{
WepSet ok_start_items = (WEPSET(MACHINEGUN) | WEPSET(VORTEX) | WEPSET(SHOTGUN));
start_weapons = warmup_start_weapons = ok_start_items;
}
+ MUTATOR_HOOKFUNCTION(ok, SetWeaponArena)
+ {
+ // turn weapon arena off
+ M_ARGV(0, string) = "off";
+ }
+
MUTATOR_HOOKFUNCTION(ok, BuildMutatorsString)
{
M_ARGV(0, string) = strcat(M_ARGV(0, string), ":OK");
/** returns true if throwing the current weapon shall not be allowed */
#define EV_ForbidThrowCurrentWeapon(i, o) \
/** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
/** returns true if dropping the current weapon shall not be allowed at any time including death */
#define EV_ForbidDropCurrentWeapon(i, o) \
- /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** weapon id */ i(int, MUTATOR_ARGV_1_int) \
/**/
MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
/** armor */ i(float, MUTATOR_ARGV_3_float) \
/** location */ i(vector, MUTATOR_ARGV_4_vector) \
/** deathtype */ i(int, MUTATOR_ARGV_5_int) \
+ /** potential_damage */ i(float, MUTATOR_ARGV_6_float) \
/**/
MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
* Called by W_DecreaseAmmo
*/
#define EV_W_DecreaseAmmo(i, o) \
- /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
#include "../common/effects/qc/all.qh"
#include "../common/mutators/mutator/waypoints/waypointsprites.qh"
#include "../common/triggers/include.qh"
+#include "../common/wepent.qh"
#include "weapons/weaponstats.qh"
valid_damage_for_weaponstats = 0;
Weapon awep = WEP_Null;
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
if(vbot || IS_REAL_CLIENT(this))
if(abot || IS_REAL_CLIENT(attacker))
if(DIFF_TEAM(this, attacker))
{
if(DEATH_ISSPECIAL(deathtype))
- awep = PS(attacker).m_weapon;
+ awep = attacker.(weaponentity).m_weapon;
else
awep = DEATH_WEAPONOF(deathtype);
valid_damage_for_weaponstats = 1;
da = da - max(this.armorvalue, 0);
if(valid_damage_for_weaponstats)
{
- WeaponStats_LogDamage(awep.m_id, abot, PS(this).m_weapon.m_id, vbot, dh + da);
+ WeaponStats_LogDamage(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot, dh + da);
}
- if (dh + da)
+ if (damage)
{
- MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype);
+ MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype, damage);
}
if (this.health < 1)
}
if(valid_damage_for_weaponstats)
- WeaponStats_LogKill(awep.m_id, abot, PS(this).m_weapon.m_id, vbot);
+ WeaponStats_LogKill(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot);
if(autocvar_sv_gentle < 1)
if(sound_allowed(MSG_BROADCAST, attacker))
MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype, damage);
excess = M_ARGV(4, float);
- Weapon wep = PS(this).m_weapon;
- /*for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ Weapon wep = this.(weaponentity).m_weapon;
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
- .entity weaponentity = weaponentities[slot];
- wep.wr_playerdeath(wep, this, weaponentity);
- }*/
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- wep.wr_playerdeath(wep, this, weaponentity);
+ .entity went = weaponentities[slot];
+ wep.wr_playerdeath(wep, this, went);
+ }
- RemoveGrapplingHook(this);
+ RemoveGrapplingHooks(this);
Portal_ClearAllLater(this);
// clear waypoints
WaypointSprite_PlayerDead(this);
// throw a weapon
- SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, PS(this).m_switchweapon.m_id);
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity went = weaponentities[slot];
+ SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, this.(went).m_switchweapon.m_id, went);
+ }
// become fully visible
this.alpha = default_player_alpha;