/// <summary> /// Adds an item during the ongoing world generation. /// </summary> public static void AddItemWorldGen(Item item, Point2D mapLocation, ProtoArray <Chunk> map, int dimension) { Point2D chunkLocation = WorldUtil.CalculateChunkLocation(mapLocation); Chunk chunk = map[chunkLocation.X, chunkLocation.Y]; ItemAdder.RememberWhichChunk(chunkLocation, item.ItemID, dimension); ItemAdder.RememberWhichTile(item, mapLocation, chunk, dimension); ItemAdder.StoreItem(chunk, mapLocation, item); }
/// <summary> /// Adds an item to the specified map location. /// </summary> public static void AddItem(Item item, Point2D mapLocation, int dimension) { Point2D chunkLocation = WorldUtil.CalculateChunkLocation(mapLocation); Chunk chunk = World.Data.World.Dimensions[dimension].GetChunk(chunkLocation.X, chunkLocation.Y); ItemAdder.RememberWhichChunk(chunkLocation, item.ItemID, dimension); ItemAdder.RememberWhichTile(item, mapLocation, chunk, dimension); ItemAdder.StoreItem(chunk, mapLocation, item); }
/// <summary> /// Adds an item to the specified map location. /// </summary> public static void AddItem(Item item, Point2D mapLocation, int dimension) { if (World.Data.World.Mode != Networking.EngineMode.ServerOnly) { NetworkAdd(item, mapLocation, dimension); } Point2D chunkLocation = WorldUtil.CalculateChunkLocation(mapLocation); Chunk chunk = World.Data.World.Dimensions[dimension].GetChunk(chunkLocation.X, chunkLocation.Y); ItemAdder.RememberWhichChunk(chunkLocation, item.ItemID, dimension); ItemAdder.RememberWhichTile(item, mapLocation, chunk); ItemAdder.StoreItem(chunk, mapLocation, item); }
public override void HandleMessage(BaseMessage message) { RouteCreatedMessage msg = (RouteCreatedMessage)message; if (this.Validated(msg.Path, msg.Dimension)) { Point2D location = msg.Path[0].Origin; Point2D chunkLocation = WorldUtil.CalculateChunkLocation(location); Chunk chunk = World.GetChunk(msg.Dimension, chunkLocation.X, chunkLocation.Y); Living l = chunk.Creatures.Where(t => t.Value.MapLocation.Equals(location)).ElementAt(0).Value; if (l != null && l.ID == msg.LivingID) { l.QueuedMovement.Clear(); MagicalLifeAPI.Util.Extensions.EnqueueCollection <PathLink>(l.QueuedMovement, msg.Path); } } else { MasterLog.DebugWriteLine("Server received invalid path"); } }