From 4d677f0685ff6966fc038b794e19d799b37cec3c Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Wed, 30 Aug 2023 21:06:15 -0400 Subject: [PATCH] 1v1 me first to 31 no powerups [Deathmatch Gamemode] (#19467) Co-authored-by: Kara --- Content.Client/Points/PointSystem.cs | 58 + .../Character/CharacterUIController.cs | 1 + .../Character/Windows/CharacterWindow.xaml | 2 +- .../Tests/PostMapInitTest.cs | 3 +- Content.Server/Chat/SuicideSystem.cs | 2 +- .../GameTicking/GameTicker.Player.cs | 5 +- .../GameTicking/GameTicker.RoundFlow.cs | 2 +- .../GameTicking/GameTicker.Spawning.cs | 29 +- .../Components/DeathMatchRuleComponent.cs | 39 +- .../Components/KillCalloutRuleComponent.cs | 32 + .../Components/RespawnDeadRuleComponent.cs | 9 + .../Components/RespawnTrackerComponent.cs | 30 + .../GameTicking/Rules/DeathMatchRuleSystem.cs | 190 +- .../Rules/KillCalloutRuleSystem.cs | 99 + .../GameTicking/Rules/RespawnRuleSystem.cs | 145 ++ .../KillTracking/KillTrackerComponent.cs | 62 + .../KillTracking/KillTrackingSystem.cs | 129 ++ Content.Server/Maps/GameMapManager.cs | 2 +- Content.Server/Medical/HealingSystem.cs | 16 +- Content.Server/Points/PointSystem.cs | 96 + Content.Server/Roles/Jobs/JobSystem.cs | 3 + Content.Server/Roles/MindRoleAddedEvent.cs | 2 +- Content.Server/Roles/RoleAddedEvent.cs | 2 +- Content.Server/Roles/RoleSystem.cs | 5 +- Content.Server/RoundEnd/RoundEndSystem.cs | 12 +- .../Damage/Systems/DamageableSystem.cs | 6 - .../Systems/MobStateSystem.StateMachine.cs | 2 +- .../Mobs/Systems/MobThresholdSystem.cs | 11 +- .../Points/PointManagerComponent.cs | 40 + Content.Shared/Points/SharedPointSystem.cs | 86 + .../game-presets/preset-deathmatch.ftl | 79 +- .../en-US/game-ticking/game-rules/rules.ftl | 5 +- Resources/Locale/en-US/points/points.ftl | 6 + Resources/Maps/Nonstations/meteor-arena.yml | 1634 +++++++++++++++++ .../Objects/Specific/Medical/healing.yml | 26 + .../Objects/Weapons/Melee/weapon_toolbox.yml | 18 + .../Entities/Stations/nanotrasen.yml | 11 + Resources/Prototypes/GameRules/roundstart.yml | 25 +- .../Prototypes/Maps/Pools/deathmatch.yml | 4 + Resources/Prototypes/Maps/arenas.yml | 16 + .../Roles/Jobs/Fun/misc_startinggear.yml | 13 + Resources/Prototypes/game_presets.yml | 5 +- .../Medical/healing_toolbox.rsi/icon.png | Bin 0 -> 683 bytes .../Medical/healing_toolbox.rsi/meta.json | 14 + 44 files changed, 2821 insertions(+), 155 deletions(-) create mode 100644 Content.Client/Points/PointSystem.cs create mode 100644 Content.Server/GameTicking/Rules/Components/KillCalloutRuleComponent.cs create mode 100644 Content.Server/GameTicking/Rules/Components/RespawnDeadRuleComponent.cs create mode 100644 Content.Server/GameTicking/Rules/Components/RespawnTrackerComponent.cs create mode 100644 Content.Server/GameTicking/Rules/KillCalloutRuleSystem.cs create mode 100644 Content.Server/GameTicking/Rules/RespawnRuleSystem.cs create mode 100644 Content.Server/KillTracking/KillTrackerComponent.cs create mode 100644 Content.Server/KillTracking/KillTrackingSystem.cs create mode 100644 Content.Server/Points/PointSystem.cs create mode 100644 Content.Shared/Points/PointManagerComponent.cs create mode 100644 Content.Shared/Points/SharedPointSystem.cs create mode 100644 Resources/Locale/en-US/points/points.ftl create mode 100644 Resources/Maps/Nonstations/meteor-arena.yml create mode 100644 Resources/Prototypes/Entities/Objects/Weapons/Melee/weapon_toolbox.yml create mode 100644 Resources/Prototypes/Maps/Pools/deathmatch.yml create mode 100644 Resources/Prototypes/Maps/arenas.yml create mode 100644 Resources/Textures/Objects/Specific/Medical/healing_toolbox.rsi/icon.png create mode 100644 Resources/Textures/Objects/Specific/Medical/healing_toolbox.rsi/meta.json diff --git a/Content.Client/Points/PointSystem.cs b/Content.Client/Points/PointSystem.cs new file mode 100644 index 0000000000..f41c4b09ab --- /dev/null +++ b/Content.Client/Points/PointSystem.cs @@ -0,0 +1,58 @@ +using Content.Client.CharacterInfo; +using Content.Client.Message; +using Content.Shared.Points; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Shared.GameStates; + +namespace Content.Client.Points; + +/// +public sealed class PointSystem : SharedPointSystem +{ + [Dependency] private readonly CharacterInfoSystem _characterInfo = default!; + + /// + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnHandleState); + SubscribeLocalEvent(OnGetCharacterInfoControls); + } + + private void OnHandleState(EntityUid uid, PointManagerComponent component, ref ComponentHandleState args) + { + if (args.Current is not PointManagerComponentState state) + return; + + component.Points = new(state.Points); + component.Scoreboard = state.Scoreboard; + _characterInfo.RequestCharacterInfo(); + } + + private void OnGetCharacterInfoControls(ref CharacterInfoSystem.GetCharacterInfoControlsEvent ev) + { + foreach (var point in EntityQuery()) + { + var box = new BoxContainer + { + Margin = new Thickness(5), + Orientation = BoxContainer.LayoutOrientation.Vertical + }; + + var title = new RichTextLabel + { + HorizontalAlignment = Control.HAlignment.Center + }; + title.SetMarkup(Loc.GetString("point-scoreboard-header")); + + var text = new RichTextLabel(); + text.SetMessage(point.Scoreboard); + + box.AddChild(title); + box.AddChild(text); + ev.Controls.Add(box); + } + } +} diff --git a/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs b/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs index a09b458685..71a06d58ee 100644 --- a/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs +++ b/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs @@ -109,6 +109,7 @@ public sealed class CharacterUIController : UIController, IOnStateEntered -