-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Simple-Station/Einstein-E…
…ngines into merge-of-the-e-and-the-e
- Loading branch information
Showing
48 changed files
with
1,017 additions
and
366 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Content.Server/EntityEffects/Effects/PlantMetabolism/PlantAdjustPotency.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,28 @@ | ||
using Content.Server.Botany.Systems; | ||
using Content.Shared.EntityEffects; | ||
|
||
namespace Content.Server.EntityEffects.Effects.PlantMetabolism; | ||
|
||
/// <summary> | ||
/// Handles increase or decrease of plant potency. | ||
/// </summary> | ||
|
||
public sealed partial class PlantAdjustPotency : PlantAdjustAttribute | ||
{ | ||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-potency"; | ||
|
||
public override void Effect(EntityEffectBaseArgs args) | ||
{ | ||
if (!CanMetabolize(args.TargetEntity, out var plantHolderComp, args.EntityManager)) | ||
return; | ||
|
||
if (plantHolderComp.Seed == null) | ||
return; | ||
|
||
var plantHolder = args.EntityManager.System<PlantHolderSystem>(); | ||
|
||
plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp); | ||
|
||
plantHolderComp.Seed.Potency = Math.Max(plantHolderComp.Seed.Potency + Amount, 1); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Content.Server/EntityEffects/Effects/PlantMetabolism/PlantDestroySeeds.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,42 @@ | ||
using Content.Server.Botany.Components; | ||
using Content.Server.Botany.Systems; | ||
using Content.Shared.EntityEffects; | ||
using Content.Shared.Popups; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.EntityEffects.Effects.PlantMetabolism; | ||
|
||
/// <summary> | ||
/// Handles removal of seeds on a plant. | ||
/// </summary> | ||
|
||
public sealed partial class PlantDestroySeeds : EntityEffect | ||
{ | ||
public override void Effect(EntityEffectBaseArgs args) | ||
{ | ||
if ( | ||
!args.EntityManager.TryGetComponent(args.TargetEntity, out PlantHolderComponent? plantHolderComp) | ||
|| plantHolderComp.Seed == null | ||
|| plantHolderComp.Dead | ||
|| plantHolderComp.Seed.Immutable | ||
) | ||
return; | ||
|
||
var plantHolder = args.EntityManager.System<PlantHolderSystem>(); | ||
var popupSystem = args.EntityManager.System<SharedPopupSystem>(); | ||
|
||
if (plantHolderComp.Seed.Seedless == false) | ||
{ | ||
plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp); | ||
popupSystem.PopupEntity( | ||
Loc.GetString("botany-plant-seedsdestroyed"), | ||
args.TargetEntity, | ||
PopupType.SmallCaution | ||
); | ||
plantHolderComp.Seed.Seedless = true; | ||
} | ||
} | ||
|
||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => | ||
Loc.GetString("reagent-effect-guidebook-plant-seeds-remove", ("chance", Probability)); | ||
} |
38 changes: 38 additions & 0 deletions
38
Content.Server/EntityEffects/Effects/PlantMetabolism/PlantRestoreSeeds.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,38 @@ | ||
using Content.Server.Botany.Components; | ||
using Content.Server.Botany.Systems; | ||
using Content.Shared.EntityEffects; | ||
using Content.Shared.Popups; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.EntityEffects.Effects.PlantMetabolism; | ||
|
||
/// <summary> | ||
/// Handles restoral of seeds on a plant. | ||
/// </summary> | ||
|
||
public sealed partial class PlantRestoreSeeds : EntityEffect | ||
{ | ||
public override void Effect(EntityEffectBaseArgs args) | ||
{ | ||
if ( | ||
!args.EntityManager.TryGetComponent(args.TargetEntity, out PlantHolderComponent? plantHolderComp) | ||
|| plantHolderComp.Seed == null | ||
|| plantHolderComp.Dead | ||
|| plantHolderComp.Seed.Immutable | ||
) | ||
return; | ||
|
||
var plantHolder = args.EntityManager.System<PlantHolderSystem>(); | ||
var popupSystem = args.EntityManager.System<SharedPopupSystem>(); | ||
|
||
if (plantHolderComp.Seed.Seedless) | ||
{ | ||
plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp); | ||
popupSystem.PopupEntity(Loc.GetString("botany-plant-seedsrestored"), args.TargetEntity); | ||
plantHolderComp.Seed.Seedless = false; | ||
} | ||
} | ||
|
||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => | ||
Loc.GetString("reagent-effect-guidebook-plant-seeds-add", ("chance", Probability)); | ||
} |
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
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
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
16 changes: 16 additions & 0 deletions
16
Content.Server/_EE/SpawnGasOnGib/SpawnGasOnGibComponent.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,16 @@ | ||
using Content.Shared.Atmos; | ||
|
||
namespace Content.Server._EE.SpawnGasOnGib; | ||
|
||
// <summary> | ||
// Spawns a gas mixture upon being gibbed. | ||
// </summary> | ||
[RegisterComponent] | ||
public sealed partial class SpawnGasOnGibComponent : Component | ||
{ | ||
// <summary> | ||
// The gas mixture to spawn. | ||
// </summary> | ||
[DataField("gasMixture", required: true)] | ||
public GasMixture Gas = new(); | ||
} |
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,24 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Server.Body.Components; | ||
|
||
namespace Content.Server._EE.SpawnGasOnGib; | ||
|
||
public sealed partial class SpawnGasOnGibSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly AtmosphereSystem _atmos = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<SpawnGasOnGibComponent, BeingGibbedEvent>(OnBeingGibbed); | ||
} | ||
|
||
private void OnBeingGibbed(EntityUid uid, SpawnGasOnGibComponent comp, BeingGibbedEvent args) | ||
{ | ||
if (_atmos.GetContainingMixture(uid, false, true) is not { } air) | ||
return; | ||
|
||
_atmos.Merge(air, comp.Gas); | ||
} | ||
} |
Oops, something went wrong.