Alchemy integration test (#967)

* Update TryAllReactionsTest.cs

* test drive

* fix traveling ship roundremove

* Update CP14RoundRemoveShuttleSystem.cs

* Dev map update
This commit is contained in:
Ed
2025-03-03 23:15:40 +03:00
committed by GitHub
parent 3fb7cc0cd7
commit 81b9cdfff7
8 changed files with 3077 additions and 69323 deletions

View File

@@ -59,6 +59,32 @@ namespace Content.IntegrationTests.Tests.Chemistry
#pragma warning restore NUnit2045
}
//------------CP14 - improve test for alchemy
//Get all possible reactions with the current reagents
var possibleReactions = prototypeManager.EnumeratePrototypes<ReactionPrototype>()
.Where(x => x.Reactants.All(id => solution.Contents.Any(s => s.Reagent.Prototype == id.Key)))
.ToList();
//Check if the reaction is the first to occur when heated
foreach (var possibleReaction in possibleReactions.OrderBy(r => r.MinimumTemperature))
{
if (possibleReaction.MinimumTemperature < reactionPrototype.MinimumTemperature && possibleReaction.MixingCategories == reactionPrototype.MixingCategories)
{
Assert.Fail($"The {possibleReaction.ID} reaction may occur before {reactionPrototype.ID} when heated.");
}
}
//Check if the reaction is the first to occur when freezing
foreach (var possibleReaction in possibleReactions.OrderBy(r => r.MaximumTemperature))
{
if (possibleReaction.MaximumTemperature > reactionPrototype.MaximumTemperature && possibleReaction.MixingCategories == reactionPrototype.MixingCategories)
{
Assert.Fail($"The {possibleReaction.ID} reaction may occur before {reactionPrototype.ID} when freezing.");
}
}
//Now safe set the temperature and mix the reagents
//----------CP14 - improve test for alchemy end
solutionContainerSystem.SetTemperature(solutionEnt.Value, reactionPrototype.MinimumTemperature);
if (reactionPrototype.MixingCategories != null)

View File

@@ -8,6 +8,7 @@ using Content.Server.StationRecords;
using Content.Server.StationRecords.Systems;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Mind.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.StationRecords;
using Robust.Shared.Prototypes;
@@ -23,7 +24,9 @@ public sealed partial class CP14RoundRemoveShuttleSystem : EntitySystem
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly StationRecordsSystem _stationRecords = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
private readonly HashSet<Entity<MindContainerComponent>> _mindSet = new();
public override void Initialize()
{
base.Initialize();
@@ -33,15 +36,20 @@ public sealed partial class CP14RoundRemoveShuttleSystem : EntitySystem
private void OnFTL(Entity<CP14RoundRemoveShuttleComponent> ent, ref FTLStartedEvent args)
{
var childrens = Transform(ent).ChildEnumerator;
_mindSet.Clear();
_lookup.GetChildEntities(ent, _mindSet);
if (!TryComp<StationRecordsComponent>(ent.Comp.Station, out var stationRecords))
return;
HashSet<EntityUid> toDelete = new();
while (childrens.MoveNext(out var uid))
var query = EntityQueryEnumerator<MindContainerComponent>();
while (query.MoveNext(out var uid, out var mindContainer))
{
if (!_mind.TryGetMind(uid, out _, out var mindComp))
if (Transform(uid).GridUid != ent)
continue;
if (!_mind.TryGetMind(uid, out _, out var mindComp, container: mindContainer))
continue;
var name = Name(uid);
@@ -73,7 +81,7 @@ public sealed partial class CP14RoundRemoveShuttleSystem : EntitySystem
_chatSystem.DispatchStationAnnouncement(ent.Comp.Station,
Loc.GetString(
_mobState.IsDead(uid) ? "cp14-earlyleave-ship-announcement-dead" : "cp14-earlyleave-ship-announcement",
_mobState.IsDead(uid) ? "cp14-earlyleave-ship-announcement-dead" : "cp14-earlyleave-ship-announcement",
("character", mindComp.CharacterName ?? "Unknown"),
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName ?? "Unknown"))
),

File diff suppressed because it is too large Load Diff

View File

@@ -40,7 +40,7 @@
- type: CP14FlammableAmbientSound
- type: AmbientSound
enabled: false
volume: -5
volume: -15
range: 5
sound:
path: /Audio/Ambience/Objects/fireplace.ogg
@@ -94,7 +94,7 @@
radius: 8
- type: AmbientSound
enabled: true
volume: -5
volume: -15
range: 5
sound:
path: /Audio/Ambience/Objects/fireplace.ogg

View File

@@ -271,7 +271,8 @@
metabolismRate: 0.05
effects:
- !type:CP14ManaChange
manaDelta: 20
manaDelta: 30
safe: true
- type: reagent
id: CP14BasicEffectDamageMana
@@ -286,7 +287,8 @@
metabolismRate: 0.05
effects:
- !type:CP14ManaChange
manaDelta: -20
manaDelta: -30
safe: false
- type: reagent
id: CP14BasicEffectSpeedUp

View File

@@ -2,7 +2,7 @@
- type: reaction
id: CP14EssenceFrost
minTemp: 500
minTemp: 600
reactants:
CP14EssenceFire:
amount: 1
@@ -16,7 +16,7 @@
- type: reaction
id: CP14EssenceLight
minTemp: 500
minTemp: 600
reactants:
CP14EssenceFire:
amount: 1
@@ -30,7 +30,7 @@
- type: reaction
id: CP14EssenceMotion
minTemp: 500
minTemp: 600
reactants:
CP14EssenceOrder:
amount: 1
@@ -44,7 +44,7 @@
- type: reaction
id: CP14EssenceCycle
minTemp: 500
minTemp: 600
reactants:
CP14EssenceOrder:
amount: 1
@@ -58,7 +58,7 @@
- type: reaction
id: CP14EssenceEnergia
minTemp: 500
minTemp: 600
reactants:
CP14EssenceOrder:
amount: 1
@@ -72,7 +72,7 @@
- type: reaction
id: CP14EssenceVoid
minTemp: 500
minTemp: 600
reactants:
CP14EssenceChaos:
amount: 1
@@ -86,7 +86,7 @@
- type: reaction
id: CP14EssencePoison
minTemp: 500
minTemp: 600
reactants:
CP14EssenceChaos:
amount: 1
@@ -100,7 +100,7 @@
- type: reaction
id: CP14EssenceLife
minTemp: 500
minTemp: 600
reactants:
CP14EssenceEarth:
amount: 1
@@ -114,7 +114,7 @@
- type: reaction
id: CP14EssenceCrystal
minTemp: 500
minTemp: 600
reactants:
CP14EssenceOrder:
amount: 1
@@ -130,7 +130,7 @@
- type: reaction
id: CP14EssenceMagic
minTemp: 500
minTemp: 600
reactants:
CP14EssenceVoid:
amount: 1

View File

@@ -4,7 +4,7 @@
- type: reaction
id: CP14PrecurserBrewingHealMana
minTemp: 600
minTemp: 500
priority: 1
reactants:
CP14EssenceMagic:
@@ -23,7 +23,7 @@
- type: reaction
id: CP14PrecurserBrewingDamageMana
minTemp: 600
minTemp: 500
priority: 1
reactants:
CP14EssenceMagic:

View File

@@ -4,7 +4,7 @@
- type: reaction
id: CP14WaterBrewingHealBrute
minTemp: 600
minTemp: 500
priority: 1
reactants:
CP14EssenceLife:
@@ -23,7 +23,7 @@
- type: reaction
id: CP14WaterBrewingDamageBrute
minTemp: 600
minTemp: 500
priority: 1
reactants:
CP14EssenceLife:
@@ -42,7 +42,7 @@
- type: reaction
id: CP14WaterBrewingHealHeat
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -63,7 +63,7 @@
- type: reaction
id: CP14WaterBrewingDamageHeat
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -84,7 +84,7 @@
- type: reaction
id: CP14WaterBrewingHealCold
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -105,7 +105,7 @@
- type: reaction
id: CP14WaterBrewingDamageCold
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -126,7 +126,7 @@
- type: reaction
id: CP14WaterBrewingHealPoison
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -147,7 +147,7 @@
- type: reaction
id: CP14WaterBrewingDamagePoison
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -168,7 +168,7 @@
- type: reaction
id: CP14WaterBrewingHealAirloss
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -189,7 +189,7 @@
- type: reaction
id: CP14WaterBrewingDamageAirloss
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -210,7 +210,7 @@
- type: reaction
id: CP14WaterBrewingBloodRestore
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -231,7 +231,7 @@
- type: reaction
id: CP14WaterBrewingBloodAbsorption
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceLife:
@@ -255,7 +255,7 @@
- type: reaction
id: CP14WaterBrewingHealMana
minTemp: 600
minTemp: 500
priority: 1
reactants:
CP14EssenceEnergia:
@@ -274,7 +274,7 @@
- type: reaction
id: CP14WaterBrewingDamageMana
minTemp: 600
minTemp: 500
priority: 1
reactants:
CP14EssenceEnergia:
@@ -293,7 +293,7 @@
- type: reaction
id: CP14WaterBrewingSpeedUp
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceMotion:
@@ -312,7 +312,7 @@
- type: reaction
id: CP14WaterBrewingSpeedDown
minTemp: 600
minTemp: 500
priority: 2
reactants:
CP14EssenceMotion: