Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Возможность отключить телепорт в крио для сервера. #218

Merged
merged 4 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Content.Server/_Sunrise/CryoTeleport/CryoTeleportSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
using Content.Server.Mind;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared._Sunrise.SunriseCCVars;
using Content.Shared.Bed.Cryostorage;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Player;
using Robust.Shared.Timing;
Expand All @@ -28,6 +30,7 @@ public sealed class CryoTeleportSystem : EntitySystem
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly IPlayerManager _playerMan = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;

public TimeSpan NextTick = TimeSpan.Zero;
public TimeSpan RefreshCooldown = TimeSpan.FromSeconds(5);
Expand All @@ -44,6 +47,9 @@ public override void Update(float delay)

NextTick += RefreshCooldown;

if (!_configurationManager.GetCVar(SunriseCCVars.EnableCryoteleport))
return;

var query = AllEntityQuery<CryoTeleportTargetComponent, MobStateComponent>();
while (query.MoveNext(out var uid, out var comp, out var mobStateComponent))
{
Expand Down Expand Up @@ -92,6 +98,9 @@ public override void Update(float delay)

private void OnCompleteSpawn(PlayerSpawnCompleteEvent ev)
{
if (!_configurationManager.GetCVar(SunriseCCVars.EnableCryoteleport))
return;

if (!TryComp<StationCryoTeleportComponent>(ev.Station, out var cryoTeleportComponent))
return;
if (ev.JobId == null)
Expand All @@ -107,6 +116,9 @@ private void OnCompleteSpawn(PlayerSpawnCompleteEvent ev)

private void OnSessionStatus(object? sender, SessionStatusEventArgs args)
{
if (!_configurationManager.GetCVar(SunriseCCVars.EnableCryoteleport))
return;

if (!TryComp<CryoTeleportTargetComponent>(args.Session.AttachedEntity, out var comp))
return;

Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,10 @@ public static readonly CVarDef<bool>
public static readonly CVarDef<string> LobbyChangelogs =
CVarDef.Create("lobby_changelog.id", "ChangelogSunrise.yml,Changelog.yml", CVar.SERVER | CVar.REPLICATED);

/*
* Cryoteleport
*/

public static readonly CVarDef<bool> EnableCryoteleport =
CVarDef.Create("station.enablecryoteleport", false, CVar.SERVERONLY);
}
Loading