From 9522dbc655c19b5154b98a4adce6546897d95042 Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:58:28 +0200 Subject: [PATCH] Vox nukies and ninjafix (#29783) * Nukie species gear * antagselectionsystem autointernals * nukie vox * skrek * Remove duplicate code * skrek * EVA tank loadouts, vox ninja update * fix prototype duplication * skrek * fix summary * fixed empty startinggear error * enable vox ninjas * Comments * removed comment because startinggearprototype should not be used on antagselection aaaanyway * squish that if * Update Content.Shared/Clothing/LoadoutSystem.cs --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> --- Content.Server/Antag/AntagSelectionSystem.cs | 15 ++++++++- .../Components/AntagSelectionComponent.cs | 7 +++++ Content.Shared/Clothing/LoadoutSystem.cs | 31 ++++++++++++++----- .../en-US/preferences/loadout-groups.ftl | 1 + Resources/Prototypes/GameRules/events.yml | 6 ++-- Resources/Prototypes/GameRules/roundstart.yml | 8 ++++- .../Loadouts/Miscellaneous/survival.yml | 21 +++++++++++-- .../Prototypes/Loadouts/loadout_groups.yml | 18 ++++++++--- .../Prototypes/Loadouts/role_loadouts.yml | 6 ++++ Resources/Prototypes/Roles/Antags/ninja.yml | 2 -- Resources/Prototypes/Roles/Antags/nukeops.yml | 2 -- 11 files changed, 92 insertions(+), 25 deletions(-) diff --git a/Content.Server/Antag/AntagSelectionSystem.cs b/Content.Server/Antag/AntagSelectionSystem.cs index 496fcbb550..64b26509c4 100644 --- a/Content.Server/Antag/AntagSelectionSystem.cs +++ b/Content.Server/Antag/AntagSelectionSystem.cs @@ -13,11 +13,14 @@ using Content.Server.Roles.Jobs; using Content.Server.Shuttles.Components; using Content.Server.Station.Systems; using Content.Shared.Antag; +using Content.Shared.Clothing; using Content.Shared.GameTicking; using Content.Shared.GameTicking.Components; using Content.Shared.Ghost; using Content.Shared.Humanoid; using Content.Shared.Players; +using Content.Shared.Preferences.Loadouts; +using Content.Shared.Roles; using Content.Shared.Whitelist; using Robust.Server.Audio; using Robust.Server.GameObjects; @@ -25,6 +28,7 @@ using Robust.Server.Player; using Robust.Shared.Enums; using Robust.Shared.Map; using Robust.Shared.Player; +using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Utility; @@ -35,10 +39,13 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem>? gear = new(); + if (def.StartingGear is not null) + gear.Add(def.StartingGear.Value); + + _loadout.Equip(player, gear, def.RoleLoadout); if (session != null) { diff --git a/Content.Server/Antag/Components/AntagSelectionComponent.cs b/Content.Server/Antag/Components/AntagSelectionComponent.cs index 1ab16e8aec..0e5a0afc9b 100644 --- a/Content.Server/Antag/Components/AntagSelectionComponent.cs +++ b/Content.Server/Antag/Components/AntagSelectionComponent.cs @@ -1,6 +1,7 @@ using Content.Server.Administration.Systems; using Content.Shared.Antag; using Content.Shared.Destructible.Thresholds; +using Content.Shared.Preferences.Loadouts; using Content.Shared.Roles; using Content.Shared.Storage; using Content.Shared.Whitelist; @@ -154,6 +155,12 @@ public partial struct AntagSelectionDefinition() [DataField] public ProtoId? StartingGear; + /// + /// A list of role loadouts, from which a randomly selected one will be equipped. + /// + [DataField] + public List>? RoleLoadout; + /// /// A briefing shown to the player. /// diff --git a/Content.Shared/Clothing/LoadoutSystem.cs b/Content.Shared/Clothing/LoadoutSystem.cs index 7605845626..2a686efd4f 100644 --- a/Content.Shared/Clothing/LoadoutSystem.cs +++ b/Content.Shared/Clothing/LoadoutSystem.cs @@ -139,22 +139,37 @@ public sealed class LoadoutSystem : EntitySystem private void OnMapInit(EntityUid uid, LoadoutComponent component, MapInitEvent args) { - // Use starting gear if specified - if (component.StartingGear != null) + Equip(uid, component.StartingGear, component.RoleLoadout); + } + + public void Equip(EntityUid uid, List>? startingGear, + List>? loadoutGroups) + { + // First, randomly pick a startingGear profile from those specified, and equip it. + if (startingGear != null && startingGear.Count > 0) + _station.EquipStartingGear(uid, _random.Pick(startingGear)); + + if (loadoutGroups == null) { - _station.EquipStartingGear(uid, _random.Pick(component.StartingGear)); + GearEquipped(uid); return; } - if (component.RoleLoadout == null) - return; - - // ...otherwise equip from role loadout - var id = _random.Pick(component.RoleLoadout); + // Then, randomly pick a RoleLoadout profile from those specified, and process/equip all LoadoutGroups from it. + // For non-roundstart mobs there is no SelectedLoadout data, so minValue must be set in each LoadoutGroup to force selection. + var id = _random.Pick(loadoutGroups); var proto = _protoMan.Index(id); var loadout = new RoleLoadout(id); loadout.SetDefault(GetProfile(uid), _actors.GetSession(uid), _protoMan, true); _station.EquipRoleLoadout(uid, loadout, proto); + + GearEquipped(uid); + } + + public void GearEquipped(EntityUid uid) + { + var ev = new StartingGearEquippedEvent(uid); + RaiseLocalEvent(uid, ref ev); } public HumanoidCharacterProfile GetProfile(EntityUid? uid) diff --git a/Resources/Locale/en-US/preferences/loadout-groups.ftl b/Resources/Locale/en-US/preferences/loadout-groups.ftl index 28785e305c..b1fba215d9 100644 --- a/Resources/Locale/en-US/preferences/loadout-groups.ftl +++ b/Resources/Locale/en-US/preferences/loadout-groups.ftl @@ -14,6 +14,7 @@ loadout-group-survival-security = Security Survival Box loadout-group-survival-syndicate = Github is forcing me to write text that is literally twice-impossible for the player to ever see, send help loadout-group-breath-tool = Species-dependent breath tools loadout-group-tank-harness = Species-specific survival equipment +loadout-group-EVA-tank = Species-specific gas tank # Command loadout-group-captain-head = Captain head diff --git a/Resources/Prototypes/GameRules/events.yml b/Resources/Prototypes/GameRules/events.yml index 01a9f00257..fe9d6410d0 100644 --- a/Resources/Prototypes/GameRules/events.yml +++ b/Resources/Prototypes/GameRules/events.yml @@ -151,10 +151,6 @@ minimumPlayers: 30 - type: SpaceSpawnRule - type: AntagLoadProfileRule - # Vox disabled until loadouts work on AntagSelection-based spawns - speciesOverride: Human - speciesOverrideBlacklist: - - Vox - type: AntagObjectives objectives: - StealResearchObjective @@ -171,6 +167,8 @@ max: 1 pickPlayer: false startingGear: SpaceNinjaGear + roleLoadout: + - RoleSurvivalEVA briefing: text: ninja-role-greeting color: Green diff --git a/Resources/Prototypes/GameRules/roundstart.yml b/Resources/Prototypes/GameRules/roundstart.yml index 3e4ea6d7b3..a10a6c8d2a 100644 --- a/Resources/Prototypes/GameRules/roundstart.yml +++ b/Resources/Prototypes/GameRules/roundstart.yml @@ -86,7 +86,7 @@ #Species that do not work with nukies should be included in this list. #Once the issues are fixed the species should be removed from this list to be enabled. #Balance concerns are not a valid reason to disable a species, except for high-impact Nukie-specific exploits. - - Vox + #- Vox - type: entity parent: BaseNukeopsRule @@ -103,6 +103,8 @@ fallbackRoles: [ Nukeops, NukeopsMedic ] spawnerPrototype: SpawnPointNukeopsCommander startingGear: SyndicateCommanderGearFull + roleLoadout: + - RoleSurvivalSyndicate components: - type: NukeOperative - type: RandomMetadata @@ -119,6 +121,8 @@ fallbackRoles: [ Nukeops, NukeopsCommander ] spawnerPrototype: SpawnPointNukeopsMedic startingGear: SyndicateOperativeMedicFull + roleLoadout: + - RoleSurvivalSyndicate components: - type: NukeOperative - type: RandomMetadata @@ -137,6 +141,8 @@ max: 3 playerRatio: 10 startingGear: SyndicateOperativeGearFull + roleLoadout: + - RoleSurvivalSyndicate components: - type: NukeOperative - type: RandomMetadata diff --git a/Resources/Prototypes/Loadouts/Miscellaneous/survival.yml b/Resources/Prototypes/Loadouts/Miscellaneous/survival.yml index d308c62506..001e8a188e 100644 --- a/Resources/Prototypes/Loadouts/Miscellaneous/survival.yml +++ b/Resources/Prototypes/Loadouts/Miscellaneous/survival.yml @@ -142,15 +142,32 @@ # Pre-equipped species gear -# Full Tank Equipped +# Full tank for vox as part of any Survival loadout - type: loadout - id: LoadoutSpeciesEVANitrogen + id: LoadoutSpeciesVoxNitrogen effects: - !type:GroupLoadoutEffect proto: EffectSpeciesVox equipment: suitstorage: NitrogenTankFilled +# Full EVA Tank, Any Species +- type: loadout + id: LoadoutSpeciesEVANitrogen + effects: + - !type:GroupLoadoutEffect + proto: NitrogenBreather + equipment: + suitstorage: NitrogenTankFilled + +- type: loadout + id: LoadoutSpeciesEVAOxygen + effects: + - !type:GroupLoadoutEffect + proto: OxygenBreather + equipment: + suitstorage: OxygenTankFilled + # Tank Harness - type: loadout id: LoadoutTankHarness diff --git a/Resources/Prototypes/Loadouts/loadout_groups.yml b/Resources/Prototypes/Loadouts/loadout_groups.yml index b1d267cc00..1df741b3c7 100644 --- a/Resources/Prototypes/Loadouts/loadout_groups.yml +++ b/Resources/Prototypes/Loadouts/loadout_groups.yml @@ -51,7 +51,15 @@ loadouts: - EmergencyNitrogen - EmergencyOxygen + - LoadoutSpeciesVoxNitrogen + +- type: loadoutGroup + id: GroupEVATank + name: loadout-group-EVA-tank + hidden: true + loadouts: - LoadoutSpeciesEVANitrogen + - LoadoutSpeciesEVAOxygen # Command - type: loadoutGroup @@ -423,7 +431,7 @@ loadouts: - EmergencyNitrogenClown - EmergencyOxygenClown - - LoadoutSpeciesEVANitrogen + - LoadoutSpeciesVoxNitrogen - type: loadoutGroup id: MimeHead @@ -746,7 +754,7 @@ loadouts: - EmergencyNitrogenExtended - EmergencyOxygenExtended - - LoadoutSpeciesEVANitrogen + - LoadoutSpeciesVoxNitrogen # Science - type: loadoutGroup @@ -1026,7 +1034,7 @@ loadouts: - EmergencyNitrogenSecurity - EmergencyOxygenSecurity - - LoadoutSpeciesEVANitrogen + - LoadoutSpeciesVoxNitrogen # Medical - type: loadoutGroup @@ -1208,7 +1216,7 @@ loadouts: - EmergencyNitrogenMedical - EmergencyOxygenMedical - - LoadoutSpeciesEVANitrogen + - LoadoutSpeciesVoxNitrogen # Wildcards - type: loadoutGroup @@ -1243,7 +1251,7 @@ loadouts: - EmergencyNitrogenSyndicate - EmergencyOxygenSyndicate - - LoadoutSpeciesEVANitrogen + - LoadoutSpeciesVoxNitrogen - type: loadoutGroup id: GroupSpeciesBreathTool diff --git a/Resources/Prototypes/Loadouts/role_loadouts.yml b/Resources/Prototypes/Loadouts/role_loadouts.yml index bb30cc182a..c204f87c93 100644 --- a/Resources/Prototypes/Loadouts/role_loadouts.yml +++ b/Resources/Prototypes/Loadouts/role_loadouts.yml @@ -550,3 +550,9 @@ - SurvivalSyndicate - GroupSpeciesBreathTool - GroupTankHarness + +- type: roleLoadout + id: RoleSurvivalEVA + groups: + - GroupEVATank + - SurvivalExtended diff --git a/Resources/Prototypes/Roles/Antags/ninja.yml b/Resources/Prototypes/Roles/Antags/ninja.yml index 6df8a2317e..6a9a65bb13 100644 --- a/Resources/Prototypes/Roles/Antags/ninja.yml +++ b/Resources/Prototypes/Roles/Antags/ninja.yml @@ -23,12 +23,10 @@ pocket1: SpiderCharge pocket2: PinpointerStation belt: EnergyKatana - suitstorage: OxygenTankFilled inhand: - JetpackBlackFilled storage: back: # belt holds katana so satchel has the tools for sabotaging things - - BoxSurvival - Crowbar - Wrench - Screwdriver diff --git a/Resources/Prototypes/Roles/Antags/nukeops.yml b/Resources/Prototypes/Roles/Antags/nukeops.yml index 8dec692ee5..52d422876f 100644 --- a/Resources/Prototypes/Roles/Antags/nukeops.yml +++ b/Resources/Prototypes/Roles/Antags/nukeops.yml @@ -55,7 +55,6 @@ belt: ClothingBeltMilitaryWebbing storage: back: - - BoxSurvivalSyndicate - WeaponPistolViper - PinpointerSyndicateNuclear - DeathAcidifierImplanter @@ -90,7 +89,6 @@ storage: back: - SyndiHypo - - BoxSurvivalSyndicate - SawAdvanced - Cautery - CombatKnife -- 2.52.0