From 51cd179d60949b7418f0cd4555003ae557ef3b80 Mon Sep 17 00:00:00 2001 From: Debug <49997488+DebugOk@users.noreply.github.com> Date: Thu, 26 Oct 2023 20:55:30 +0200 Subject: [PATCH 1/4] Create ShipyardTests.cs --- .../Tests/_NF/ShipyardTests.cs | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Content.IntegrationTests/Tests/_NF/ShipyardTests.cs diff --git a/Content.IntegrationTests/Tests/_NF/ShipyardTests.cs b/Content.IntegrationTests/Tests/_NF/ShipyardTests.cs new file mode 100644 index 00000000000..9e3cbac5a9d --- /dev/null +++ b/Content.IntegrationTests/Tests/_NF/ShipyardTests.cs @@ -0,0 +1,100 @@ +using System.Linq; +using Content.Server.Cargo.Systems; +using Content.Shared.Shipyard.Prototypes; +using Robust.Server.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Map; +using Robust.Shared.Map.Components; +using Robust.Shared.Prototypes; + +namespace Content.IntegrationTests.Tests._NF; + +[TestFixture] +public sealed class ShipyardTest +{ + [Test] + public async Task CheckAllShuttleGrids() + { + await using var pair = await PoolManager.GetServerClient(); + var server = pair.Server; + + var entManager = server.ResolveDependency(); + var protoManager = server.ResolveDependency(); + var mapLoader = entManager.System(); + var mapManager = server.ResolveDependency(); + + await server.WaitPost(() => + { + Assert.Multiple(() => + { + foreach (var vessel in protoManager.EnumeratePrototypes()) + { + var mapId = mapManager.CreateMap(); + + try + { + Assert.That(mapLoader.TryLoad(mapId, vessel.ShuttlePath.ToString(), out var roots)); + Assert.That(roots.Where(uid => entManager.HasComponent(uid)), Is.Not.Empty); + } + catch (Exception ex) + { + throw new Exception($"Failed to load shuttle {vessel.ShuttlePath}", ex); + } + + try + { + mapManager.DeleteMap(mapId); + } + catch (Exception ex) + { + throw new Exception($"Failed to delete map {vessel.ShuttlePath}", ex); + } + } + }); + }); + await server.WaitRunTicks(1); + await pair.CleanReturnAsync(); + } + + [Test] + public async Task NoShipyardShipArbitrage() + { + await using var pair = await PoolManager.GetServerClient(); + var server = pair.Server; + + var entManager = server.ResolveDependency(); + var mapLoader = server.ResolveDependency().GetEntitySystem(); + var mapManager = server.ResolveDependency(); + var protoManager = server.ResolveDependency(); + var pricing = server.ResolveDependency().GetEntitySystem(); + + await server.WaitAssertion(() => + { + Assert.Multiple(() => + { + foreach (var vessel in protoManager.EnumeratePrototypes()) + { + var mapId = mapManager.CreateMap(); + double combinedPrice = 0; + + Assert.That(mapLoader.TryLoad(mapId, vessel.ShuttlePath.ToString(), out var roots)); + var shuttle = roots.FirstOrDefault(uid => entManager.HasComponent(uid)); + + pricing.AppraiseGrid(shuttle, null, (uid, price) => + { + combinedPrice += price; + }); + + Assert.That(combinedPrice, Is.AtMost(vessel.Price), + $"Found arbitrage on {vessel.ID} shuttle! Cost is {vessel.Price} but sell is {combinedPrice}!"); + Assert.That(vessel.Price - combinedPrice, Is.GreaterThan(vessel.Price * 0.05), + $"Arbitrage possible on {vessel.ID}. {vessel.Price} - {combinedPrice} = {vessel.Price - combinedPrice} > 5% of the buy price!"); + + mapManager.DeleteMap(mapId); + } + }); + }); + + await pair.CleanReturnAsync(); + } +} From ab4507d5a02aaa78f714f2b15e559f8f1d67a1e0 Mon Sep 17 00:00:00 2001 From: Debug <49997488+DebugOk@users.noreply.github.com> Date: Thu, 26 Oct 2023 20:55:38 +0200 Subject: [PATCH 2/4] Fix shipyard test failures --- Resources/Maps/Shuttles/empress.yml | 203 ------------------ Resources/Maps/Shuttles/praeda.yml | 3 - .../Entities/Clothing/Head/misc.yml | 2 +- .../Prototypes/_NF/Shipyard/marauder.yml | 2 +- .../Prototypes/_NF/Shipyard/rosebudmki.yml | 2 +- .../Prototypes/_NF/Shipyard/svnugget.yml | 4 +- Resources/Prototypes/_NF/Shipyard/svtide.yml | 4 +- 7 files changed, 7 insertions(+), 213 deletions(-) diff --git a/Resources/Maps/Shuttles/empress.yml b/Resources/Maps/Shuttles/empress.yml index c4d5c29abdb..6fddbef90b5 100644 --- a/Resources/Maps/Shuttles/empress.yml +++ b/Resources/Maps/Shuttles/empress.yml @@ -1204,110 +1204,6 @@ entities: type: GridAtmosphere - type: GasTileOverlay - type: RadiationGridResistance -- proto: ActionToggleBlock - entities: - - uid: 1028 - components: - - flags: InContainer - type: MetaData - - parent: 1027 - type: Transform -- proto: ActionToggleInternals - entities: - - uid: 910 - components: - - flags: InContainer - type: MetaData - - parent: 894 - type: Transform - - uid: 917 - components: - - flags: InContainer - type: MetaData - - parent: 915 - type: Transform - - uid: 921 - components: - - flags: InContainer - type: MetaData - - parent: 919 - type: Transform - - uid: 928 - components: - - flags: InContainer - type: MetaData - - parent: 926 - type: Transform - - uid: 936 - components: - - flags: InContainer - type: MetaData - - parent: 934 - type: Transform - - uid: 944 - components: - - flags: InContainer - type: MetaData - - parent: 942 - type: Transform - - uid: 2419 - components: - - flags: InContainer - type: MetaData - - parent: 922 - type: Transform - - uid: 2420 - components: - - flags: InContainer - type: MetaData - - parent: 924 - type: Transform -- proto: ActionToggleJetpack - entities: - - uid: 909 - components: - - flags: InContainer - type: MetaData - - parent: 894 - type: Transform - - uid: 916 - components: - - flags: InContainer - type: MetaData - - parent: 915 - type: Transform - - uid: 920 - components: - - flags: InContainer - type: MetaData - - parent: 919 - type: Transform - - uid: 927 - components: - - flags: InContainer - type: MetaData - - parent: 926 - type: Transform - - uid: 935 - components: - - flags: InContainer - type: MetaData - - parent: 934 - type: Transform - - uid: 943 - components: - - flags: InContainer - type: MetaData - - parent: 942 - type: Transform -- proto: ActionToggleLight - entities: - - uid: 1435 - components: - - flags: InContainer - type: MetaData - - parent: 1434 - type: Transform - proto: AirlockBrigGlassLocked entities: - uid: 466 @@ -9138,9 +9034,6 @@ entities: - pos: 40.5,6.5 parent: 1 type: Transform - - sleepAction: invalid - type: HealOnBuckle - - type: HealOnBuckleHealing - proto: DonkpocketBoxSpawner entities: - uid: 2016 @@ -9263,15 +9156,8 @@ entities: type: MetaData - parent: 1023 type: Transform - - blockingToggleActionEntity: 1028 - type: Blocking - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 1028 - type: ContainerContainer - type: InsideEntityStorage - proto: ExGrenade entities: @@ -13373,18 +13259,8 @@ entities: type: MetaData - parent: 671 type: Transform - - toggleActionEntity: 910 - type: GasTank - - toggleActionEntity: 909 - type: Jetpack - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 909 - - 910 - type: ContainerContainer - type: InsideEntityStorage - uid: 915 components: @@ -13392,18 +13268,8 @@ entities: type: MetaData - parent: 672 type: Transform - - toggleActionEntity: 917 - type: GasTank - - toggleActionEntity: 916 - type: Jetpack - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 916 - - 917 - type: ContainerContainer - type: InsideEntityStorage - uid: 919 components: @@ -13411,18 +13277,8 @@ entities: type: MetaData - parent: 2418 type: Transform - - toggleActionEntity: 921 - type: GasTank - - toggleActionEntity: 920 - type: Jetpack - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 920 - - 921 - type: ContainerContainer - type: InsideEntityStorage - uid: 926 components: @@ -13430,18 +13286,8 @@ entities: type: MetaData - parent: 674 type: Transform - - toggleActionEntity: 928 - type: GasTank - - toggleActionEntity: 927 - type: Jetpack - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 927 - - 928 - type: ContainerContainer - type: InsideEntityStorage - uid: 934 components: @@ -13449,18 +13295,8 @@ entities: type: MetaData - parent: 675 type: Transform - - toggleActionEntity: 936 - type: GasTank - - toggleActionEntity: 935 - type: Jetpack - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 935 - - 936 - type: ContainerContainer - type: InsideEntityStorage - uid: 942 components: @@ -13468,18 +13304,8 @@ entities: type: MetaData - parent: 676 type: Transform - - toggleActionEntity: 944 - type: GasTank - - toggleActionEntity: 943 - type: Jetpack - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 943 - - 944 - type: ContainerContainer - type: InsideEntityStorage - uid: 1309 components: @@ -13562,21 +13388,6 @@ entities: - pos: -3.2778687,6.908551 parent: 1 type: Transform - - toggleActionEntity: 1435 - type: HandheldLight - - containers: - cell_slot: !type:ContainerSlot - showEnts: False - occludes: True - ent: null - ProvidedActionContainer: !type:Container - showEnts: False - occludes: True - ents: - - 1435 - type: ContainerContainer - - canCollide: True - type: Physics - uid: 2033 components: - pos: 4.235004,10.953442 @@ -14125,15 +13936,8 @@ entities: type: MetaData - parent: 2418 type: Transform - - toggleActionEntity: 2420 - type: GasTank - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 2420 - type: ContainerContainer - type: InsideEntityStorage - uid: 931 components: @@ -14227,15 +14031,8 @@ entities: type: MetaData - parent: 2418 type: Transform - - toggleActionEntity: 2419 - type: GasTank - canCollide: False type: Physics - - containers: - ProvidedActionContainer: !type:Container - ents: - - 2419 - type: ContainerContainer - type: InsideEntityStorage - uid: 930 components: diff --git a/Resources/Maps/Shuttles/praeda.yml b/Resources/Maps/Shuttles/praeda.yml index 852f08a3519..a9e15f078f4 100644 --- a/Resources/Maps/Shuttles/praeda.yml +++ b/Resources/Maps/Shuttles/praeda.yml @@ -8253,9 +8253,6 @@ entities: - pos: 0.5,-6.5 parent: 1 type: Transform - - recentlyEjected: - - invalid - type: DisposalUnit - uid: 1243 components: - pos: -1.5,-31.5 diff --git a/Resources/Prototypes/Entities/Clothing/Head/misc.yml b/Resources/Prototypes/Entities/Clothing/Head/misc.yml index 50e3da93fbf..565eabb0018 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/misc.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/misc.yml @@ -150,7 +150,7 @@ sprite: Clothing/Head/Misc/fancycrown.rsi - type: Clothing sprite: Clothing/Head/Misc/fancycrown.rsi - - type: MobPrice + - type: StaticPrice price: 3000 - type: AddAccentClothing accent: MobsterAccent diff --git a/Resources/Prototypes/_NF/Shipyard/marauder.yml b/Resources/Prototypes/_NF/Shipyard/marauder.yml index a0e3eb12098..a710dc9ec0c 100644 --- a/Resources/Prototypes/_NF/Shipyard/marauder.yml +++ b/Resources/Prototypes/_NF/Shipyard/marauder.yml @@ -2,7 +2,7 @@ id: Marauder name: NT Marauder description: A heavy corvette, the marauder class is a dedicated deep space patrol vessel outfitted with a reduced radar cross-section and heavily fortified against hostile assault. - price: 100220 + price: 111550 category: Large group: Security shuttlePath: /Maps/Shuttles/marauder.yml diff --git a/Resources/Prototypes/_NF/Shipyard/rosebudmki.yml b/Resources/Prototypes/_NF/Shipyard/rosebudmki.yml index e544c5b8e5e..ccd1d857a18 100644 --- a/Resources/Prototypes/_NF/Shipyard/rosebudmki.yml +++ b/Resources/Prototypes/_NF/Shipyard/rosebudmki.yml @@ -2,7 +2,7 @@ id: RosebudMKI name: NT Rosebud MKI description: A medium-sized luxury salvaging and mining vessel perfectly suited for a small crew. - price: 80000 + price: 100800 category: Medium group: Civilian shuttlePath: /Maps/Shuttles/rosebudmki.yml diff --git a/Resources/Prototypes/_NF/Shipyard/svnugget.yml b/Resources/Prototypes/_NF/Shipyard/svnugget.yml index 41c7a0b4c0a..33bd553b23d 100644 --- a/Resources/Prototypes/_NF/Shipyard/svnugget.yml +++ b/Resources/Prototypes/_NF/Shipyard/svnugget.yml @@ -2,7 +2,7 @@ id: svnugget name: SV-Nugget description: A flying hunk of wood and metal disguised as a kitchen shuttle. Not FDA approved. - price: 12250 + price: 12985 category: Small group: Civilian shuttlePath: /Maps/Shuttles/svnugget.yml @@ -24,4 +24,4 @@ - type: StationJobs overflowJobs: [] availableJobs: - Passenger: [ 0, 0 ] \ No newline at end of file + Passenger: [ 0, 0 ] diff --git a/Resources/Prototypes/_NF/Shipyard/svtide.yml b/Resources/Prototypes/_NF/Shipyard/svtide.yml index 3d6cdc8ecf7..812fe6f5908 100644 --- a/Resources/Prototypes/_NF/Shipyard/svtide.yml +++ b/Resources/Prototypes/_NF/Shipyard/svtide.yml @@ -2,7 +2,7 @@ id: svtide name: SV-Tide description: A cheaply made mass-produced shuttle made from salvaged wrecks. For the seasoned assistant. - price: 9150 + price: 9700 category: Small group: Civilian shuttlePath: /Maps/Shuttles/svtide.yml @@ -24,4 +24,4 @@ - type: StationJobs overflowJobs: [] availableJobs: - Passenger: [ 0, 0 ] \ No newline at end of file + Passenger: [ 0, 0 ] From 128af27ecd511942b8b69bb95eed9d58a90b90ef Mon Sep 17 00:00:00 2001 From: Dvir Date: Sun, 7 Jan 2024 20:12:40 +0200 Subject: [PATCH 3/4] Remove map changes --- Resources/Maps/Shuttles/empress.yml | 203 ++++++++++++++++++++++++++++ Resources/Maps/Shuttles/praeda.yml | 3 + 2 files changed, 206 insertions(+) diff --git a/Resources/Maps/Shuttles/empress.yml b/Resources/Maps/Shuttles/empress.yml index 6fddbef90b5..c4d5c29abdb 100644 --- a/Resources/Maps/Shuttles/empress.yml +++ b/Resources/Maps/Shuttles/empress.yml @@ -1204,6 +1204,110 @@ entities: type: GridAtmosphere - type: GasTileOverlay - type: RadiationGridResistance +- proto: ActionToggleBlock + entities: + - uid: 1028 + components: + - flags: InContainer + type: MetaData + - parent: 1027 + type: Transform +- proto: ActionToggleInternals + entities: + - uid: 910 + components: + - flags: InContainer + type: MetaData + - parent: 894 + type: Transform + - uid: 917 + components: + - flags: InContainer + type: MetaData + - parent: 915 + type: Transform + - uid: 921 + components: + - flags: InContainer + type: MetaData + - parent: 919 + type: Transform + - uid: 928 + components: + - flags: InContainer + type: MetaData + - parent: 926 + type: Transform + - uid: 936 + components: + - flags: InContainer + type: MetaData + - parent: 934 + type: Transform + - uid: 944 + components: + - flags: InContainer + type: MetaData + - parent: 942 + type: Transform + - uid: 2419 + components: + - flags: InContainer + type: MetaData + - parent: 922 + type: Transform + - uid: 2420 + components: + - flags: InContainer + type: MetaData + - parent: 924 + type: Transform +- proto: ActionToggleJetpack + entities: + - uid: 909 + components: + - flags: InContainer + type: MetaData + - parent: 894 + type: Transform + - uid: 916 + components: + - flags: InContainer + type: MetaData + - parent: 915 + type: Transform + - uid: 920 + components: + - flags: InContainer + type: MetaData + - parent: 919 + type: Transform + - uid: 927 + components: + - flags: InContainer + type: MetaData + - parent: 926 + type: Transform + - uid: 935 + components: + - flags: InContainer + type: MetaData + - parent: 934 + type: Transform + - uid: 943 + components: + - flags: InContainer + type: MetaData + - parent: 942 + type: Transform +- proto: ActionToggleLight + entities: + - uid: 1435 + components: + - flags: InContainer + type: MetaData + - parent: 1434 + type: Transform - proto: AirlockBrigGlassLocked entities: - uid: 466 @@ -9034,6 +9138,9 @@ entities: - pos: 40.5,6.5 parent: 1 type: Transform + - sleepAction: invalid + type: HealOnBuckle + - type: HealOnBuckleHealing - proto: DonkpocketBoxSpawner entities: - uid: 2016 @@ -9156,8 +9263,15 @@ entities: type: MetaData - parent: 1023 type: Transform + - blockingToggleActionEntity: 1028 + type: Blocking - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 1028 + type: ContainerContainer - type: InsideEntityStorage - proto: ExGrenade entities: @@ -13259,8 +13373,18 @@ entities: type: MetaData - parent: 671 type: Transform + - toggleActionEntity: 910 + type: GasTank + - toggleActionEntity: 909 + type: Jetpack - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 909 + - 910 + type: ContainerContainer - type: InsideEntityStorage - uid: 915 components: @@ -13268,8 +13392,18 @@ entities: type: MetaData - parent: 672 type: Transform + - toggleActionEntity: 917 + type: GasTank + - toggleActionEntity: 916 + type: Jetpack - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 916 + - 917 + type: ContainerContainer - type: InsideEntityStorage - uid: 919 components: @@ -13277,8 +13411,18 @@ entities: type: MetaData - parent: 2418 type: Transform + - toggleActionEntity: 921 + type: GasTank + - toggleActionEntity: 920 + type: Jetpack - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 920 + - 921 + type: ContainerContainer - type: InsideEntityStorage - uid: 926 components: @@ -13286,8 +13430,18 @@ entities: type: MetaData - parent: 674 type: Transform + - toggleActionEntity: 928 + type: GasTank + - toggleActionEntity: 927 + type: Jetpack - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 927 + - 928 + type: ContainerContainer - type: InsideEntityStorage - uid: 934 components: @@ -13295,8 +13449,18 @@ entities: type: MetaData - parent: 675 type: Transform + - toggleActionEntity: 936 + type: GasTank + - toggleActionEntity: 935 + type: Jetpack - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 935 + - 936 + type: ContainerContainer - type: InsideEntityStorage - uid: 942 components: @@ -13304,8 +13468,18 @@ entities: type: MetaData - parent: 676 type: Transform + - toggleActionEntity: 944 + type: GasTank + - toggleActionEntity: 943 + type: Jetpack - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 943 + - 944 + type: ContainerContainer - type: InsideEntityStorage - uid: 1309 components: @@ -13388,6 +13562,21 @@ entities: - pos: -3.2778687,6.908551 parent: 1 type: Transform + - toggleActionEntity: 1435 + type: HandheldLight + - containers: + cell_slot: !type:ContainerSlot + showEnts: False + occludes: True + ent: null + ProvidedActionContainer: !type:Container + showEnts: False + occludes: True + ents: + - 1435 + type: ContainerContainer + - canCollide: True + type: Physics - uid: 2033 components: - pos: 4.235004,10.953442 @@ -13936,8 +14125,15 @@ entities: type: MetaData - parent: 2418 type: Transform + - toggleActionEntity: 2420 + type: GasTank - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 2420 + type: ContainerContainer - type: InsideEntityStorage - uid: 931 components: @@ -14031,8 +14227,15 @@ entities: type: MetaData - parent: 2418 type: Transform + - toggleActionEntity: 2419 + type: GasTank - canCollide: False type: Physics + - containers: + ProvidedActionContainer: !type:Container + ents: + - 2419 + type: ContainerContainer - type: InsideEntityStorage - uid: 930 components: diff --git a/Resources/Maps/Shuttles/praeda.yml b/Resources/Maps/Shuttles/praeda.yml index a9e15f078f4..852f08a3519 100644 --- a/Resources/Maps/Shuttles/praeda.yml +++ b/Resources/Maps/Shuttles/praeda.yml @@ -8253,6 +8253,9 @@ entities: - pos: 0.5,-6.5 parent: 1 type: Transform + - recentlyEjected: + - invalid + type: DisposalUnit - uid: 1243 components: - pos: -1.5,-31.5 From 970ad5c69572f1cc841701df1e207d19c9f8ff85 Mon Sep 17 00:00:00 2001 From: Dvir Date: Sun, 7 Jan 2024 20:13:57 +0200 Subject: [PATCH 4/4] Update rosebudmki.yml --- Resources/Prototypes/_NF/Shipyard/rosebudmki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/_NF/Shipyard/rosebudmki.yml b/Resources/Prototypes/_NF/Shipyard/rosebudmki.yml index ccd1d857a18..e544c5b8e5e 100644 --- a/Resources/Prototypes/_NF/Shipyard/rosebudmki.yml +++ b/Resources/Prototypes/_NF/Shipyard/rosebudmki.yml @@ -2,7 +2,7 @@ id: RosebudMKI name: NT Rosebud MKI description: A medium-sized luxury salvaging and mining vessel perfectly suited for a small crew. - price: 100800 + price: 80000 category: Medium group: Civilian shuttlePath: /Maps/Shuttles/rosebudmki.yml