Skip to content

Commit

Permalink
Возможность отключить телепорт в крио для сервера. (#218)
Browse files Browse the repository at this point in the history
* у ОСЩ майндщилд

Signed-off-by: JDtrimble <[email protected]>

* Revert "у ОСЩ майндщилд"

This reverts commit 595f886.

* Отключен телепорт в крио

Signed-off-by: JDtrimble <[email protected]>

---------

Signed-off-by: JDtrimble <[email protected]>
  • Loading branch information
pxc1984 authored Jul 18, 2024
1 parent ac1c5a4 commit 360c5e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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);
}

0 comments on commit 360c5e9

Please sign in to comment.