From: terencehill Date: Wed, 7 Aug 2024 22:03:13 +0000 (+0200) Subject: CTF: g_ctf_flag_health: default to 0 if negative, allow reading it during a match... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fa6fc71bc1dc53ff5ab2a3454464527317964bd6;p=xonotic%2Fxonotic-data.pk3dir.git CTF: g_ctf_flag_health: default to 0 if negative, allow reading it during a match and improve cvar description --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 68b2606e0..d3b253c6d 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -283,7 +283,7 @@ set g_ctf_flag_return_carrying 0 "(manual return mode) auto return the flag to b set g_ctf_flag_return_carried_radius 100 "allow flags to be returned by carrier if base is within this radius" set g_ctf_flag_return_time 30 "automatically return the flag to base after this amount of time" set g_ctf_flag_return_dropped 100 "automatically return the flag to base if dropped within this distance from base (in qu)" -set g_ctf_flag_return_damage 0 "allow the flag to be damaged, reducing time needed to automatically return to base" +set g_ctf_flag_return_damage 0 "allow the flag to be damaged when dropped, reducing time needed to automatically return to base; initial health is defined by g_ctf_flag_health" set g_ctf_flag_return_damage_delay 0 "how much time the flag takes to automatically return to base if it falls into lava/slime/trigger hurt" set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt" set g_ctf_flag_waypoint 1 "show a waypoint at the flag for easy discovery and directions" @@ -304,7 +304,7 @@ 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, 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_health 0 "secondary setting of g_ctf_flag_return_damage that defines initial health of the flag when dropped. Is set to 0 initial health defaults to 100" set g_ctf_flag_dropped_waypoint 2 "show dropped flag waypointsprite when a flag is lost. 1 = team only, 2 = for all players" set g_ctf_flag_dropped_floatinwater 200 "move upwards while in water at this velocity" set g_ctf_throw 1 "throwing allows circumventing carrierkill score, so enable this with care!" diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index e6554964a..d20aed535 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -50,7 +50,7 @@ float autocvar_g_ctf_flag_damageforcescale; bool autocvar_g_ctf_flag_dropped_waypoint; bool autocvar_g_ctf_flag_dropped_floatinwater; bool autocvar_g_ctf_flag_glowtrails; -int autocvar_g_ctf_flag_health; +float autocvar_g_ctf_flag_health; bool autocvar_g_ctf_flag_return; bool autocvar_g_ctf_flag_return_carrying; float autocvar_g_ctf_flag_return_carried_radius; @@ -367,7 +367,10 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) set_movetype(flag, MOVETYPE_TOSS); flag.takedamage = DAMAGE_YES; flag.angles = '0 0 0'; + + flag.max_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health > 0) ? autocvar_g_ctf_flag_health : 100); SetResourceExplicit(flag, RES_HEALTH, flag.max_health); + flag.ctf_droptime = time; flag.ctf_landtime = 0; flag.ctf_dropper = player; @@ -1330,8 +1333,10 @@ void ctf_FlagSetup(int teamnum, entity flag) // called when spawning a flag enti flag.solid = SOLID_TRIGGER; flag.takedamage = DAMAGE_NO; flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale; - flag.max_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100); + + flag.max_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health > 0) ? autocvar_g_ctf_flag_health : 100); SetResourceExplicit(flag, RES_HEALTH, flag.max_health); + flag.event_damage = ctf_FlagDamage; flag.pushable = true; flag.teleportable = TELEPORT_NORMAL;