1using System.Collections.Generic;
16 MapData mapData = DunGen.Generate(generator);
17 width = mapData.size_X + 2;
18 height = mapData.size_Y + 2;
27 biome = biome.Instantiate();
37 if (biome.name ==
"Dungeon_Water")
40 biome.exterior.block.id = (biome.interior.block.id = num);
47 biome.exterior.block.mat = (biome.interior.block.mat = 3);
61 bool flag = zone.lv <= 0;
67 for (
int i = 0; i < mapData.size_X + 2; i++)
69 for (
int j = 0; j < mapData.size_Y + 2; j++)
71 if (i == 0 || j == 0 || i >= mapData.size_X || j >= mapData.size_Y)
77 Dungen.Cell cell = mapData.cellsOnMap[i - 1, j - 1];
78 CellType type = cell.type;
87 Debug.LogError(
"exception: already created entrance");
111 Debug.LogError(
"exception: already created exit");
139 if (type.passable == generator.reversePassage)
145 if (!cell.isRoomCell)
153 Debug.LogError(
"exception: Failed to create entrance:");
158 Debug.LogError(
"exception: Failed to create exist:");
163 thing2.pos.cell._block = 0;
164 thing2.pos.cell.obj = 0;
168 thing.pos.cell._block = 0;
169 thing.pos.cell.obj = 0;
171 Dictionary<int, GenRoom> rooms =
new Dictionary<int, GenRoom>();
174 foreach (Dungen.Room room in mapData.rooms)
176 if (room.width != 0 && room.height != 0)
183 mapData.rooms.Clear();
185 if (mapData.rooms.Count == 0)
193 foreach (Dungen.Room room2 in mapData.rooms)
201 foreach (
GenRoom value
in rooms.Values)
207 Debug.Log(
"Dungen: room:" + rooms.Count +
"/" + mapData.rooms.Count +
" width:" +
width +
" height:" +
height);
209 num3 = num3 * Mathf.Min(20 +
zone.
DangerLv * 5, 100) / 100;
214 for (
int k = 0; k < num3; k++)
217 if (!point.cell.isModified && !point.HasThing && !point.HasBlock && !point.HasObj)
228 int num4 = ((forest || EClass.rnd(5) == 0) ? EClass.sources.objs.rows.Where((SourceObj.Row a) => a.ContainsTag(
"wild")).RandomItem().id : ((EClass.rnd(3) == 0) ? 108 : 105));
230 int num5 = Mathf.Min(EClass._zone.DangerLv, EClass.pc.Evalue(286) * 2 / 3);
233 thing5 = TraitSeed.MakeSeed(EClass.sources.objs.map[num4]);
234 Rand.SetSeed(EClass._zone.uid * 10 + num5);
235 TraitSeed.LevelSeed(thing5, (thing5.trait as TraitSeed).row, num5);
237 thing5.elements.SetBase(2, EClass.curve(thing5.encLV, 50, 10, 80));
239 foreach (
Point point2 in r.points)
241 if (!point2.cell.isModified && !point2.HasThing && !point2.HasBlock && !point2.HasObj)
243 map.SetObj(point2.x, point2.z, num4);
245 if (EClass.rnd(6) == 0)
249 point2.growth.SetStage(num6);
252 EClass._map.AddPlant(point2, thing5);
259 map.things.ForeachReverse(delegate(
Thing t)
263 Debug.Log(
"Purging Door:" + t.Name +
"/" + t.pos);
276 static void ClearPos(
Thing t)
287 t.pos.cell.height = 0;
295 rooms[room.
Index] = room;
297 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
static int rndSeed(int a, int seed)
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)