jp_DungeonRoom
cavern
place()
var/list/all = range(centre,size)
var/list/poss = gen.getAdjacent(centre)
turfs += new gen.floortype(centre)
var/count = round(size**2)
while(count>0 && poss.len)
var/turf/t = pick(poss)
poss-=t
for(var/turf/k in gen.getAdjacent(t))
if(gen.isWall(k))
if(k in all)
if(!(k in poss))
poss+=k
turfs += new gen.floortype(t)
count--
for(var/turf/t in turfs) for(var/turf/t2 in gen.getAdjacent(t)) if(gen.isWall(t2) && !(t2 in border)) border+=t2
turf/Open_World_1/Random_Gen_caves_prior
name = "Caves"
icon = 'Caves2.dmi'
icon_state = "13"
pheight=32
pwidth=32
density=1
Click()
if(src in oview(1))
src.icon = 'Caves2.dmi'
src.icon_state="0";src.density=0
turf
Open_World_1
Bonderies
layer=MOB_LAYER
B1
B2
turf/Open_World_1/Random_Gen_caves
name = "Caves"
icon = 'Caves2.dmi'
icon_state = "13"
autojoin = 13
pheight=32
pwidth=32
density=1
layer=OBJ_LAYER
New()
..()
spawn(10)
if(src.icon_state=="13")
src.density=0
return //13
if(src.icon_state=="7")
src.icon='Caves.dmi'
src.icon_state="ground1"
src.pwidth=32
src.pheight=32
src.density=1
Click()
if(src in oview(1))
src.icon = 'Caves2.dmi'
src.icon_state="0";src.density=0
var/jp_DungeonGenerator/generate = new()//generate = caves()//new()
mob
var
seed=null
mob
verb
caves()
src.client.view="100x100"
generate.setArea(/turf/Open_World_1/Bonderies/B2, /turf/Open_World_1/Bonderies/B1)
generate.setWallType(/turf/Open_World_1/Random_Gen_caves)
generate.setFloorType(/turf/Open_World_1/Random_Gen_caves)
generate.setAllowedRooms(list(/jp_DungeonRoom/cavern))
generate.setNumRooms(3)
generate.setExtraPaths(1)
generate.setMinPathLength(3)
generate.setMaxPathLength(45)
generate.setMinLongPathLength(0)
generate.setLongPathChance(0)
generate.setPathEndChance(100)
generate.setRoomMinSize(4)
generate.setRoomMaxSize(8)
generate.generate()
var/const/EROSION_PROB = 30
var/jp_DungeonRegion/r = generate.out_region
for(var/turf/t in r.getBorder()) if(prob(EROSION_PROB)) new generate.floortype(t)
src.display()
generate.setArea(/turf/Open_World_1/Bonderies/B2, /turf/Open_World_1/Bonderies/B1)
This line is what is currently causing the generator tool to crash, I set B1 at 2,2 and B2 at something like 200,100.
Problem description:
I'm having a devil of a time trying to use jp_DungeonGenerator. The library is exactly what my game needs, a means to randomly generate caves as well as pre-made rooms in the open world cave system. More or less, I want my caves to be similar to the game Terraria's caves. Randomly generated rooms with baddies, resources and loot. Some rooms will be large, others small, and you may need to dig to get from one to another.
Eventually, I want to set an area from 1 corner of the map to another and have all random caverns with like I mentioned, loot, resources and baddies. Right now I'm using the example, from the jp_DungeonGenerator demo to try and create one temporary cavern before I delve into making something more complex.
For testing purposes, I'm making mining as simple as just pressing click(). This click behavior is not refreshing foomer's autojoin library and simply making the turf clicked no longer dense and a particular icon_state. I'm creating the dungeon over the non-autojoining turfs, that being, turfs that will remain the same icon_state whatever the case, and making the dungeon use the autojoining turfs when creating the dungeon.
Anyway, I read through the helpfile and still can't get this baby working. Is there anyone out there that can give me insight on how to use this library, fix my ongoing problem or point me in the direction of an easier library to use?
Here's a link to library: http://www.byond.com/developer/Jp/ jp_DungeonGenerator?tab=related#tab=index
2. jp_DungeonGenerator.setArea() takes two turf instances, not turf types. This means you might just wrap those types in locate(), or give them tags and use locate().