2024-01-21 13:14:01 +04:00
|
|
|
|
using Content.Shared.CCVar;
|
|
|
|
|
|
using Content.Shared.Chat;
|
|
|
|
|
|
using Content.Shared.NukeOps;
|
2023-08-30 10:56:20 +03:00
|
|
|
|
using JetBrains.Annotations;
|
2024-01-21 13:14:01 +04:00
|
|
|
|
using Robust.Shared.Configuration;
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
|
using Robust.Shared.Timing;
|
2023-08-30 10:56:20 +03:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.NukeOps;
|
|
|
|
|
|
|
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
|
public sealed class WarDeclaratorBoundUserInterface : BoundUserInterface
|
|
|
|
|
|
{
|
2024-01-21 13:14:01 +04:00
|
|
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
|
|
|
|
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
|
2024-01-21 13:14:01 +04:00
|
|
|
|
|
2023-08-30 10:56:20 +03:00
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
private WarDeclaratorWindow? _window;
|
|
|
|
|
|
|
|
|
|
|
|
public WarDeclaratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) {}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Open();
|
|
|
|
|
|
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
|
_window = new WarDeclaratorWindow(_gameTiming, _localizationManager);
|
2023-08-30 10:56:20 +03:00
|
|
|
|
if (State != null)
|
|
|
|
|
|
UpdateState(State);
|
|
|
|
|
|
|
|
|
|
|
|
_window.OpenCentered();
|
|
|
|
|
|
|
|
|
|
|
|
_window.OnClose += Close;
|
|
|
|
|
|
_window.OnActivated += OnWarDeclaratorActivated;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.UpdateState(state);
|
|
|
|
|
|
if (_window == null || state is not WarDeclaratorBoundUserInterfaceState cast)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
_window?.UpdateState(cast);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Dispose(disposing);
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
|
if (disposing)
|
|
|
|
|
|
_window?.Dispose();
|
2023-08-30 10:56:20 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnWarDeclaratorActivated(string message)
|
|
|
|
|
|
{
|
2024-01-21 13:14:01 +04:00
|
|
|
|
var maxLength = _cfg.GetCVar(CCVars.ChatMaxAnnouncementLength);
|
|
|
|
|
|
var msg = SharedChatSystem.SanitizeAnnouncement(message, maxLength);
|
|
|
|
|
|
SendMessage(new WarDeclaratorActivateMessage(msg));
|
2023-08-30 10:56:20 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|