-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DeltaV Anti EORG Code & Species vision cvar edit (#2327)
* Eorg * Update DCCVars.cs * add the no EORG popup (#2070) ONE MORE PR TODAY * add the no EORG popup (#2070) * EORG rewrites * refactor eorg popup * comment on margin changes --------- Co-authored-by: Milon <[email protected]> Co-authored-by: ErhardSteinhauer <[email protected]> Co-authored-by: Whatstone <[email protected]>
- Loading branch information
1 parent
58904b5
commit ffd4966
Showing
6 changed files
with
252 additions
and
3 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 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
Title="{Loc 'no-eorg-popup-title'}" | ||
MinSize="520 423" | ||
MaxSize="520 423"> <!-- Frontier: height: 450<423 --> | ||
<BoxContainer Orientation="Vertical" Margin="15"> <!-- Frontier: margin: 20<15 --> | ||
<Label Name="TitleLabel" | ||
StyleClasses="LabelBig" | ||
HorizontalAlignment="Center" | ||
Margin="0 5 0 5" /> | ||
<PanelContainer StyleClasses="BackgroundDark" Margin="0"> <!-- Frontier: no margin --> | ||
<BoxContainer Orientation="Vertical" Margin="10"> | ||
<RichTextLabel Name="MessageLabel" HorizontalAlignment="Center" Margin="0 5 0 10"/> <!-- Frontier: added margins, removed blank Control --> | ||
<RichTextLabel Name="RuleLabel" HorizontalAlignment="Center" Margin="0 5 0 10"/> <!-- Frontier: added margins --> | ||
<RichTextLabel Name="RuleTextLabel" HorizontalAlignment="Center" Margin="0 5 0 0" /> <!-- Frontier: added margins --> | ||
</BoxContainer> | ||
</PanelContainer> | ||
<BoxContainer Orientation="Vertical" VerticalAlignment="Bottom" Margin="0 5 0 0"> <!-- Frontier: top margin 10<5 --> | ||
<CheckBox Name="SkipCheckBox" | ||
Text="{Loc 'no-eorg-popup-skip-checkbox'}" | ||
HorizontalAlignment="Center" | ||
Margin="0 0 0 15" /> <!-- Frontier: bottom margin 10<15 --> | ||
<Button Name="NoEorgCloseButton" | ||
HorizontalAlignment="Center" | ||
MinWidth="150" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
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,91 @@ | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared.DeltaV.CCVars; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Timing; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.DeltaV.RoundEnd; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class NoEorgPopup : FancyWindow | ||
{ | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
|
||
private float _remainingTime; | ||
private bool _initialSkipState; | ||
|
||
public NoEorgPopup() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
RobustXamlLoader.Load(this); | ||
|
||
InitializeUI(); | ||
InitializeEvents(); | ||
ResetTimer(); | ||
} | ||
|
||
private void InitializeUI() | ||
{ | ||
TitleLabel.Text = Loc.GetString("no-eorg-popup-label"); | ||
MessageLabel.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("no-eorg-popup-message"))); | ||
RuleLabel.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("no-eorg-popup-rule"))); | ||
RuleTextLabel.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("no-eorg-popup-rule-text"))); | ||
|
||
_initialSkipState = | ||
_cfg.GetCVar(DCCVars.SkipRoundEndNoEorgPopup); // Store the initial CVar value to compare against | ||
SkipCheckBox.Pressed = _initialSkipState; | ||
NoEorgCloseButton.Disabled = true; | ||
|
||
UpdateCloseButtonText(); | ||
} | ||
|
||
private void InitializeEvents() | ||
{ | ||
OnClose += SaveSkipState; // Only change the CVar once the close button is pressed | ||
NoEorgCloseButton.OnPressed += OnClosePressed; | ||
} | ||
|
||
private void ResetTimer() | ||
{ | ||
_remainingTime = _cfg.GetCVar(DCCVars.RoundEndNoEorgPopupTime); // Set how long to show the popup for | ||
UpdateCloseButtonText(); | ||
} | ||
|
||
private void SaveSkipState() | ||
{ | ||
if (SkipCheckBox.Pressed == _initialSkipState) | ||
return; | ||
|
||
_cfg.SetCVar(DCCVars.SkipRoundEndNoEorgPopup, SkipCheckBox.Pressed); | ||
_cfg.SaveToFile(); | ||
} | ||
|
||
private void OnClosePressed(BaseButton.ButtonEventArgs args) | ||
{ | ||
Close(); | ||
} | ||
|
||
private void UpdateCloseButtonText() | ||
{ | ||
var isWaiting = _remainingTime > 0f; | ||
NoEorgCloseButton.Text = isWaiting | ||
? Loc.GetString("no-eorg-popup-close-button-wait", ("time", (int)MathF.Ceiling(_remainingTime))) | ||
: Loc.GetString("no-eorg-popup-close-button"); | ||
NoEorgCloseButton.Disabled = isWaiting; | ||
} | ||
|
||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
|
||
if (!NoEorgCloseButton.Disabled) | ||
return; | ||
|
||
_remainingTime = MathF.Max(0f, _remainingTime - args.DeltaSeconds); | ||
UpdateCloseButtonText(); | ||
} | ||
} | ||
|
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,36 @@ | ||
using Content.Shared.GameTicking; | ||
using Content.Shared.DeltaV.CCVars; | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Client.DeltaV.RoundEnd; | ||
|
||
public sealed class NoEorgPopupSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
|
||
private NoEorgPopup? _window; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeNetworkEvent<RoundEndMessageEvent>(OnRoundEnd); | ||
} | ||
|
||
private void OnRoundEnd(RoundEndMessageEvent ev) | ||
{ | ||
if (_cfg.GetCVar(DCCVars.SkipRoundEndNoEorgPopup) || _cfg.GetCVar(DCCVars.RoundEndNoEorgPopup) == false) | ||
return; | ||
|
||
OpenNoEorgPopup(); | ||
} | ||
|
||
private void OpenNoEorgPopup() | ||
{ | ||
if (_window != null) | ||
return; | ||
|
||
_window = new NoEorgPopup(); | ||
_window.OpenCentered(); | ||
_window.OnClose += () => _window = null; | ||
} | ||
} |
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,61 @@ | ||
using Content.Server.Explosion.Components; | ||
using Content.Server.GameTicking; | ||
using Content.Shared.CombatMode; | ||
using Content.Shared.CombatMode.Pacification; | ||
using Content.Shared.DeltaV.CCVars; | ||
using Content.Shared.Explosion.Components; | ||
using Content.Shared.Flash.Components; | ||
using Content.Shared.Store.Components; | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Server.DeltaV.RoundEnd; | ||
|
||
public sealed class PacifiedRoundEnd : EntitySystem | ||
{ | ||
[Dependency] private readonly IConfigurationManager _configurationManager = default!; | ||
|
||
private bool _enabled; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
_configurationManager.OnValueChanged(DCCVars.RoundEndPacifist, v => _enabled = v, true); | ||
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEnded); | ||
} | ||
|
||
private void OnRoundEnded(RoundEndTextAppendEvent ev) | ||
{ | ||
if (!_enabled) | ||
return; | ||
|
||
var harmQuery = EntityQueryEnumerator<CombatModeComponent>(); | ||
while (harmQuery.MoveNext(out var uid, out _)) | ||
{ | ||
EnsureComp<PacifiedComponent>(uid); | ||
} | ||
|
||
var explosiveQuery = EntityQueryEnumerator<ExplosiveComponent>(); | ||
while (explosiveQuery.MoveNext(out var uid, out _)) | ||
{ | ||
RemComp<ExplosiveComponent>(uid); | ||
} | ||
|
||
var grenadeQuery = EntityQueryEnumerator<OnUseTimerTriggerComponent>(); | ||
while (grenadeQuery.MoveNext(out var uid, out _)) | ||
{ | ||
RemComp<OnUseTimerTriggerComponent>(uid); | ||
} | ||
|
||
var flashQuery = EntityQueryEnumerator<FlashComponent>(); | ||
while (flashQuery.MoveNext(out var uid, out _)) | ||
{ | ||
RemComp<FlashComponent>(uid); | ||
} | ||
|
||
var uplinkQuery = EntityQueryEnumerator<StoreComponent>(); | ||
while (uplinkQuery.MoveNext(out var uid, out _)) | ||
{ | ||
RemComp<StoreComponent>(uid); | ||
} | ||
} | ||
} |
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,9 @@ | ||
# Frontier: edits to title and messages | ||
no-eorg-popup-title = Frontier Station | ||
no-eorg-popup-label = Welcome to the End of Round! | ||
no-eorg-popup-message = [bold]End-of-round griefing (EORG)[/bold] is [color=#DD0000]not allowed[/color]. Please stay in character until the lobby screen appears to maintain an immersive environment for everyone. Thank you for respecting the community rules! | ||
no-eorg-popup-rule = [bold][color=#a4885c]Significant end-of-round griefing (EORG) is not allowed.[/color][/bold] | ||
no-eorg-popup-rule-text = This includes attacking, destroying, polluting, and severely injuring players or property without reason. Remember that you are playing a character throughout the round. | ||
no-eorg-popup-close-button = Sounds good! | ||
no-eorg-popup-close-button-wait = The close button will be enabled after {$time} seconds. | ||
no-eorg-popup-skip-checkbox = Don't show this again. |