public virtual bool Open(Rectangle dimensions) { if (isOpened) { throw new Exception("Cannot open map because it is alread opened."); } //PoMWorld pomWorld = PathOfModifiers.Instance.GetModWorld<PoMWorld>(); //int ID = pomWorld.AddOpenMap(this); //if (ID < 0) // return false; generator.GenerateTerrain(dimensions); int npcs = GetNPCFrequency(dimensions); generator.SpawnPacks(dimensions, npcs, MakePackArray(npcs)); openMap = new OpenMap(dimensions); //This method should never run on a client, so only case is SP/Server if (Main.netMode == NetmodeID.Server) { MapPacketHandler.SSyncOpenedMap(dimensions); } return(true); }
public virtual void Close() { if (!isOpened) { throw new Exception("Cannot close map because it is not opened."); } generator.ClearMap(openMap.dimensions); if (Main.netMode == NetmodeID.Server) { MapPacketHandler.SSyncOpenedMap(openMap.dimensions, true); } //PoMWorld pomWorld = PathOfModifiers.Instance.GetModWorld<PoMWorld>(); //pomWorld.RemoveOpenMap(openMap.ID); openMap = null; }