Example #1
0
        public void AddItem(int x, int y, ItemObject itemObject)
        {
            GameLog.DebugFormat("{0}, {1}, {2} qty {3} id {4}",
                                x, y, itemObject.Name, itemObject.Count, itemObject.Id);
            if (itemObject.Id == 0)
            {
                World.Insert(itemObject);
            }

            if (itemObject == null)
            {
                GameLog.DebugFormat("ItemObject is null, aborting");
                return;
            }
            // Add the ItemObject to the world at the given location.
            itemObject.X   = (byte)x;
            itemObject.Y   = (byte)y;
            itemObject.Map = this;
            lock (_lock)
            {
                EntityTree.Add(itemObject);
                Objects.Add(itemObject);
            }
            NotifyNearbyAoiEntry(itemObject);
        }
Example #2
0
 public void InsertSignpost(Objects.Signpost post)
 {
     World.Insert(post);
     Insert(post, post.X, post.Y);
     Signposts[new Tuple <byte, byte>(post.X, post.Y)] = post;
     Logger.InfoFormat("Inserted signpost {0}@{1},{2}", post.Map.Name, post.X, post.Y);
 }
Example #3
0
        private void InsertDoor(byte x, byte y, bool open, bool isLeftRight, bool triggerCollision = true)
        {
            var door = new Objects.Door(x, y, open, isLeftRight, triggerCollision);

            World.Insert(door);
            Insert(door, door.X, door.Y);
            Doors[new Tuple <byte, byte>(door.X, door.Y)] = door;
        }
Example #4
0
        public void InsertReactor(reactor toinsert)
        {
            var reactor = new Reactor(toinsert);

            World.Insert(reactor);
            Insert(reactor, reactor.X, reactor.Y);
            reactor.OnSpawn();
        }
Example #5
0
        public void InsertNpc(npc toinsert)
        {
            var merchant = new Merchant(toinsert);

            World.Insert(merchant);
            Insert(merchant, merchant.X, merchant.Y);
            merchant.OnSpawn();
        }
Example #6
0
        public void InsertSignpost(signpost toinsert)
        {
            Logger.InfoFormat("Inserting signpost {0}@{1},{2}", toinsert.map.name, toinsert.map_x, toinsert.map_y);
            var post = new Signpost(toinsert);

            World.Insert(post);
            Insert(post, post.X, post.Y);
            Signposts[new Tuple <byte, byte>(post.X, post.Y)] = post;
        }
Example #7
0
 public void InsertNpc(Merchant toInsert)
 {
     World.Insert(toInsert);
     Insert(toInsert, toInsert.X, toInsert.Y);
     try
     {
         toInsert.OnSpawn();
     }
     catch (Exception e)
     {
         GameLog.Error("NPC {name}: exception occurred, aborting: {e}", toInsert.Name, e);
     }
 }
Example #8
0
 public void InsertCreature(Creature toInsert)
 {
     World.Insert(toInsert);
     Insert(toInsert, toInsert.X, toInsert.Y);
     Logger.DebugFormat("Monster {0} with id {1} spawned.", toInsert.Name, toInsert.Id);
 }
Example #9
0
 public void InsertNpc(Merchant toInsert)
 {
     World.Insert(toInsert);
     Insert(toInsert, toInsert.X, toInsert.Y);
     toInsert.OnSpawn();
 }
Example #10
0
 public void InsertReactor(Reactor toInsert)
 {
     World.Insert(toInsert);
     Insert(toInsert, toInsert.X, toInsert.Y);
     Reactors[new Tuple <byte, byte>(toInsert.X, toInsert.Y)] = toInsert;
 }