Add plant phalanximine, fix slippery fruits (#19820)

This commit is contained in:
Doru991
2023-09-04 23:11:40 +03:00
committed by GitHub
parent 941e49e580
commit c6869c89d0
3 changed files with 45 additions and 0 deletions

View File

@@ -7,12 +7,16 @@ using Content.Server.Popups;
using Content.Shared.Botany;
using Content.Shared.Examine;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Random.Helpers;
using Content.Shared.Slippery;
using Content.Shared.StepTrigger.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -29,6 +33,8 @@ public sealed partial class BotanySystem : EntitySystem
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly FixtureSystem _fixtureSystem = default!;
[Dependency] private readonly CollisionWakeSystem _colWakeSystem = default!;
public override void Initialize()
{
@@ -187,6 +193,14 @@ public sealed partial class BotanySystem : EntitySystem
var slippery = EnsureComp<SlipperyComponent>(entity);
EntityManager.Dirty(slippery);
EnsureComp<StepTriggerComponent>(entity);
// Need a fixture with a slip layer in order to actually do the slipping
var fixtures = EnsureComp<FixturesComponent>(entity);
var body = EnsureComp<PhysicsComponent>(entity);
var shape = fixtures.Fixtures["fix1"].Shape;
_fixtureSystem.TryCreateFixture(entity, shape, "slips", 1, false, (int) CollisionGroup.SlipLayer, manager: fixtures, body: body);
// Need to disable collision wake so that mobs can collide with and slip on it
var collisionWake = EnsureComp<CollisionWakeComponent>(entity);
_colWakeSystem.SetEnabled(entity, false, collisionWake);
}
}

View File

@@ -0,0 +1,24 @@
using Content.Server.Botany.Components;
using Content.Shared.Chemistry.Reagent;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
{
[UsedImplicitly]
[DataDefinition]
public sealed partial class PlantPhalanximine : ReagentEffect
{
public override void Effect(ReagentEffectArgs args)
{
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out PlantHolderComponent? plantHolderComp)
|| plantHolderComp.Seed == null || plantHolderComp.Dead ||
plantHolderComp.Seed.Immutable)
return;
plantHolderComp.Seed.Viable = true;
}
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability));
}
}

View File

@@ -547,6 +547,13 @@
physicalDesc: reagent-physical-desc-acrid
flavor: medicine
color: "#c8ff75"
plantMetabolism:
- !type:PlantAdjustToxins
amount: 6
- !type:PlantPhalanximine
conditions:
- !type:ReagentThreshold
min: 4
metabolisms:
Medicine:
effects: