Skip to content

Commit

Permalink
Merge branch 'master' into add-trait-parkour
Browse files Browse the repository at this point in the history
Signed-off-by: Angelo Fallaria <[email protected]>
  • Loading branch information
angelofallars authored Aug 5, 2024
2 parents 44aed2c + 27c2c35 commit 20a2555
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 16 deletions.
21 changes: 10 additions & 11 deletions Content.Server/GameTicking/Rules/ZombieRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
[Dependency] private readonly AntagSelectionSystem _antagSelection = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly AnnouncerSystem _announcer = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -89,7 +90,7 @@ private void OnRoundEndText(RoundEndTextAppendEvent ev)
("username", player.Value)));
}

var healthy = GetHealthyHumans();
var healthy = GetHealthyHumans(true);
// Gets a bunch of the living players and displays them if they're under a threshold.
// InitialInfected is used for the threshold because it scales with the player count well.
if (healthy.Count <= 0 || healthy.Count > 2 * zombie.InitialInfectedNames.Count)
Expand Down Expand Up @@ -185,7 +186,7 @@ private void OnZombifySelf(EntityUid uid, PendingZombieComponent component, Zomb
/// <param name="includeOffStation">Include healthy players that are not on the station grid</param>
/// <param name="includeDead">Should dead zombies be included in the count</param>
/// <returns></returns>
private float GetInfectedFraction(bool includeOffStation = true, bool includeDead = false)
private float GetInfectedFraction(bool includeOffStation = false, bool includeDead = true)
{
var players = GetHealthyHumans(includeOffStation);
var zombieCount = 0;
Expand All @@ -205,14 +206,14 @@ private float GetInfectedFraction(bool includeOffStation = true, bool includeDea
/// Flying off via a shuttle disqualifies you.
/// </summary>
/// <returns></returns>
private List<EntityUid> GetHealthyHumans(bool includeOffStation = true)
private List<EntityUid> GetHealthyHumans(bool includeOffStation = false)
{
var healthy = new List<EntityUid>();

var stationGrids = new HashSet<EntityUid>();
if (!includeOffStation)
{
foreach (var station in _station.GetStationsSet())
foreach (var station in _gameTicker.GetSpawnableStations())
{
if (TryComp<StationDataComponent>(station, out var data) && _station.GetLargestGrid(data) is { } grid)
stationGrids.Add(grid);
Expand All @@ -223,13 +224,11 @@ private List<EntityUid> GetHealthyHumans(bool includeOffStation = true)
var zombers = GetEntityQuery<ZombieComponent>();
while (players.MoveNext(out var uid, out _, out _, out var mob, out var xform))
{
if (!_mobState.IsAlive(uid, mob))
continue;

if (zombers.HasComponent(uid))
continue;

if (!includeOffStation && !stationGrids.Contains(xform.GridUid ?? EntityUid.Invalid))
if (!_mobState.IsAlive(uid, mob)
|| HasComp<PendingZombieComponent>(uid) //Do not include infected players in the "Healthy players" list.
|| HasComp<ZombifyOnDeathComponent>(uid)
|| zombers.HasComponent(uid)
|| !includeOffStation && !stationGrids.Contains(xform.GridUid ?? EntityUid.Invalid))
continue;

healthy.Add(uid);
Expand Down
11 changes: 10 additions & 1 deletion Content.Shared/Movement/Systems/SharedMoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Content.Shared.Movement.Events;
using Content.Shared.StepTrigger.Components;
using Content.Shared.Tag;
using Content.Shared.Traits.Assorted.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
Expand Down Expand Up @@ -261,9 +262,17 @@ protected void HandleMobMovement(
TryGetSound(weightless, uid, mover, mobMover, xform, out var sound, tileDef: tileDef))
{
var soundModifier = mover.Sprinting ? 3.5f : 1.5f;
var volume = sound.Params.Volume + soundModifier;

if (_entities.TryGetComponent(uid, out FootstepVolumeModifierComponent? volumeModifier))
{
volume += mover.Sprinting
? volumeModifier.SprintVolumeModifier
: volumeModifier.WalkVolumeModifier;
}

var audioParams = sound.Params
.WithVolume(sound.Params.Volume + soundModifier)
.WithVolume(volume)
.WithVariation(sound.Params.Variation ?? FootstepVariation);

// If we're a relay target then predict the sound for all relays.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies footstep volumes.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class FootstepVolumeModifierComponent : Component
{
/// <summary>
/// What to add to the volume of sprinting, in terms of decibels.
/// </summary>
[DataField, AutoNetworkedField]
public float SprintVolumeModifier;

/// <summary>
/// What to add to the volume of walking, in terms of decibels.
/// </summary>
[DataField, AutoNetworkedField]
public float WalkVolumeModifier;
}
25 changes: 25 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4877,3 +4877,28 @@ Entries:
twice as fast.
id: 6210
time: '2024-08-04T09:30:31.0000000+00:00'
- author: VMSolidus
changes:
- type: Fix
message: >-
Zombie events have had their Anti-Stalling mechanic improved. Dead
(Player) Zombies, Infected Players, and Initial Infected are all counted
as zombies for the purpose of determine if the shuttle should be called.
Additionally, any player who leaves the station is no longer counted as
a healthy crewman for the automatic shuttle call.
id: 6211
time: '2024-08-04T14:14:12.0000000+00:00'
- author: Skubman
changes:
- type: Tweak
message: Rename the trait "Heavyweight Drunk" into "Alcohol Tolerance".
id: 6212
time: '2024-08-05T03:30:41.0000000+00:00'
- author: Skubman
changes:
- type: Add
message: >-
Add the Light Step trait, a 1-point trait that makes your footsteps
quieter.
id: 6213
time: '2024-08-05T15:29:07.0000000+00:00'
10 changes: 7 additions & 3 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ trait-description-Pacifist = You cannot attack or hurt any living beings.
trait-name-LightweightDrunk = Lightweight Drunk
trait-description-LightweightDrunk = Alcohol has a stronger effect on you
trait-name-HeavyweightDrunk = Heavyweight Drunk
trait-description-HeavyweightDrunk = Alcohols are afraid of you
trait-name-HeavyweightDrunk = Alcohol Tolerance
trait-description-HeavyweightDrunk = Alcohol is afraid of you.
trait-name-Muted = Muted
trait-description-Muted = You can't speak
Expand Down Expand Up @@ -61,7 +61,11 @@ trait-description-Voracious =
Nothing gets between you and your food.
Your endless consumption of food and drinks is twice as fast.
trait-name-LightStep = Light Step
trait-description-LightStep =
You move with a gentle step, making your footsteps quieter.
trait-name-ParkourTraining = Parkour Training
trait-description-ParkourTraining =
Whether as a hobby, lifestyle, or professional training, you are trained in the discipline of parkour.
You're faster with climbing, crawling, lying down, and getting up.
You're faster with climbing, crawling, lying down, and getting up.
16 changes: 15 additions & 1 deletion Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@
foodDelayMultiplier: 0.5
drinkDelayMultiplier: 0.5

- type: trait
id: LightStep
category: Auditory
points: -1
components:
- type: FootstepVolumeModifier
sprintVolumeModifier: -10
walkVolumeModifier: -10
requirements:
- !type:CharacterSpeciesRequirement
inverted: true
species:
- Felinid

- type: trait
id: ParkourTraining
category: Physical
Expand All @@ -50,4 +64,4 @@
climbDelayMultiplier: 0.70
- type: LayingDownModifier
layingDownCooldownMultiplier: 0.8
downedSpeedMultiplierMultiplier: 1.25
downedSpeedMultiplierMultiplier: 1.25

0 comments on commit 20a2555

Please sign in to comment.