using Content.Server.Popups;
using Content.Shared.Botany;
using Content.Shared.Examine;
+using Content.Shared.Hands.EntitySystems;
using Content.Shared.Popups;
using Content.Shared.Random.Helpers;
using Content.Shared.Slippery;
public sealed partial class BotanySystem : EntitySystem
{
[Dependency] private readonly AppearanceSystem _appearance = default!;
+ [Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
#region SeedPrototype prototype stuff
- public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates transformCoordinates)
+ /// <summary>
+ /// Spawns a new seed packet on the floor at a position, then tries to put it in the user's hands if possible.
+ /// </summary>
+ public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user)
{
- var seed = Spawn(proto.PacketPrototype, transformCoordinates);
+ var seed = Spawn(proto.PacketPrototype, coords);
var seedComp = EnsureComp<SeedComponent>(seed);
seedComp.Seed = proto;
var val = Loc.GetString("botany-seed-packet-name", ("seedName", name), ("seedNoun", noun));
MetaData(seed).EntityName = val;
+ // try to automatically place in user's other hand
+ _hands.TryPickupAnyHand(user, seed);
return seed;
}
}
component.Seed.Unique = false;
- var seed = _botanySystem.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates);
+ var seed = _botanySystem.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User);
seed.RandomOffset(0.25f);
var displayName = Loc.GetString(component.Seed.DisplayName);
_popupSystem.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
}
else if (component.Age < 0) // Revert back to seed packet!
{
- _botanySystem.SpawnSeedPacket(component.Seed, Transform(uid).Coordinates);
+ // will put it in the trays hands if it has any, please do not try doing this
+ _botanySystem.SpawnSeedPacket(component.Seed, Transform(uid).Coordinates, uid);
RemovePlant(uid, component);
component.ForceUpdate = true;
Update(uid, component);