Problems With DMP Read/Write in Developer Help
|
|
Code:
world name = "Dungeon" mob = /mob/creating_character view = 10 maxx=50 maxy=50 turf = /turf/floor/grass New() ..() darke_mapwall = /turf/wall/concrete darke_mappassage = /turf/door darke_mapfloor = /turf/floor/indoor/tile darke_roomX = 10 darke_roomY = 10 darke_openchance = 25 darke_passagechance = 15 darke_nodeX = 1 darke_nodeY = 1
var/dmp_reader/new_reader = new() if(fexists("[world.name].dmp")) new_reader.load_map("[world.name].dmp") world.log << "Loading dungeon [world.maxz]..." else world.log << "Generating dungeon..." darke_MakeMap(1,world.maxx,1,world.maxy, 1)
Del() if(fexists("[world.name].dmp")) fdel("[world.name].dmp") var/dmp_writer/D = new() var/map_name=world.name var/turf/south_west_deep = locate(1,1,1) var/turf/north_east_shallow = locate(world.maxx,world.maxy,world.maxz-1) D.save_map(south_west_deep, north_east_shallow, map_name, flags = DMP_IGNORE_PLAYERS) ..()
|
Problem description: Whenever I initially run, things work fine. Town.dmm goes on z level 2 and the dungeon on 1. It seems to just save z level 1. Great. Then, when I start it back up, it loads the dungeon to Z 3, town to Z 2 and a blank level to Z 1. This, then, gets saved. Why is it creating a blank Z level?
|
I think you mixed up your variables here:
var/turf/north_east_shallow = locate(world.maxx,world.maxy,world.maxx-1)You probably intended the last argument to be world.maxz-1, correct?
I'm not sure if that is the cause of your problems, but it may be contributing.
Also, this section has be baffled:
for(var/Number = rand(10,20), Number > 0 , Number--)do
// find a random turf
Turf = locate(rand(1,world.maxx),rand(1,world.maxy),2)
// keep looking until you find a floor that's empty
while(!isfloor(Turf) && Turf.contents)
if(!stairs_placed)
stairs_placed=1
var/obj/stairs/up/O=new /obj/stairs(Turf)
O.tag="stairsup[O.z]"
O.target="stairsdown[O.z+1]"
world << "Stairs placed ([O.x],[O.y])"
It seems to be searching z-level 2 (which you say is the town, correct?) for an open floor turf to place stairs going up. This makes me think you either mispoke, or had originally intended to have the town on z-1 and the dungeon on z-2, unless it's a floating dungeon...
Also, var/obj/stairs/up/O=new /obj/stairs(Turf) seems like an odd statement. Is there an /obj/stairs/up type, or was that accidentally left behind from something else? Either way, the new /obj/stairs(Turf) can be shortened to new(Turf).