Example #1
0
        public void Plant(GameObject who)
        {
            Cell cell = ParentObject.CurrentCell;

            if (cell == null)
            {
                Popup.Show("Put things on the ground to plant them.");
                return;
            }
            if (ParentObject.GetPart <Stacker>() != null && ParentObject.GetPart <Stacker>().StackCount > 1)
            {
                GameObject gameObject = ParentObject.DeepCopy(true);
                gameObject.GetPart <Stacker>().StackCount   = ParentObject.GetPart <Stacker>().StackCount - 1;
                ParentObject.GetPart <Stacker>().StackCount = 1;
                who.GetPart <Inventory>().AddObject(gameObject);
                IPart.AddPlayerMessage("You plant one " + ParentObject.DisplayNameOnly + " and collect the rest");
            }

            ParentObject.pPhysics.Takeable = false;
            this.stage = 1;
            //ParentObject.pPhysics.Category = "Plant";
            //ParentObject.RemovePart<NoEffects>();
            tileupdate();
            // Statistic statistic = new Statistic("Energy", 0, 10000, 0, ParentObject);
            // statistic.Owner = ParentObject;
            // ParentObject.Statistics.Add("Energy", statistic);

            // XRLCore.Core.Game.ActionManager.AddActiveObject(ParentObject);
        }