Skip to content

Commit

Permalink
Update Contests System (Simple-Station#583)
Browse files Browse the repository at this point in the history
# Description

This PR massively expands upon the functionality of the Contests System,
fully restoring it not only to the original level of functionality
available to the Nyanotrasen Contests, but vastly exceeding its
functionality too. Contests now include features like Health Contests,
Stamina Contests, but also include hooks for Mind Contests (To allow
other systems to implement theoretical effects of MindContest even
though I'm not yet finished with the Psionic Refactor).

Additionally, all Contests now include optional overrides, allowing
other functions to modify their own expected outcomes from the
ContestsSystem. These two optional overrides are:

- BypassClamp: Bypasses the clamp outright, allowing for Classic
Nyanotrasen Contests style of outputs, with theoretically infinite
results. If completely unlimited infinite results is desired, setting
this to true when calling Contests will unlock the range to (-inf, inf).
- RangeFactor: Proportionally expands the allowed Range of outputs from
a given Contest. Normally they are CVar clamped to +/- 0.25, but if for
instance RangeFactor was set to 2, the Range is now +/- 0.5

# Changelog

No changelog because this is completely zero player-facing
implementations. All I have done is give DEVS the tools needed to begin
implementing easy math into the game.

---------

Signed-off-by: VMSolidus <[email protected]>
Co-authored-by: DEATHB4DEFEAT <[email protected]>
  • Loading branch information
VMSolidus and DEATHB4DEFEAT authored Jul 24, 2024
1 parent 6afac54 commit ad7fd13
Show file tree
Hide file tree
Showing 2 changed files with 298 additions and 48 deletions.
36 changes: 36 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2286,17 +2286,53 @@ public static readonly CVarDef<float>
public static readonly CVarDef<float> StationGoalsChance =
CVarDef.Create("game.station_goals_chance", 0.1f, CVar.SERVERONLY);

#region Contests System

/// <summary>
/// The MASTER TOGGLE for the entire Contests System.
/// ALL CONTESTS BELOW, regardless of type or setting will output 1f when false.
/// </summary>
public static readonly CVarDef<bool> DoContestsSystem =
CVarDef.Create("contests.do_contests_system", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Contest functions normally include an optional override to bypass the clamp set by max_percentage.
/// This CVar disables the bypass when false, forcing all implementations to comply with max_percentage.
/// </summary>
public static readonly CVarDef<bool> AllowClampOverride =
CVarDef.Create("contests.allow_clamp_override", true, CVar.REPLICATED | CVar.SERVER);
/// <summary>
/// Toggles all MassContest functions. All mass contests output 1f when false
/// </summary>
public static readonly CVarDef<bool> DoMassContests =
CVarDef.Create("contests.do_mass_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles all StaminaContest functions. All stamina contests output 1f when false
/// </summary>
public static readonly CVarDef<bool> DoStaminaContests =
CVarDef.Create("contests.do_stamina_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles all HealthContest functions. All health contests output 1f when false
/// </summary>
public static readonly CVarDef<bool> DoHealthContests =
CVarDef.Create("contests.do_health_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles all MindContest functions. All mind contests output 1f when false.
/// MindContests are not currently implemented, and are awaiting completion of the Psionic Refactor
/// </summary>
public static readonly CVarDef<bool> DoMindContests =
CVarDef.Create("contests.do_mind_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// The maximum amount that Mass Contests can modify a physics multiplier, given as a +/- percentage
/// Default of 0.25f outputs between * 0.75f and 1.25f
/// </summary>
public static readonly CVarDef<float> MassContestsMaxPercentage =
CVarDef.Create("contests.max_percentage", 0.25f, CVar.REPLICATED | CVar.SERVER);

#endregion
}
}
Loading

0 comments on commit ad7fd13

Please sign in to comment.