Skip to content

Commit

Permalink
func_escapezone: balance tweak via new cvar fcs_escapepenalty. Sugges…
Browse files Browse the repository at this point in the history
…ted by Xylemon
  • Loading branch information
eukara committed Mar 2, 2023
1 parent f74e44e commit 2d51a76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/server/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var string autocvar_motdfile = "motd.txt";
var int autocvar_mp_friendlyfire = FALSE;

/* new, FreeCS exclusive variables */
var int autocvar_fcs_escapepenalty = -300;
var int autocvar_fcs_swaponround = 0;
var int autocvar_fcs_voxannounce = FALSE;
var int autocvar_fcs_knifeonly = FALSE; /* Disallows buying and spawning with weps */
Expand Down
16 changes: 15 additions & 1 deletion src/server/func_escapezone.qc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ void
func_escapezone::Touch(entity eToucher)
{
CSMultiplayerRules rule = (CSMultiplayerRules)g_grMode;
int to_escape = g_cs_total_t;
int to_escape = 0;

rule.CountPlayers();
to_escape = g_cs_total_t;

/* only 3 Ts need to escape, max */
if (to_escape > 3)
Expand All @@ -72,6 +75,17 @@ func_escapezone::Touch(entity eToucher)

rule.m_iEscapedTerrorists++;

/* balancing tweak: for every escaped T, each and every CT will lose funds */
if (autocvar_fcs_escapepenalty != 0) {
for (entity eFind = world; (eFind = find(eFind, ::classname, "player"));) {
player ct = (player)eFind;

if (ct.team == TEAM_CT) {
Money_AddMoney(ct, autocvar_fcs_escapepenalty);
}
}
}

/* mark player as spectator for the end of this 'round' */
pl.MakeTempSpectator();

Expand Down

0 comments on commit 2d51a76

Please sign in to comment.