Back up to date.

This commit is contained in:
KasparoVy
2016-07-15 13:00:35 -04:00
1328 changed files with 35982 additions and 17206 deletions
+3 -3
View File
@@ -12,9 +12,9 @@
return STATUS_CLOSE
/mob/proc/shared_nano_interaction()
if (src.stat || !client)
if(src.stat || !client)
return STATUS_CLOSE // no updates, close the interface
else if (restrained() || lying || stat || stunned || weakened)
else if(restrained() || lying || stat || stunned || weakened)
return STATUS_UPDATE // update only (orange visibility)
return STATUS_INTERACTIVE
@@ -26,7 +26,7 @@
/mob/living/silicon/ai/shared_nano_interaction()
if(lacks_power())
return STATUS_CLOSE
if (check_unable(1, 0))
if(check_unable(1, 0))
return STATUS_CLOSE
return ..()
+4 -4
View File
@@ -64,15 +64,15 @@
return user.shared_living_nano_distance(src_object)
/mob/living/proc/shared_living_nano_distance(var/atom/movable/src_object)
if (!(src_object in view(4, src))) // If the src object is not in visable, disable updates
if(!(src_object in view(4, src))) // If the src object is not in visable, disable updates
return STATUS_CLOSE
var/dist = get_dist(src_object, src)
if (dist <= 1)
if(dist <= 1)
return STATUS_INTERACTIVE // interactive (green visibility)
else if (dist <= 2)
else if(dist <= 2)
return STATUS_UPDATE // update only (orange visibility)
else if (dist <= 4)
else if(dist <= 4)
return STATUS_DISABLED // no updates, completely disabled (red visibility)
return STATUS_CLOSE
+1 -1
View File
@@ -81,7 +81,7 @@
data["categories"] = categories
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
if(!ui)
ui = new(user, src, ui_key, "alarm_monitor.tmpl", "Alarm Monitoring Console", 800, 800, state = state)
ui.set_initial_data(data)
ui.open()
+1 -1
View File
@@ -5,7 +5,7 @@
if(..())
return 1
var/turf/T = get_turf(nano_host())
if (!T || !(T.z in config.player_levels))
if(!T || !(T.z in config.player_levels))
to_chat(usr, "<span class='warning'>Unable to establish a connection<span>: You're too far away from the station!")
return 0
if(href_list["track"])
@@ -266,7 +266,7 @@
data["change_body_marking_color"] = can_change_markings("body")
data["change_tail_marking_color"] = can_change_markings("tail")
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
if(!ui)
ui = new(user, src, ui_key, "appearance_changer.tmpl", "[src]", 800, 450, state = state)
ui.set_initial_data(data)
ui.open()
+2 -2
View File
@@ -170,14 +170,14 @@
data["view"] = current_view
var/channels[0]
for (var/ch_name in owner.law_channels())
for(var/ch_name in owner.law_channels())
channels[++channels.len] = list("channel" = ch_name)
data["channel"] = owner.lawchannel
data["channels"] = channels
data["law_sets"] = package_multiple_laws(data["isAdmin"] ? admin_laws : player_laws)
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
if(!ui)
ui = new(user, src, ui_key, "law_manager.tmpl", sanitize("[src] - [owner.name]"), 800, is_malf(user) ? 600 : 400, state = state)
ui.set_initial_data(data)
ui.open()
+2 -2
View File
@@ -19,7 +19,7 @@
data["select_monitor"] = 1
data["powermonitors"] = powermonitor_repository.powermonitor_data()
if (powermonitor && !isnull(powermonitor.powernet))
if(powermonitor && !isnull(powermonitor.powernet))
if(select_monitor && (powermonitor.stat & (NOPOWER|BROKEN)))
powermonitor = null
return
@@ -29,7 +29,7 @@
data["apcs"] = apc_repository.apc_data(powermonitor)
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
if(!ui)
ui = new(user, src, ui_key, "power_monitor.tmpl", "Power Monitoring Console", 800, 700, state = state)
ui.set_initial_data(data)
ui.open()
+2 -2
View File
@@ -13,13 +13,13 @@
var/datum/nanoui/ui = locate(uiref)
if (istype(ui))
if(istype(ui))
ui.close()
if(ui.ref)
var/href = "close=1"
src.Topic(href, params2list(href), ui.ref) // this will direct to the atom's Topic() proc via client.Topic()
else if (ui.on_close_logic)
else if(ui.on_close_logic)
// no atomref specified (or not found)
// so just reset the user mob's machine var
if(src && src.mob)
+26 -26
View File
@@ -19,13 +19,13 @@
* @return /nanoui Returns the found ui, for null if none exists
*/
/datum/nanomanager/proc/try_update_ui(var/mob/user, src_object, ui_key, var/datum/nanoui/ui, data, var/force_open = 0)
if (isnull(ui)) // no ui has been passed, so we'll search for one
if(isnull(ui)) // no ui has been passed, so we'll search for one
{
ui = get_open_ui(user, src_object, ui_key)
}
if (!isnull(ui))
if(!isnull(ui))
// The UI is already open
if (!force_open)
if(!force_open)
ui.push_data(data)
return ui
else
@@ -44,15 +44,15 @@
*/
/datum/nanomanager/proc/get_open_ui(var/mob/user, src_object, ui_key)
var/src_object_key = "\ref[src_object]"
if (isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
//testing("nanomanager/get_open_ui mob [user.name] [src_object:name] [ui_key] - there are no uis open")
return null
else if (isnull(open_uis[src_object_key][ui_key]) || !istype(open_uis[src_object_key][ui_key], /list))
else if(isnull(open_uis[src_object_key][ui_key]) || !istype(open_uis[src_object_key][ui_key], /list))
//testing("nanomanager/get_open_ui mob [user.name] [src_object:name] [ui_key] - there are no uis open for this object")
return null
for (var/datum/nanoui/ui in open_uis[src_object_key][ui_key])
if (ui.user == user)
for(var/datum/nanoui/ui in open_uis[src_object_key][ui_key])
if(ui.user == user)
return ui
//testing("nanomanager/get_open_ui mob [user.name] [src_object:name] [ui_key] - ui not found")
@@ -67,12 +67,12 @@
*/
/datum/nanomanager/proc/update_uis(src_object)
var/src_object_key = "\ref[src_object]"
if (isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
return 0
var/update_count = 0
for (var/ui_key in open_uis[src_object_key])
for (var/datum/nanoui/ui in open_uis[src_object_key][ui_key])
for(var/ui_key in open_uis[src_object_key])
for(var/datum/nanoui/ui in open_uis[src_object_key][ui_key])
if(ui && ui.src_object && ui.user && ui.src_object.nano_host())
ui.process(1)
update_count++
@@ -87,12 +87,12 @@
*/
/datum/nanomanager/proc/close_uis(src_object)
var/src_object_key = "\ref[src_object]"
if (isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
return 0
var/close_count = 0
for (var/ui_key in open_uis[src_object_key])
for (var/datum/nanoui/ui in open_uis[src_object_key][ui_key])
for(var/ui_key in open_uis[src_object_key])
for(var/datum/nanoui/ui in open_uis[src_object_key][ui_key])
if(ui && ui.src_object && ui.user && ui.src_object.nano_host())
ui.close()
close_count++
@@ -108,12 +108,12 @@
* @return int The number of uis updated
*/
/datum/nanomanager/proc/update_user_uis(var/mob/user, src_object = null, ui_key = null)
if (isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0)
if(isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0)
return 0 // has no open uis
var/update_count = 0
for (var/datum/nanoui/ui in user.open_uis)
if ((isnull(src_object) || !isnull(src_object) && ui.src_object == src_object) && (isnull(ui_key) || !isnull(ui_key) && ui.ui_key == ui_key))
for(var/datum/nanoui/ui in user.open_uis)
if((isnull(src_object) || !isnull(src_object) && ui.src_object == src_object) && (isnull(ui_key) || !isnull(ui_key) && ui.ui_key == ui_key))
ui.process(1)
update_count++
@@ -129,13 +129,13 @@
* @return int The number of uis closed
*/
/datum/nanomanager/proc/close_user_uis(var/mob/user, src_object = null, ui_key = null)
if (isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0)
if(isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0)
//testing("nanomanager/close_user_uis mob [user.name] has no open uis")
return 0 // has no open uis
var/close_count = 0
for (var/datum/nanoui/ui in user.open_uis)
if ((isnull(src_object) || !isnull(src_object) && ui.src_object == src_object) && (isnull(ui_key) || !isnull(ui_key) && ui.ui_key == ui_key))
for(var/datum/nanoui/ui in user.open_uis)
if((isnull(src_object) || !isnull(src_object) && ui.src_object == src_object) && (isnull(ui_key) || !isnull(ui_key) && ui.ui_key == ui_key))
ui.close()
close_count++
@@ -153,9 +153,9 @@
*/
/datum/nanomanager/proc/ui_opened(var/datum/nanoui/ui)
var/src_object_key = "\ref[ui.src_object]"
if (isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
open_uis[src_object_key] = list(ui.ui_key = list())
else if (isnull(open_uis[src_object_key][ui.ui_key]) || !istype(open_uis[src_object_key][ui.ui_key], /list))
else if(isnull(open_uis[src_object_key][ui.ui_key]) || !istype(open_uis[src_object_key][ui.ui_key], /list))
open_uis[src_object_key][ui.ui_key] = list();
ui.user.open_uis.Add(ui)
@@ -174,9 +174,9 @@
*/
/datum/nanomanager/proc/ui_closed(var/datum/nanoui/ui)
var/src_object_key = "\ref[ui.src_object]"
if (isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
return 0 // wasn't open
else if (isnull(open_uis[src_object_key][ui.ui_key]) || !istype(open_uis[src_object_key][ui.ui_key], /list))
else if(isnull(open_uis[src_object_key][ui.ui_key]) || !istype(open_uis[src_object_key][ui.ui_key], /list))
return 0 // wasn't open
processing_uis.Remove(ui)
@@ -214,14 +214,14 @@
*/
/datum/nanomanager/proc/user_transferred(var/mob/oldMob, var/mob/newMob)
//testing("nanomanager/user_transferred from mob [oldMob.name] to mob [newMob.name]")
if (!oldMob || isnull(oldMob.open_uis) || !istype(oldMob.open_uis, /list) || open_uis.len == 0)
if(!oldMob || isnull(oldMob.open_uis) || !istype(oldMob.open_uis, /list) || open_uis.len == 0)
//testing("nanomanager/user_transferred mob [oldMob.name] has no open uis")
return 0 // has no open uis
if (isnull(newMob.open_uis) || !istype(newMob.open_uis, /list))
if(isnull(newMob.open_uis) || !istype(newMob.open_uis, /list))
newMob.open_uis = list()
for (var/datum/nanoui/ui in oldMob.open_uis)
for(var/datum/nanoui/ui in oldMob.open_uis)
ui.user = newMob
newMob.open_uis.Add(ui)
+8 -8
View File
@@ -25,31 +25,31 @@
/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)
if(endX < 0 || endX > world.maxx)
endX = world.maxx
if (endY < 0 || endY > world.maxy)
if(endY < 0 || endY > world.maxy)
endY = world.maxy
if (currentZ < 0 || currentZ > world.maxz)
if(currentZ < 0 || currentZ > world.maxz)
to_chat(usr, "NanoMapGen: <B>ERROR: currentZ ([currentZ]) must be between 1 and [world.maxz]</B>")
sleep(3)
return NANOMAP_TERMINALERR
if (startX > endX)
if(startX > endX)
to_chat(usr, "NanoMapGen: <B>ERROR: startX ([startX]) cannot be greater than endX ([endX])</B>")
sleep(3)
return NANOMAP_TERMINALERR
if (startY > endX)
if(startY > endX)
to_chat(usr, "NanoMapGen: <B>ERROR: startY ([startY]) cannot be greater than endY ([endY])</B>")
sleep(3)
return NANOMAP_TERMINALERR
var/icon/Tile = icon(file("nano/mapbase1024.png"))
if (Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION)
if(Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION)
log_to_dd("NanoMapGen: <B>ERROR: BASE IMAGE DIMENSIONS ARE NOT [NANOMAP_MAX_ICON_DIMENSION]x[NANOMAP_MAX_ICON_DIMENSION]</B>")
sleep(3)
return NANOMAP_TERMINALERR
@@ -70,7 +70,7 @@
count++
if (count % 8000 == 0)
if(count % 8000 == 0)
log_to_dd("NanoMapGen: <B>[count] tiles done</B>")
sleep(1)
@@ -84,7 +84,7 @@
to_chat(usr, "NanoMapGen: <B>Done. File [mapFilename] uploaded to your cache.</B>")
if (Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION)
if(Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION)
return NANOMAP_BADOUTPUT
return NANOMAP_SUCCESS
+19 -19
View File
@@ -85,13 +85,13 @@ nanoui is used to open and update nano browser uis
// add the passed template filename as the "main" template, this is required
add_template("main", ntemplate_filename)
if (ntitle)
if(ntitle)
title = ntitle
if (nwidth)
if(nwidth)
width = nwidth
if (nheight)
if(nheight)
height = nheight
if (nref)
if(nref)
ref = nref
add_common_assets()
@@ -123,14 +123,14 @@ nanoui is used to open and update nano browser uis
* @return nothing
*/
/datum/nanoui/proc/set_status(state, push_update)
if (state != status) // Only update if it is different
if (status == STATUS_DISABLED)
if(state != status) // Only update if it is different
if(status == STATUS_DISABLED)
status = state
if (push_update)
if(push_update)
update()
else
status = state
if (push_update || status == 0)
if(push_update || status == 0)
push_data(null, 1) // Update the UI, force the update in case the status is 0, data is null so that previous data is used
/**
@@ -209,7 +209,7 @@ nanoui is used to open and update nano browser uis
var/list/send_data = list("config" = config_data)
if (!isnull(data))
if(!isnull(data))
send_data["data"] = data
return send_data
@@ -345,14 +345,14 @@ nanoui is used to open and update nano browser uis
var/head_content = ""
for (var/filename in scripts)
for(var/filename in scripts)
head_content += "<script type='text/javascript' src='[filename]'></script> "
for (var/filename in stylesheets)
for(var/filename in stylesheets)
head_content += "<link rel='stylesheet' type='text/css' href='[filename]'> "
var/template_data_json = "{}" // An empty JSON object
if (templates.len > 0)
if(templates.len > 0)
template_data_json = json_encode(templates)
var/list/send_data = get_send_data(initial_data)
@@ -371,7 +371,7 @@ nanoui is used to open and update nano browser uis
{
// We need both jQuery and NanoStateManager to be able to recieve data
// At the moment any data received before those libraries are loaded will be lost
if (typeof NanoStateManager != 'undefined' && typeof jQuery != 'undefined')
if(typeof NanoStateManager != 'undefined' && typeof jQuery != 'undefined')
{
NanoStateManager.receiveUpdateData(jsonString);
}
@@ -406,7 +406,7 @@ nanoui is used to open and update nano browser uis
if(!user.client)
return
var/window_size = ""
if (width && height)
if(width && height)
window_size = "size=[width]x[height];"
update_status(0)
if(status == STATUS_CLOSE)
@@ -450,7 +450,7 @@ nanoui is used to open and update nano browser uis
*/
/datum/nanoui/proc/push_data(data, force_push = 0)
update_status(0)
if (status == STATUS_DISABLED && !force_push)
if(status == STATUS_DISABLED && !force_push)
return // Cannot update UI, no visibility
var/list/send_data = get_send_data(data)
@@ -468,7 +468,7 @@ nanoui is used to open and update nano browser uis
*/
/datum/nanoui/Topic(href, href_list)
update_status(0) // update the status
if (status != STATUS_INTERACTIVE || user != usr) // If UI is not interactive or usr calling Topic is not the UI user
if(status != STATUS_INTERACTIVE || user != usr) // If UI is not interactive or usr calling Topic is not the UI user
return
// This is used to toggle the nano map ui
@@ -481,7 +481,7 @@ nanoui is used to open and update nano browser uis
set_map_z_level(text2num(href_list["mapZLevel"]))
map_update = 1
if ((src_object && src_object.Topic(href, href_list, 0, state)) || map_update)
if((src_object && src_object.Topic(href, href_list, 0, state)) || map_update)
nanomanager.update_uis(src_object) // update all UIs attached to src_object
/**
@@ -493,11 +493,11 @@ nanoui is used to open and update nano browser uis
* @return nothing
*/
/datum/nanoui/proc/process(update = 0)
if (!src_object || !user)
if(!src_object || !user)
close()
return
if (status && (update || is_auto_updating))
if(status && (update || is_auto_updating))
update() // Update the UI (update_status() is called whenever a UI is updated)
else
update_status(1) // Not updating UI, so lets check here if status has changed