-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2dcab4d
commit fa53fde
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