Metabolism tweaks / metabolism 4.0 (#5246)

* Metabolism tweaks

* use MetabolismArgs and convert ReagentEntityReactions into ReagentEffects

* fork forgor 💀

* fixes
This commit is contained in:
mirrorcult
2021-11-10 03:11:28 -07:00
committed by GitHub
parent 6486e07077
commit 747f02f3f3
41 changed files with 328 additions and 291 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;