set sv_clones 0 "number of clones a player may make (reset by the \"kill\" command)"
-set cl_handicap 1 "the higher, the more damage you will receive (client setting) NOTE: reconnect or use sendcvar command to update the choice."
+set cl_handicap 1 "multiplies damage received and divides damage dealt NOTE: reconnect or use 'sendcvar cl_handicap' to update the choice."
seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such. (client setting) NOTE: reconnect or use sendcvar command to update the choice."
// =================
// gamestart hooks
// =================
-seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to
+seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to
alias _cl_hook_gamestart "set _cl_hook_gametype $1; _cl_hook_gamestart_stage2"
alias _cl_hook_gamestart_stage2 "cl_hook_gamestart_all; cl_hook_gamestart_${_cl_hook_gametype}"
alias cl_hook_gamestart_all
set g_ctf_dropped_capture_radius 100 "allow dropped flags to be automatically captured by base flags if the dropped flag is within this radius of it"
set g_ctf_flag_damageforcescale 2
set g_ctf_portalteleport 0 "allow flag carriers to go through portals made in portal gun without dropping the flag"
-set g_ctf_reverse 0 "if enabled, flags positions are switched: you have to capture the enemy's flag from your own base by bringing it to your own flag in the enemy base"
+set g_ctf_reverse 0 "if enabled, you score by bringing your own flag to an enemy's flag in their base"
set g_ctf_flag_collect_delay 1
set g_ctf_flag_health 0
set g_ctf_flag_dropped_waypoint 2 "show dropped flag waypointsprite when a flag is lost. 1 = team only, 2 = for all players"
mv = MOVE_NORMAL;
if(zoomscript_caught)
{
- tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+ tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * max_shot_distance, mv, ta);
return EnemyHitCheck();
}
break;
vecs = decompressShotOrigin(STAT(SHOTORG));
- traceline(traceorigin, traceorigin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+ traceline(traceorigin, traceorigin + view_forward * max_shot_distance, mv, ta);
trueaimpoint = trace_endpos;
if(vdist((trueaimpoint - traceorigin), <, g_trueaim_minrange))
float shottype;
// wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
- wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);
+ wcross_origin = project_3d_to_2d(view_origin + max_shot_distance * view_forward);
wcross_origin.z = 0;
if(autocvar_crosshair_hittest)
{
vector forward = '0 0 0'; vector right = '0 0 0'; vector up = '0 0 0';
MAKEVECTORS(makevectors, it.v_angle, forward, right, up);
vector pos = it.origin + it.view_ofs;
- traceline(pos, pos + forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, it);
+ traceline(pos, pos + forward * max_shot_distance, MOVE_NORMAL, it);
FOREACH_ENTITY(true, {
it.solid = it.solid_prev;
it.solid_prev = 0;
bool autocvar_g_breakablehook; // allow toggling mid match?
bool autocvar_g_breakablehook_owner;
-MUTATOR_HOOKFUNCTION(breakablehook, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(breakablehook, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
}
}
-MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
Kill_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CPID_CAMPCHECK);
}
-MUTATOR_HOOKFUNCTION(campcheck, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(campcheck, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
return true;
}
-MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
.float midair_shieldtime;
-MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(midair, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
nades_RemoveBonus(frag_target);
}
-MUTATOR_HOOKFUNCTION(nades, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(nades, Damage_Calculate)
{
entity frag_inflictor = M_ARGV(0, entity);
entity frag_attacker = M_ARGV(1, entity);
return (ent.ammo_charge[wep] >= cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname)));
}
-MUTATOR_HOOKFUNCTION(ok, PlayerDamage_Calculate, CBC_ORDER_LAST)
+MUTATOR_HOOKFUNCTION(ok, Damage_Calculate, CBC_ORDER_LAST)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
float frag_deathtype = M_ARGV(3, float);
- if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target))
+ if(IS_PLAYER(frag_attacker) && (IS_PLAYER(frag_target) || IS_VEHICLE(frag_target) || IS_TURRET(frag_target)))
if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
{
if(frag_attacker != frag_target)
- if(frag_target.health > 0)
- if(STAT(FROZEN, frag_target) == 0)
+ if(!STAT(FROZEN, frag_target))
if(!IS_DEAD(frag_target))
{
Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE);
wep.nextthink = time + 0.1;
return true;
}
-
- if(ent.classname == "item_invincible")
+ else if(ent.classname == "item_invincible")
{
entity wep = new(weapon_rpc);
setorigin(wep, ent.origin);
REGISTER_MUTATOR(rm, cvar("g_instagib"));
-MUTATOR_HOOKFUNCTION(rm, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(rm, Damage_Calculate)
{
// we do it this way, so rm can be toggled during the match
if(!autocvar_g_rm) { return; }
#include "sv_spawn_near_teammate.qh"
-const float FLOAT_MAX = 340282346638528859811704183484516925440.0f;
+#include <lib/float.qh>
float autocvar_g_spawn_near_teammate_distance;
int autocvar_g_spawn_near_teammate_ignore_spawnpoint;
tur.shot_force = bound(0.001, (TRY(tur.shot_force) : tur.shot_dmg * 0.5 + tur.shot_radius * 0.5 ), 5000);
tur.shot_volly = bound(1, (TRY(tur.shot_volly) : 1 ), floor(tur.ammo_max / tur.shot_dmg));
tur.shot_volly_refire = bound(tur.shot_refire, (TRY(tur.shot_volly_refire) : tur.shot_refire * tur.shot_volly ), 60);
- tur.target_range = bound(0, (TRY(tur.target_range) : tur.shot_speed * 0.5 ), MAX_SHOT_DISTANCE);
- tur.target_range_min = bound(0, (TRY(tur.target_range_min) : tur.shot_radius * 2 ), MAX_SHOT_DISTANCE);
- tur.target_range_optimal = bound(0, (TRY(tur.target_range_optimal) : tur.target_range * 0.5 ), MAX_SHOT_DISTANCE);
+ tur.target_range = bound(0, (TRY(tur.target_range) : tur.shot_speed * 0.5 ), max_shot_distance);
+ tur.target_range_min = bound(0, (TRY(tur.target_range_min) : tur.shot_radius * 2 ), max_shot_distance);
+ tur.target_range_optimal = bound(0, (TRY(tur.target_range_optimal) : tur.target_range * 0.5 ), max_shot_distance);
tur.aim_maxrotate = bound(0, (TRY(tur.aim_maxrotate) : 90 ), 360);
tur.aim_maxpitch = bound(0, (TRY(tur.aim_maxpitch) : 20 ), 90);
tur.aim_speed = bound(0.1, (TRY(tur.aim_speed) : 36 ), 1000);
- tur.aim_firetolerance_dist = bound(0.1, (TRY(tur.aim_firetolerance_dist) : 5 + (tur.shot_radius * 2) ), MAX_SHOT_DISTANCE);
+ tur.aim_firetolerance_dist = bound(0.1, (TRY(tur.aim_firetolerance_dist) : 5 + (tur.shot_radius * 2) ), max_shot_distance);
tur.target_select_rangebias = bound(-10, (TRY(tur.target_select_rangebias) : 1 ), 10);
tur.target_select_samebias = bound(-10, (TRY(tur.target_select_samebias) : 1 ), 10);
tur.target_select_anglebias = bound(-10, (TRY(tur.target_select_anglebias) : 1 ), 10);
this.netname = tur.netname;
load_unit_settings(this, 0);
- if(!this.team || !teamplay) { this.team = MAX_SHOT_DISTANCE; }
+ if(!this.team || !teamplay) { this.team = FLOAT_MAX; }
if(!this.ticrate) { this.ticrate = ((this.turret_flags & TUR_FLAG_SUPPORT) ? 0.2 : 0.1); }
if(!this.health) { this.health = 1000; }
if(!this.shot_refire) { this.shot_refire = 1; }
{
if(g_instagib)
{
- FireRailgunBullet (it, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
+ FireRailgunBullet (it, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, it.tur_shotorg, it.tur_shotdir_updated * 1000, 1);
METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur, entity it))
{
if (g_instagib) {
- FireRailgunBullet (it, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
+ FireRailgunBullet (it, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
ad = gettaginfo(gun, gettagindex(gun, "fire"));
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, gun);
+ traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, gun);
UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' *(1 - this.vehicle_reload1)), 0);
/*
ad = ad * 0.5;
v_forward = vf * 0.5;
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+ traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
*/
vf += v_forward;
ad = ad * 0.5;
v_forward = vf * 0.5;
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+ traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
#else
vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+ traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
vector vf = ad;
ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+ traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
ad = 0.5 * (ad + vf);
#endif
rocket.pos1 = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
rocket.pos1_z = trace_endpos_z;
- traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
+ traceline(v, v + '0 0 1' * max_shot_distance, MOVE_WORLDONLY, this);
float h1 = 0.75 * vlen(v - trace_endpos);
//v = trace_endpos;
- traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
+ traceline(v , rocket.pos1 + '0 0 1' * max_shot_distance, MOVE_WORLDONLY, this);
float h2 = 0.75 * vlen(rocket.pos1 - v);
rocket.velocity = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2));
.OffhandWeapon offhand;
#endif
-const int MAX_SHOT_DISTANCE = 32768;
+int max_shot_distance = 32768; // determined by world mins/maxs when map loads
// weapon flags
const int WEP_TYPE_OTHER = 0x00; // not for damaging people
yoda = 0;
damage_goodhits = 0;
- FireRailgunBullet(actor, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
+ FireRailgunBullet(actor, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
// do this now, as goodhits is disabled below
SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
yoda = 0;
damage_goodhits = 0;
- FireRailgunBullet(actor, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX.m_id);
+ FireRailgunBullet(actor, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX.m_id);
if(yoda && flying)
Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
--- /dev/null
+#pragma once
+
+const float FLOAT_MAX = 340282346638528859811704183484516925440.0f;
// effectname
effectnum = _particleeffectnum(argv(1));
W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
- traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, this);
+ traceline(w_shotorg, w_shotorg + w_shotdir * max_shot_distance, MOVE_NORMAL, this);
__trailparticles(this, effectnum, w_shotorg, trace_endpos);
DID_CHEAT();
break;
// =====================================================
// Server side game commands code, reworked by Samual
-// Last updated: December 29th, 2011
// =====================================================
// used by GameCommand_make_mapinfo()
{
case CMD_REQUEST_COMMAND:
{
- if (teamplay)
+ if (!teamplay)
{
- float t_teams, t_players, team_color;
-
- // count the total amount of players and total amount of teams
- t_players = 0;
- t_teams = 0;
- FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
- CheckAllowedTeams(it);
-
- if (c1 >= 0) t_teams = max(1, t_teams);
- if (c2 >= 0) t_teams = max(2, t_teams);
- if (c3 >= 0) t_teams = max(3, t_teams);
- if (c4 >= 0) t_teams = max(4, t_teams);
-
- ++t_players;
- ));
-
- // build a list of the players in a random order
- FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
- for ( ; ; )
- {
- int idx = bound(1, floor(random() * maxclients) + 1, maxclients);
-
- if (shuffleteams_players[idx])
- {
- continue; // a player is already assigned to this slot
- }
- else
- {
- shuffleteams_players[idx] = etof(it);
- break;
- }
- }
- ));
-
- // finally, from the list made earlier, re-join the players in different order.
- for (int i = 1; i <= t_teams; ++i)
- {
- // find out how many players to assign to this team
- int pnum = (t_players / t_teams);
- pnum = ((i == 1) ? ceil(pnum) : floor(pnum));
-
- team_color = Team_NumberToTeam(i);
-
- // sort through the random list of players made earlier
- for (int z = 1; z <= maxclients; ++z)
- {
- if (!(shuffleteams_teams[i] >= pnum))
- {
- if (!(shuffleteams_players[z])) continue; // not a player, move on to next random slot
-
- entity e = NULL;
- if(VerifyClientNumber(shuffleteams_players[z]))
- e = edict_num(shuffleteams_players[z]);
-
- if(!e) continue; // unverified
-
- if (e.team != team_color) MoveToTeam(e, team_color, 6);
+ LOG_INFO("Can't shuffle teams when currently not playing a team game.\n");
+ return;
+ }
- shuffleteams_players[z] = 0;
- shuffleteams_teams[i] = shuffleteams_teams[i] + 1;
- }
- else
- {
- break; // move on to next team
- }
- }
+ FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
+ if (it.team_forced) {
+ // we could theoretically assign forced players to their teams
+ // and shuffle the rest to fill the empty spots but in practise
+ // either all players or none are gonna have forced teams
+ LOG_INFO("Can't shuffle teams because at least one player has a forced team.\n");
+ return;
}
+ ));
- bprint("Successfully shuffled the players around randomly.\n");
-
- // clear the buffers now
- for (int i = 0; i < SHUFFLETEAMS_MAX_PLAYERS; ++i)
- shuffleteams_players[i] = 0;
-
- for (int i = 0; i < SHUFFLETEAMS_MAX_TEAMS; ++i)
- shuffleteams_teams[i] = 0;
- }
- else
- {
- LOG_INFO("Can't shuffle teams when currently not playing a team game.\n");
- }
+ int number_of_teams = 0;
+ CheckAllowedTeams(NULL);
+ if (c1 >= 0) number_of_teams = max(1, number_of_teams);
+ if (c2 >= 0) number_of_teams = max(2, number_of_teams);
+ if (c3 >= 0) number_of_teams = max(3, number_of_teams);
+ if (c4 >= 0) number_of_teams = max(4, number_of_teams);
+
+ int team_index = 0;
+ FOREACH_CLIENT_RANDOM(IS_PLAYER(it) || it.caplayer, LAMBDA(
+ int target_team_number = Team_NumberToTeam(team_index + 1);
+ if (it.team != target_team_number) MoveToTeam(it, target_team_number, 6);
+ team_index = (team_index + 1) % number_of_teams;
+ ));
+ bprint("Successfully shuffled the players around randomly.\n");
return;
}
// =================================================
// Declarations for server side game commands
-// Last updated: December 25th, 2011
// =================================================
string GotoMap(string m);
void race_deleteTime(string map, float pos);
-const float SHUFFLETEAMS_MAX_PLAYERS = 255;
-const float SHUFFLETEAMS_MAX_TEAMS = 4;
-float shuffleteams_players[SHUFFLETEAMS_MAX_PLAYERS]; // maximum of 255 player slots
-float shuffleteams_teams[SHUFFLETEAMS_MAX_TEAMS]; // maximum of 4 teams
-
// used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
void GameCommand_macro_write_aliases(float fh);
}
// should this be changed at all? If so, in what way?
- MUTATOR_CALLHOOK(PlayerDamage_Calculate, inflictor, attacker, targ, deathtype, damage, mirrordamage, force);
+ MUTATOR_CALLHOOK(Damage_Calculate, inflictor, attacker, targ, deathtype, damage, mirrordamage, force);
damage = M_ARGV(4, float);
mirrordamage = M_ARGV(5, float);
force = M_ARGV(6, vector);
void crosshair_trace(entity pl)
{
- traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * MAX_SHOT_DISTANCE, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+ traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
}
.bool ctrace_solidchanged;
void crosshair_trace_plusvisibletriggers(entity pl)
}
void WarpZone_crosshair_trace(entity pl)
{
- WarpZone_traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * MAX_SHOT_DISTANCE, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+ WarpZone_traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
}
* called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
* i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
*/
-#define EV_PlayerDamage_Calculate(i, o) \
+#define EV_Damage_Calculate(i, o) \
/** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
/** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
/** target */ i(entity, MUTATOR_ARGV_2_entity) \
/** force */ i(vector, MUTATOR_ARGV_6_vector) \
/** force */ o(vector, MUTATOR_ARGV_6_vector) \
/**/
-MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_PlayerDamage_Calculate);
+MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
/**
* Called when a player is damaged
#include "gamemode_assault.qh"
+#include <lib/float.qh>
+
.entity sprite;
#define AS_ROUND_DELAY 5
{
entity turret = M_ARGV(0, entity);
- if(!turret.team || turret.team == MAX_SHOT_DISTANCE)
+ if(!turret.team || turret.team == FLOAT_MAX)
turret.team = 5; // this gets reversed when match starts?
}
start_ammo_fuel = warmup_start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
}
-MUTATOR_HOOKFUNCTION(ca, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(ca, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
}
-MUTATOR_HOOKFUNCTION(ctf, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
+MUTATOR_HOOKFUNCTION(ctf, Damage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
return true;
}
-MUTATOR_HOOKFUNCTION(cts, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(cts, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
player.bot_attack = false;
}
-MUTATOR_HOOKFUNCTION(inv, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(inv, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
}
}
-MUTATOR_HOOKFUNCTION(ka, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
+MUTATOR_HOOKFUNCTION(ka, Damage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
if(!DEATH_ISSPECIAL(deathtype))
{
- damage *= sqrt(bound(1.0, this.cvar_cl_handicap, 100.0));
+ damage *= bound(1.0, this.cvar_cl_handicap, 10.0);
if(this != attacker)
- damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0));
+ damage /= bound(1.0, attacker.cvar_cl_handicap, 10.0);
}
if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1)
get_mi_min_max(1);
world.mins = mi_min;
world.maxs = mi_max;
+ // currently, NetRadiant's limit is 131072 qu for each side
+ // distance from one corner of a 131072qu cube to the opposite corner is approx. 227023 qu
+ // set the distance according to map size but don't go over the limit to avoid issues with float precision
+ // in case somebody makes extremely large maps
+ max_shot_distance = min(230000, vlen(world.maxs - world.mins));
MapInfo_LoadMapSettings(mapname);
serverflags &= ~SERVERFLAG_TEAMPLAY;
lag = 0; // only antilag for clients
org = player.origin + player.view_ofs;
- traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
+ traceline_antilag_force(player, org, org + screenforward * max_shot_distance, MOVE_NORMAL, player, lag);
if(IS_CLIENT(trace_ent) || IS_MONSTER(trace_ent))
{
entity store = IS_CLIENT(trace_ent) ? CS(trace_ent) : trace_ent;
vector end;
dir = normalize(dir + randomvec() * spread);
- end = start + dir * MAX_SHOT_DISTANCE;
+ end = start + dir * max_shot_distance;
fireBullet_last_hit = NULL;
float solid_penetration_left = 1;
start = trace_endpos;
entity hit = trace_ent;
+ // traced up to max_shot_distance and didn't hit anything at all
+ if (trace_fraction == 1.0)
+ break;
+
// When hitting sky, stop.
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
break;
// make sure you call makevectors first (FIXME?)
void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range);
-#define W_SetupShot_Dir_ProjectileSize(ent,wepent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, MAX_SHOT_DISTANCE)
+#define W_SetupShot_Dir_ProjectileSize(ent,wepent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, max_shot_distance)
#define W_SetupShot_ProjectileSize(ent,wepent,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, wepent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage)
#define W_SetupShot_Dir(ent,wepent,s_forward,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
#define W_SetupShot(ent,wepent,antilag,recoil,snd,chan,maxdamage) W_SetupShot_ProjectileSize(ent, wepent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)