From 58d004fe4ea8ca88c44aa8572232aa442bebffa9 Mon Sep 17 00:00:00 2001 From: Whatstone Date: Sat, 8 Jun 2024 09:46:50 -0400 Subject: [PATCH 1/5] Add loadout name, desc, preview entity overrides --- .../Preferences/UI/LoadoutContainer.xaml.cs | 19 ++++++++++++---- .../UI/LoadoutGroupContainer.xaml.cs | 2 +- .../Preferences/Loadouts/LoadoutPrototype.cs | 22 +++++++++++++++++++ .../_NF/Loadouts/Jobs/Contractor/belt.yml | 8 +++++++ 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/Content.Client/Preferences/UI/LoadoutContainer.xaml.cs b/Content.Client/Preferences/UI/LoadoutContainer.xaml.cs index a54ae970725..625403f1d1a 100644 --- a/Content.Client/Preferences/UI/LoadoutContainer.xaml.cs +++ b/Content.Client/Preferences/UI/LoadoutContainer.xaml.cs @@ -36,17 +36,28 @@ public LoadoutContainer(ProtoId proto, bool disabled, Formatte if (_protoManager.TryIndex(proto, out var loadProto)) { - var ent = _entManager.System().GetFirstOrNull(loadProto); + // Frontier: overrideable prototype fields (description, name, icon [via entity]) Price.Text = "$" + loadProto.Price; - if (ent != null) + + bool hasDescription = !string.IsNullOrEmpty(loadProto.Description); + bool hasEntity = !string.IsNullOrEmpty(loadProto.PreviewEntity.Id); + + EntProtoId? ent = null; + if (!hasEntity || !hasDescription) { + ent = _entManager.System().GetFirstOrNull(loadProto); + } + var finalEnt = hasEntity ? loadProto.PreviewEntity : ent; + if (finalEnt != null) { - _entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace); + _entity = _entManager.SpawnEntity(finalEnt, MapCoordinates.Nullspace); Sprite.SetEntity(_entity); var spriteTooltip = new Tooltip(); - spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent(_entity.Value).EntityDescription)); + var description = hasDescription ? loadProto.Description : _entManager.GetComponent(_entity.Value).EntityDescription; + spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(description)); Sprite.TooltipSupplier = _ => spriteTooltip; } + // End Frontier } } diff --git a/Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs b/Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs index 8dc1c405394..374b63b9f29 100644 --- a/Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs +++ b/Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs @@ -77,7 +77,7 @@ public void RefreshLoadouts(RoleLoadout loadout, ICommonSession session, IDepend var enabled = loadout.IsValid(session, loadoutProto, collection, out var reason); var loadoutContainer = new LoadoutContainer(loadoutProto, !enabled, reason); loadoutContainer.Select.Pressed = pressed; - loadoutContainer.Text = loadoutSystem.GetName(loadProto); + loadoutContainer.Text = string.IsNullOrEmpty(loadProto.Name) ? loadoutSystem.GetName(loadProto) : loadProto.Name; // Frontier: allow overriding loadout names loadoutContainer.Select.OnPressed += args => { diff --git a/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs b/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs index c84a30d0e3f..dd4ba462851 100644 --- a/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs +++ b/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs @@ -1,6 +1,7 @@ using Content.Shared.Preferences.Loadouts.Effects; using Content.Shared.Roles; using Robust.Shared.Prototypes; +using Robust.Shared.Utility; namespace Content.Shared.Preferences.Loadouts; @@ -29,4 +30,25 @@ public sealed partial class LoadoutPrototype : IPrototype /// [DataField] public int Price = 0; + + /// + /// Frontier - optional name of the loadout as it appears in the menu + /// + [DataField] + public string Name = ""; + + /// + /// Frontier - optional description of the loadout as it appears in the menu + /// + [DataField] + public string Description = ""; + + /// + /// Frontier - optional entity to use for its sprite in the loadout as it appears in the menu + /// + /// + /// Currently, if not defaulted, this will be the fallback entity used to get the description if an override is not provided here. + /// + [DataField] + public EntProtoId PreviewEntity = default!; } diff --git a/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/belt.yml b/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/belt.yml index c99782cba5b..b53f320e151 100644 --- a/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/belt.yml +++ b/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/belt.yml @@ -11,6 +11,7 @@ - type: loadout id: ContractorClothingBeltPlantFilled equipment: ContractorClothingBeltPlantFilled + name: botanical belt (filled) price: 1500 - type: startingGear @@ -31,6 +32,7 @@ - type: loadout id: ContractorClothingBeltChefFilled equipment: ContractorClothingBeltChefFilled + name: chef belt (filled) price: 1500 - type: startingGear @@ -61,6 +63,7 @@ - type: loadout id: ContractorClothingBeltMedicalFilled equipment: ContractorClothingBeltMedicalFilled + name: medical belt (filled) price: 2000 - type: startingGear @@ -81,6 +84,7 @@ - type: loadout id: ContractorClothingBeltMedicalEMTFilled equipment: ContractorClothingBeltMedicalEMTFilled + name: EMT belt (filled) price: 2000 - type: startingGear @@ -101,6 +105,7 @@ - type: loadout id: ContractorClothingBeltUtilityFilled equipment: ContractorClothingBeltUtilityFilled + name: utility belt (filled) price: 1500 - type: startingGear @@ -121,6 +126,7 @@ - type: loadout id: ContractorClothingBeltSalvageWebbingFilledNF equipment: ContractorClothingBeltSalvageWebbingFilledNF + name: salvage rig (filled) price: 1500 - type: startingGear @@ -158,6 +164,7 @@ - type: loadout id: ContractorClothingBeltPilotFilled equipment: ContractorClothingBeltPilotFilled + name: pilot webbing (filled) effects: - !type:GroupLoadoutEffect proto: ContractorT1 @@ -210,6 +217,7 @@ - type: loadout id: ContractorClothingBeltChaplainSashFilled equipment: ContractorClothingBeltChaplainSashFilled + name: chaplain sash (filled) effects: - !type:GroupLoadoutEffect proto: ContractorT1 From 7b6932a7db86578a9bc62ea0de8200072b0c7c0e Mon Sep 17 00:00:00 2001 From: Whatstone Date: Sat, 8 Jun 2024 11:40:42 -0400 Subject: [PATCH 2/5] Fix for nullable fields --- Content.Client/Preferences/UI/LoadoutContainer.xaml.cs | 2 +- Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Client/Preferences/UI/LoadoutContainer.xaml.cs b/Content.Client/Preferences/UI/LoadoutContainer.xaml.cs index 625403f1d1a..ba4ac4e8ce6 100644 --- a/Content.Client/Preferences/UI/LoadoutContainer.xaml.cs +++ b/Content.Client/Preferences/UI/LoadoutContainer.xaml.cs @@ -40,7 +40,7 @@ public LoadoutContainer(ProtoId proto, bool disabled, Formatte Price.Text = "$" + loadProto.Price; bool hasDescription = !string.IsNullOrEmpty(loadProto.Description); - bool hasEntity = !string.IsNullOrEmpty(loadProto.PreviewEntity.Id); + bool hasEntity = !string.IsNullOrEmpty(loadProto.PreviewEntity?.Id); EntProtoId? ent = null; if (!hasEntity || !hasDescription) { diff --git a/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs b/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs index dd4ba462851..1e44a4fa51d 100644 --- a/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs +++ b/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs @@ -50,5 +50,5 @@ public sealed partial class LoadoutPrototype : IPrototype /// Currently, if not defaulted, this will be the fallback entity used to get the description if an override is not provided here. /// [DataField] - public EntProtoId PreviewEntity = default!; + public EntProtoId? PreviewEntity = default!; } From 24ea9f22f8e4f0496b401c963f6d0778ab44f713 Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 11 Jun 2024 19:57:07 +0300 Subject: [PATCH 3/5] Add survival box --- .../_NF/Catalog/Fills/Boxes/emergency.yml | 41 ++++--------------- .../_NF/Loadouts/Jobs/Contractor/survival.yml | 4 ++ 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/Resources/Prototypes/_NF/Catalog/Fills/Boxes/emergency.yml b/Resources/Prototypes/_NF/Catalog/Fills/Boxes/emergency.yml index 91d56e64c37..03b6170003b 100644 --- a/Resources/Prototypes/_NF/Catalog/Fills/Boxes/emergency.yml +++ b/Resources/Prototypes/_NF/Catalog/Fills/Boxes/emergency.yml @@ -1,8 +1,7 @@ - type: entity - name: oxygen survival box - parent: BoxCardboard + parent: BoxSurvival id: BoxSurvivalNFOxygen - description: It's a box with basic oxygen internals inside. + suffix: Oxygen components: - type: StorageFill contents: @@ -18,10 +17,9 @@ - state: emergencytank - type: entity - name: nitrogen survival box - parent: BoxCardboard + parent: BoxSurvival id: BoxSurvivalNFNitrogen - description: It's a box with basic nitrogen internals inside. + suffix: Nitrogen components: - type: StorageFill contents: @@ -37,10 +35,9 @@ - state: emergencytank - type: entity - name: extended-oxygen survival box - parent: BoxCardboard + parent: BoxSurvivalEngineering id: BoxSurvivalNFOxygenExtended - description: It's a box with extended internals inside. + suffix: Oxygen components: - type: StorageFill contents: @@ -56,10 +53,9 @@ - state: extendedtank - type: entity - name: extended-nitrogen survival box - parent: BoxCardboard + parent: BoxSurvivalEngineering id: BoxSurvivalNFNitrogenExtended - description: It's a box with extended nitrogen internals inside. + suffix: Nitrogen components: - type: StorageFill contents: @@ -73,24 +69,3 @@ layers: - state: internals - state: extendedtank - -- type: entity - name: survival box - parent: BoxSurvivalSecurity - id: BoxSurvivalNfsd - description: It's a box with basic internals inside. This one is labelled to contain an double extended-capacity tank. - suffix: NFSD - components: - - type: StorageFill - contents: - - id: ClothingMaskGasNfsd - - id: DoubleEmergencyAirTankFilled - - id: SpaceMedipen - - id: EmergencyMedipen - - id: FoodPSB - - id: DrinkWaterBottleFull - - id: EncryptionKeyTraffic - - type: Sprite - layers: - - state: internals - - state: extendedtank diff --git a/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/survival.yml b/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/survival.yml index 44763471e00..ea7b9e4268a 100644 --- a/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/survival.yml +++ b/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/survival.yml @@ -2,6 +2,7 @@ - type: loadout id: ContractorBoxSurvivalNFOxygen equipment: ContractorBoxSurvivalNFOxygen + name: oxygen survival box - type: startingGear id: ContractorBoxSurvivalNFOxygen @@ -12,6 +13,7 @@ - type: loadout id: ContractorBoxSurvivalNFNitrogen equipment: ContractorBoxSurvivalNFNitrogen + name: nitrogen survival box - type: startingGear id: ContractorBoxSurvivalNFNitrogen @@ -23,6 +25,7 @@ - type: loadout id: ContractorBoxSurvivalNFOxygenExtended equipment: ContractorBoxSurvivalNFOxygenExtended + name: extended-oxygen survival box effects: - !type:GroupLoadoutEffect proto: ContractorT1 @@ -37,6 +40,7 @@ - type: loadout id: ContractorBoxSurvivalNFNitrogenExtended equipment: ContractorBoxSurvivalNFNitrogenExtended + name: extended-nitrogen survival box effects: - !type:GroupLoadoutEffect proto: ContractorT1 From aab370e30ab69846519afb45b5a304105a0ef1b1 Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 11 Jun 2024 20:00:07 +0300 Subject: [PATCH 4/5] Update survival.yml --- Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/survival.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/survival.yml b/Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/survival.yml index a5904ba5af8..b51776d1746 100644 --- a/Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/survival.yml +++ b/Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/survival.yml @@ -2,6 +2,7 @@ - type: loadout id: NfsdBoxSurvivalNfsdOxygen equipment: NfsdBoxSurvivalNfsdOxygen + name: extended-oxygen survival box - type: startingGear id: NfsdBoxSurvivalNfsdOxygen @@ -12,6 +13,7 @@ - type: loadout id: NfsdBoxSurvivalNfsdNitrogen equipment: NfsdBoxSurvivalNfsdNitrogen + name: extended-nitrogen survival box - type: startingGear id: NfsdBoxSurvivalNfsdNitrogen From 6eedfd072ab704b8e062d1c25656a09a334d63cf Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 11 Jun 2024 20:24:14 +0300 Subject: [PATCH 5/5] More edits --- Resources/Prototypes/_NF/Catalog/Fills/Crates/npc.yml | 3 +-- Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/fun.yml | 4 ++++ Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/belt.yml | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Resources/Prototypes/_NF/Catalog/Fills/Crates/npc.yml b/Resources/Prototypes/_NF/Catalog/Fills/Crates/npc.yml index 93c6378a854..5bc092f289b 100644 --- a/Resources/Prototypes/_NF/Catalog/Fills/Crates/npc.yml +++ b/Resources/Prototypes/_NF/Catalog/Fills/Crates/npc.yml @@ -72,5 +72,4 @@ - type: entity id: PetCarrierNPCEmotionalSupportSafe - parent: [FillNPCEmotionalSupportSafe, PetCarrier] - name: emotional support pet in a pet carrier + parent: [PetCarrier, FillNPCEmotionalSupportSafe] diff --git a/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/fun.yml b/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/fun.yml index 66f5c9db71a..36eb90d0918 100644 --- a/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/fun.yml +++ b/Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/fun.yml @@ -2,6 +2,7 @@ - type: loadout id: ContractorBriefcaseBrownFilled equipment: ContractorBriefcaseBrownFilled + name: brown briefcase (empty) effects: - !type:GroupLoadoutEffect proto: ContractorT1 @@ -15,6 +16,7 @@ - type: loadout id: ContractorToolboxEmergency equipment: ContractorToolboxEmergency + name: emergency toolbox (empty) effects: - !type:GroupLoadoutEffect proto: ContractorT1 @@ -28,6 +30,7 @@ - type: loadout id: ContractorToolboxMechanical equipment: ContractorToolboxMechanical + name: mechanical toolbox (empty) effects: - !type:GroupLoadoutEffect proto: ContractorT1 @@ -225,6 +228,7 @@ - type: loadout id: ContractorEmotionalPetCarrier equipment: ContractorEmotionalPetCarrier + name: emotional support pet effects: - !type:GroupLoadoutEffect proto: ContractorT3 diff --git a/Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/belt.yml b/Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/belt.yml index 59aa0a1271f..4f26e5708b5 100644 --- a/Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/belt.yml +++ b/Resources/Prototypes/_NF/Loadouts/Jobs/Nfsd/belt.yml @@ -1,6 +1,7 @@ - type: loadout id: NfsdWebbing equipment: NfsdWebbing + name: nfsd webbing (filled) - type: startingGear id: NfsdWebbing @@ -10,6 +11,7 @@ - type: loadout id: NfsdBelt equipment: NfsdBelt + name: nfsd belt (filled) - type: startingGear id: NfsdBelt @@ -20,6 +22,7 @@ - type: loadout id: BrigmedicClothingBeltBrigmedicWebbing equipment: BrigmedicClothingBeltBrigmedicWebbing + name: nfsd webbing (filled) - type: startingGear id: BrigmedicClothingBeltBrigmedicWebbing