* auto doggy

* fix

* fix
This commit is contained in:
Ed
2025-03-09 23:29:20 +03:00
committed by GitHub
parent 759260c2ba
commit 66058ffc49
9 changed files with 105 additions and 38 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared._CP14.Configuration;
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
@@ -12,8 +12,8 @@ public sealed partial class CP14OptionsMenuMainTab : Control
{
RobustXamlLoader.Load(this);
Control.AddOptionCheckBox(CP14ConfigVars.WaveShaderEnabled, WaveShaderEnabled);
Control.AddOptionCheckBox(CP14ConfigVars.PostProcess, PostProcessCheckBox);
Control.AddOptionCheckBox(CCVars.WaveShaderEnabled, WaveShaderEnabled);
Control.AddOptionCheckBox(CCVars.PostProcess, PostProcessCheckBox);
Control.Initialize();
}

View File

@@ -1,5 +1,5 @@
using Content.Shared._CP14.Configuration;
using System.Numerics;
using Content.Shared.CCVar;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Configuration;
@@ -32,7 +32,7 @@ public sealed class CP14BasePostProcessOverlay : Overlay
protected override bool BeforeDraw(in OverlayDrawArgs args)
{
if (!_configManager.GetCVar(CP14ConfigVars.PostProcess))
if (!_configManager.GetCVar(CCVars.PostProcess))
return false;
if (!_entityManager.TryGetComponent(_playerManager.LocalSession?.AttachedEntity, out EyeComponent? eyeComp))
@@ -74,4 +74,4 @@ public sealed class CP14BasePostProcessOverlay : Overlay
worldHandle.DrawRect(viewport, Color.White);
worldHandle.UseShader(null);
}
}
}

View File

@@ -1,8 +1,6 @@
using Content.Shared._CP14.Configuration;
using Content.Shared.CCVar;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Placement;
using Robust.Client.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -23,7 +21,7 @@ public sealed class CP14WaveShaderSystem : EntitySystem
base.Initialize();
_shader = _protoMan.Index<ShaderPrototype>("Wave").InstanceUnique();
_enabled = _configuration.GetCVar(CP14ConfigVars.WaveShaderEnabled);
_enabled = _configuration.GetCVar(CCVars.WaveShaderEnabled);
SubscribeLocalEvent<CP14WaveShaderComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<CP14WaveShaderComponent, ComponentShutdown>(OnShutdown);

View File

@@ -0,0 +1,68 @@
using Content.Server.GameTicking;
using Content.Shared.CCVar;
using Robust.Shared.Audio;
using Robust.Shared.Console;
namespace Content.Server._CP14.RoundEnd;
public sealed partial class CP14RoundEndSystem
{
[Dependency] private readonly IConsoleHost _consoleHost = default!;
[Dependency] private readonly GameTicker _ticker = default!;
private TimeSpan _nextUpdateTime = TimeSpan.Zero;
private readonly TimeSpan _updateFrequency = TimeSpan.FromSeconds(45f);
private bool _enabled;
private void InitCbt()
{
_enabled = _configManager.GetCVar(CCVars.CP14ClosedBetaTest);
_configManager.OnValueChanged(CCVars.CP14ClosedBetaTest, _ => { _enabled = _configManager.GetCVar(CCVars.CP14ClosedBetaTest); }, true);
}
// Вы можете сказать: Эд, ты ебанулся? Это же лютый щиткод!
// И я вам отвечу: Да. Но сама система ограничения времени работы сервера - временная штука на этап разработки, которая будет удалена. Мне просто лень каждый раз запускать и выключать сервер ручками.
private void UpdateCbt(float _)
{
if (!_enabled)
return;
if (_nextUpdateTime > _timing.CurTime)
return;
_nextUpdateTime = _timing.CurTime + _updateFrequency;
DateTime nowMoscow = DateTime.UtcNow.AddHours(3);
//Disable any round timers
if (nowMoscow.Hour is < 18 or > 20)
{
if (_ticker.RunLevel == GameRunLevel.InRound)
_roundEnd.EndRound();
if (!_ticker.Paused)
_ticker.TogglePause();
}
else
{
if (_ticker.Paused)
_ticker.TogglePause();
}
if (nowMoscow.Hour == 17 && nowMoscow.Minute == 45)
{
_consoleHost.ExecuteCommand("shutdown"); //Restart server, load updates and other
}
if (nowMoscow.Hour == 20 && nowMoscow.Minute == 45)
{
_chatSystem.DispatchGlobalAnnouncement("ВНИМАНИЕ: Сервер автоматически завершит раунд через 15 минут", announcementSound: new SoundPathSpecifier("/Audio/Effects/beep1.ogg"), sender: "Сервер");
}
if (nowMoscow.Hour == 21 && nowMoscow.Minute == 02)
{
_consoleHost.ExecuteCommand("golobby");
_consoleHost.ExecuteCommand("set-motd Плейтест на сегодня уже закончен. Следующий запуск в 18:00 МСК.");
}
}
}

View File

@@ -15,7 +15,6 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly CP14DemiplaneSystem _demiplane = default!;
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
@@ -27,6 +26,8 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
{
base.Initialize();
InitCbt();
SubscribeLocalEvent<CP14MagicContainerRoundFinisherComponent, CP14MagicEnergyLevelChangeEvent>(OnFinisherMagicEnergyLevelChange);
SubscribeNetworkEvent<RoundEndMessageEvent>(OnRoundEndMessage);
}
@@ -34,19 +35,25 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
private void OnRoundEndMessage(RoundEndMessageEvent ev)
{
_roundEndMoment = TimeSpan.Zero; //Reset timer, so it cant affect next round in any case
_demiplane.DeleteAllDemiplanes(safe: false);
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("cp14-round-end"),
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Ambience/event_boom.ogg"));
}
public override void Update(float frameTime)
{
base.Update(frameTime);
UpdateCbt(frameTime);
if (_roundEndMoment == TimeSpan.Zero)
return;
if (_roundEndMoment > _timing.CurTime)
return;
EndRound();
_roundEnd.EndRound();
}
private void OnFinisherMagicEnergyLevelChange(Entity<CP14MagicContainerRoundFinisherComponent> ent,
@@ -103,16 +110,4 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("cp14-round-end-monolith-recharged"),
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Ambience/event_boom.ogg"));
}
private void EndRound()
{
if (_gameTicker.RunLevel != GameRunLevel.InRound)
return;
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("cp14-round-end"),
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Ambience/event_boom.ogg"));
_roundEndMoment = TimeSpan.Zero;
_roundEnd.EndRound();
_demiplane.DeleteAllDemiplanes(safe: false);
}
}

View File

@@ -1,9 +0,0 @@
using Robust.Shared.Configuration;
namespace Content.Shared.CCVar;
public sealed partial class CCVars
{
public static readonly CVarDef<int> CP14RoundEndMinutes =
CVarDef.Create("cp14_demiplane.round_end_minutes", 15, CVar.SERVERONLY);
}

View File

@@ -0,0 +1,15 @@
using Robust.Shared.Configuration;
namespace Content.Shared.CCVar;
public sealed partial class CCVars
{
public static readonly CVarDef<int> CP14RoundEndMinutes =
CVarDef.Create("cp14.round_end_minutes", 15, CVar.SERVERONLY);
/// <summary>
/// Automatically shuts down the server outside of the CBT plytime. Shitcoded enough, but it's temporary anyway
/// </summary>
public static readonly CVarDef<bool> CP14ClosedBetaTest =
CVarDef.Create("cp14.closet_beta_test", false, CVar.SERVERONLY);
}

View File

@@ -1,13 +1,12 @@
using Robust.Shared;
using Robust.Shared.Configuration;
namespace Content.Shared._CP14.Configuration;
namespace Content.Shared.CCVar;
[CVarDefs]
public sealed class CP14ConfigVars : CVars
public sealed partial class CCVars
{
public static readonly CVarDef<bool>
WaveShaderEnabled = CVarDef.Create("cp14_rendering.wave_shader_enabled", true, CVar.CLIENT | CVar.ARCHIVE);
WaveShaderEnabled = CVarDef.Create("cp14_shaders.wave_shader_enabled", true, CVar.CLIENT | CVar.ARCHIVE);
/// <summary>
/// Toggle for non-gameplay-affecting or otherwise status indicative post-process effects, such additive lighting.
@@ -15,5 +14,5 @@ public sealed class CP14ConfigVars : CVars
/// However, for now (mid-July of 2024), this only applies specifically to a particularly cheap shader: additive lighting.
/// </summary>
public static readonly CVarDef<bool>
PostProcess = CVarDef.Create("cp14_graphics.post_process", true, CVar.CLIENTONLY | CVar.ARCHIVE);
PostProcess = CVarDef.Create("cp14_shaders.post_process", true, CVar.CLIENTONLY | CVar.ARCHIVE);
}

View File

@@ -61,3 +61,4 @@ enable_during_round = true
[cp14]
discord_auth_enabled = true
closet_beta_test = true