示例#1
0
            public MockShipYard(ILocation orbiting, Corporation owner)
                : base(orbiting, owner)
            {
                var refinedOre = new RefinedOre();
                refinedOre.Quantity = 1000;
                refinedOre.Owner = owner;

                AddItem(refinedOre);
            }
示例#2
0
文件: Refinery.cs 项目: andy-uq/Echo
        /// <summary>Load refined ore onto a ship</summary>
        /// <param name="ship"></param>
        /// <returns>True if the ship has picked up all the ore it can</returns>
        public bool LoadRefinedOre(Ship ship)
        {
            AssertShipInRange(ship, "load refined ore from this refinery");

            if (RefinedOre != 0)
            {
                var refinedOre = new RefinedOre();

                uint maxOreCanCarry = (refinedOre.SizePerUnit == 0d) ? RefinedOre : Math.Min((uint) Math.Floor(ship.CargoHoldRemaining/refinedOre.SizePerUnit), RefinedOre);

                RefinedOre -= maxOreCanCarry;

                refinedOre.Quantity = maxOreCanCarry;
                refinedOre.Owner = Owner;

                ship.AddCargo(refinedOre);

                Universe.EventPump.RaiseEvent(ship, EventType.ShipCargo, "Loaded {0:n0} refined ore from {1}", refinedOre.Quantity, Name);

                return (refinedOre.SizePerUnit == 0d) || (ship.CargoHoldRemaining < refinedOre.SizePerUnit);
            }

            return false;
        }