Add material arbitrage tests (#13315)
This commit is contained in:
@@ -131,9 +131,7 @@ public sealed partial class LatheMenu : DefaultWindow
|
|||||||
else
|
else
|
||||||
sb.Append('\n');
|
sb.Append('\n');
|
||||||
|
|
||||||
var adjustedAmount = amount;
|
var adjustedAmount = SharedLatheSystem.AdjustMaterial(amount, prototype.ApplyMaterialDiscount, component.MaterialUseMultiplier);
|
||||||
if (prototype.ApplyMaterialDiscount)
|
|
||||||
adjustedAmount = (int) (adjustedAmount * component.MaterialUseMultiplier);
|
|
||||||
|
|
||||||
sb.Append(adjustedAmount);
|
sb.Append(adjustedAmount);
|
||||||
sb.Append(' ');
|
sb.Append(' ');
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public sealed class CargoTest
|
|||||||
{
|
{
|
||||||
var mapId = testMap.MapId;
|
var mapId = testMap.MapId;
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
foreach (var proto in protoManager.EnumeratePrototypes<CargoProductPrototype>())
|
foreach (var proto in protoManager.EnumeratePrototypes<CargoProductPrototype>())
|
||||||
{
|
{
|
||||||
var ent = entManager.SpawnEntity(proto.Product, new MapCoordinates(Vector2.Zero, mapId));
|
var ent = entManager.SpawnEntity(proto.Product, new MapCoordinates(Vector2.Zero, mapId));
|
||||||
@@ -40,6 +42,8 @@ public sealed class CargoTest
|
|||||||
entManager.DeleteEntity(ent);
|
entManager.DeleteEntity(ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
mapManager.DeleteMap(mapId);
|
mapManager.DeleteMap(mapId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using Content.Server.Construction.Components;
|
using Content.Server.Construction.Components;
|
||||||
using Content.Server.Stack;
|
|
||||||
using Content.Shared.Construction.Prototypes;
|
using Content.Shared.Construction.Prototypes;
|
||||||
using Content.Shared.Construction.Steps;
|
|
||||||
using Content.Shared.Prototypes;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Construction
|
namespace Content.IntegrationTests.Tests.Construction
|
||||||
{
|
{
|
||||||
@@ -90,6 +87,37 @@ namespace Content.IntegrationTests.Tests.Construction
|
|||||||
await pairTracker.CleanReturnAsync();
|
await pairTracker.CleanReturnAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task DeconstructionIsValid()
|
||||||
|
{
|
||||||
|
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
|
||||||
|
var server = pairTracker.Pair.Server;
|
||||||
|
|
||||||
|
var entMan = server.ResolveDependency<IEntityManager>();
|
||||||
|
var protoMan = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
var compFact = server.ResolveDependency<IComponentFactory>();
|
||||||
|
|
||||||
|
var name = compFact.GetComponentName(typeof(ConstructionComponent));
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
foreach (var proto in protoMan.EnumeratePrototypes<EntityPrototype>())
|
||||||
|
{
|
||||||
|
if (proto.Abstract || !proto.Components.TryGetValue(name, out var reg))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var comp = (ConstructionComponent) reg.Component;
|
||||||
|
var target = comp.DeconstructionNode;
|
||||||
|
if (target == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var graph = protoMan.Index<ConstructionGraphPrototype>(comp.Graph);
|
||||||
|
Assert.That(graph.Nodes.ContainsKey(target), $"Invalid deconstruction node \"{target}\" on graph \"{graph.ID}\" for construction entity \"{proto.ID}\"!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await pairTracker.CleanReturnAsync();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TestStartReachesValidTarget()
|
public async Task TestStartReachesValidTarget()
|
||||||
{
|
{
|
||||||
|
|||||||
301
Content.IntegrationTests/Tests/MaterialArbitrageTest.cs
Normal file
301
Content.IntegrationTests/Tests/MaterialArbitrageTest.cs
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
using Content.Server.Cargo.Systems;
|
||||||
|
using Content.Server.Construction.Completions;
|
||||||
|
using Content.Server.Construction.Components;
|
||||||
|
using Content.Server.Destructible;
|
||||||
|
using Content.Server.Destructible.Thresholds.Behaviors;
|
||||||
|
using Content.Server.Stack;
|
||||||
|
using Content.Shared.Construction.Prototypes;
|
||||||
|
using Content.Shared.Construction.Steps;
|
||||||
|
using Content.Shared.Lathe;
|
||||||
|
using Content.Shared.Research.Prototypes;
|
||||||
|
using Content.Shared.Stacks;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Content.IntegrationTests.Tests;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This test checks that any destructible or constructible entities do not drop more resources than are required to
|
||||||
|
/// create them.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture]
|
||||||
|
public sealed class MaterialArbitrageTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public async Task NoMaterialArbitrage()
|
||||||
|
{
|
||||||
|
// TODO check lathe resource prices?
|
||||||
|
// I CBF doing that atm because I know that will probably fail for most lathe recipies.
|
||||||
|
|
||||||
|
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings() {NoClient = true});
|
||||||
|
var server = pairTracker.Pair.Server;
|
||||||
|
|
||||||
|
var testMap = await PoolManager.CreateTestMap(pairTracker);
|
||||||
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
var entManager = server.ResolveDependency<IEntityManager>();
|
||||||
|
var sysManager = server.ResolveDependency<IEntitySystemManager>();
|
||||||
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
|
Assert.That(mapManager.IsMapInitialized(testMap.MapId));
|
||||||
|
|
||||||
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
var pricing = sysManager.GetEntitySystem<PricingSystem>();
|
||||||
|
var stackSys = sysManager.GetEntitySystem<StackSystem>();
|
||||||
|
var compFact = server.ResolveDependency<IComponentFactory>();
|
||||||
|
|
||||||
|
var constructionName = compFact.GetComponentName(typeof(ConstructionComponent));
|
||||||
|
var destructibleName = compFact.GetComponentName(typeof(DestructibleComponent));
|
||||||
|
var stackName = compFact.GetComponentName(typeof(StackComponent));
|
||||||
|
|
||||||
|
// construct inverted lathe recipe dictionary
|
||||||
|
Dictionary<string, LatheRecipePrototype> latheRecipes = new();
|
||||||
|
foreach (var proto in protoManager.EnumeratePrototypes<LatheRecipePrototype>())
|
||||||
|
{
|
||||||
|
latheRecipes.Add(proto.Result, proto);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lets assume the possible lathe for resource multipliers:
|
||||||
|
var multiplier = MathF.Pow(LatheComponent.DefaultPartRatingMaterialUseMultiplier, MachinePartComponent.MaxRating - 1);
|
||||||
|
|
||||||
|
// create construction dictionary
|
||||||
|
Dictionary<string, ConstructionComponent> constructionRecipes = new();
|
||||||
|
foreach (var proto in protoManager.EnumeratePrototypes<EntityPrototype>())
|
||||||
|
{
|
||||||
|
if (proto.NoSpawn || proto.Abstract)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!proto.Components.TryGetValue(constructionName, out var destructible))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var comp = (ConstructionComponent) destructible.Component;
|
||||||
|
constructionRecipes.Add(proto.ID, comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get ingredients required to construct an entity
|
||||||
|
Dictionary<string, Dictionary<string, int>> constructionMaterials = new();
|
||||||
|
foreach (var (id, comp) in constructionRecipes)
|
||||||
|
{
|
||||||
|
var materials = new Dictionary<string, int>();
|
||||||
|
var graph = protoManager.Index<ConstructionGraphPrototype>(comp.Graph);
|
||||||
|
if (!graph.TryPath(graph.Start, comp.Node, out var path) || path.Length == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var cur = graph.Nodes[graph.Start];
|
||||||
|
foreach (var node in path)
|
||||||
|
{
|
||||||
|
var edge = cur.GetEdge(node.Name);
|
||||||
|
cur = node;
|
||||||
|
|
||||||
|
foreach (var step in edge.Steps)
|
||||||
|
{
|
||||||
|
if (step is MaterialConstructionGraphStep materialStep)
|
||||||
|
materials[materialStep.MaterialPrototypeId] = materialStep.Amount + materials.GetValueOrDefault(materialStep.MaterialPrototypeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
constructionMaterials.Add(id, materials);
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, double> priceCache = new();
|
||||||
|
|
||||||
|
Dictionary<string, (Dictionary<string, int> Ents, Dictionary<string, int> Mats)> spawnedOnDestroy = new();
|
||||||
|
|
||||||
|
// Here we get the set of entities/materials spawned when destroying an entity.
|
||||||
|
foreach (var proto in protoManager.EnumeratePrototypes<EntityPrototype>())
|
||||||
|
{
|
||||||
|
if (proto.NoSpawn || proto.Abstract)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!proto.Components.TryGetValue(destructibleName, out var destructible))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var comp = (DestructibleComponent) destructible.Component;
|
||||||
|
|
||||||
|
var spawnedEnts = new Dictionary<string, int>();
|
||||||
|
var spawnedMats = new Dictionary<string, int>();
|
||||||
|
|
||||||
|
// This test just blindly assumes that ALL spawn entity behaviors get triggered. In reality, some entities
|
||||||
|
// might only trigger a subset. If that starts being a problem, this test either needs fixing or needs to
|
||||||
|
// get an ignored prototypes list.
|
||||||
|
|
||||||
|
foreach (var threshold in comp.Thresholds)
|
||||||
|
{
|
||||||
|
foreach (var behaviour in threshold.Behaviors)
|
||||||
|
{
|
||||||
|
if (behaviour is not SpawnEntitiesBehavior spawn)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
foreach (var (key, value) in spawn.Spawn)
|
||||||
|
{
|
||||||
|
spawnedEnts[key] = spawnedEnts.GetValueOrDefault(key) + value.Max;
|
||||||
|
|
||||||
|
var spawnProto = protoManager.Index<EntityPrototype>(key);
|
||||||
|
if (!spawnProto.Components.TryGetValue(stackName, out var reg))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var stack = (StackComponent) reg.Component;
|
||||||
|
spawnedMats[stack.StackTypeId] = value.Max + spawnedMats.GetValueOrDefault(stack.StackTypeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spawnedEnts.Count > 0)
|
||||||
|
spawnedOnDestroy.Add(proto.ID, (spawnedEnts, spawnedMats));
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the main loop where we actually check for destruction arbitrage
|
||||||
|
Assert.Multiple(async () =>
|
||||||
|
{
|
||||||
|
foreach (var (id, (spawnedEnts, spawnedMats)) in spawnedOnDestroy)
|
||||||
|
{
|
||||||
|
// Check cargo sell price
|
||||||
|
// several constructible entities have no sell price
|
||||||
|
// also this test only really matters if the entity is also purchaseable.... eh..
|
||||||
|
var spawnedPrice = await GetSpawnedPrice(spawnedEnts);
|
||||||
|
var price = await GetPrice(id);
|
||||||
|
if (spawnedPrice > 0 && price > 0)
|
||||||
|
Assert.LessOrEqual(spawnedPrice, price, $"{id} increases in price after being destroyed");
|
||||||
|
|
||||||
|
// Check lathe production
|
||||||
|
if (latheRecipes.TryGetValue(id, out var recipe))
|
||||||
|
{
|
||||||
|
foreach (var (matId, amount) in recipe.RequiredMaterials)
|
||||||
|
{
|
||||||
|
var actualAmount = SharedLatheSystem.AdjustMaterial(amount, recipe.ApplyMaterialDiscount, multiplier);
|
||||||
|
if (spawnedMats.TryGetValue(matId, out var numSpawned))
|
||||||
|
Assert.LessOrEqual(numSpawned, actualAmount, $"destroying a {id} spawns more {matId} than required to produce via an (upgraded) lathe.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check construction.
|
||||||
|
if (constructionMaterials.TryGetValue(id, out var constructionMats))
|
||||||
|
{
|
||||||
|
foreach (var (matId, amount) in constructionMats)
|
||||||
|
{
|
||||||
|
if (spawnedMats.TryGetValue(matId, out var numSpawned))
|
||||||
|
Assert.LessOrEqual(numSpawned, amount, $"destroying a {id} spawns more {matId} than required to construct it.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Finally, lets also check for deconstruction arbitrage.
|
||||||
|
// Get ingredients returned when deconstructing an entity
|
||||||
|
Dictionary<string, Dictionary<string, int>> deconstructionMaterials = new();
|
||||||
|
foreach (var (id, comp) in constructionRecipes)
|
||||||
|
{
|
||||||
|
if (comp.DeconstructionNode == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var materials = new Dictionary<string, int>();
|
||||||
|
var graph = protoManager.Index<ConstructionGraphPrototype>(comp.Graph);
|
||||||
|
|
||||||
|
if (!graph.TryPath(comp.Node, comp.DeconstructionNode, out var path) || path.Length == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var cur = graph.Nodes[comp.Node];
|
||||||
|
foreach (var node in path)
|
||||||
|
{
|
||||||
|
var edge = cur.GetEdge(node.Name);
|
||||||
|
cur = node;
|
||||||
|
|
||||||
|
foreach (var completion in edge.Completed)
|
||||||
|
{
|
||||||
|
if (completion is not SpawnPrototype spawnCompletion)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var spawnProto = protoManager.Index<EntityPrototype>(spawnCompletion.Prototype);
|
||||||
|
if (!spawnProto.Components.TryGetValue(stackName, out var reg))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var stack = (StackComponent) reg.Component;
|
||||||
|
|
||||||
|
materials[stack.StackTypeId] = spawnCompletion.Amount + materials.GetValueOrDefault(stack.StackTypeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deconstructionMaterials.Add(id, materials);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is functionally the same loop as before, but now testinng deconstruction rather than destruction.
|
||||||
|
// This is pretty braindead. In principle construction graphs can have loops and whatnot.
|
||||||
|
|
||||||
|
Assert.Multiple(async () =>
|
||||||
|
{
|
||||||
|
foreach (var (id, deconstructedMats) in deconstructionMaterials)
|
||||||
|
{
|
||||||
|
// Check cargo sell price
|
||||||
|
var deconstructedPrice = await GetDeconstructedPrice(deconstructedMats);
|
||||||
|
var price = await GetPrice(id);
|
||||||
|
if (deconstructedPrice > 0 && price > 0)
|
||||||
|
Assert.LessOrEqual(deconstructedPrice, price, $"{id} increases in price after being deconstructed");
|
||||||
|
|
||||||
|
// Check lathe production
|
||||||
|
if (latheRecipes.TryGetValue(id, out var recipe))
|
||||||
|
{
|
||||||
|
foreach (var (matId, amount) in recipe.RequiredMaterials)
|
||||||
|
{
|
||||||
|
var actualAmount = SharedLatheSystem.AdjustMaterial(amount, recipe.ApplyMaterialDiscount, multiplier);
|
||||||
|
if (deconstructedMats.TryGetValue(matId, out var numSpawned))
|
||||||
|
Assert.LessOrEqual(numSpawned, actualAmount, $"deconstructing {id} spawns more {matId} than required to produce via an (upgraded) lathe.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check construction.
|
||||||
|
if (constructionMaterials.TryGetValue(id, out var constructionMats))
|
||||||
|
{
|
||||||
|
foreach (var (matId, amount) in constructionMats)
|
||||||
|
{
|
||||||
|
if (deconstructedMats.TryGetValue(matId, out var numSpawned))
|
||||||
|
Assert.LessOrEqual(numSpawned, amount, $"deconstructing a {id} spawns more {matId} than required to construct it.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await server.WaitPost(() => mapManager.DeleteMap(testMap.MapId));
|
||||||
|
await pairTracker.CleanReturnAsync();
|
||||||
|
|
||||||
|
async Task<double> GetSpawnedPrice(Dictionary<string, int> ents)
|
||||||
|
{
|
||||||
|
double price = 0;
|
||||||
|
foreach (var (id, num) in ents)
|
||||||
|
{
|
||||||
|
price += num * await GetPrice(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task<double> GetPrice(string id)
|
||||||
|
{
|
||||||
|
if (!priceCache.TryGetValue(id, out var price))
|
||||||
|
{
|
||||||
|
await server.WaitPost(() =>
|
||||||
|
{
|
||||||
|
var ent = entManager.SpawnEntity(id, testMap.GridCoords);
|
||||||
|
stackSys.SetCount(ent, 1);
|
||||||
|
priceCache[id] = price = pricing.GetPrice(ent);
|
||||||
|
entManager.DeleteEntity(ent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async Task<double> GetDeconstructedPrice(Dictionary<string, int> mats)
|
||||||
|
{
|
||||||
|
double price = 0;
|
||||||
|
foreach (var (id, num) in mats)
|
||||||
|
{
|
||||||
|
var matProto = protoManager.Index<StackPrototype>(id).Spawn;
|
||||||
|
price += num * await GetPrice(matProto);
|
||||||
|
}
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,5 +12,12 @@ namespace Content.Server.Construction.Components
|
|||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField("rating")]
|
[DataField("rating")]
|
||||||
public int Rating { get; private set; } = 1;
|
public int Rating { get; private set; } = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This number is used in tests to ensure that you can't use high quality machines for arbitrage. In
|
||||||
|
/// principle there is nothing wrong with using higher quality parts, but you have to be careful to not
|
||||||
|
/// allow them to be put into a lathe or something like that.
|
||||||
|
/// </summary>
|
||||||
|
public const int MaxRating = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ namespace Content.Shared.Lathe
|
|||||||
/// The value that is used to calculate the modifier <see cref="MaterialUseMultiplier"/>
|
/// The value that is used to calculate the modifier <see cref="MaterialUseMultiplier"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("partRatingMaterialUseMultiplier")]
|
[DataField("partRatingMaterialUseMultiplier")]
|
||||||
public float PartRatingMaterialUseMultiplier = 0.75f;
|
public float PartRatingMaterialUseMultiplier = DefaultPartRatingMaterialUseMultiplier;
|
||||||
|
|
||||||
|
public const float DefaultPartRatingMaterialUseMultiplier = 0.75f;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using System.Net.Mail;
|
||||||
|
|
||||||
namespace Content.Shared.Lathe;
|
namespace Content.Shared.Lathe;
|
||||||
|
|
||||||
@@ -50,9 +51,7 @@ public abstract class SharedLatheSystem : EntitySystem
|
|||||||
|
|
||||||
foreach (var (material, needed) in recipe.RequiredMaterials)
|
foreach (var (material, needed) in recipe.RequiredMaterials)
|
||||||
{
|
{
|
||||||
var adjustedAmount = recipe.ApplyMaterialDiscount
|
var adjustedAmount = AdjustMaterial(needed, recipe.ApplyMaterialDiscount, component.MaterialUseMultiplier);
|
||||||
? (int) (needed * component.MaterialUseMultiplier)
|
|
||||||
: needed;
|
|
||||||
|
|
||||||
if (_materialStorage.GetMaterialAmount(component.Owner, material) < adjustedAmount * amount)
|
if (_materialStorage.GetMaterialAmount(component.Owner, material) < adjustedAmount * amount)
|
||||||
return false;
|
return false;
|
||||||
@@ -60,6 +59,9 @@ public abstract class SharedLatheSystem : EntitySystem
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int AdjustMaterial(int original, bool reduce, float multiplier)
|
||||||
|
=> reduce ? (int) MathF.Ceiling(original * multiplier) : original;
|
||||||
|
|
||||||
protected abstract bool HasRecipe(EntityUid uid, LatheRecipePrototype recipe, LatheComponent component);
|
protected abstract bool HasRecipe(EntityUid uid, LatheRecipePrototype recipe, LatheComponent component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
sprite: Objects/Consumable/Food/Baked/pizza.rsi
|
sprite: Objects/Consumable/Food/Baked/pizza.rsi
|
||||||
state: margherita
|
state: margherita
|
||||||
product: CrateFoodPizza
|
product: CrateFoodPizza
|
||||||
cost: 500
|
cost: 550
|
||||||
category: Food
|
category: Food
|
||||||
group: market
|
group: market
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
sprite: Objects/Specific/Service/vending_machine_restock.rsi
|
sprite: Objects/Specific/Service/vending_machine_restock.rsi
|
||||||
state: base
|
state: base
|
||||||
product: CrateVendingMachineRestockGamesFilled
|
product: CrateVendingMachineRestockGamesFilled
|
||||||
cost: 650
|
cost: 750
|
||||||
category: Service
|
category: Service
|
||||||
group: market
|
group: market
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,8 @@
|
|||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
- type: SpaceGarbage
|
- type: SpaceGarbage
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 0
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: bowl
|
name: bowl
|
||||||
|
|||||||
@@ -74,6 +74,8 @@
|
|||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 50
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: FoodTinBase
|
parent: FoodTinBase
|
||||||
@@ -129,6 +131,8 @@
|
|||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 50
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: FoodTinBase
|
parent: FoodTinBase
|
||||||
@@ -179,6 +183,8 @@
|
|||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 50
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: FoodTinBase
|
parent: FoodTinBase
|
||||||
@@ -241,6 +247,8 @@
|
|||||||
- id: FoodTinMREOpen
|
- id: FoodTinMREOpen
|
||||||
sound:
|
sound:
|
||||||
path: /Audio/Items/can_open3.ogg
|
path: /Audio/Items/can_open3.ogg
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 50
|
||||||
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
@@ -195,6 +195,7 @@
|
|||||||
materialRequirements:
|
materialRequirements:
|
||||||
Cable: 5
|
Cable: 5
|
||||||
- type: Construction
|
- type: Construction
|
||||||
|
deconstructionTarget: null
|
||||||
graph: ThermomachineBoard
|
graph: ThermomachineBoard
|
||||||
node: freezer
|
node: freezer
|
||||||
|
|
||||||
@@ -215,6 +216,7 @@
|
|||||||
Cable: 5
|
Cable: 5
|
||||||
- type: Construction
|
- type: Construction
|
||||||
graph: ThermomachineBoard
|
graph: ThermomachineBoard
|
||||||
|
deconstructionTarget: null
|
||||||
node: heater
|
node: heater
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
@@ -76,6 +76,8 @@
|
|||||||
damage:
|
damage:
|
||||||
types:
|
types:
|
||||||
Piercing: 5
|
Piercing: 5
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 0
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ShardBase
|
parent: ShardBase
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
SheetGlass:
|
SheetGlass:
|
||||||
min: 5
|
min: 5
|
||||||
max: 5
|
max: 5
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 50
|
||||||
|
|
||||||
#Security Shields
|
#Security Shields
|
||||||
|
|
||||||
@@ -115,6 +117,8 @@
|
|||||||
MaterialWoodPlank:
|
MaterialWoodPlank:
|
||||||
min: 5
|
min: 5
|
||||||
max: 5
|
max: 5
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 150
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: makeshift shield
|
name: makeshift shield
|
||||||
|
|||||||
@@ -116,6 +116,7 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: ShotgunSawn
|
graph: ShotgunSawn
|
||||||
node: shotgundoublebarreled
|
node: shotgundoublebarreled
|
||||||
|
deconstructionTarget: null
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: Enforcer
|
name: Enforcer
|
||||||
@@ -161,3 +162,4 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: ShotgunSawn
|
graph: ShotgunSawn
|
||||||
node: shotgunsawn
|
node: shotgunsawn
|
||||||
|
deconstructionTarget: null
|
||||||
|
|||||||
@@ -192,3 +192,5 @@
|
|||||||
states:
|
states:
|
||||||
enum.Trigger.TriggerVisualState.Primed: primed
|
enum.Trigger.TriggerVisualState.Primed: primed
|
||||||
enum.Trigger.TriggerVisualState.Unprimed: complete
|
enum.Trigger.TriggerVisualState.Unprimed: complete
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 25
|
||||||
|
|||||||
@@ -175,6 +175,8 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Wooden
|
- Wooden
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 75
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: ritual chair
|
name: ritual chair
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
components:
|
components:
|
||||||
- type: Construction
|
- type: Construction
|
||||||
graph: LightFixture
|
graph: LightFixture
|
||||||
node: tubeLight
|
node: groundLight
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Lighting/LightPosts/small_light_post.rsi
|
sprite: Structures/Lighting/LightPosts/small_light_post.rsi
|
||||||
snapCardinals: true
|
snapCardinals: true
|
||||||
@@ -117,3 +117,5 @@
|
|||||||
damage:
|
damage:
|
||||||
types:
|
types:
|
||||||
Heat: 20
|
Heat: 20
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 25
|
||||||
|
|||||||
@@ -527,6 +527,8 @@
|
|||||||
layer:
|
layer:
|
||||||
- MachineLayer
|
- MachineLayer
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 60
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: GasCanisterBrokenBase
|
parent: GasCanisterBrokenBase
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
node: crateplastic
|
node: crateplastic
|
||||||
containers:
|
containers:
|
||||||
- entity_storage
|
- entity_storage
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 150
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: CrateBaseWeldable
|
parent: CrateBaseWeldable
|
||||||
@@ -280,6 +282,8 @@
|
|||||||
node: cratelivestock
|
node: cratelivestock
|
||||||
containers:
|
containers:
|
||||||
- entity_storage
|
- entity_storage
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 125
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: CrateGeneric
|
parent: CrateGeneric
|
||||||
@@ -325,4 +329,6 @@
|
|||||||
- LargeMobMask
|
- LargeMobMask
|
||||||
layer:
|
layer:
|
||||||
- LargeMobLayer
|
- LargeMobLayer
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 60
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 0.5
|
price: 10
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: ReinforcedGirder
|
id: ReinforcedGirder
|
||||||
@@ -85,3 +85,5 @@
|
|||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 66
|
||||||
|
|||||||
@@ -154,7 +154,7 @@
|
|||||||
spawn:
|
spawn:
|
||||||
PartRodMetal1:
|
PartRodMetal1:
|
||||||
min: 0
|
min: 0
|
||||||
max: 2
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- type: Climbable
|
- type: Climbable
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
damageOverlay:
|
damageOverlay:
|
||||||
sprite: Structures/Windows/cracks.rsi
|
sprite: Structures/Windows/cracks.rsi
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 20.5
|
price: 60
|
||||||
- type: RadiationBlocker
|
- type: RadiationBlocker
|
||||||
resistance: 2
|
resistance: 2
|
||||||
|
|
||||||
@@ -81,4 +81,4 @@
|
|||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 20.5
|
price: 30
|
||||||
|
|||||||
@@ -48,8 +48,6 @@
|
|||||||
trackAllDamage: true
|
trackAllDamage: true
|
||||||
damageOverlay:
|
damageOverlay:
|
||||||
sprite: Structures/Windows/cracks.rsi
|
sprite: Structures/Windows/cracks.rsi
|
||||||
- type: StaticPrice
|
|
||||||
price: 150
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ReinforcedWindow
|
parent: ReinforcedWindow
|
||||||
@@ -68,7 +66,7 @@
|
|||||||
node: tintedWindow
|
node: tintedWindow
|
||||||
- type: Occluder
|
- type: Occluder
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 0.75
|
price: 44
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: WindowReinforcedDirectional
|
id: WindowReinforcedDirectional
|
||||||
@@ -109,4 +107,4 @@
|
|||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 0.75
|
price: 22
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
damageOverlay:
|
damageOverlay:
|
||||||
sprite: Structures/Windows/cracks.rsi
|
sprite: Structures/Windows/cracks.rsi
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 20.75
|
price: 132
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: PlasmaReinforcedWindowDirectional
|
id: PlasmaReinforcedWindowDirectional
|
||||||
@@ -99,4 +99,4 @@
|
|||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 20.75
|
price: 66
|
||||||
|
|||||||
@@ -169,7 +169,7 @@
|
|||||||
graph: WindowDirectional
|
graph: WindowDirectional
|
||||||
node: windowDirectional
|
node: windowDirectional
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 0.5
|
price: 5
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: WindowTintedDirectional
|
id: WindowTintedDirectional
|
||||||
@@ -194,7 +194,7 @@
|
|||||||
- type: Occluder
|
- type: Occluder
|
||||||
boundingBox: "-0.5,-0.5,0.5,-0.3"
|
boundingBox: "-0.5,-0.5,0.5,-0.3"
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 0.5
|
price: 5
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: WindowFrostedDirectional
|
id: WindowFrostedDirectional
|
||||||
@@ -214,4 +214,4 @@
|
|||||||
sprite: Structures/Windows/directional.rsi
|
sprite: Structures/Windows/directional.rsi
|
||||||
state: frosted_window
|
state: frosted_window
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 0.5
|
price: 5
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: PlasticFlapsGraph
|
graph: PlasticFlapsGraph
|
||||||
node: plasticFlaps
|
node: plasticFlaps
|
||||||
|
- type: StaticPrice
|
||||||
|
price: 150
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: PlasticFlapsOpaque
|
id: PlasticFlapsOpaque
|
||||||
|
|||||||
@@ -149,6 +149,7 @@
|
|||||||
id: TargetHuman
|
id: TargetHuman
|
||||||
result: TargetHuman
|
result: TargetHuman
|
||||||
completetime: 5
|
completetime: 5
|
||||||
|
applyMaterialDiscount: false # ingredients dropped when destroyed
|
||||||
materials:
|
materials:
|
||||||
Steel: 10
|
Steel: 10
|
||||||
|
|
||||||
@@ -156,6 +157,7 @@
|
|||||||
id: TargetClown
|
id: TargetClown
|
||||||
result: TargetClown
|
result: TargetClown
|
||||||
completetime: 5
|
completetime: 5
|
||||||
|
applyMaterialDiscount: false # ingredients dropped when destroyed
|
||||||
materials:
|
materials:
|
||||||
Steel: 10
|
Steel: 10
|
||||||
|
|
||||||
@@ -163,5 +165,6 @@
|
|||||||
id: TargetSyndicate
|
id: TargetSyndicate
|
||||||
result: TargetSyndicate
|
result: TargetSyndicate
|
||||||
completetime: 5
|
completetime: 5
|
||||||
|
applyMaterialDiscount: false # ingredients dropped when destroyed
|
||||||
materials:
|
materials:
|
||||||
Steel: 10
|
Steel: 10
|
||||||
|
|||||||
Reference in New Issue
Block a user