Beispiel #1
0
        /// <summary>
        /// Drops the result of the harvesting down.
        /// </summary>
        /// <param name="l"></param>
        /// <param name="drop"></param>
        private void DropItem(Living l, Item drop)
        {
            //The tile the entity is standing on
            Tile entityOn = World.Data.World.GetTile(l.Dimension, l.MapLocation.X, l.MapLocation.Y);

            if (entityOn.Item == null || entityOn.Item.GetType() == drop.GetType())
            {
                ItemAdder.AddItem(drop, l.MapLocation, l.Dimension);
            }
            else
            {
                l.Inventory.AddItem(drop);
                Point2D      emtpyTile = ItemFinder.FindNearestNoItemResource(entityOn.MapLocation, l.Dimension);
                DropItemTask task      = new DropItemTask(emtpyTile, l.Dimension, drop, l.ID, Guid.NewGuid());
                task.ReservedFor = l.ID;
                TaskManager.Manager.AddTask(task);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Drops the result of the harvesting down.
        /// </summary>
        /// <param name="l"></param>
        /// <param name="drop"></param>
        private void DropItem(Living l, Item drop)
        {
            //The tile the entity is standing on
            ComponentSelectable entityS = l.GetExactComponent <ComponentSelectable>();
            Tile entityOn = World.Data.World.GetTile(l.Dimension, entityS.MapLocation.X, entityS.MapLocation.Y);


            if (entityOn.MainObject == null || entityOn.MainObject.GetType() == drop.GetType())
            {
                ItemAdder.AddItem(drop, entityS.MapLocation, l.Dimension);
            }
            else
            {
                l.Inventory.AddItem(drop);
                Point2D      emtpyTile = ItemFinder.FindMainObjectEmptyTile(entityOn.GetExactComponent <ComponentSelectable>().MapLocation, l.Dimension);
                DropItemTask task      = new DropItemTask(emtpyTile, l.Dimension, drop, l.ID, Guid.NewGuid());
                task.ReservedFor = l.ID;
                TaskManager.Manager.AddTask(task);
            }
        }