Skip to content

Commit

Permalink
Shiptest Fixups (#2158)
Browse files Browse the repository at this point in the history
* ShipPrice Fucky

* destroy all of the invalid entity refs

* No redundant value in shipyard test, revalue ships

---------

Co-authored-by: Whatstone <[email protected]>
  • Loading branch information
dvir001 and whatston3 authored Oct 6, 2024
1 parent 2664fe8 commit 52c3123
Show file tree
Hide file tree
Showing 49 changed files with 95 additions and 588 deletions.
14 changes: 7 additions & 7 deletions Content.IntegrationTests/Tests/_NF/ShipyardTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using Content.Server.Cargo.Systems;
using Content.Shared.Shipyard.Prototypes;
using Robust.Server.GameObjects;
Expand Down Expand Up @@ -75,20 +75,20 @@ await server.WaitAssertion(() =>
foreach (var vessel in protoManager.EnumeratePrototypes<VesselPrototype>())
{
var mapId = mapManager.CreateMap();
double combinedPrice = 0;
double appraisePrice = 0;

Assert.That(mapLoader.TryLoad(mapId, vessel.ShuttlePath.ToString(), out var roots));
var shuttle = roots.FirstOrDefault(uid => entManager.HasComponent<MapGridComponent>(uid));

pricing.AppraiseGrid(shuttle, null, (uid, price) =>
{
combinedPrice += price;
appraisePrice += 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!");
var idealMinPrice = appraisePrice * vessel.MinPriceMarkup;

Assert.That(vessel.Price, Is.AtLeast(idealMinPrice),
$"Arbitrage possible on {vessel.ID}. Minimal price should be {idealMinPrice}, {(vessel.MinPriceMarkup - 1.0f) * 100}% over the appraise price ({appraisePrice}).");

mapManager.DeleteMap(mapId);
}
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Shipyard/Prototypes/VesselPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public sealed class VesselPrototype : IPrototype
/// </summary>
[DataField]
public ProtoId<GuideEntryPrototype>? GuidebookPage = default!;

/// <summary>
/// The price markup of the vessel testing
/// </summary>
[DataField]
public float MinPriceMarkup = 1.05f;
}

public enum VesselSize : byte
Expand Down
18 changes: 0 additions & 18 deletions Resources/Maps/_NF/POI/edison.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12887,8 +12887,6 @@ entities:
pos: 16.5,19.5
parent: 2
- type: DeviceList
configurators:
- invalid
devices:
- 1588
- 1587
Expand Down Expand Up @@ -13066,8 +13064,6 @@ entities:
pos: -13.5,14.5
parent: 2
- type: DeviceList
configurators:
- invalid
devices:
- 1750
- 1751
Expand Down Expand Up @@ -13114,8 +13110,6 @@ entities:
pos: -11.5,1.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 3947
- uid: 1566
Expand All @@ -13124,8 +13118,6 @@ entities:
pos: 12.5,1.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 3948
- uid: 1567
Expand Down Expand Up @@ -13698,8 +13690,6 @@ entities:
pos: -13.5,9.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 3955
- 3956
Expand All @@ -13710,8 +13700,6 @@ entities:
pos: -13.5,10.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 3955
- 3956
Expand All @@ -13722,8 +13710,6 @@ entities:
pos: -5.5,16.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 3818
- 3817
Expand All @@ -13735,8 +13721,6 @@ entities:
pos: -5.5,17.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 3818
- 3817
Expand All @@ -13748,8 +13732,6 @@ entities:
pos: -5.5,18.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 3818
- 3817
Expand Down
14 changes: 0 additions & 14 deletions Resources/Maps/_NF/Shuttles/Expedition/brigand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2536,8 +2536,6 @@ entities:
pos: -0.5,-0.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 647
- uid: 198
Expand All @@ -2547,8 +2545,6 @@ entities:
pos: -0.5,-4.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 647
- uid: 204
Expand All @@ -2558,8 +2554,6 @@ entities:
pos: -0.5,5.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 647
- uid: 220
Expand All @@ -2574,8 +2568,6 @@ entities:
pos: 0.5,5.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 647
- uid: 433
Expand All @@ -2591,8 +2583,6 @@ entities:
pos: -1.5,-4.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 647
- uid: 450
Expand All @@ -2602,8 +2592,6 @@ entities:
pos: 0.5,-4.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 647
- uid: 459
Expand All @@ -2613,8 +2601,6 @@ entities:
pos: 0.5,-0.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 647
- uid: 460
Expand Down
5 changes: 0 additions & 5 deletions Resources/Maps/_NF/Shuttles/Expedition/decadedove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3111,11 +3111,6 @@ entities:
rot: 3.141592653589793 rad
pos: -1.5,-5.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 2
- proto: FloorDrain
entities:
- uid: 729
Expand Down
6 changes: 0 additions & 6 deletions Resources/Maps/_NF/Shuttles/Nfsd/broadhead.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4429,9 +4429,6 @@ entities:
- type: Transform
pos: 8.5,-12.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
- proto: SurveillanceCameraSecurity
entities:
- uid: 244
Expand Down Expand Up @@ -4557,9 +4554,6 @@ entities:
rot: -1.5707963267948966 rad
pos: 4.5,-18.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
- type: SurveillanceCamera
setupAvailableNetworks:
- SurveillanceCameraSecurity
Expand Down
6 changes: 0 additions & 6 deletions Resources/Maps/_NF/Shuttles/Nfsd/prowler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1745,9 +1745,6 @@ entities:
rot: 1.5707963267948966 rad
pos: -1.5,7.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
- proto: ConveyorBelt
entities:
- uid: 224
Expand Down Expand Up @@ -3200,9 +3197,6 @@ entities:
- type: Transform
pos: -1.5,8.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
- proto: SurveillanceCameraSecurity
entities:
- uid: 418
Expand Down
6 changes: 0 additions & 6 deletions Resources/Maps/_NF/Shuttles/Scrap/point.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1234,8 +1234,6 @@ entities:
pos: 1.5,1.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 58
- proto: FirelockEdge
Expand Down Expand Up @@ -1520,8 +1518,6 @@ entities:
pos: 4.5,0.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 58
- type: AtmosPipeColor
Expand All @@ -1546,8 +1542,6 @@ entities:
pos: 2.5,0.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 58
- type: AtmosPipeColor
Expand Down
6 changes: 0 additions & 6 deletions Resources/Maps/_NF/Shuttles/Sr/broom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,6 @@ entities:
rot: 1.5707963267948966 rad
pos: -0.5,0.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
- type: AtmosPipeColor
color: '#0055CCFF'
- proto: GasVentScrubber
Expand All @@ -521,9 +518,6 @@ entities:
- type: Transform
pos: 1.5,-0.5
parent: 1
- type: DeviceNetwork
configurators:
- invalid
- type: AtmosPipeColor
color: '#990000FF'
- proto: GravityGeneratorMini
Expand Down
Loading

0 comments on commit 52c3123

Please sign in to comment.