mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-22 07:58:06 +03:00
# 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
🆑
- tweak: Space stations now have a tiny bit of velocity dampening to
prevent them from being flunged into the void.
29 lines
968 B
C#
29 lines
968 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|