-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into submarine
- Loading branch information
Showing
44 changed files
with
2,039 additions
and
1,988 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
Content.IntegrationTests/Tests/Nyanotrasen/Metempsychosis/MetempsychosisTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Content.Server.Nyanotrasen.Cloning; | ||
using Content.Shared.Humanoid.Prototypes; | ||
using Content.Shared.Random; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.IntegrationTests.Tests.DeltaV; | ||
|
||
[TestFixture] | ||
[TestOf(typeof(MetempsychoticMachineSystem))] | ||
public sealed class MetempsychosisTest | ||
{ | ||
[Test] | ||
public async Task AllHumanoidPoolSpeciesExist() | ||
{ | ||
await using var pair = await PoolManager.GetServerClient(); | ||
var server = pair.Server; | ||
// Per RobustIntegrationTest.cs, wait until state is settled to access it. | ||
await server.WaitIdleAsync(); | ||
|
||
var prototypeManager = server.ResolveDependency<IPrototypeManager>(); | ||
|
||
var metemComponent = new MetempsychoticMachineComponent(); | ||
|
||
await server.WaitAssertion(() => | ||
{ | ||
prototypeManager.TryIndex<WeightedRandomPrototype>(metemComponent.MetempsychoticHumanoidPool, | ||
out var humanoidPool); | ||
prototypeManager.TryIndex<WeightedRandomPrototype>(metemComponent.MetempsychoticNonHumanoidPool, | ||
out var nonHumanoidPool); | ||
|
||
Assert.That(humanoidPool, Is.Not.Null, "MetempsychoticHumanoidPool is null!"); | ||
Assert.That(nonHumanoidPool, Is.Not.Null, "MetempsychoticNonHumanoidPool is null!"); | ||
|
||
Assert.That(humanoidPool.Weights, Is.Not.Empty, | ||
"MetempsychoticHumanoidPool has no valid prototypes!"); | ||
Assert.That(nonHumanoidPool.Weights, Is.Not.Empty, | ||
"MetempsychoticNonHumanoidPool has no valid prototypes!"); | ||
|
||
foreach (var key in humanoidPool.Weights.Keys) | ||
{ | ||
Assert.That(prototypeManager.TryIndex<SpeciesPrototype>(key, out _), | ||
$"MetempsychoticHumanoidPool has invalid prototype {key}!"); | ||
} | ||
|
||
foreach (var key in nonHumanoidPool.Weights.Keys) | ||
{ | ||
Assert.That(prototypeManager.TryIndex<EntityPrototype>(key, out _), | ||
$"MetempsychoticNonHumanoidPool has invalid prototype {key}!"); | ||
} | ||
}); | ||
await pair.CleanReturnAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
Content.Server/Nyanotrasen/Cloning/MetempsychosisKarmaComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Content.Server.Nyanotrasen.Cloning | ||
{ | ||
/// <summary> | ||
/// This tracks how many times you have already been cloned and lowers your chance of getting a humanoid each time. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class MetempsychosisKarmaComponent : Component | ||
{ | ||
[DataField("score")] | ||
public int Score = 0; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Content.Server/Nyanotrasen/Cloning/MetempsychoticMachineComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Content.Shared.Random; | ||
|
||
namespace Content.Server.Nyanotrasen.Cloning | ||
{ | ||
[RegisterComponent] | ||
public sealed partial class MetempsychoticMachineComponent : Component | ||
{ | ||
/// <summary> | ||
/// Chance you will spawn as a humanoid instead of a non humanoid. | ||
/// </summary> | ||
[DataField("humanoidBaseChance")] | ||
public float HumanoidBaseChance = 0.75f; | ||
|
||
[ValidatePrototypeId<WeightedRandomPrototype>] | ||
[DataField("metempsychoticHumanoidPool")] | ||
public string MetempsychoticHumanoidPool = "MetempsychoticHumanoidPool"; | ||
|
||
[ValidatePrototypeId<WeightedRandomPrototype>] | ||
[DataField("metempsychoticNonHumanoidPool")] | ||
public string MetempsychoticNonHumanoidPool = "MetempsychoticNonhumanoidPool"; | ||
} | ||
} |
Oops, something went wrong.