示例#1
0
def savemap(caller,name=None):
        """This allows players to savemaps to the server. This not only allows for easier transfer of files later on, but also allows for partial asynchronous work on a map by saving the map back to the server."""
	if name is None:
		name=sbserver.mapName()
	ogzfilename,ogz=openfile(os.path.join("maps",name+".ogz"),"wb")
	
	mapdata=sbserver.getMapDataFile()
	mapdata.seek(0)
	ogz.write(mapdata.read())
	ogz.close()
	
	triggerServerEvent("savemap",[caller,name,ogzfilename])
示例#2
0
def savemap(caller,name=None):
	"""Saves the map to the server. Note that the map must be sent prior to saving."""
	if name is None:
		name=sbserver.mapName()
	ogzfilename,ogz=openfile(os.path.join("maps",name+".ogz"),"wb")
	
	mapdata=sbserver.getMapDataFile()
	mapdata.seek(0)
	ogz.write(mapdata.read())
	ogz.close()
	
	triggerServerEvent("savemap",[caller,name,ogzfilename])
示例#3
0
def loadmap(caller,name=None):
        """This is the opposite of #savemap. This is automatically executed when you change to a map that the server has in storage."""
	if name is None:
		name=sbserver.mapName()
	
	ogzfilename,ogz=openfile(os.path.join("maps",name+".ogz"),"rb")
	
	mapdata=sbserver.getMapDataFile()
	mapdata.seek(0)
	mapdata.truncate(0)
	mapdata.write(ogz.read())
	mapdata.flush()
	ogz.close()
	
	triggerServerEvent("loadmap",[caller,name,ogzfilename])