From: Samual Date: Sun, 1 Apr 2012 17:54:36 +0000 (-0400) Subject: Improvements to how dropped flags are handled X-Git-Tag: xonotic-v0.7.0~240^2~118 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2955b62ed57b8a3a26f687e4c0d99b83cd705ad3;p=xonotic%2Fxonotic-data.pk3dir.git Improvements to how dropped flags are handled --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 31e963a4c..0a3cf9376 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -591,7 +591,10 @@ set gamecfg 1 // "deathmatch" // ctf set g_ctf 0 "Capture The Flag: take the enemy flag and bring it to yours at your base to score" -set g_ctf_flag_returntime 15 +set g_ctf_flag_return_time 15 +set g_ctf_flag_return_dropped 100 +set g_ctf_flag_return_damage 0 +set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt" set g_ctf_flagcarrier_selfdamagefactor 1 set g_ctf_flagcarrier_selfforcefactor 1 set g_ctf_flagcarrier_damagefactor 1 @@ -603,10 +606,8 @@ set g_ctf_allow_drop 1 "dropping allows circumventing carrierkill score, so enab 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_flag_collect_delay 1 set g_ctf_flag_health 0 -set g_ctf_flag_take_damage 0 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_pickup_verbosename 1 "show the name of the person who picked up the flag too" -set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt" +set g_ctf_flag_pickup_verbosename 0 "show the name of the person who picked up the flag too" set g_ctf_throw_velocity 700 "how fast or far a player can throw the flag" set g_ctf_allow_pass 1 "allow passing of flags to nearby team mates" set g_ctf_pass_radius 500 "maximum radius that you can pass to a team mate in" diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 4327fac3e..9271e23fa 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -782,9 +782,10 @@ float autocvar_g_ctf_flag_pickup_effects; float autocvar_g_ctf_flag_pickup_verbosename; string autocvar_g_ctf_flag_red_model; float autocvar_g_ctf_flag_red_skin; -float autocvar_g_ctf_flag_returntime; +float autocvar_g_ctf_flag_return_time; float autocvar_g_ctf_flag_return_when_unreachable; -float autocvar_g_ctf_flag_take_damage; +float autocvar_g_ctf_flag_return_damage; +float autocvar_g_ctf_flag_return_dropped; float autocvar_g_ctf_flagcarrier_selfdamagefactor; float autocvar_g_ctf_flagcarrier_selfforcefactor; float autocvar_g_ctf_flagcarrier_damagefactor; diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 5e6818806..5faec0233 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -191,7 +191,7 @@ void ctf_Handle_Drop(entity flag, entity player, float droptype) if(autocvar_g_ctf_flag_dropped_waypoint) WaypointSprite_Spawn("flagdropped", 0, 0, flag, '0 0 64', world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, FALSE, RADARICON_FLAG, '0 0.5 0' + ((flag.team == COLOR_TEAM1) ? '0.75 0 0' : '0 0 0.75')); // (COLOR_TEAM1 + COLOR_TEAM2 - flag.team) - if(autocvar_g_ctf_flag_returntime || (autocvar_g_ctf_flag_take_damage && autocvar_g_ctf_flag_health)) + if(autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health)) { WaypointSprite_UpdateMaxHealth(flag.wps_flagdropped, flag.max_flag_health); WaypointSprite_UpdateHealth(flag.wps_flagdropped, flag.health); @@ -253,7 +253,7 @@ void ctf_Handle_Throw(entity player, entity reciever, float droptype) if(!flag) { return; } if((droptype == DROP_PASS) && !reciever) { return; } - //if(flag.speedrunning) { ctf_RespawnFlag(flag); return; } + if(flag.speedrunning) { ctf_RespawnFlag(flag); return; } // reset the flag setattachment(flag, world, ""); @@ -453,7 +453,7 @@ void ctf_Handle_Pickup(entity flag, entity player, float pickuptype) case PICKUP_DROPPED: { - pickup_dropped_score = (autocvar_g_ctf_flag_returntime ? bound(0, ((flag.ctf_droptime + autocvar_g_ctf_flag_returntime) - time) / autocvar_g_ctf_flag_returntime, 1) : 1); + pickup_dropped_score = (autocvar_g_ctf_flag_return_time ? bound(0, ((flag.ctf_droptime + autocvar_g_ctf_flag_return_time) - time) / autocvar_g_ctf_flag_return_time, 1) : 1); pickup_dropped_score = floor((ctf_ReadScore("score_pickup_dropped_late") * (1 - pickup_dropped_score) + ctf_ReadScore("score_pickup_dropped_early") * pickup_dropped_score) + 0.5); print("pickup_dropped_score is ", ftos(pickup_dropped_score), "\n"); PlayerTeamScore_AddScore(player, pickup_dropped_score); @@ -490,7 +490,7 @@ void ctf_CheckFlagReturn(entity flag) { if(flag.wps_flagdropped) { WaypointSprite_UpdateHealth(flag.wps_flagdropped, flag.health); } - if((flag.health <= 0) || (time > flag.ctf_droptime + autocvar_g_ctf_flag_returntime)) + if((flag.health <= 0) || (time > flag.ctf_droptime + autocvar_g_ctf_flag_return_time)) { bprint("The ", flag.netname, " has returned to base\n"); sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTN_NONE); @@ -508,7 +508,7 @@ void ctf_FlagDamage(entity inflictor, entity attacker, float damage, float death ctf_CheckFlagReturn(self); } - if(autocvar_g_ctf_flag_take_damage) + if(autocvar_g_ctf_flag_return_damage) { self.health = self.health - damage; ctf_CheckFlagReturn(self); @@ -551,10 +551,20 @@ void ctf_FlagThink() case FLAG_DROPPED: { - if(autocvar_g_ctf_flag_returntime) + if(autocvar_g_ctf_flag_return_dropped) { - self.health -= ((self.max_flag_health / autocvar_g_ctf_flag_returntime) * FLAG_THINKRATE); + if((vlen(self.origin - self.ctf_spawnorigin) < autocvar_g_ctf_flag_return_dropped) || (autocvar_g_ctf_flag_return_dropped == -1)) + { + self.health = 0; + ctf_CheckFlagReturn(self); + return; + } + } + if(autocvar_g_ctf_flag_return_time) + { + self.health -= ((self.max_flag_health / autocvar_g_ctf_flag_return_time) * FLAG_THINKRATE); ctf_CheckFlagReturn(self); + return; } return; } @@ -762,7 +772,7 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag flag.solid = SOLID_TRIGGER; flag.takedamage = DAMAGE_NO; flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale; - flag.max_flag_health = ((autocvar_g_ctf_flag_take_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100); + flag.max_flag_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100); flag.health = flag.max_flag_health; flag.event_damage = ctf_FlagDamage; flag.pushable = TRUE;