1using System.Collections.Generic;
15 MapData mapData = DunGen.Generate(generator);
16 width = mapData.size_X + 2;
17 height = mapData.size_Y + 2;
26 biome = biome.Instantiate();
47 bool flag = zone.lv <= 0;
53 for (
int i = 0; i < mapData.size_X + 2; i++)
55 for (
int j = 0; j < mapData.size_Y + 2; j++)
57 if (i == 0 || j == 0 || i >= mapData.size_X || j >= mapData.size_Y)
63 Dungen.Cell cell = mapData.cellsOnMap[i - 1, j - 1];
64 CellType type = cell.type;
73 Debug.LogError(
"exception: already created entrance");
97 Debug.LogError(
"exception: already created exit");
125 if (type.passable == generator.reversePassage)
131 if (!cell.isRoomCell)
139 Debug.LogError(
"exception: Failed to create entrance:");
144 Debug.LogError(
"exception: Failed to create exist:");
149 thing2.pos.cell._block = 0;
150 thing2.pos.cell.obj = 0;
154 thing.pos.cell._block = 0;
155 thing.pos.cell.obj = 0;
157 Dictionary<int, GenRoom> rooms =
new Dictionary<int, GenRoom>();
160 foreach (Dungen.Room room in mapData.rooms)
162 if (room.width != 0 && room.height != 0)
169 mapData.rooms.Clear();
171 if (mapData.rooms.Count == 0)
179 foreach (Dungen.Room room2 in mapData.rooms)
187 foreach (
GenRoom value
in rooms.Values)
193 Debug.Log(
"Dungen: room:" + rooms.Count +
"/" + mapData.rooms.Count +
" width:" +
width +
" height:" +
height);
195 num2 = num2 * Mathf.Min(20 +
zone.
DangerLv * 5, 100) / 100;
200 for (
int k = 0; k < num2; k++)
203 if (!point.cell.isModified && !point.HasThing && !point.HasBlock && !point.HasObj)
215 int id = ((EClass.rnd(3) == 0) ? 108 : 105);
216 foreach (Point point2 in r.points)
218 if (!point2.cell.isModified && !point2.HasThing && !point2.HasBlock && !point2.HasObj)
220 map.SetObj(point2.x, point2.z, id);
222 if (EClass.rnd(6) == 0)
226 point2.growth.SetStage(num3);
236 Debug.Log(
"Purging Door:" + t.Name +
"/" + t.pos);
249 static void ClearPos(
Thing t)
260 t.pos.cell.height = 0;
268 rooms[room.
Index] = room;
270 Debug.Log(
"Room" + count +
" " + room.
width +
"*" + room.
height +
" " + room);
void SetSize(int size, int _poiSize)
string GetIdStairs(bool upstairs)
void Populate(Point point, bool interior=false)
static Crawler Create(string id)
bool CrawlUntil(Map map, Func< Point > onStart, int tries, Func< Result, bool > canComplete, Action onFail=null)
static SourceManager sources
void SetBlock(BiomeProfile.Tile t, int x, int z, int idMat=-1)
void SetFloor(BiomeProfile.Tile t, int x, int z)
void Init(Dungen.Room room)
static SourceMaterial.Row GetRandomMaterialFromCategory(int lv, string cat, SourceMaterial.Row fallback)
static MapGenDungen _Instance
static MapGenDungen Instance
override bool OnGenerateTerrain()
Point GetRandomPoint(Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
void CreateNew(int size, bool setReference=true)
void SetObj(int id=0, int value=1, int dir=0)
List< Card > ListCards(bool includeMasked=false)
Point Set(int _x, int _z)
void SetBlock(int idMat=0, int idBlock=0)
static int Range(int min, int max)
static Thing CreateFromCategory(string idCat, int lv=-1)
static Thing Create(string id, int idMat=-1, int lv=-1)
bool IsValid(bool shouldLookGood=true)
virtual bool ShouldMakeExit
virtual void OnGenerateRooms(BaseMapGen gen)
Card AddCard(Card t, Point point)