X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_ctf.qc;h=908d81cf3fe0a9d96b13a1c529a8db568f5008a9;hb=22dd9943727b1f6566a2401347663ed60a3eefb9;hp=7467346a1bd070adcf850c414e72d9d85aabbef0;hpb=d65311344a88e8b3fb151fba6891ba1f37d1a7eb;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 7467346a1..908d81cf3 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -23,7 +23,7 @@ void ctf_EventLog(string mode, float flagteam, entity actor) // use an alias for string ctf_CaptureRecord(entity flag, entity player) { float cap_time, cap_record, success; - string cap_message, refername; + string cap_message = string_null, refername; if((autocvar_g_ctf_captimerecord_always) || (player_count - currentbots)) { @@ -502,7 +502,10 @@ void ctf_Handle_Pickup(entity flag, entity player, float pickuptype) FOR_EACH_REALPLAYER(tmp_player) { if(tmp_player == player) + { centerprint(tmp_player, strcat("You got the ", flag.netname, "!")); + //if(ctf_stalemate) { centerprint(tmp_player, "Stalemate! Enemies can see you on radar!"); } + } //else if(!IsDifferentTeam(tmp_player, player)) // centerprint(tmp_player, strcat("Your ", Team_ColorCode(player.team), "team mate ", verbosename, "^7got the flag! Protect them!")); else if(!IsDifferentTeam(tmp_player, flag)) @@ -584,17 +587,17 @@ void ctf_CheckFlagReturn(entity flag, float returntype) void ctf_CheckStalemate(void) { // declarations - float stale_red_flags, stale_blue_flags; + float stale_red_flags = 0, stale_blue_flags = 0; entity tmp_entity; - entity ctf_staleflaglist; // reset the list, we need to build the list each time this function runs + entity ctf_staleflaglist = world; // reset the list, we need to build the list each time this function runs // build list of stale flags for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext) { - if(autocvar_g_ctf_flagcarrier_waypointforenemy_stalemate) + if(autocvar_g_ctf_stalemate) if(tmp_entity.ctf_status != FLAG_BASE) - if(time >= tmp_entity.ctf_pickuptime + autocvar_g_ctf_flagcarrier_waypointforenemy_stalemate) + if(time >= tmp_entity.ctf_pickuptime + autocvar_g_ctf_stalemate_time) { tmp_entity.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist ctf_staleflaglist = tmp_entity; @@ -609,9 +612,11 @@ void ctf_CheckStalemate(void) if(stale_red_flags && stale_blue_flags) ctf_stalemate = TRUE; - else if(!stale_red_flags && !stale_blue_flags) - ctf_stalemate = FALSE; - + else if((!stale_red_flags && !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 2) + { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; } + else if((!stale_red_flags || !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 1) + { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; } + // if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary if(ctf_stalemate) { @@ -745,7 +750,7 @@ void ctf_FlagThink() ImpulseCommands(); self = tmp_entity; } - if(autocvar_g_ctf_flagcarrier_waypointforenemy_stalemate) + if(autocvar_g_ctf_stalemate) { if(time >= wpforenemy_nextthink) { @@ -907,8 +912,6 @@ void ctf_RespawnFlag(entity flag) flag.ctf_dropper = world; flag.ctf_pickuptime = 0; flag.ctf_droptime = 0; - - wpforenemy_announced = FALSE; } void ctf_Reset() @@ -1753,8 +1756,12 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerDamage) // for changing damage and force values t } else if(frag_target.flagcarried && (frag_target.deadflag == DEAD_NO) && IsDifferentTeam(frag_target, frag_attacker)) // if the target is a flagcarrier { - if(autocvar_g_ctf_flagcarrier_auto_helpme_when_damaged > ('1 0 0' * healtharmor_maxdamage(frag_target.health, frag_target.armorvalue, autocvar_g_balance_armor_blockpercent))) + if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > ('1 0 0' * healtharmor_maxdamage(frag_target.health, frag_target.armorvalue, autocvar_g_balance_armor_blockpercent))) + if(time > frag_target.wps_helpme_time + autocvar_g_ctf_flagcarrier_auto_helpme_time) + { + frag_target.wps_helpme_time = time; WaypointSprite_HelpMePing(frag_target.wps_flagcarrier); + } } return FALSE; } @@ -1816,7 +1823,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey) // pass the flag to a team mate if(autocvar_g_ctf_pass) { - entity head, closest_target; + entity head, closest_target = world; head = WarpZone_FindRadius(player.origin, autocvar_g_ctf_pass_radius, TRUE); while(head) // find the closest acceptable target to pass to @@ -1826,8 +1833,8 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey) if(!head.speedrunning && !head.vehicle) { // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc) - vector head_center = WarpZone_UnTransformOrigin(head, PLAYER_CENTER(head)); - vector passer_center = PLAYER_CENTER(player); + vector head_center = WarpZone_UnTransformOrigin(head, CENTER_OR_VIEWOFS(head)); + vector passer_center = CENTER_OR_VIEWOFS(player); if(ctf_CheckPassDirection(head_center, passer_center, player.v_angle, head.WarpZone_findradius_nearest)) { @@ -1850,7 +1857,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey) { if(closest_target) { - vector closest_target_center = WarpZone_UnTransformOrigin(closest_target, PLAYER_CENTER(closest_target)); + vector closest_target_center = WarpZone_UnTransformOrigin(closest_target, CENTER_OR_VIEWOFS(closest_target)); if(vlen(passer_center - head_center) < vlen(passer_center - closest_target_center)) { closest_target = head; } } @@ -1878,7 +1885,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey) } else { - centerprint(player, strcat("Too many flag throws, throwing disabled for ", ftos((player.throw_prevtime + autocvar_g_ctf_throw_punish_delay) - time), " seconds.")); + centerprint(player, strcat("Too many flag throws, throwing disabled for ", ftos(rint((player.throw_prevtime + autocvar_g_ctf_throw_punish_delay) - time)), " seconds.")); return FALSE; } } @@ -1902,6 +1909,7 @@ MUTATOR_HOOKFUNCTION(ctf_HelpMePing) { if(self.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification { + self.wps_helpme_time = time; WaypointSprite_HelpMePing(self.wps_flagcarrier); } else // create a normal help me waypointsprite @@ -1977,7 +1985,7 @@ MUTATOR_HOOKFUNCTION(ctf_MatchEnd) flag.solid = SOLID_NOT; flag.nextthink = FALSE; // stop thinking - print("stopping the ", flag.netname, " from moving.\n"); + //dprint("stopping the ", flag.netname, " from moving.\n"); break; } @@ -2189,13 +2197,11 @@ MUTATOR_DEFINITION(gamemode_ctf) { if(time > 1) // game loads at time 1 error("This is a game type and it cannot be added at runtime."); - g_ctf = 1; ctf_Initialize(); } MUTATOR_ONREMOVE { - g_ctf = 0; error("This is a game type and it cannot be removed at runtime."); }