mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-15 00:53:23 +01:00
NanoUI updates.
* Map gen verb is now limited to those with server access. * Added Z layer support. Conflicts: code/modules/admin/admin_verbs.dm nano/images/nanomap.png
This commit is contained in:
@@ -129,8 +129,8 @@ var/list/admin_verbs_server = list(
|
||||
/client/proc/cmd_admin_change_custom_event,
|
||||
/client/proc/cmd_admin_create_centcom_report,
|
||||
/client/proc/cmd_admin_dress,
|
||||
/client/proc/response_team // Response Teams admin verb
|
||||
|
||||
/client/proc/response_team, // Response Teams admin verb
|
||||
/client/proc/nanomapgen_DumpImage
|
||||
)
|
||||
var/list/admin_verbs_debug = list(
|
||||
/client/proc/cmd_admin_list_open_jobs,
|
||||
|
||||
@@ -16,16 +16,14 @@
|
||||
//Call these procs to dump your world to a series of image files (!!)
|
||||
//NOTE: Does not explicitly support non 32x32 icons or stuff with large pixel_* values, so don't blame me if it doesn't work perfectly
|
||||
|
||||
/mob/verb/nanomapgen_DumpImage()
|
||||
set category = "Server"
|
||||
/client/proc/nanomapgen_DumpImage()
|
||||
set name = "Generate NanoUI Map"
|
||||
set category = "Server"
|
||||
|
||||
if(!src.client.holder)
|
||||
src << "Only administrators may use this command."
|
||||
return
|
||||
nanomapgen_DumpTile()
|
||||
if(holder)
|
||||
nanomapgen_DumpTile(1, 1, text2num(input(usr,"Enter the Z level to generate")))
|
||||
|
||||
/mob/proc/nanomapgen_DumpTile(var/startX = 1, var/startY = 1, var/currentZ = 1, var/endX = -1, var/endY = -1)
|
||||
/client/proc/nanomapgen_DumpTile(var/startX = 1, var/startY = 1, var/currentZ = 1, var/endX = -1, var/endY = -1)
|
||||
|
||||
if (endX < 0 || endX > world.maxx)
|
||||
endX = world.maxx
|
||||
@@ -33,13 +31,20 @@
|
||||
if (endY < 0 || endY > world.maxy)
|
||||
endY = world.maxy
|
||||
|
||||
if (currentZ < 0 || currentZ > world.maxz)
|
||||
usr << "NanoMapGen: <B>ERROR: currentZ ([currentZ]) must be between 1 and [world.maxz]</B>"
|
||||
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
if (startX > endX)
|
||||
world.log << "NanoMapGen: <B>ERROR: startX ([startX]) cannot be greater than endX ([endX])</B>"
|
||||
usr << "NanoMapGen: <B>ERROR: startX ([startX]) cannot be greater than endX ([endX])</B>"
|
||||
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
if (startY > endX)
|
||||
world.log << "NanoMapGen: <B>ERROR: startY ([startY]) cannot be greater than endY ([endY])</B>"
|
||||
usr << "NanoMapGen: <B>ERROR: startY ([startY]) cannot be greater than endY ([endY])</B>"
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
@@ -49,7 +54,8 @@
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
world.log << "NanoMapGen: <B>GENERATE MAP ([startX],[startY],[currentZ]) to ([endX],[endY],[currentZ])</B>"
|
||||
world.log << "NanoMapGen: <B>GENERATE MAP ([startX],[startY],[currentZ]) to ([endX],[endY],[currentZ])</B>"
|
||||
usr << "NanoMapGen: <B>GENERATE MAP ([startX],[startY],[currentZ]) to ([endX],[endY],[currentZ])</B>"
|
||||
|
||||
var/count = 0;
|
||||
for(var/WorldX = startX, WorldX <= endX, WorldX++)
|
||||
@@ -57,22 +63,26 @@
|
||||
|
||||
var/atom/Turf = locate(WorldX, WorldY, currentZ)
|
||||
|
||||
var/icon/TurfIcon = new(Turf.icon, Turf.icon_state, Turf.dir, 1, 0)
|
||||
var/icon/TurfIcon = new(Turf.icon, Turf.icon_state)
|
||||
TurfIcon.Scale(NANOMAP_ICON_SIZE, NANOMAP_ICON_SIZE)
|
||||
|
||||
Tile.Blend(TurfIcon, ICON_OVERLAY, ((WorldX - 1) * NANOMAP_ICON_SIZE), ((WorldY - 1) * NANOMAP_ICON_SIZE))
|
||||
|
||||
count++
|
||||
|
||||
if (count % 1024 == 0)
|
||||
world.log << "NanoMapGen: [count] tiles done"
|
||||
sleep(5)
|
||||
if (count % 8000 == 0)
|
||||
world.log << "NanoMapGen: <B>[count] tiles done</B>"
|
||||
sleep(1)
|
||||
|
||||
var/mapFilename = "nanomap_z[currentZ]-new.png"
|
||||
|
||||
world.log << "NanoMapGen: sending nanoMap.png to client"
|
||||
world.log << "NanoMapGen: <B>sending [mapFilename] to client</B>"
|
||||
|
||||
usr << browse(Tile, "window=picture;file=nanoMap.png;display=0")
|
||||
usr << browse(Tile, "window=picture;file=[mapFilename];display=0")
|
||||
|
||||
world.log << "NanoMapGen: Done."
|
||||
world.log << "NanoMapGen: <B>Done.</B>"
|
||||
|
||||
usr << "NanoMapGen: <B>Done. File [mapFilename] uploaded to your cache.</B>"
|
||||
|
||||
if (Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION)
|
||||
return NANOMAP_BADOUTPUT
|
||||
|
||||
@@ -50,6 +50,8 @@ nanoui is used to open and update nano browser uis
|
||||
var/state_key = "default"
|
||||
// show the map ui, this is used by the default layout
|
||||
var/show_map = 0
|
||||
// the map z level to display
|
||||
var/map_z_level = 1
|
||||
// initial data, containing the full data structure, must be sent to the ui (the data structure cannot be extended later on)
|
||||
var/list/initial_data[0]
|
||||
// set to 1 to update the ui automatically every master_controller tick
|
||||
@@ -203,6 +205,7 @@ nanoui is used to open and update nano browser uis
|
||||
"autoUpdateLayout" = auto_update_layout,
|
||||
"autoUpdateContent" = auto_update_content,
|
||||
"showMap" = show_map,
|
||||
"mapZLevel" = map_z_level,
|
||||
"user" = list("name" = user.name)
|
||||
)
|
||||
return config_data
|
||||
@@ -322,6 +325,16 @@ nanoui is used to open and update nano browser uis
|
||||
*/
|
||||
/datum/nanoui/proc/set_show_map(nstate)
|
||||
show_map = nstate
|
||||
|
||||
/**
|
||||
* Toggle showing the map ui
|
||||
*
|
||||
* @param nstate_key boolean 1 to show map, 0 to hide (default is 0)
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
/datum/nanoui/proc/set_map_z_level(nz)
|
||||
map_z_level = nz
|
||||
|
||||
/**
|
||||
* Set whether or not to use the "old" on close logic (mainly unset_machine())
|
||||
@@ -466,12 +479,16 @@ nanoui is used to open and update nano browser uis
|
||||
return
|
||||
|
||||
// This is used to toggle the nano map ui
|
||||
var/show_map_updated = 0
|
||||
var/map_update = 0
|
||||
if(href_list["showMap"])
|
||||
set_show_map(text2num(href_list["showMap"]))
|
||||
show_map_updated = 1
|
||||
map_update = 1
|
||||
|
||||
if(href_list["mapZLevel"])
|
||||
set_map_z_level(text2num(href_list["mapZLevel"]))
|
||||
map_update = 1
|
||||
|
||||
if ((src_object && src_object.Topic(href, href_list)) || show_map_updated)
|
||||
if ((src_object && src_object.Topic(href, href_list)) || map_update)
|
||||
nanomanager.update_uis(src_object) // update all UIs attached to src_object
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user