ID:1301301
 
Code:
mob

Read(savefile/F)

..()

if (base_save_location && world.maxx)
var/last_x
var/last_y
var/nowZ
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> nowZ
F["swapMap"] >> swapMap
if(nowZ>=11)
if(swapMap==SINGLEPLAYER_DESERT)
var/Map/map = maps.copy(1)
addEnemies(map.z)
nowZ=map.z
else if(swapMap=="[src]'s house")
var/swapmap/map = SwapMaps_Load("house_[src.ckey]")
nowZ=map.z1
var/destination = locate(last_x, last_y, nowZ)

if (!Move(destination))
loc = destination

UpdateEquipment()
return

obj
Home
Wall
name = "Wall"
icon = 'HomeWall.dmi'
icon_state = "16"
autojoin = 16
density = 1
bound_height = 26
bound_width = 20
bound_x = 6

JoinMatch(direction)
var/turf/T = get_step(src, direction)

// Connect to the edges of the map.
if(!T)
return 0
// Connect to objects on the same type in that turf.
for(var/atom/movable/M in T)
if(M.type == src.type)
return 1

return 0

mob
proc
Create_Home()
src.map = SwapMaps_Find("house_[src.ckey]") //We check to see if there is a map already made

if(!src.map) //If NO map is found...
src.map = new("house_[src.ckey]",15,15,1) //If there isn't a map we create a new one that is 60x60 tiles

map.BuildFilledRectangle(locate(map.x1+1,map.y1+2,map.z1),\
locate(map.x2,map.y2,map.z1),\
/turf/Home/Floor) //We build a filled rectangle from 26,1 to 38,15

map.BuildRectangle(locate(map.x1+1,map.y1+2,map.z1),\
locate(map.x2,map.y2,map.z1),\
/obj/Home/Wall) //We build a rectangle from 25,0 to 39,14
for(var/atom/a in locate(map.x1+7,map.y1+2,map.z1))
del a
for(var/atom/a in locate(map.x1+8,map.y1+2,map.z1))
del a
new /turf/Home/DoorL(locate(map.x1+7,map.y1+2,map.z1))
new /turf/Home/DoorR(locate(map.x1+8,map.y1+2,map.z1))


Problem description:

So, the first time I create a home and Move the player there it all appears fine. The walls have all autojoined correctly, the doors appear in the right place, and everything is great.



However, if the player logs out, and then logs back in the walls aren't made correctly at all. I assume that some are being loaded AFTER the first ones are auto-joined, but I have no idea how to counteract that.



Any ideas?

P.s. I have tried removing the bounds adjustments, as well as using the default JoinMatch proc. Neither helped at all.
I found a "solution". It works, but it's a bit too much brute-force, and not enough elegance. I basically just hit every single turf in the SwapMap, force it to look at autojoining. Unfortunately due to the way the library is made this also makes all adjacent turfs check autojoining. As such, loading this map causes over 2000 calls to Join(). Any better suggestions?

    Read(savefile/F)
// Restore the mob's location if that has been specified and there is a map.
// Tries to use Move() to place the character, in case the game has special Move() handling.
// If that fails, forces the move by setting the loc.

// Call the default Read() behavior for mobs.
..()

if (base_save_location && world.maxx)
var/last_x
var/last_y
var/nowZ
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> nowZ
F["swapMap"] >> swapMap
if(nowZ>=11)
if(swapMap==SINGLEPLAYER_DESERT)
var/Map/map = maps.copy(1)
addEnemies(map.z)
nowZ=map.z
else if(swapMap=="[src]'s house")
var/swapmap/map = SwapMaps_Load("house_[src.ckey]")
for(var/turf/T in map.AllTurfs())
autojoining.Join(T)
nowZ=map.z1
var/destination = locate(last_x, last_y, nowZ)

if (!Move(destination))
loc = destination

UpdateEquipment()
return