Exemplo n.º 1
0
        /// <summary>
        /// Adds the FurnaceInterface to a FurnaceInstance, then returns the FurnaceInstance it is added to.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <param name="furnace"></param>
        /// <returns>The FurnaceInstance that the FurnaceInterface was added to</returns>
        private static FurnaceInstance AddFurnaceInterface(UniversalCoords coords, FurnaceInterface furnace)
        {
            string id = String.Format("{0}-{1},{2},{3}", furnace.World.Name, coords.WorldX, coords.WorldY, coords.WorldZ);
            lock (_staticLock)
            {
                FurnaceInstance furnaceInstance;
                if (!_furnaceInstances.ContainsKey(id))
                {
                    furnaceInstance = new FurnaceInstance(furnace.World, coords);
                    _furnaceInstances[id] = furnaceInstance;
                }
                else
                {
                    furnaceInstance = _furnaceInstances[id];
                }
                furnaceInstance.Add(furnace);

                return furnaceInstance;
            }
        }
Exemplo n.º 2
0
 protected override void DoOpen()
 {
     base.DoOpen();
     this._furnaceInstance = AddFurnaceInterface(Coords, this);
 }
Exemplo n.º 3
0
 protected override void DoClose()
 {
     RemoveFurnaceInterface(Coords, this);
     _furnaceInstance = null;
     base.DoClose();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Adds the FurnaceInterface to a FurnaceInstance, then returns the FurnaceInstance it is added to.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <param name="furnace"></param>
        /// <returns>The FurnaceInstance that the FurnaceInterface was added to</returns>
        private static FurnaceInstance AddFurnaceInterface(int x, int y, int z, FurnaceInterface furnace)
        {
            string id = String.Format("{0}-{1},{2},{3}", furnace.World.Name, x, y, z);
            lock (_staticLock)
            {
                FurnaceInstance furnaceInstance;
                if (!_furnaceInstances.ContainsKey(id))
                {
                    furnaceInstance = new FurnaceInstance(furnace.World, x, y, z);
                    _furnaceInstances[id] = furnaceInstance;
                }
                else
                {
                    furnaceInstance = _furnaceInstances[id];
                }
                furnaceInstance.Add(furnace);

                return furnaceInstance;
            }
        }
Exemplo n.º 5
0
 protected override void DoOpen()
 {
     base.DoOpen();
     this._furnaceInstance = AddFurnaceInterface(this.X, this.Y, this.Z, this);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Adds the FurnaceInterface to a FurnaceInstance, then returns the FurnaceInstance it is added to.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <param name="furnace"></param>
        /// <returns>The FurnaceInstance that the FurnaceInterface was added to</returns>
        private static FurnaceInstance AddFurnaceInterface(UniversalCoords coords, FurnaceInterface furnace)
        {
            string id = String.Format("{0}-{1},{2},{3}", furnace.World.Name, coords.WorldX, coords.WorldY, coords.WorldZ);
            lock (_staticLock)
            {
                FurnaceInstance furnaceInstance;
                if (!_furnaceInstances.ContainsKey(id))
                {
                    furnaceInstance = new FurnaceInstance(furnace.World, coords);
                    furnaceInstance.InitSlots(furnace[(short)FurnaceSlots.Input], furnace[(short)FurnaceSlots.Fuel], furnace[(short)FurnaceSlots.Output]);
                    furnaceInstance.TryBurn();
                    _furnaceInstances[id] = furnaceInstance;
                }
                else
                {
                    furnaceInstance = _furnaceInstances[id];
                }
                furnaceInstance.Add(furnace);

                return furnaceInstance;
            }
        }