-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Metempsychosis Returns * Last updates * Fixin the linter * Update lathe.yml * Update CloningSystem.cs * Fixing the random name bug * Fugitive, rough but functional * Update fugitive.yml * Update humanoid.yml * Checking if its the floortile * Guh * Update EntityTest.cs * Revert "Update EntityTest.cs" This reverts commit 82375ac. * Revert "Guh" This reverts commit bc98f0f. * Revert "Checking if its the floortile" This reverts commit 51d3355. * Revert "Update humanoid.yml" This reverts commit 5af8fbd. * Revert "Update fugitive.yml" This reverts commit 13124db. * Revert "Fugitive, rough but functional" This reverts commit 47586c3. * Update Content.Server/Medical/Components/MedicalScannerComponent.cs Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update Content.Server/Nyanotrasen/Cloning/MetempsychosisKarmaComponent.cs Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update Content.Server/Nyanotrasen/Cloning/MetempsychoticMachineComponent.cs Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update Content.Server/Nyanotrasen/Cloning/MetempsychoticMachineSystem.cs Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update Content.Server/Nyanotrasen/Cloning/MetempsychoticMachineSystem.cs Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update Content.Server/Nyanotrasen/Cloning/MetempsychoticMachineSystem.cs Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update Resources/Prototypes/Nyanotrasen/Entities/Structures/Machines/metempsychoticMachine.yml Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update Resources/Prototypes/Nyanotrasen/Research/biochemical.yml.yml Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update Resources/Textures/Nyanotrasen/Structures/Machines/metempsychotic.rsi/meta.json Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update CloningSystem.cs Signed-off-by: VMSolidus <[email protected]> * Update CloningSystem.cs * Update Content.Server/Nyanotrasen/Cloning/MetempsychoticMachineSystem.cs Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update MetempsychoticMachineSystem.cs * Cleaning up some of the Metem code * Update CloningConsoleSystem.cs reordering for less merge conflict Signed-off-by: VMSolidus <[email protected]> * Reordering usings for less merge conflicts Signed-off-by: VMSolidus <[email protected]> * Update HumanoidAppearanceComponent.cs Signed-off-by: VMSolidus <[email protected]> * Update CloningSystem.cs Signed-off-by: VMSolidus <[email protected]> * Apply suggestions from code review Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Update CloningConsoleSystem.cs Somehow this got removed during cleanup Signed-off-by: VMSolidus <[email protected]> * Update CloningConsoleSystem.cs Signed-off-by: VMSolidus <[email protected]> * Update CloningSystem.cs I put it back in the wrong file... Signed-off-by: VMSolidus <[email protected]> * Update CloningConsoleSystem.cs Signed-off-by: VMSolidus <[email protected]> * Apply suggestions from code review Co-authored-by: DEATHB4DEFEAT <[email protected]> Signed-off-by: VMSolidus <[email protected]> * Requested changes but need assistance with test fail * biochem is gone apparently * Update experimental.yml Signed-off-by: VMSolidus <[email protected]> * Update MetempsychosisTest.cs * Update CloningSystem.cs --------- Signed-off-by: VMSolidus <[email protected]> Co-authored-by: DEATHB4DEFEAT <[email protected]>
- Loading branch information
1 parent
1e83a0e
commit 8df7cc3
Showing
19 changed files
with
359 additions
and
19 deletions.
There are no files selected for viewing
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"; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
Content.Server/Nyanotrasen/Cloning/MetempsychoticMachineSystem.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,47 @@ | ||
using Content.Shared.Humanoid.Prototypes; | ||
using Content.Shared.Random; | ||
using Content.Shared.Random.Helpers; | ||
using Robust.Shared.Random; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.Nyanotrasen.Cloning | ||
{ | ||
public sealed class MetempsychoticMachineSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
|
||
private ISawmill _sawmill = default!; | ||
|
||
public string GetSpawnEntity(EntityUid uid, float karmaBonus, MetempsychoticMachineComponent component, SpeciesPrototype oldSpecies, out SpeciesPrototype? species, int? karma = null) | ||
{ | ||
var chance = component.HumanoidBaseChance + karmaBonus; | ||
|
||
if (karma != null) | ||
chance -= ((1 - component.HumanoidBaseChance) * (float) karma); | ||
|
||
if (chance > 1 && _random.Prob(chance - 1)) | ||
{ | ||
species = oldSpecies; | ||
return oldSpecies.Prototype; | ||
} | ||
else | ||
chance = 1; | ||
|
||
chance = Math.Clamp(chance, 0, 1); | ||
if (_random.Prob(chance) && | ||
_prototypeManager.TryIndex<WeightedRandomPrototype>(component.MetempsychoticHumanoidPool, out var humanoidPool) && | ||
_prototypeManager.TryIndex<SpeciesPrototype>(humanoidPool.Pick(), out var speciesPrototype)) | ||
{ | ||
species = speciesPrototype; | ||
return speciesPrototype.Prototype; | ||
} | ||
else | ||
{ | ||
species = null; | ||
_sawmill.Error("Could not index species for metempsychotic machine..."); | ||
return "MobHuman"; | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
research-technology-psionic-countermeasures = Psionic Countermeasures | ||
research-technology-teleportation = Teleportation | ||
research-technology-metempsychosis = Metempsychosis |
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
21 changes: 21 additions & 0 deletions
21
Resources/Prototypes/Nyanotrasen/Entities/Objects/Devices/CircuitBoards/production.yml
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
Oops, something went wrong.