public bool DoHarvest(EntityUid user)
        {
            if (Seed == null || _entMan.Deleted(user) || !EntitySystem.Get <ActionBlockerSystem>().CanInteract(user))
            {
                return(false);
            }

            if (Harvest && !Dead)
            {
                if (_entMan.TryGetComponent(user, out HandsComponent? hands))
                {
                    if (!Seed.CheckHarvest(user, hands.GetActiveHand?.Owner))
                    {
                        return(false);
                    }
                }
                else if (!Seed.CheckHarvest(user))
                {
                    return(false);
                }

                Seed.Harvest(user, YieldMod);
                AfterHarvest();
                return(true);
            }

            if (!Dead)
            {
                return(false);
            }

            RemovePlant();
            AfterHarvest();
            return(true);
        }
Esempio n. 2
0
        public bool DoHarvest(IEntity user)
        {
            if (Seed == null || user.Deleted || !ActionBlockerSystem.CanInteract(user))
            {
                return(false);
            }

            if (Harvest && !Dead)
            {
                if (user.TryGetComponent(out HandsComponent? hands))
                {
                    if (!Seed.CheckHarvest(user, hands.GetActiveHand?.Owner))
                    {
                        return(false);
                    }
                }
                else if (!Seed.CheckHarvest(user))
                {
                    return(false);
                }

                Seed.Harvest(user, YieldMod);
                AfterHarvest();
                return(true);
            }

            if (!Dead)
            {
                return(false);
            }

            RemovePlant();
            AfterHarvest();
            return(true);
        }