Metabolism tweaks / metabolism 4.0 (#5246)
* Metabolism tweaks
* use MetabolismArgs and convert ReagentEntityReactions into ReagentEffects
* fork forgor 💀
* fixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -6,9 +7,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
{
|
||||
public class PlantAdjustHealth : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.Health += Amount;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -6,9 +7,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
{
|
||||
public class PlantAdjustMutationLevel : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.MutationLevel += Amount * plantHolderComp.MutationMod;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public class PlantAdjustMutationMod : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.MutationMod += Amount;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public class PlantAdjustNutrition : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.AdjustNutrient(Amount);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public class PlantAdjustPests : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.PestLevel += Amount;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public class PlantAdjustToxins : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.Toxins += Amount;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public class PlantAdjustWater : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.AdjustWater(Amount);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public class PlantAdjustWeeds : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.WeedLevel += Amount;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public class PlantAffectGrowth : PlantAdjustAttribute
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager))
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
return;
|
||||
|
||||
plantHolderComp.AffectGrowth((int) Amount);
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[DataDefinition]
|
||||
public class PlantClonexadone : ReagentEffect
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp)
|
||||
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out PlantHolderComponent? plantHolderComp)
|
||||
|| plantHolderComp.Seed == null || plantHolderComp.Dead)
|
||||
return;
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[DataDefinition]
|
||||
public class PlantDiethylamine : ReagentEffect
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp)
|
||||
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out PlantHolderComponent? plantHolderComp)
|
||||
|| plantHolderComp.Seed == null || plantHolderComp.Dead ||
|
||||
plantHolderComp.Seed.Immutable)
|
||||
return;
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[DataDefinition]
|
||||
public class RobustHarvest : ReagentEffect
|
||||
{
|
||||
public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
|
||||
public override void Metabolize(ReagentEffectArgs args)
|
||||
{
|
||||
if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp)
|
||||
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out PlantHolderComponent? plantHolderComp)
|
||||
|| plantHolderComp.Seed == null || plantHolderComp.Dead ||
|
||||
plantHolderComp.Seed.Immutable)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user