From e05bac1c15e5406083a8b754ab5b25e69beb9222 Mon Sep 17 00:00:00 2001 From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Fri, 4 Aug 2023 08:15:05 +0100 Subject: [PATCH] Various cow fixes (#18602) Reparent cow outputs to the correct grid. Adjust produce so that cows and other multi-stomached animals can eat most produce. --------- Co-authored-by: deltanedas <@deltanedas:kde.org> --- .../ReactionEffects/CreateEntityReactionEffect.cs | 7 +++++-- .../Nutrition/EntitySystems/AnimalHusbandrySystem.cs | 6 ++++-- .../Entities/Objects/Consumable/Food/produce.yml | 4 ++++ Resources/Prototypes/Entities/Objects/Misc/kudzu.yml | 1 - 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs index e87b4ca771..2cc5ea9dbe 100644 --- a/Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Reagent; +using Robust.Shared.GameObjects; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; @@ -28,13 +29,15 @@ public sealed class CreateEntityReactionEffect : ReagentEffect public override void Effect(ReagentEffectArgs args) { var transform = args.EntityManager.GetComponent(args.SolutionEntity); + var transformSystem = args.EntityManager.System(); var quantity = Number * args.Quantity.Int(); for (var i = 0; i < quantity; i++) { - args.EntityManager.SpawnEntity(Entity, transform.MapPosition); + var uid = args.EntityManager.SpawnEntity(Entity, transform.MapPosition); + transformSystem.AttachToGridOrMap(uid); - // TODO figure out how to spawn inside of containers + // TODO figure out how to properly spawn inside of containers // e.g. cheese: // if the user is holding a bowl milk & enzyme, should drop to floor, not attached to the user. // if reaction happens in a backpack, should insert cheese into backpack. diff --git a/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs b/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs index 1a9167182f..fea72c814c 100644 --- a/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs +++ b/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs @@ -21,15 +21,16 @@ namespace Content.Server.Nutrition.EntitySystems; /// public sealed class AnimalHusbandrySystem : EntitySystem { + [Dependency] private readonly EntityLookupSystem _entityLookup = default!; + [Dependency] private readonly HungerSystem _hunger = default!; [Dependency] private readonly IAdminLogManager _adminLog = default!; [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly EntityLookupSystem _entityLookup = default!; - [Dependency] private readonly HungerSystem _hunger = default!; [Dependency] private readonly MetaDataSystem _metaData = default!; [Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly SharedTransformSystem _transform = default!; private readonly HashSet _failedAttempts = new(); @@ -197,6 +198,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem foreach (var spawn in spawns) { var offspring = Spawn(spawn, xform.Coordinates.Offset(_random.NextVector2(0.3f))); + _transform.AttachToGridOrMap(offspring); if (component.MakeOffspringInfant) { var infant = AddComp(offspring); diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml index 02fffadc03..4c76bf7f98 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml @@ -8,6 +8,9 @@ - type: SolutionContainerManager - type: Sprite state: produce + # let cows eat raw produce like wheat and oats + - type: Food + requiredStomachs: 2 - type: Produce - type: PotencyVisuals - type: Appearance @@ -981,6 +984,7 @@ seedId: flyAmanita - type: Extractable grindableSolutionName: food + - type: BadFood - type: entity name: gatfruit diff --git a/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml b/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml index 89dd885c4f..f2e3c46bd2 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml @@ -83,7 +83,6 @@ nodeGroupID: Spreader - type: Food requiredStomachs: 2 # ruminants have 4 stomachs but i dont care to give them literally 4 stomachs. 2 is good - # TODO make botany plants edible to ruminants as well ... delay: 0.5 - type: FlavorProfile flavors: