-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description Makes it so that the station and the ATS get a very tiny bit of friction to prevent cargo tech pros from sending either of those out of this galaxy cluster (which has actually happened multiple times on two servers and required either admin intervention or early round ending). # Technical details Added a PassiveDampeningComponent which defines how much friction an entity receives while in 0g. FrictionRemoverSystem was updated to try to fetch this component from an entity before updating its dampening. A new system was added to automatically add this component (if it's not already defined) to all station grids. # Media See the #when-you-code-it channel for a preview. It's kinda hard to demonstrate, but after a few minutes, stations and the ATS come to an almost complete stop. # Changelog :cl: - tweak: Space stations now have a tiny bit of velocity dampening to prevent them from being flunged into the void.
- Loading branch information
1 parent
6aaf466
commit e092203
Showing
4 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Content.Server.Station.Events; | ||
using Content.Shared.Physics; | ||
|
||
namespace Content.Server.Station.Systems; | ||
|
||
public sealed class StationDampeningSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<StationPostInitEvent>(OnInitStation); | ||
} | ||
|
||
private void OnInitStation(ref StationPostInitEvent ev) | ||
{ | ||
foreach (var grid in ev.Station.Comp.Grids) | ||
{ | ||
// If the station grid doesn't have defined dampening, give it a small dampening by default | ||
// This will ensure cargo tech pros won't fling the station 1000 megaparsec away from the galaxy | ||
if (!TryComp<PassiveDampeningComponent>(grid, out var dampening)) | ||
{ | ||
dampening = AddComp<PassiveDampeningComponent>(grid); | ||
dampening.Enabled = true; | ||
dampening.LinearDampening = 0.01f; | ||
dampening.AngularDampening = 0.01f; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Content.Shared.Physics; | ||
|
||
/// <summary> | ||
/// A component that allows an entity to have friction (linear and angular dampening) | ||
/// even when not being affected by gravity. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class PassiveDampeningComponent : Component | ||
{ | ||
[DataField] | ||
public bool Enabled = true; | ||
|
||
[DataField] | ||
public float LinearDampening = 0.2f; | ||
|
||
[DataField] | ||
public float AngularDampening = 0.2f; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters