Logic with SwapMaps in Design Philosophy
|
|
I am having issues with thee logic in this. What I am trying to do is to have the map Z level increase so that people can "create a house" there. But, I want to be able to put a system in check so that when I am going to create a house, I could somehow check all Z levels to see if there was a "free one" first that would be from a player logging out who had created their "home". I am using the SwapMaps library.
mob/var assigned_house_x = 50 assigned_house_y = 50 assigned_house_z person mob/verb/set_name() person = input("Enter your name")
var/tmp/list/Housing mob verb SaveChunk() if(!loc) usr << "You must be on the map." return var/_x = usr.assigned_house_x var/_y = usr.assigned_house_y _x=max(1,min(_x,world.maxx-x+1)) _y=max(1,min(_y,world.maxy-y+1)) SwapMaps_SaveChunk("chunk",loc,locate(x+_x-1,y+_y-1,assigned_house_z)) LoadChunk() if(!loc) usr << "You must be on the map to save your house." return var/list/L=SwapMaps_GetSize("chunk") if(!L) usr << "House not found." return var/_x=max(1,min(x,world.maxx-L[1]+1)) var/_y=max(1,min(y,world.maxy-L[2]+1)) var/oldloc=loc usr << "Loading house at [_x],[_y],[assigned_house_z]" SwapMaps_LoadChunk("chunk",locate(_x,_y,assigned_house_z)) loc=oldloc proc Load_My_House() assigned_house_z = world.maxz + 1 world.maxz++ usr << "<font color = red>[world.maxz]-world.maxz.</font> <font color = blue>[assigned_house_z]-assigned_house_z.</font>" loc = locate(1,5,assigned_house_z)
Clean_Up_Duty() Housing.Add("[assigned_house_z]_[person]")
proc Set_Up() obj/floor icon = 'turfs.dmi' icon_state = "floor"
|
|