NanoUI is now 'tgui'

This commit is contained in:
Bjorn Neergaard
2016-01-01 16:12:02 -06:00
parent f5e42db0f6
commit a2bb279164
146 changed files with 548 additions and 1709 deletions

View File

@@ -18,7 +18,7 @@ env:
cache:
directories:
- nano/node_modules
- tgui/node_modules
- $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}
@@ -39,7 +39,7 @@ install:
- pip install --user beautifulsoup4 -q
before_script:
- cd nano && npm install && cd ..
- cd tgui && npm install && cd ..
- chmod +x ./install-byond.sh
- ./install-byond.sh
@@ -48,7 +48,7 @@ script:
- (! grep 'step_[xy]' _maps/**/*.dmm)
- md5sum -c - <<< "49bc6b1b9ed56c83cceb6674bd97cb34 *html/changelogs/example.yml"
- tools/check_filedirs.sh tgstation.dme
- cd nano && gulp && gulp --min && cd ..
- cd tgui && gulp && cd ..
- python tools/ss13_genchangelog.py html/changelog.html html/changelogs
- source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup
- bash dm.sh -M${DM_MAPFILE} tgstation.dme

View File

@@ -97,8 +97,8 @@ Passive gate is similar to the regular pump except:
if(stat & (BROKEN|NOPOWER)) return
ui_interact(user)
/obj/machinery/atmospherics/components/binary/passive_gate/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/atmospherics/components/binary/passive_gate/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "atmos_pump", name, 400, 115)
ui.open()

View File

@@ -105,8 +105,8 @@ Thus, the two variables affect pump operation are set in New():
return
ui_interact(user)
/obj/machinery/atmospherics/components/binary/pump/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/atmospherics/components/binary/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "atmos_pump", name, 400, 115)
ui.open()

View File

@@ -102,8 +102,8 @@ Thus, the two variables affect pump operation are set in New():
return
ui_interact(user)
/obj/machinery/atmospherics/components/binary/volume_pump/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/atmospherics/components/binary/volume_pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "atmos_pump", name, 400, 115)
ui.open()

View File

@@ -166,8 +166,8 @@ Filter types:
return
ui_interact(user)
/obj/machinery/atmospherics/components/trinary/filter/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/atmospherics/components/trinary/filter/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "atmos_filter", name, 450, 145)
ui.open()

View File

@@ -129,8 +129,8 @@
return
ui_interact(user)
/obj/machinery/atmospherics/components/trinary/mixer/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/atmospherics/components/trinary/mixer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "atmos_mixer", name, 450, 175)
ui.open()

View File

@@ -110,8 +110,8 @@
return
ui_interact(user)
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "cryo", name, 410, 550, state = notcontained_state)
ui.open()

View File

@@ -1,15 +0,0 @@
/**
* NanoUI Defines
*
* Contains all NanoUI state definitions.
*
* /tg/station user interface library
* thanks to baystation12
*
* modified by neersighted
**/
#define NANO_INTERACTIVE 2 // Green/Interactive
#define NANO_UPDATE 1 // Orange/Updates Only
#define NANO_DISABLED 0 // Red/Disabled
#define NANO_CLOSE -1 // Closed

4
code/__DEFINES/tgui.dm Normal file
View File

@@ -0,0 +1,4 @@
#define UI_INTERACTIVE 2 // Green/Interactive
#define UI_UPDATE 1 // Orange/Updates Only
#define UI_DISABLED 0 // Red/Disabled
#define UI_CLOSE -1 // Closed

View File

@@ -1,30 +0,0 @@
var/datum/subsystem/nano/SSnano
/datum/subsystem/nano
name = "NanoUI"
wait = 10
priority = 16
display = 6
can_fire = 1 // This needs to fire before round start.
var/list/open_uis = list() // A list of open NanoUIs, grouped by src_object and ui_key.
var/list/processing_uis = list() // A list of processing NanoUIs, not grouped.
var/html // The HTML template used by new UIs; minus initial data.
/datum/subsystem/nano/New()
html = file2text('nano/nanoui.html') // Read the HTML from disk.
NEW_SS_GLOBAL(SSnano)
/datum/subsystem/nano/stat_entry()
..("O:[open_uis.len]|P:[processing_uis.len]") // Show how many interfaces we have open/are processing.
/datum/subsystem/nano/fire() // Process UIs.
for(var/thing in processing_uis)
var/datum/nanoui/ui = thing
if(ui && ui.user && ui.src_object)
ui.process()
continue
processing_uis.Remove(ui)

View File

@@ -0,0 +1,30 @@
var/datum/subsystem/tgui/SStgui
/datum/subsystem/tgui
name = "tgui"
wait = 10
priority = 16
display = 6
can_fire = 1 // This needs to fire before round start.
var/list/open_uis = list() // A list of open UIs, grouped by src_object and ui_key.
var/list/processing_uis = list() // A list of processing UIs, not grouped.
var/html // The HTML template used by new UIs; minus initial data.
/datum/subsystem/tgui/New()
html = file2text('tgui/tgui.html') // Read the HTML from disk.
NEW_SS_GLOBAL(SStgui)
/datum/subsystem/tgui/stat_entry()
..("O:[open_uis.len]|P:[processing_uis.len]") // Show how many interfaces we have open/are processing.
/datum/subsystem/tgui/fire() // Process UIs.
for(var/thing in processing_uis)
var/datum/tgui/ui = thing
if(ui && ui.user && ui.src_object)
ui.process()
continue
processing_uis.Remove(ui)

View File

@@ -63,7 +63,7 @@
/datum/mind/proc/transfer_to(mob/new_character)
if(current) // remove ourself from our old body's mind variable
current.mind = null
SSnano.on_transfer(current, new_character)
SStgui.on_transfer(current, new_character)
if(key)
if(new_character.key != key) //if we're transfering into a body with a key associated which is not ours
@@ -1576,5 +1576,4 @@
/mob/living/simple_animal/hostile/construct/mind_initialize()
..()
mind.assigned_role = "[initial(name)]"
mind.special_role = "Cultist"
mind.special_role = "Cultist"

View File

@@ -187,8 +187,8 @@
else if (!shorted)
ui_interact(user)
/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "air_alarm", name, 480, 660)
ui.open()

View File

@@ -273,8 +273,8 @@ update_flag
return
ui_interact(user)
/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "canister", name, 480, 420, state = physical_state)
ui.open()

View File

@@ -13,8 +13,8 @@
add_fingerprint(user)
ui_interact(user)
/obj/item/weapon/electronics/airlock/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, force_open = 0)
SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/item/weapon/electronics/airlock/ui_interact(mob/user, ui_key = "main", var/datum/tgui/ui = null, force_open = 0)
SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "airlock_electronics", name, 975, 415, state = hands_state)
ui.open()

View File

@@ -132,7 +132,7 @@
C.add_fingerprint(usr)
user.visible_message("\The [user] inserts a power cell into \the [src].", "<span class='notice'>You insert the power cell into \the [src].</span>")
SSnano.update_uis(src)
SStgui.update_uis(src)
else
user << "<span class='warning'>The hatch must be open to insert a power cell!</span>"
return
@@ -153,8 +153,8 @@
/obj/machinery/space_heater/interact(mob/user)
ui_interact(user)
/obj/machinery/space_heater/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/space_heater/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "space_heater", name, 490, 340, state = physical_state)
ui.open()

View File

@@ -119,8 +119,8 @@
add_fingerprint(user)
ui_interact(user)
/obj/item/weapon/tank/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/item/weapon/tank/ui_interact(mob/user, ui_key = "main", var/datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "tanks", name, 530, 220, state = inventory_state)
ui.open()

View File

@@ -173,10 +173,10 @@ You can set verify to TRUE if you want send() to sleep until the client has the
//DEFINITIONS FOR ASSET DATUMS START HERE.
/datum/asset/simple/nanoui
/datum/asset/simple/tgui
assets = list(
"nanoui.css" = 'nano/assets/nanoui.css',
"nanoui.js" = 'nano/assets/nanoui.js'
"tgui.css" = 'tgui/assets/tgui.css',
"tgui.js" = 'tgui/assets/tgui.js'
)
/datum/asset/simple/pda

View File

@@ -27,7 +27,7 @@ var/list/preferences_datums = list()
var/UI_style = "Midnight"
var/nanoui_fancy = TRUE
var/tgui_fancy = TRUE
var/toggles = TOGGLES_DEFAULT
var/chat_toggles = TOGGLES_DEFAULT_CHAT
var/ghost_form = "ghost"
@@ -325,7 +325,7 @@ var/list/preferences_datums = list()
dat += "<table><tr><td width='340px' height='300px' valign='top'>"
dat += "<h2>General Settings</h2>"
dat += "<b>UI Style:</b> <a href='?_src_=prefs;preference=ui'>[UI_style]</a><br>"
dat += "<b>Fancy NanoUI:</b> <a href='?_src_=prefs;preference=nanoui'>[(nanoui_fancy) ? "Yes" : "No"]</a><br>"
dat += "<b>tgui Style:</b> <a href='?_src_=prefs;preference=tgui_fancy'>[(tgui_fancy) ? "Fancy" : "No Frills"]</a><br>"
dat += "<b>Play admin midis:</b> <a href='?_src_=prefs;preference=hear_midis'>[(toggles & SOUND_MIDI) ? "Yes" : "No"]</a><br>"
dat += "<b>Play lobby music:</b> <a href='?_src_=prefs;preference=lobby_music'>[(toggles & SOUND_LOBBY) ? "Yes" : "No"]</a><br>"
dat += "<b>Ghost ears:</b> <a href='?_src_=prefs;preference=ghost_ears'>[(chat_toggles & CHAT_GHOSTEARS) ? "All Speech" : "Nearest Creatures"]</a><br>"
@@ -1011,8 +1011,8 @@ var/list/preferences_datums = list()
else
UI_style = "Midnight"
if("nanoui")
nanoui_fancy = !nanoui_fancy
if("tgui_fancy")
tgui_fancy = !tgui_fancy
if("hear_adminhelps")
toggles ^= SOUND_ADMINHELP

View File

@@ -165,7 +165,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["ooccolor"] >> ooccolor
S["lastchangelog"] >> lastchangelog
S["UI_style"] >> UI_style
S["nanoui_fancy"] >> nanoui_fancy
S["nanoui_fancy"] >> tgui_fancy
S["be_special"] >> be_special
if(islist(S["be_special"]))
@@ -193,7 +193,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
ooccolor = sanitize_ooccolor(sanitize_hexcolor(ooccolor, 6, 1, initial(ooccolor)))
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
UI_style = sanitize_inlist(UI_style, list("Midnight", "Plasmafire", "Retro"), initial(UI_style))
nanoui_fancy = sanitize_integer(nanoui_fancy, 0, 1, initial(nanoui_fancy))
tgui_fancy = sanitize_integer(tgui_fancy, 0, 1, initial(tgui_fancy))
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
ghost_form = sanitize_inlist(ghost_form, ghost_forms, initial(ghost_form))
@@ -213,7 +213,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["ooccolor"] << ooccolor
S["lastchangelog"] << lastchangelog
S["UI_style"] << UI_style
S["nanoui_fancy"] << nanoui_fancy
S["nanoui_fancy"] << tgui_fancy
S["be_special"] << be_special
S["default_slot"] << default_slot
S["toggles"] << toggles

View File

@@ -86,7 +86,7 @@ Works together with spawning an observer, noted above.
if(key)
if(!cmptext(copytext(key,1,2),"@")) // Skip aghosts.
var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc.
SSnano.on_transfer(src, ghost) // Transfer NanoUIs.
SStgui.on_transfer(src, ghost) // Transfer NanoUIs.
ghost.can_reenter_corpse = can_reenter_corpse
ghost.key = key
return ghost
@@ -156,7 +156,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(mind.current.key && copytext(mind.current.key,1,2)!="@") //makes sure we don't accidentally kick any clients
usr << "<span class='warning'>Another consciousness is in your body...It is resisting you.</span>"
return
SSnano.on_transfer(src, mind.current) // Transfer NanoUIs.
SStgui.on_transfer(src, mind.current) // Transfer NanoUIs.
mind.current.key = key
return 1

View File

@@ -1,5 +1,5 @@
/mob/Logout()
SSnano.on_logout(src)
SStgui.on_logout(src)
player_list -= src
log_access("Logout: [key_name(src)]")
if(admin_datums[src.ckey])

View File

@@ -1,12 +0,0 @@
/**
* NanoUI State: admin_state
*
* Checks that the user is an admin, end-of-story.
**/
/var/global/datum/nano_state/admin_state/admin_state = new()
/datum/nano_state/admin_state/can_use_topic(atom/movable/src_object, mob/user)
if(check_rights_for(user.client, R_ADMIN))
return NANO_INTERACTIVE
return NANO_CLOSE

View File

@@ -1,12 +0,0 @@
/**
* NanoUI State: conscious_state
*
* Only checks if the user is conscious.
**/
/var/global/datum/nano_state/conscious_state/conscious_state = new()
/datum/nano_state/conscious_state/can_use_topic(atom/movable/src_object, mob/user)
if(user.stat == CONSCIOUS)
return NANO_INTERACTIVE
return NANO_CLOSE

View File

@@ -1,12 +0,0 @@
/**
* NanoUI State: contained_state
*
* Checks that the user is inside the src_object.
**/
/var/global/datum/nano_state/contained_state/contained_state = new()
/datum/nano_state/contained_state/can_use_topic(atom/movable/src_object, mob/user)
if(!src_object.contains(user))
return NANO_CLOSE
return user.shared_nano_interaction(src_object)

View File

@@ -1,12 +0,0 @@
/**
* NanoUI State: deep_inventory_state
*
* Checks that the src_object is in the user's fist-level (backpack, webbing, etc) inventory.
**/
/var/global/datum/nano_state/deep_inventory_state/deep_inventory_state = new()
/datum/nano_state/deep_inventory_state/can_use_topic(atom/movable/src_object, mob/user)
if(!user.contains(src_object))
return NANO_CLOSE
return user.shared_nano_interaction(src_object)

View File

@@ -1,20 +0,0 @@
/**
* NanoUI State: hands_state
*
* Checks that the src_object is in the user's hands.
**/
/var/global/datum/nano_state/hands_state/hands_state = new()
/datum/nano_state/hands_state/can_use_topic(atom/movable/src_object, mob/user)
. = user.shared_nano_interaction(src_object)
if(. > NANO_CLOSE)
return min(., user.hands_can_use_topic(src_object))
/mob/proc/hands_can_use_topic(atom/movable/src_object)
return NANO_CLOSE
/mob/living/hands_can_use_topic(atom/movable/src_object)
if(src_object in get_both_hands(src))
return NANO_INTERACTIVE
return NANO_CLOSE

View File

@@ -1,12 +0,0 @@
/**
* NanoUI State: inventory_state
*
* Checks that the src_object is in the user's top-level (hand, ear, pocket, belt, etc) inventory.
**/
/var/global/datum/nano_state/inventory_state/inventory_state = new()
/datum/nano_state/inventory_state/can_use_topic(atom/movable/src_object, mob/user)
if(!(src_object in user))
return NANO_CLOSE
return user.shared_nano_interaction(src_object)

View File

@@ -1,21 +0,0 @@
/**
* NanoUI State: physical_state
*
* Short-circuits the default state to only check physical distance.
**/
/var/global/datum/nano_state/physical/physical_state = new()
/datum/nano_state/physical/can_use_topic(atom/movable/src_object, mob/user)
. = user.shared_nano_interaction(src_object)
if(. > NANO_CLOSE)
return min(., user.physical_can_use_topic(src_object))
/mob/proc/physical_can_use_topic(atom/movable/src_object)
return NANO_CLOSE
/mob/living/physical_can_use_topic(atom/movable/src_object)
return shared_living_nano_distance(src_object)
/mob/living/silicon/physical_can_use_topic(atom/movable/src_object)
return max(NANO_UPDATE, shared_living_nano_distance(src_object)) // Silicons can always see.

View File

@@ -1,12 +0,0 @@
/**
* NanoUI State: self_state
*
* Only checks that the user and src_object are the same.
**/
/var/global/datum/nano_state/self_state/self_state = new()
/datum/nano_state/self_state/can_use_topic(atom/movable/src_object, mob/user)
if(src_object != user)
return NANO_CLOSE
return user.shared_nano_interaction(src_object)

View File

@@ -1,112 +0,0 @@
/**
* NanoUI States
*
* Base state and helpers for states. Just does some sanity checks, implement a state for in-depth checks.
**/
/**
* public
*
* Checks if a user can use src_object's NanoUI, under the given state.
*
* required user mob The mob who opened/is using the NanoUI.
* required state datum/nano_state The state to check.
*
* return NANO_state The state of the UI.
**/
/atom/proc/nano_state(mob/user, datum/nano_state/state)
var/src_object = nano_host()
if(istype(user, /mob/dead/observer)) // Special-case ghosts.
if(check_rights_for(user.client, R_ADMIN))
return NANO_INTERACTIVE // Admins can interact anyway.
if(get_dist(src_object, src) > user.client.view)
return NANO_CLOSE // Keep ghosts from opening too many NanoUIs.
return NANO_UPDATE // Ghosts can only view.
return state.can_use_topic(src_object, user) // Check if the state allows interaction.
/**
* private
*
* Checks if a user can use src_object's NanoUI, and returns the state.
* Can call a mob proc, which allows overrides for each mob.
*
* required src_object atom/movable The object which owns the NanoUI.
* required user mob The mob who opened/is using the NanoUI.
*
* return NANO_state The state of the UI.
**/
/datum/nano_state/proc/can_use_topic(atom/movable/src_object, mob/user)
return NANO_CLOSE // Don't allow interaction by default.
/**
* public
*
* Standard interaction/sanity checks. Different mob types may have overrides.
*
* return NANO_state The state of the UI.
**/
/mob/proc/shared_nano_interaction(atom/movable/src_object)
if(!client || stat) // Close NanoUIs if mindless or dead/unconcious.
return NANO_CLOSE
// Update NanoUIs if incapicitated but concious.
else if(incapacitated() || lying)
return NANO_UPDATE
return NANO_INTERACTIVE
/mob/living/carbon/human/shared_nano_interaction(atom/movable/src_object)
// If we have telekinesis and remain close enough, allow interaction.
if(dna.check_mutation(TK))
if(tkMaxRangeCheck(src, src_object))
return NANO_INTERACTIVE
return ..()
/mob/living/silicon/ai/shared_nano_interaction(atom/movable/src_object)
if(lacks_power()) // Close NanoUIs if the AI is unpowered.
return NANO_CLOSE
return ..()
/mob/living/silicon/robot/shared_nano_interaction(atom/movable/src_object)
if(cell.charge <= 0) // Close NanoUIs if the Borg is unpowered.
return NANO_CLOSE
if(lockcharge) // Disable NanoUIs if the Borg is locked.
return NANO_DISABLED
return ..()
/**
* public
*
* Check the distance for a living mob.
* Really only used for checks outside the context of a mob.
* Otherwise, use shared_living_nano_distance().
*
* required src_object atom/movable The object which owns the NanoUI.
* required user mob The mob who opened/is using the NanoUI.
*
* return NANO_state The state of the UI.
**/
/atom/proc/contents_nano_distance(atom/movable/src_object, mob/living/user)
return user.shared_living_nano_distance(src_object) // Just call this mob's check.
/**
* public
*
* Distance versus interaction check.
*
* required src_object atom/movable The object which owns the NanoUI.
*
* return NANO_state The state of the UI.
**/
/mob/living/proc/shared_living_nano_distance(atom/movable/src_object)
if(!(src_object in view(4, src))) // If the object is out of view, close it.
return NANO_CLOSE
var/dist = get_dist(src_object, src)
if(dist <= 1) // Open and interact if 1-0 tiles away.
return NANO_INTERACTIVE
else if(dist <= 2) // View only if 2-3 tiles away.
return NANO_UPDATE
else if(dist <= 5) // Disable if 5 tiles away.
return NANO_DISABLED
return NANO_CLOSE // Otherwise, we got nothing.

View File

@@ -626,8 +626,8 @@
else
ui_interact(user)
/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", var/datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "apc", name, 550, 560)
ui.open()

View File

@@ -329,8 +329,8 @@
return
ui_interact(user)
/obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "smes", name, 500, 455)
ui.open()

View File

@@ -369,8 +369,8 @@
return
ui_interact(user)
/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "solar_control", name, 515, 425)
ui.open()

View File

@@ -85,8 +85,8 @@
return
ui_interact(user)
/obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "chem_dispenser", name, 550, 600)
ui.open()

View File

@@ -96,8 +96,8 @@
return
ui_interact(user)
/obj/machinery/chem_heater/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open)
/obj/machinery/chem_heater/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open = force_open)
if (!ui)
ui = new(user, src, ui_key, "chem_heater", name, 450, 340)
ui.open()

View File

@@ -1,41 +1,36 @@
/**
* NanoUI External
* tgui external
*
* Contains all external NanoUI declarations.
*
* /tg/station user interface library
* thanks to baystation12
*
* modified by neersighted
* Contains all external tgui declarations.
**/
/**
* public
*
* Used to open and update NanoUIs.
* If this proc is not implemented properly, the NanoUI will not update correctly.
* Used to open and update UIs.
* If this proc is not implemented properly, the UI will not update correctly.
*
* required user mob The mob who opened/is using the NanoUI.
* optional ui_key string The ui_key of the NanoUI.
* optional ui datum/nanoui The UI to be updated, if it exists.
* required user mob The mob who opened/is using the UI.
* optional ui_key string The ui_key of the UI.
* optional ui datum/tgui The UI to be updated, if it exists.
* optional force_open bool If the UI should be re-opened instead of updated.
* optional master_ui datum/nanoui The parent NanoUI.
* optional state datum/nano_state The state used to determine status.
* optional master_ui datum/tgui The parent UI.
* optional state datum/ui_state The state used to determine status.
**/
/atom/movable/proc/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, \
force_open = 0, datum/nano_ui/master_ui = null, \
datum/nano_state/state = default_state)
/atom/movable/proc/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, \
force_open = 0, datum/tgui/master_ui = null, \
datum/ui_state/state = default_state)
return -1 // Sorta implemented.
/**
* public
*
* Data to be sent to the NanoUI.
* This must be implemented for a NanoUI to work.
* Data to be sent to the UI.
* This must be implemented for a UI to work.
*
* required user mob The mob interacting with the NanoUI.
* required user mob The mob interacting with the UI.
*
* return list Data to be sent to the NanoUI.
* return list Data to be sent to the UI.
**/
/atom/movable/proc/get_ui_data(mob/user)
return list() // Not implemented.
@@ -44,7 +39,7 @@
/**
* public
*
* Called on a NanoUI when the UI receieves a href.
* Called on a UI when the UI receieves a href.
* Think of this as Topic().
*
* required action string The action/button that has been invoked by the user.
@@ -59,34 +54,34 @@
/**
* private
*
* The NanoUI's host object (usually src_object).
* Used internally by nano_state(s).
* The UI's host object (usually src_object).
* Used internally by ui_state(s).
**/
/atom/proc/nano_host()
/atom/proc/ui_host()
return src
/**
* global
*
* Used to track NanoUIs for a mob.
* Used to track UIs for a mob.
**/
/mob/var/list/open_uis = list()
/**
* verb
*
* Called by NanoUIs when they are closed.
* Called by UIs when they are closed.
* Must be a verb so winset() can call it.
*
* required uiref ref The UI that was closed.
**/
/client/verb/nanoclose(uiref as text)
/client/verb/uiclose(uiref as text)
// Name the verb, and hide it from the user panel.
set name = "nanoclose"
set name = "uiclose"
set hidden = 1
// Get the UI based on the ref.
var/datum/nanoui/ui = locate(uiref)
var/datum/tgui/ui = locate(uiref)
// If we found the UI, close it.
if(istype(ui))

View File

@@ -0,0 +1,12 @@
/**
* tgui state: admin_state
*
* Checks that the user is an admin, end-of-story.
**/
/var/global/datum/ui_state/admin_state/admin_state = new()
/datum/ui_state/admin_state/can_use_topic(atom/movable/src_object, mob/user)
if(check_rights_for(user.client, R_ADMIN))
return UI_INTERACTIVE
return UI_CLOSE

View File

@@ -0,0 +1,12 @@
/**
* tgui state: conscious_state
*
* Only checks if the user is conscious.
**/
/var/global/datum/ui_state/conscious_state/conscious_state = new()
/datum/ui_state/conscious_state/can_use_topic(atom/movable/src_object, mob/user)
if(user.stat == CONSCIOUS)
return UI_INTERACTIVE
return UI_CLOSE

View File

@@ -0,0 +1,12 @@
/**
* tgui state: contained_state
*
* Checks that the user is inside the src_object.
**/
/var/global/datum/ui_state/contained_state/contained_state = new()
/datum/ui_state/contained_state/can_use_topic(atom/movable/src_object, mob/user)
if(!src_object.contains(user))
return UI_CLOSE
return user.shared_ui_interaction(src_object)

View File

@@ -0,0 +1,12 @@
/**
* tgui state: deep_inventory_state
*
* Checks that the src_object is in the user's fist-level (backpack, webbing, etc) inventory.
**/
/var/global/datum/ui_state/deep_inventory_state/deep_inventory_state = new()
/datum/ui_state/deep_inventory_state/can_use_topic(atom/movable/src_object, mob/user)
if(!user.contains(src_object))
return UI_CLOSE
return user.shared_ui_interaction(src_object)

View File

@@ -1,60 +1,60 @@
/**
* NanoUI State: default_state
* tgui state: default_state
*
* Checks a number of things -- mostly physical distance for humans and view for robots.
**/
/var/global/datum/nano_state/default/default_state = new()
/var/global/datum/ui_state/default/default_state = new()
/datum/nano_state/default/can_use_topic(atom/movable/src_object, mob/user)
/datum/ui_state/default/can_use_topic(atom/movable/src_object, mob/user)
return user.default_can_use_topic(src_object) // Call the individual mob-overriden procs.
/mob/proc/default_can_use_topic(atom/movable/src_object)
return NANO_CLOSE // Don't allow interaction by default.
return UI_CLOSE // Don't allow interaction by default.
/mob/living/default_can_use_topic(atom/movable/src_object)
. = shared_nano_interaction(src_object)
if(. > NANO_CLOSE)
. = min(., shared_living_nano_distance(src_object)) // Check the distance...
if(. == NANO_INTERACTIVE) // Non-human living mobs can only look, not touch.
return NANO_UPDATE
. = shared_ui_interaction(src_object)
if(. > UI_CLOSE)
. = min(., shared_living_ui_distance(src_object)) // Check the distance...
if(. == UI_INTERACTIVE) // Non-human living mobs can only look, not touch.
return UI_UPDATE
/mob/living/carbon/human/default_can_use_topic(atom/movable/src_object)
. = shared_nano_interaction(src_object)
if(. > NANO_CLOSE)
. = min(., shared_living_nano_distance(src_object)) // Check the distance...
. = shared_ui_interaction(src_object)
if(. > UI_CLOSE)
. = min(., shared_living_ui_distance(src_object)) // Check the distance...
// Derp a bit if we have brain loss.
if(prob(getBrainLoss()))
return NANO_UPDATE
return UI_UPDATE
/mob/living/silicon/robot/default_can_use_topic(atom/movable/src_object)
. = shared_nano_interaction(src_object)
if(. <= NANO_DISABLED)
. = shared_ui_interaction(src_object)
if(. <= UI_DISABLED)
return
// Robots can interact with anything they can see.
if(get_dist(src, src_object) <= src.client.view)
return NANO_INTERACTIVE
return NANO_DISABLED // Otherwise they can keep the UI open.
return UI_INTERACTIVE
return UI_DISABLED // Otherwise they can keep the UI open.
/mob/living/silicon/ai/default_can_use_topic(atom/movable/src_object)
. = shared_nano_interaction(src_object)
if(. < NANO_INTERACTIVE)
. = shared_ui_interaction(src_object)
if(. < UI_INTERACTIVE)
return
// The AI can interact with anything it can see nearby, or with cameras.
if((get_dist(src, src_object) <= src.client.view) || cameranet.checkTurfVis(get_turf_pixel(src_object)))
return NANO_INTERACTIVE
return NANO_CLOSE
return UI_INTERACTIVE
return UI_CLOSE
/mob/living/simple_animal/drone/default_can_use_topic(atom/movable/src_object)
. = shared_nano_interaction(src_object)
if(. > NANO_CLOSE)
. = min(., shared_living_nano_distance(src_object)) // Drones can only use things they're near.
. = shared_ui_interaction(src_object)
if(. > UI_CLOSE)
. = min(., shared_living_ui_distance(src_object)) // Drones can only use things they're near.
/mob/living/silicon/pai/default_can_use_topic(atom/movable/src_object)
// pAIs can only use themselves and the owner's radio.
if((src_object == src || src_object == radio) && !stat)
return NANO_INTERACTIVE
return UI_INTERACTIVE
else
return ..()

View File

@@ -0,0 +1,20 @@
/**
* tgui state: hands_state
*
* Checks that the src_object is in the user's hands.
**/
/var/global/datum/ui_state/hands_state/hands_state = new()
/datum/ui_state/hands_state/can_use_topic(atom/movable/src_object, mob/user)
. = user.shared_ui_interaction(src_object)
if(. > UI_CLOSE)
return min(., user.hands_can_use_topic(src_object))
/mob/proc/hands_can_use_topic(atom/movable/src_object)
return UI_CLOSE
/mob/living/hands_can_use_topic(atom/movable/src_object)
if(src_object in get_both_hands(src))
return UI_INTERACTIVE
return UI_CLOSE

View File

@@ -0,0 +1,12 @@
/**
* tgui state: inventory_state
*
* Checks that the src_object is in the user's top-level (hand, ear, pocket, belt, etc) inventory.
**/
/var/global/datum/ui_state/inventory_state/inventory_state = new()
/datum/ui_state/inventory_state/can_use_topic(atom/movable/src_object, mob/user)
if(!(src_object in user))
return UI_CLOSE
return user.shared_ui_interaction(src_object)

View File

@@ -1,22 +1,22 @@
/**
* NanoUI State: notcontained_state
* tgui state: notcontained_state
*
* Checks that the user is not inside src_object, and then makes the default checks.
**/
/var/global/datum/nano_state/notcontained_state/notcontained_state = new()
/var/global/datum/ui_state/notcontained_state/notcontained_state = new()
/datum/nano_state/notcontained_state/can_use_topic(atom/movable/src_object, mob/user)
. = user.shared_nano_interaction(src_object)
if(. > NANO_CLOSE)
/datum/ui_state/notcontained_state/can_use_topic(atom/movable/src_object, mob/user)
. = user.shared_ui_interaction(src_object)
if(. > UI_CLOSE)
return min(., user.notcontained_can_use_topic(src_object))
/mob/proc/notcontained_can_use_topic(atom/movable/src_object)
return NANO_CLOSE
return UI_CLOSE
/mob/living/notcontained_can_use_topic(atom/movable/src_object)
if(src_object.contains(src))
return NANO_CLOSE // Close if we're inside it.
return UI_CLOSE // Close if we're inside it.
return default_can_use_topic(src_object)
/mob/living/silicon/notcontained_can_use_topic(atom/movable/src_object)

View File

@@ -0,0 +1,21 @@
/**
* tgui state: physical_state
*
* Short-circuits the default state to only check physical distance.
**/
/var/global/datum/ui_state/physical/physical_state = new()
/datum/ui_state/physical/can_use_topic(atom/movable/src_object, mob/user)
. = user.shared_ui_interaction(src_object)
if(. > UI_CLOSE)
return min(., user.physical_can_use_topic(src_object))
/mob/proc/physical_can_use_topic(atom/movable/src_object)
return UI_CLOSE
/mob/living/physical_can_use_topic(atom/movable/src_object)
return shared_living_ui_distance(src_object)
/mob/living/silicon/physical_can_use_topic(atom/movable/src_object)
return max(UI_UPDATE, shared_living_ui_distance(src_object)) // Silicons can always see.

View File

@@ -0,0 +1,12 @@
/**
* tgui state: self_state
*
* Only checks that the user and src_object are the same.
**/
/var/global/datum/ui_state/self_state/self_state = new()
/datum/ui_state/self_state/can_use_topic(atom/movable/src_object, mob/user)
if(src_object != user)
return UI_CLOSE
return user.shared_ui_interaction(src_object)

View File

@@ -0,0 +1,112 @@
/**
* tgui states
*
* Base state and helpers for states. Just does some sanity checks, implement a state for in-depth checks.
**/
/**
* public
*
* Checks if a user can use src_object's UI, under the given state.
*
* required user mob The mob who opened/is using the UI.
* required state datum/ui_state The state to check.
*
* return UI_state The state of the UI.
**/
/atom/proc/ui_state(mob/user, datum/ui_state/state)
var/src_object = ui_host()
if(istype(user, /mob/dead/observer)) // Special-case ghosts.
if(check_rights_for(user.client, R_ADMIN))
return UI_INTERACTIVE // Admins can interact anyway.
if(get_dist(src_object, src) > user.client.view)
return UI_CLOSE // Keep ghosts from opening too many UIs.
return UI_UPDATE // Ghosts can only view.
return state.can_use_topic(src_object, user) // Check if the state allows interaction.
/**
* private
*
* Checks if a user can use src_object's UI, and returns the state.
* Can call a mob proc, which allows overrides for each mob.
*
* required src_object atom/movable The object which owns the UI.
* required user mob The mob who opened/is using the UI.
*
* return UI_state The state of the UI.
**/
/datum/ui_state/proc/can_use_topic(atom/movable/src_object, mob/user)
return UI_CLOSE // Don't allow interaction by default.
/**
* public
*
* Standard interaction/sanity checks. Different mob types may have overrides.
*
* return UI_state The state of the UI.
**/
/mob/proc/shared_ui_interaction(atom/movable/src_object)
if(!client || stat) // Close UIs if mindless or dead/unconcious.
return UI_CLOSE
// Update UIs if incapicitated but concious.
else if(incapacitated() || lying)
return UI_UPDATE
return UI_INTERACTIVE
/mob/living/carbon/human/shared_ui_interaction(atom/movable/src_object)
// If we have telekinesis and remain close enough, allow interaction.
if(dna.check_mutation(TK))
if(tkMaxRangeCheck(src, src_object))
return UI_INTERACTIVE
return ..()
/mob/living/silicon/ai/shared_ui_interaction(atom/movable/src_object)
if(lacks_power()) // Close UIs if the AI is unpowered.
return UI_CLOSE
return ..()
/mob/living/silicon/robot/shared_ui_interaction(atom/movable/src_object)
if(cell.charge <= 0) // Close UIs if the Borg is unpowered.
return UI_CLOSE
if(lockcharge) // Disable UIs if the Borg is locked.
return UI_DISABLED
return ..()
/**
* public
*
* Check the distance for a living mob.
* Really only used for checks outside the context of a mob.
* Otherwise, use shared_living_ui_distance().
*
* required src_object atom/movable The object which owns the UI.
* required user mob The mob who opened/is using the UI.
*
* return UI_state The state of the UI.
**/
/atom/proc/contents_ui_distance(atom/movable/src_object, mob/living/user)
return user.shared_living_ui_distance(src_object) // Just call this mob's check.
/**
* public
*
* Distance versus interaction check.
*
* required src_object atom/movable The object which owns the UI.
*
* return UI_state The state of the UI.
**/
/mob/living/proc/shared_living_ui_distance(atom/movable/src_object)
if(!(src_object in view(4, src))) // If the object is out of view, close it.
return UI_CLOSE
var/dist = get_dist(src_object, src)
if(dist <= 1) // Open and interact if 1-0 tiles away.
return UI_INTERACTIVE
else if(dist <= 2) // View only if 2-3 tiles away.
return UI_UPDATE
else if(dist <= 5) // Disable if 5 tiles away.
return UI_DISABLED
return UI_CLOSE // Otherwise, we got nothing.

View File

@@ -1,14 +1,14 @@
/**
* NanoUI State: z_state
* tgui state: z_state
*
* Only checks that the Z-level of the user and src_object are the same.
**/
/var/global/datum/nano_state/z_state/z_state = new()
/var/global/datum/ui_state/z_state/z_state = new()
/datum/nano_state/z_state/can_use_topic(atom/movable/src_object, mob/user)
/datum/ui_state/z_state/can_use_topic(atom/movable/src_object, mob/user)
var/turf/turf_obj = get_turf(src_object)
var/turf/turf_usr = get_turf(user)
if(!turf_obj || !turf_usr || !(turf_obj.z == turf_usr.z))
return NANO_CLOSE
return NANO_INTERACTIVE
return UI_CLOSE
return UI_INTERACTIVE

View File

@@ -1,34 +1,29 @@
/**
* NanoUI Subsystem
* tgui subsystem
*
* Contains all NanoUI state and subsystem code.
*
* /tg/station user interface library
* thanks to baystation12
*
* modified by neersighted
* Contains all tgui state and subsystem code.
**/
/**
* public
*
* Get a open NanoUI given a user, src_object, and ui_key and try to update it with data.
* Get a open UI given a user, src_object, and ui_key and try to update it with data.
*
* required user mob The mob who opened/is using the NanoUI.
* required src_object atom/movable The object which owns the NanoUI.
* required ui_key string The ui_key of the NanoUI.
* optional ui datum/nanoui The UI to be updated, if it exists.
* required user mob The mob who opened/is using the UI.
* required src_object atom/movable The object which owns the UI.
* required ui_key string The ui_key of the UI.
* optional ui datum/tgui The UI to be updated, if it exists.
* optional data list The data to update the UI with, if it exists.
* optional force_open bool If the UI should be re-opened instead of updated.
*
* return datum/nanoui The found NanoUI.
* return datum/tgui The found UI.
**/
/datum/subsystem/nano/proc/try_update_ui(mob/user, atom/movable/src_object, ui_key, datum/nanoui/ui, \
/datum/subsystem/tgui/proc/try_update_ui(mob/user, atom/movable/src_object, ui_key, datum/tgui/ui, \
list/data = null, force_open = 0)
if(!data)
data = src_object.get_ui_data(user)
if(isnull(ui)) // No NanoUI was passed, so look for one.
if(isnull(ui)) // No UI was passed, so look for one.
ui = get_open_ui(user, src_object, ui_key)
if(!isnull(ui))
@@ -43,22 +38,22 @@
/**
* private
*
* Get a open NanoUI given a user, src_object, and ui_key.
* Get a open UI given a user, src_object, and ui_key.
*
* required user mob The mob who opened/is using the NanoUI.
* required src_object atom/movable The object which owns the NanoUI.
* required ui_key string The ui_key of the NanoUI.
* required user mob The mob who opened/is using the UI.
* required src_object atom/movable The object which owns the UI.
* required ui_key string The ui_key of the UI.
*
* return datum/nanoui The found NanoUI.
* return datum/tgui The found UI.
**/
/datum/subsystem/nano/proc/get_open_ui(mob/user, atom/movable/src_object, ui_key)
/datum/subsystem/tgui/proc/get_open_ui(mob/user, atom/movable/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))
return null // No UIs open.
else if(isnull(open_uis[src_object_key][ui_key]) || !istype(open_uis[src_object_key][ui_key], /list))
return null // No UIs open for this object.
for(var/datum/nanoui/ui in open_uis[src_object_key][ui_key]) // Find UIs for this object.
for(var/datum/tgui/ui in open_uis[src_object_key][ui_key]) // Find UIs for this object.
if(ui.user == user) // Make sure we have the right user
return ui
@@ -67,21 +62,21 @@
/**
* private
*
* Update all NanoUIs attached to src_object.
* Update all UIs attached to src_object.
*
* required src_object atom/movable The object which owns the NanoUIs.
* required src_object atom/movable The object which owns the UIs.
*
* return int The number of NanoUIs updated.
* return int The number of UIs updated.
**/
/datum/subsystem/nano/proc/update_uis(atom/movable/src_object)
/datum/subsystem/tgui/proc/update_uis(atom/movable/src_object)
var/src_object_key = "\ref[src_object]"
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
return 0 // Couldn't find any UIs for this object.
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])
if(ui && ui.src_object && ui.user && ui.src_object.nano_host()) // Check the UI is valid.
for(var/datum/tgui/ui in open_uis[src_object_key][ui_key])
if(ui && ui.src_object && ui.user && ui.src_object.ui_host()) // Check the UI is valid.
ui.process(force = 1) // Update the UI.
update_count++ // Count each UI we update.
return update_count
@@ -89,21 +84,21 @@
/**
* private
*
* Close all NanoUIs attached to src_object.
* Close all UIs attached to src_object.
*
* required src_object atom/movable The object which owns the NanoUIs.
* required src_object atom/movable The object which owns the UIs.
*
* return int The number of NanoUIs closed.
* return int The number of UIs closed.
**/
/datum/subsystem/nano/proc/close_uis(atom/movable/src_object)
/datum/subsystem/tgui/proc/close_uis(atom/movable/src_object)
var/src_object_key = "\ref[src_object]"
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
return 0 // Couldn't find any UIs for this object.
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])
if(ui && ui.src_object && ui.user && ui.src_object.nano_host()) // Check the UI is valid.
for(var/datum/tgui/ui in open_uis[src_object_key][ui_key])
if(ui && ui.src_object && ui.user && ui.src_object.ui_host()) // Check the UI is valid.
ui.close() // Close the UI.
close_count++ // Count each UI we close.
return close_count
@@ -111,20 +106,20 @@
/**
* private
*
* Update all NanoUIs belonging to a user.
* Update all UIs belonging to a user.
*
* required user mob The mob who opened/is using the NanoUI.
* required user mob The mob who opened/is using the UI.
* optional src_object atom/movable If provided, only update UIs belonging this atom.
* optional ui_key string If provided, only update UIs with this UI key.
*
* return int The number of NanoUIs updated.
* return int The number of UIs updated.
**/
/datum/subsystem/nano/proc/update_user_uis(mob/user, atom/movable/src_object = null, ui_key = null)
/datum/subsystem/tgui/proc/update_user_uis(mob/user, atom/movable/src_object = null, ui_key = null)
if(isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0)
return 0 // Couldn't find any UIs for this user.
var/update_count = 0
for(var/datum/nanoui/ui in user.open_uis)
for(var/datum/tgui/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(force = 1) // Update the UI.
update_count++ // Count each UI we upadte.
@@ -133,20 +128,20 @@
/**
* private
*
* Close all NanoUIs belonging to a user.
* Close all UIs belonging to a user.
*
* required user mob The mob who opened/is using the NanoUI.
* required user mob The mob who opened/is using the UI.
* optional src_object atom/movable If provided, only update UIs belonging this atom.
* optional ui_key string If provided, only update UIs with this UI key.
*
* return int The number of NanoUIs closed.
* return int The number of UIs closed.
**/
/datum/subsystem/nano/proc/close_user_uis(mob/user, atom/movable/src_object = null, ui_key = null)
/datum/subsystem/tgui/proc/close_user_uis(mob/user, atom/movable/src_object = null, ui_key = null)
if(isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0)
return 0 // Couldn't find any UIs for this user.
var/close_count = 0
for(var/datum/nanoui/ui in user.open_uis)
for(var/datum/tgui/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 the UI.
close_count++ // Count each UI we close.
@@ -155,11 +150,11 @@
/**
* private
*
* Add a NanoUI to the list of open UIs.
* Add a UI to the list of open UIs.
*
* required ui datum/nanoui The UI to be added.
* required ui datum/tgui The UI to be added.
**/
/datum/subsystem/nano/proc/on_open(datum/nanoui/ui)
/datum/subsystem/tgui/proc/on_open(datum/tgui/ui)
var/src_object_key = "\ref[ui.src_object]"
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
open_uis[src_object_key] = list(ui.ui_key = list()) // Make a list for the ui_key and src_object.
@@ -175,13 +170,13 @@
/**
* private
*
* Remove a NanoUI from the list of open UIs.
* Remove a UI from the list of open UIs.
*
* required ui datum/nanoui The UI to be removed.
* required ui datum/tgui The UI to be removed.
*
* return bool If the UI was removed or not.
**/
/datum/subsystem/nano/proc/on_close(datum/nanoui/ui)
/datum/subsystem/tgui/proc/on_close(datum/tgui/ui)
var/src_object_key = "\ref[ui.src_object]"
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
return 0 // It wasn't open.
@@ -198,35 +193,35 @@
/**
* private
*
* Handle client logout, by closing all their NanoUIs.
* Handle client logout, by closing all their UIs.
*
* required user mob The mob which logged out.
*
* return int The number of NanoUIs closed.
* return int The number of UIs closed.
**/
/datum/subsystem/nano/proc/on_logout(mob/user)
/datum/subsystem/tgui/proc/on_logout(mob/user)
return close_user_uis(user)
/**
* private
*
* Handle clients switching mobs, by transfering their NanoUIs.
* Handle clients switching mobs, by transfering their UIs.
*
* required user source The client's original mob.
* required user target The client's new mob.
*
* return bool If the NanoUIs were transferred.
* return bool If the UIs were transferred.
**/
/datum/subsystem/nano/proc/on_transfer(mob/source, mob/target)
/datum/subsystem/tgui/proc/on_transfer(mob/source, mob/target)
if(!source || isnull(source.open_uis) || !istype(source.open_uis, /list) || open_uis.len == 0)
return 0 // The old mob had no open NanoUIs.
return 0 // The old mob had no open UIs.
if(isnull(target.open_uis) || !istype(target.open_uis, /list))
target.open_uis = list() // Create a list for the new mob if needed.
for(var/datum/nanoui/ui in source.open_uis)
for(var/datum/tgui/ui in source.open_uis)
ui.user = target // Inform the UIs of their new owner.
target.open_uis.Add(ui) // Transfer all the NanoUIs.
target.open_uis.Add(ui) // Transfer all the UIs.
source.open_uis.Cut() // Clear the old list.
return 1 // Let the caller know we did it.

View File

@@ -1,24 +1,17 @@
/**
* NanoUI
*
* Contains the NanoUI datum, and its procs.
* tgui
*
* /tg/station user interface library
* thanks to baystation12
*
* modified by neersighted
**/
/**
* NanoUI datum:
*
* Represents a NanoUI.
* tgui datum (represents a UI).
**/
/datum/nanoui
var/mob/user // The mob who opened/is using the NanoUI.
var/atom/movable/src_object // The object which owns the NanoUI.
var/title // The title of te NanoUI.
var/ui_key // The ui_key of the NanoUI. This allows multiple UIs for one src_object.
/datum/tgui
var/mob/user // The mob who opened/is using the UI.
var/atom/movable/src_object // The object which owns the UI.
var/title // The title of te UI.
var/ui_key // The ui_key of the UI. This allows multiple UIs for one src_object.
var/window_id // The window_id for browse() and onclose().
var/width = 0 // The window width.
var/height = 0 // The window height
@@ -34,35 +27,35 @@
var/atom/ref = null // An extra ref to call when the window is closed.
var/style = "nanotrasen" // The style to be used for this UI.
var/interface // The interface (template) to be used for this UI.
var/auto_update = 1 // Update the NanoUI every MC tick.
var/list/initial_data // The data (and datastructure) used to initialize the NanoUI.
var/status = NANO_INTERACTIVE // The status/visibility of the NanoUI.
var/datum/nano_state/state = null // Topic state used to determine status/interactability.
var/datum/nanoui/master_ui // The parent NanoUI.
var/list/datum/nanoui/children = list() // Children of this NanoUI.
var/auto_update = 1 // Update the UI every MC tick.
var/list/initial_data // The data (and datastructure) used to initialize the UI.
var/status = UI_INTERACTIVE // The status/visibility of the UI.
var/datum/ui_state/state = null // Topic state used to determine status/interactability.
var/datum/tgui/master_ui // The parent UI.
var/list/datum/tgui/children = list() // Children of this UI.
/**
* public
*
* Create a new NanoUI.
* Create a new UI.
*
* required user mob The mob who opened/is using the NanoUI.
* required src_object atom/movable The object which owns the NanoUI.
* required ui_key string The ui_key of the NanoUI.
* required user mob The mob who opened/is using the UI.
* required src_object atom/movable The object which owns the UI.
* required ui_key string The ui_key of the UI.
* required interface string The interface used to render the UI.
* optional title string The title of the NanoUI.
* optional title string The title of the UI.
* optional width int The window width.
* optional height int The window height.
* optional ref atom An extra ref to use when the window is closed.
* optional master_ui datum/nanoui The parent NanoUI.
* optional state datum/nano_state The state used to determine status.
* optional master_ui datum/tgui The parent UI.
* optional state datum/ui_state The state used to determine status.
*
* return datum/nanoui The requested NanoUI.
* return datum/tgui The requested UI.
**/
/datum/nanoui/New(mob/user, atom/movable/src_object, ui_key, interface, \
/datum/tgui/New(mob/user, atom/movable/src_object, ui_key, interface, \
title, width = 0, height = 0, \
atom/ref = null, datum/nanoui/master_ui = null, \
datum/nano_state/state = default_state)
atom/ref = null, datum/tgui/master_ui = null, \
datum/ui_state/state = default_state)
src.user = user
src.src_object = src_object
src.ui_key = ui_key
@@ -85,22 +78,22 @@
master_ui.children += src
src.state = state
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/nanoui)
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/tgui)
assets.send(user)
/**
* public
*
* Open this NanoUI (and initialize it with data).
* Open this UI (and initialize it with data).
*
* optional data list The data to intialize the UI with.
**/
/datum/nanoui/proc/open(list/data = null)
/datum/tgui/proc/open(list/data = null)
if(!user.client)
return // Bail if there is no client.
update_status(push = 0) // Update the window status.
if(status == NANO_CLOSE)
if(status == UI_CLOSE)
return // Bail if we should close.
if(!initial_data)
@@ -113,19 +106,19 @@
window_size = "size=[width]x[height];"
user << browse(get_html(), "window=[window_id];[window_size][list2params(window_options)]") // Open the window.
winset(user, window_id, "on-close=\"nanoclose \ref[src]\"") // Instruct the client to signal NanoUI when the window is closed.
SSnano.on_open(src)
winset(user, window_id, "on-close=\"uiclose \ref[src]\"") // Instruct the client to signal UI when the window is closed.
SStgui.on_open(src)
/**
* public
*
* Reinitialize the NanoUI.
* Reinitialize the UI.
* (Possibly with a new interface and/or data).
*
* optional template string The name of the new interface.
* optional data list The new initial data.
**/
/datum/nanoui/proc/reinitialize(interface, list/data)
/datum/tgui/proc/reinitialize(interface, list/data)
if(interface)
set_interface(interface) // Set a new interface.
if(data)
@@ -135,90 +128,90 @@
/**
* public
*
* Close the NanoUI, and all its children.
* Close the UI, and all its children.
**/
/datum/nanoui/proc/close()
/datum/tgui/proc/close()
user << browse(null, "window=[window_id]") // Close the window.
SSnano.on_close(src)
for(var/datum/nanoui/child in children) // Loop through and close all children.
SStgui.on_close(src)
for(var/datum/tgui/child in children) // Loop through and close all children.
child.close()
/**
* public
*
* Sets the browse() window options for this NanoUI.
* Sets the browse() window options for this UI.
*
* required window_options list The window options to set.
**/
/datum/nanoui/proc/set_window_options(list/window_options)
/datum/tgui/proc/set_window_options(list/window_options)
src.window_options = window_options
/**
* public
*
* Set the style for this NanoUI.
* Set the style for this UI.
*
* required style string The new UI style.
**/
/datum/nanoui/proc/set_style(style)
/datum/tgui/proc/set_style(style)
src.style = lowertext(style)
/**
* public
*
* Set the interface (template) for this NanoUI.
* Set the interface (template) for this UI.
*
* required interface string The new UI interface.
**/
/datum/nanoui/proc/set_interface(interface)
/datum/tgui/proc/set_interface(interface)
src.interface = lowertext(interface)
/**
* public
*
* Enable/disable auto-updating of the NanoUI.
* Enable/disable auto-updating of the UI.
*
* required state bool Enable/disable auto-updating.
**/
/datum/nanoui/proc/set_auto_update(state = 1)
/datum/tgui/proc/set_auto_update(state = 1)
auto_update = state
/**
* private
*
* Set the data to initialize the NanoUI with.
* Set the data to initialize the UI with.
* The datastructure cannot be changed by subsequent updates.
*
* optional data list The data/datastructure to initialize the NanoUI with.
* optional data list The data/datastructure to initialize the UI with.
**/
/datum/nanoui/proc/set_initial_data(list/data)
/datum/tgui/proc/set_initial_data(list/data)
initial_data = data
/**
* private
*
* Generate HTML for this NanoUI.
* Generate HTML for this UI.
*
* return string NanoUI HTML output.
* return string UI HTML output.
**/
/datum/nanoui/proc/get_html()
/datum/tgui/proc/get_html()
// Poplate HTML with JSON.
return replacetextEx(SSnano.html, "{}", get_json(initial_data))
return replacetextEx(SStgui.html, "{}", get_json(initial_data))
/**
* private
*
* Get the config data/datastructure to initialize the NanoUI with.
* Get the config data/datastructure to initialize the UI with.
*
* return list The config data.
**/
/datum/nanoui/proc/get_config_data()
/datum/tgui/proc/get_config_data()
var/list/config_data = list(
"title" = title,
"status" = status,
"style" = style,
"interface" = interface,
"fancy" = user.client.prefs.nanoui_fancy,
"fancy" = user.client.prefs.tgui_fancy,
"window" = window_id,
"ref" = "\ref[src]",
"user" = list(
@@ -240,7 +233,7 @@
*
* return string The packaged JSON.
**/
/datum/nanoui/proc/get_json(list/data)
/datum/tgui/proc/get_json(list/data)
var/list/json_data = list()
json_data["config"] = get_config_data()
@@ -256,13 +249,13 @@
/**
* private
*
* Handle clicks from the NanoUI.
* Call the src_object's ui_act() if status is NANO_INTERACTIVE.
* Handle clicks from the UI.
* Call the src_object's ui_act() if status is UI_INTERACTIVE.
* If the src_object's ui_act() returns 1, update all UIs attacked to it.
**/
/datum/nanoui/Topic(href, href_list)
/datum/tgui/Topic(href, href_list)
update_status(push = 0) // Update the window state.
if(status != NANO_INTERACTIVE || user != usr)
if(status != UI_INTERACTIVE || user != usr)
return // If UI is not interactive or usr calling Topic is not the UI user.
var/action = href_list["action"] // Pull the action out.
@@ -270,17 +263,17 @@
var/update = src_object.ui_act(action, href_list, state) // Call ui_act() on the src_object.
if(src_object && update)
SSnano.update_uis(src_object) // If we have a src_object and its ui_act() told us to update.
SStgui.update_uis(src_object) // If we have a src_object and its ui_act() told us to update.
/**
* private
*
* Update the NanoUI.
* Update the UI.
* Only updates the data if update is true, otherwise only updates the status.
*
* optional force bool If the UI should be forced to update.
**/
/datum/nanoui/process(force = 0)
/datum/tgui/process(force = 0)
if(!src_object || !user) // If the object or user died (or something else), abort.
close()
return
@@ -293,14 +286,14 @@
/**
* private
*
* Push data to an already open NanoUI.
* Push data to an already open UI.
*
* required data list The data to send.
* optional force bool If the update should be sent regardless of state.
**/
/datum/nanoui/proc/push_data(data, force = 0)
/datum/tgui/proc/push_data(data, force = 0)
update_status(push = 0) // Update the window state.
if(status <= NANO_DISABLED && !force)
if(status <= UI_DISABLED && !force)
return // Cannot update UI, we have no visibility.
// Send the new JSON to the recieveUpdate() Javascript function.
@@ -315,22 +308,22 @@
*
* optional force_open bool If force_open should be passed to ui_interact.
**/
/datum/nanoui/proc/update(force_open = 0)
/datum/tgui/proc/update(force_open = 0)
src_object.ui_interact(user, ui_key, src, force_open, master_ui, state)
/**
* private
*
* Update the status/visibility of the NanoUI for its user.
* Update the status/visibility of the UI for its user.
*
* optional push bool Push an update to the UI (an update is always sent for NANO_DISABLED).
* optional push bool Push an update to the UI (an update is always sent for UI_DISABLED).
**/
/datum/nanoui/proc/update_status(push = 0)
var/new_status = src_object.nano_state(user, state)
/datum/tgui/proc/update_status(push = 0)
var/new_status = src_object.ui_state(user, state)
if(master_ui)
new_status = min(new_status, master_ui.status)
if(new_status == NANO_CLOSE)
if(new_status == UI_CLOSE)
close()
else
set_status(new_status, push)
@@ -338,18 +331,18 @@
/**
* private
*
* Set the status/visibility of the NanoUI.
* Set the status/visibility of the UI.
*
* required status int The status to set (NANO_CLOSE/NANO_DISABLED/NANO_UPDATE/NANO_INTERACTIVE).
* optional push bool Push an update to the UI (an update is always sent for NANO_DISABLED).
* required status int The status to set (UI_CLOSE/UI_DISABLED/UI_UPDATE/UI_INTERACTIVE).
* optional push bool Push an update to the UI (an update is always sent for UI_DISABLED).
**/
/datum/nanoui/proc/set_status(status, push = 0)
/datum/tgui/proc/set_status(status, push = 0)
if(src.status != status) // Only update if status has changed.
if(src.status == NANO_DISABLED)
if(src.status == UI_DISABLED)
src.status = status
if(push)
update()
else
src.status = status
if(status == NANO_DISABLED || push) // Update if the UI just because disabled, or a push is requested.
if(status == UI_DISABLED || push) // Update if the UI just because disabled, or a push is requested.
push_data(null, force = 1)

View File

@@ -1,14 +0,0 @@
<div id='container' class='container'>
<header id='titlebar' class='titlebar' unselectable='on'>
<i class='statusicon fa fa-eye fa-2x good' unselectable='on'></i>
<span class='title' unselectable='on'>{{=config.title}}</span>
<i class='minimize fancy fa fa-minus fa-2x' unselectable='on'></i>
<i class='close fancy fa fa-close fa-2x' unselectable='on'></i>
</header>
<div id='content' class='content titlebared resizeable' unselectable='on'>
<div class='loading'>Initiating...</div>
</div>
<div id='resize' class='resize fancy' unselectable='on'></div>
</div>

View File

@@ -1,14 +0,0 @@
<div id='container' class='container'>
<header id='titlebar' class='titlebar' unselectable='on'>
<i class='statusicon fa fa-eye fa-2x good' unselectable='on'></i>
<span class='title' unselectable='on'>{{=config.title}}</span>
<i class='minimize fa fa-minus fa-2x fancy' unselectable='on'></i>
<i class='close fa fa-close fa-2x fancy' unselectable='on'></i>
</header>
<div id='content' class='content titlebared resizeable' unselectable='on'>
<div class='loading'>Initiating...</div>
</div>
<div id='resize' class='resize fancy' unselectable='on'></div>
</div>

View File

@@ -1,233 +0,0 @@
<article class="notice">
{{? data.siliconUser}}
<section>
<span class="label">Interface Lock:</span>
<div class="content">
{{=helper.link('Engaged', 'lock', 'toggleaccess', null, data.locked ? 'selected' : null)}}
{{=helper.link('Disengaged', 'unlock', 'toggleaccess', null, data.locked ? null : 'selected')}}
</div>
</section>
{{??}}
{{? data.locked}}
<span>Swipe an ID card to unlock this interface.</span>
{{??}}
<span>Swipe an ID card to lock this interface.</span>
{{?}}
{{?}}
</article>
<article class="display">
<header><h2>Air Status</h2></header>
{{? data.environment_data}}
{{~ data.environment_data:info:i}}
<section>
<span class="label">{{=info.name}}:</span>
<div class="content">
{{? info.danger_level == 2}}
<span class="bad">
{{?? info.danger_level == 1}}
<span class="average">
{{??}}
<span class="good">
{{?}}
{{=helper.fixed(info.value, 2)}}{{=info.unit}}</span>
</div>
</section>
{{~}}
<section>
<span class="label">Local Status:</span>
<div class="content">
{{? data.danger_level == 2}}
<span class="bad bold">Danger (Internals Required)</span>
{{?? data.danger_level == 1}}
<span class="average bold">Caution</span>
{{??}}
<span class="good">Optimal</span>
{{?}}
</div>
</section>
<section>
<span class="label">Area Status:</span>
<div class="content">
{{? data.atmos_alarm}}
<span class="bad bold">Atmosphere Alarm</span>
{{?? data.fire_alarm}}
<span class="bad bold">Fire Alarm</span>
{{??}}
<span class="good">Nominal</span>
{{?}}
</div>
</section>
{{??}}
<section>
<span class="bad bold">Warning: Cannot obtain air sample for analysis.</span>
</section>
{{?}}
{{? data.emagged}}
<hr />
<section>
<span class="bad bold">Warning: Safety measures offline. Device may exhibit abnormal behavior.</span>
</section>
{{?}}
</article>
{{? (!data.locked || data.siliconUser)}}
{{? data.screen != 1}}
{{=helper.link('Back', 'arrow-left', 'screen', {'screen': 1})}}
{{?}}
{{? data.screen == 1}}
<article class="display">
<header><h2>Air Controls</h2></header>
<section class="button">
{{? !data.atmos_alarm}}
{{=helper.link('Area Atmospheric Alarm', 'hand-stop-o', 'alarm')}}
{{??}}
{{=helper.link('Area Atmospheric Alarm', 'close', 'reset', null, null, 'caution')}}
{{?}}
</section>
<section class="button">
{{? data.mode != 3}}
{{=helper.link('Panic Siphon', 'exclamation', 'mode', {'mode': 3})}}
{{??}}
{{=helper.link('Panic Siphon', 'close', 'mode', {'mode': 1}, null, 'danger')}}
{{?}}
</section>
<section class="button">
{{=helper.link('Vent Controls', 'sign-out', 'screen', {'screen': 2})}}
</section>
<section class="button">
{{=helper.link('Scrubber Controls', 'filter', 'screen', {'screen': 3})}}
</section>
<section class="button">
{{=helper.link('Set Environmental Mode', 'cog', 'screen', {'screen': 4})}}
</section>
<section class="button">
{{=helper.link('Set Alarm Threshold', 'bar-chart', 'screen', {'screen': 5})}}
</section>
</article>
{{?? data.screen == 2}}
{{~ data.vents:vent:i}}
<article class="display">
<header><h3>{{=vent.long_name}}</h3></header>
<section>
<span class="label">Power:</span>
<div class="content">
{{? vent.power}}
{{=helper.link('On', 'power-off', 'adjust', {'id_tag': vent.id_tag, 'command': 'power', 'val': 0}, null, null)}}
{{??}}
{{=helper.link('Off', 'close', 'adjust', {'id_tag': vent.id_tag, 'command': 'power', 'val': 1}, null, 'danger')}}
{{?}}
</div>
</section>
<section>
<span class="label">Mode:</span>
<div class="content">
{{? vent.direction == "release"}}
<span class="good">Pressurizing</span>
{{??}}
<span class="bad">Siphoning</span>
{{?}}
</div>
</section>
<section>
<span class="label">Pressure Checks:</span>
<div class="content">
{{=helper.link('Internal', 'sign-in', 'adjust', {'id_tag': vent.id_tag, 'command': 'incheck', 'val': vent.checks}, null, vent.incheck ? 'selected' : null)}}
{{=helper.link('External', 'sign-out', 'adjust', {'id_tag': vent.id_tag, 'command': 'excheck', 'val': vent.checks}, null, vent.excheck ? 'selected' : null)}}
</div>
</section>
<section>
<span class="label">Set Pressure:</span>
<div class="content">
{{=helper.link(helper.fixed(vent.external), 'pencil', 'adjust', {'id_tag': vent.id_tag, 'command': 'set_external_pressure'})}}
{{=helper.link('Reset', 'refresh', 'adjust', {'id_tag': vent.id_tag, 'command': 'reset_external_pressure'}, vent.extdefault ? 'disabled' : null)}}
</div>
</section>
</article>
{{~}}
{{? !data.vents.length}}
<span class="bad">No vents connected.</span>
{{?}}
{{?? data.screen == 3}}
{{~ data.scrubbers:scrubber:i}}
<article class="display">
<header><h3>{{=scrubber.long_name}}</h3></header>
<section>
<span class="label">Power:</span>
<div class="content">
{{? scrubber.power}}
{{=helper.link('On', 'power-off', 'adjust', {'id_tag': scrubber.id_tag, 'command': 'power', 'val': 0}, null, null)}}
{{??}}
{{=helper.link('Off', 'close', 'adjust', {'id_tag': scrubber.id_tag, 'command': 'power', 'val': 1}, null, 'danger')}}
{{?}}
</div>
</section>
<section>
<span class="label">Mode:</span>
<div class="content">
{{? scrubber.scrubbing}}
{{=helper.link('Scrubbing', 'filter', 'adjust', {'id_tag': scrubber.id_tag, 'command': 'scrubbing', 'val': 0}, null, null)}}
{{??}}
{{=helper.link('Siphoning', 'sign-in', 'adjust', {'id_tag': scrubber.id_tag, 'command': 'scrubbing', 'val': 1}, null, 'danger')}}
{{?}}
</div>
</section>
<section>
<span class="label">Range:</span>
<div class="content">
{{? scrubber.widenet}}
{{=helper.link('Extended', 'expand', 'adjust', {'id_tag': scrubber.id_tag, 'command': 'widenet', 'val': 0}, null, 'caution')}}
{{??}}
{{=helper.link('Normal', 'compress', 'adjust', {'id_tag': scrubber.id_tag, 'command': 'widenet', 'val': 1}, null, null)}}
{{?}}
</div>
</section>
<section>
<span class="label">Filters:</span>
<div class="content">
{{=helper.link("CO2", scrubber.filter_co2 ? 'check-square-o' : 'square-o', 'adjust', {'id_tag': scrubber.id_tag, 'command': "co2_scrub", 'val': scrubber.filter_co2 ? 0 : 1}, null, scrubber.filter_co2 ? 'selected' : null)}}
{{=helper.link("N2O", scrubber.filter_n2o ? 'check-square-o' : 'square-o', 'adjust', {'id_tag': scrubber.id_tag, 'command': "n2o_scrub", 'val': scrubber.filter_n2o ? 0 : 1}, null, scrubber.filter_n2o ? 'selected' : null)}}
{{=helper.link("Plasma", scrubber.filter_toxins ? 'check-square-o' : 'square-o', 'adjust', {'id_tag': scrubber.id_tag, 'command': "tox_scrub", 'val': scrubber.filter_toxins ? 0 : 1}, null, scrubber.filter_toxins ? 'selected' : null)}}
</div>
</section>
</article>
{{~}}
{{? !data.scrubbers.length}}
<span class="bad">No scrubbers connected.</span>
{{?}}
{{?? data.screen == 4}}
<article class="display">
<header><h2>Environmental Modes</h2></header>
{{~ data.modes:mode:i}}
<section class="button">
{{=helper.link(mode.name, mode.selected ? 'check-square-o' : 'square-o', 'mode', {'mode': mode.mode}, null, mode.selected ? (mode.danger ? 'danger' : 'selected') : null)}}
</section>
{{~}}
</article>
{{?? data.screen == 5}}
<article class="display">
<header><h2>Alarm Thresholds</h2></header>
<table>
<thead>
<tr>
<th></th>
<th><span class="bad">min2</span></th>
<th><span class="average">min1</span></th>
<th><span class="average">max1</span></th>
<th><span class="bad">max2</span></th>
</tr>
</thead>
<tbody>
{{~ data.thresholds:threshold:i}}
<tr>
<th>{{=threshold.name}}</th>
{{~ threshold.settings:setting:j}}
<td>
{{=helper.link(setting.selected >= 0 ? helper.round(setting.selected*100)/100 : "Off", null, 'adjust', {'command': 'set_threshold', 'env': setting.env, 'var': setting.val})}}
</td>
{{~}}
</tr>
{{~}}
</tbody>
<table>
</article>
{{?}}
{{?}}

View File

@@ -1,33 +0,0 @@
<article class="display">
<section>
{{? data.oneAccess}}
{{=helper.link('One Required', 'unlock', 'one_access')}}
{{??}}
{{=helper.link('All Required', 'lock', 'one_access')}}
{{?}}
{{=helper.link('Clear', 'refresh', 'clear')}}
<section>
<table class="grow">
<thead>
<tr>
{{~ data.regions :region:i}}
<th>
<span class="highlight bold">{{=region.name}}</span>
</th>
{{~}}
</tr>
</thead>
<tbody>
<tr>
{{~ data.regions :region:i}}
<td>
{{~ region.accesses :access:j}}
{{=helper.link(access.name, access.req ? 'check-square-o' : 'square-o', 'set', {'access': access.id}, null, access.req ? 'selected' : null)}}
<br />
{{~}}
</td>
{{~}}
</tr>
</tbody>
</table>
</article>

View File

@@ -1,157 +0,0 @@
<article class="notice">
{{? data.siliconUser}}
<section>
<span class="label">Interface Lock:</span>
<div class="content">
{{=helper.link('Engaged', 'lock', 'toggleaccess', null, data.locked ? 'selected' : null)}}
{{=helper.link('Disengaged', 'unlock', 'toggleaccess', null, data.malfStatus >= 2 ? 'linkOff' : (data.locked ? null : 'selected'))}}
</div>
</section>
{{??}}
{{? data.locked}}
<span>Swipe an ID card to unlock this interface.</span>
{{??}}
<span>Swipe an ID card to lock this interface.</span>
{{?}}
{{?}}
</article>
<article class="display">
<header><h2>Power Status</h2></header>
<section>
<span class="label">Main Breaker:</span>
<div class="content">
{{? data.locked && !data.siliconUser}}
{{? data.isOperating}}
<span class="good">On</span>
{{??}}
<span class="bad">Off</span>
{{?}}
{{??}}
{{=helper.link('On', 'power-off', 'breaker', null, data.isOperating ? 'selected' : null)}}
{{=helper.link('Off', 'close', 'breaker', null, data.isOperating ? null : 'selected')}}
{{?}}
</div>
</section>
<section>
<span class="label">External Power:</span>
<div class="content">
{{? data.externalPower == 2}}
<span class="good">Good</span>
{{?? data.externalPower == 1}}
<span class="average">Low</span>
{{??}}
<span class="bad">None</span>
{{?}}
</div>
</section>
<section>
<span class="label">Power Cell:</span>
<div class="content">
{{? data.powerCellStatus != null}}
{{=helper.bar(data.powerCellStatus, 0, 100, data.powerCellStatus >= 50 ? "good" : data.powerCellStatus >= 25 ? "average" : "bad", helper.fixed(data.powerCellStatus) + "%")}}
{{??}}
<span class="bad">Power cell removed.</span>
{{?}}
</div>
</section>
{{? data.powerCellStatus != null}}
<section>
<span class="label">Charge Mode:</span>
<div class="content">
{{? data.locked && !data.siliconUser}}
{{? data.chargeMode}}
<span class="good">Auto</span>
{{??}}
<span class="bad">Off</span>
{{?}}
{{??}}
{{=helper.link('Auto', 'refresh', 'chargemode', null, data.chargeMode ? 'selected' : null)}}
{{=helper.link('Off', 'close', 'chargemode', null, data.chargeMode ? null : 'selected')}}
{{?}}
&nbsp;
{{? data.chargingStatus > 1}}
[<span class="good">Fully Charged</span>]
{{?? data.chargingStatus == 1}}
[<span class="average">Charging</span>]
{{??}}
[<span class="bad">Not Charging</span>]
{{?}}
</div>
</section>
{{?}}
</article>
<article class="display">
<header><h2>Power Channels</h2></header>
<table class="grow">
{{~ data.powerChannels :channel:i}}
<tr>
<th>{{=channel.title}}:</th>
<td>{{=channel.powerLoad}} W</td>
<td>
{{? channel.status <= 1}}
<span class="bad">Off</span>
{{?? channel.status >= 2}}
<span class="good">On</span>
{{?}}
</td>
<td>
{{? channel.status == 1 || channel.status == 3}}
[Auto]
{{??}}
[Manual]
{{?}}
</td>
<td class="floatRight">
{{? !data.locked || data.siliconUser}}
{{=helper.link('Auto', 'refresh', 'channel', channel.topicParams.auto, (channel.status == 1 || channel.status == 3) ? 'selected' : null)}}
{{=helper.link('On', 'power-off', 'channel', channel.topicParams.on, (channel.status == 2) ? 'selected' : null)}}
{{=helper.link('Off', 'close', 'channel', channel.topicParams.off, (channel.status == 0) ? 'selected' : null)}}
{{?}}
</td>
</tr>
{{~}}
<tr>
<th>Total Load:</th>
<td class="bold">{{=data.totalLoad}} W</td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</article>
{{? data.siliconUser}}
<article class="display">
<header><h2>System Overrides</h2></header>
<section>
{{=helper.link('Overload Lighting Circuit', 'lightbulb-o', 'overload')}}
</section>
<section>
{{? data.malfStatus == 1}}
{{=helper.link('Override Programming', 'terminal', 'hack')}}
{{?? data.malfStatus == 2}}
{{=helper.link('Shunt Core Processes', 'caret-square-o-down', 'occupy')}}
{{?? data.malfStatus == 3}}
{{=helper.link('Return to Main Core', 'carat-square-o-left', 'deoccupy')}}
{{?? data.malfStatus == 4}}
{{=helper.link('Shunt Core Processes', 'caret-square-o-down')}}
{{?}}
</section>
</article>
{{?}}
<article class="notice">
<section>
<span class="label">Cover Lock:</span>
<div class="content">
{{? data.locked && !data.siliconUser}}
{{? data.coverLocked}}
<span>Engaged</span>
{{??}}
<span>Disengaged</span>
{{?}}
{{??}}
{{=helper.link('Engaged', 'lock', 'lock', null, data.coverLocked ? 'selected' : null)}}
{{=helper.link('Disengaged', 'unlock', 'lock', null, data.coverLocked ? null : 'selected')}}
{{?}}
</div>
</section>
</article>

View File

@@ -1,27 +0,0 @@
<article class="display">
<section>
<span class="label">Power:</span>
<div class="content">
{{=helper.link(data.on? 'On' : 'Off', data.on ? 'power-off' : 'close', 'power')}}
</div>
</section>
<section>
<span class="label">Output Pressure:</span>
<div class="content">
{{=helper.link('Set', 'pencil', 'pressure', {'set': 'custom'})}}
{{=helper.link('Max', 'plus', 'pressure', {'set': 'max'}, data.set_pressure == data.max_pressure ? 'disabled' : null)}}
<span class="buttoninfo">{{=data.set_pressure}} kPa</span>
</div>
</section>
<section>
<span class="label">Filter:</span>
<div class="content">
{{=helper.link('Nothing', null, 'filter', {'mode': -1}, data.filter_type == -1 ? 'selected' : null)}}
{{=helper.link('Plasma', null, 'filter', {'mode': 0}, data.filter_type == 0 ? 'selected' : null)}}
{{=helper.link('O2', null, 'filter', {'mode': 1}, data.filter_type == 1 ? 'selected' : null)}}
{{=helper.link('N2', null, 'filter', {'mode': 2}, data.filter_type == 2 ? 'selected' : null)}}
{{=helper.link('CO2', null, 'filter', {'mode': 3}, data.filter_type == 3 ? 'selected' : null)}}
{{=helper.link('N2O', null, 'filter', {'mode': 4}, data.filter_type == 4 ? 'selected' : null)}}
</div>
</section>
</article>

View File

@@ -1,36 +0,0 @@
<article class="display">
<section>
<span class="label">Power:</span>
<div class="content">
{{=helper.link(data.on? 'On' : 'Off', data.on? 'power-off' : 'close', 'power')}}
</div>
</section>
<section>
<span class="label">Output Pressure:</span>
<div class="content">
{{=helper.link('Set', 'pencil', 'pressure', {'set': 'custom'})}}
{{=helper.link('Max', 'plus', 'pressure', {'set': 'max'}, data.set_pressure == data.max_pressure ? 'disabled' : null)}}
<span class="buttoninfo">{{=data.set_pressure}} kPa</span>
</div>
</section>
<section>
<span class="label">Node 1:</span>
<div class="content">
{{=helper.link('', 'fast-backward', 'node1', {'concentration' : '-0.1'}, null)}}
{{=helper.link('', 'backward', 'node1', {'concentration' : '-0.01'}, null)}}
{{=helper.link('', 'forward', 'node1', {'concentration' : '0.01'}, null)}}
{{=helper.link('', 'fast-forward', 'node1', {'concentration' : '0.1'}, null)}}
<span class="buttoninfo">{{=data.node1_concentration}}%</span>
</div>
</section>
<section>
<span class="label">Node 2:</span>
<div class="content">
{{=helper.link('', 'fast-backward', 'node2', {'concentration' : '-0.1'}, null)}}
{{=helper.link('', 'backward', 'node2', {'concentration' : '-0.01'}, null)}}
{{=helper.link('', 'forward', 'node2', {'concentration' : '0.01'}, null)}}
{{=helper.link('', 'fast-forward', 'node2', {'concentration' : '0.1'}, null)}}
<span class="buttoninfo">{{=data.node2_concentration}}%</span>
</div>
</section>
</article>

View File

@@ -1,27 +0,0 @@
<article class="display">
<section>
<span class="label">Power:</span>
<div class="content">
{{=helper.link(data.on? 'On' : 'Off', data.on? 'power-off' : 'close', 'power')}}
</div>
</section>
{{? data.max_rate}}
<section>
<span class="label">Transfer Rate:</span>
<div class="content">
{{=helper.link('Set', 'pencil', 'transfer', {'set': 'custom'})}}
{{=helper.link('Max', 'plus', 'transfer', {'set' : 'max'}, data.transfer_rate == data.max_rate ? 'disabled' : null)}}
<span class="buttoninfo">{{=data.transfer_rate}} L/s</span>
</div>
</section>
{{??}}
<section>
<span class="label">Output Pressure:</span>
<div class="content">
{{=helper.link('Set', 'pencil', 'pressure', {'set': 'custom'})}}
{{=helper.link('Max', 'plus', 'pressure', {'set' : 'max'}, data.set_pressure == data.max_pressure ? 'disabled' : null)}}
<span class="buttoninfo">{{=data.set_pressure}} kPa</span>
</div>
</section>
{{?}}
</article>

View File

@@ -1,80 +0,0 @@
<article class="notice">
{{? data.hasHoldingTank }}
<span>The regulator is connected to a tank.</span>
{{??}}
<span>The regulator is not connected to a tank.</span>
{{?}}
</article>
<article class="display">
<header><h2>Canister</h2></header>
<section>
{{=helper.link('Relabel', 'pencil', 'relabel', null, data.canLabel ? null : 'disabled')}}
</section>
<section>
<span class="label">Pressure:</span>
<div class="content">
<span>{{=data.tankPressure}} kPa</span>
</div>
</section>
<section>
<span class="label">
Port:
</span>
<div class="content">
{{? data.portConnected}}
<span class="good">Connected</span>
{{??}}
<span class="bad">Disconnected</span>
{{?}}
</div>
</section>
</article>
<article class="display">
<header><h2>Valve</h2></header>
<section>
<span class="label">Release Pressure:</span>
<div class="content">
{{=helper.bar(data.releasePressure, data.minReleasePressure, data.maxReleasePressure, null, data.releasePressure + ' kPa')}}
</div>
</section>
<section>
<div class="label">Pressure Regulator:</div>
<div class="content">
{{=helper.link('Reset', 'refresh', 'pressure', {'set': 'reset'}, (data.releasePressure != data.defaultReleasePressure) ? null : 'disabled')}}
{{=helper.link('Min', 'minus', 'pressure', {'set': 'min'}, (data.releasePressure > data.minReleasePressure) ? null : 'disabled')}}
{{=helper.link('Set', 'pencil', 'pressure', {'set': 'custom'}, null)}}
{{=helper.link('Max', 'plus', 'pressure', {'set': 'max'}, (data.releasePressure < data.maxReleasePressure) ? null : 'disabled')}}
</div>
</section>
<section>
<div class="label">Valve:</div>
<div class="content">
{{=helper.link('Open', 'unlock', 'valve', null, data.valveOpen ? 'selected' : null)}}
{{=helper.link('Close', 'lock', 'valve', null, data.valveOpen ? null : 'selected')}}
</div>
</section>
</article>
<article class="display">
<header><h2>Holding Tank</h2></header>
{{? data.hasHoldingTank}}
<section>
{{=helper.link('Eject', 'eject', 'eject')}}
</section>
<section>
<span class="label">Label:</span>
<div class="content">
{{=data.holdingTank.name}}
</div>
</section>
<section>
<span class="label">Tank Pressure:</span>
<div class="content">
{{=data.holdingTank.tankPressure}} kPa
</div>
</section>
{{??}}
<section>
<span class="average">No Holding Tank</span>
</section>
{{?}}
</article>

View File

@@ -1,55 +0,0 @@
<article class="display">
<header><h2>Status</h2></header>
<section>
<span class="label">Energy:</span>
<div class="content">
{{=helper.bar(data.energy, 0, data.maxEnergy, null, data.energy + ' Units')}}
</div>
</section>
<section>
<span class="label">Amount:</span>
<div class="content">
{{~ data.beakerTransferAmounts :amount:i}}
{{=helper.link(amount, 'plus', 'amount', {'set': amount}, (data.amount == amount) ? 'selected' : null)}}
{{~}}
</div>
</section>
</article>
<article class="display">
<header><h2>Dispense</h2></header>
<section>
{{~ data.chemicals :chem:i}}
{{=helper.link(chem.title, 'tint', 'dispense', chem.commands, null, 'gridable')}}
{{~}}
</section>
</article>
<article class="display">
<header><h2>Beaker</h2></header>
<section>
<div class="label">
{{=helper.link('Eject', 'eject', 'eject', null, data.isBeakerLoaded ? null : 'disabled')}}
</div>
<div class="content">
{{~ data.beakerTransferAmounts :amount:i}}
{{=helper.link(amount, 'minus', 'remove', {'amount': amount})}}
{{~}}
</div>
</section>
<section>
<div class="label">Contents:</div>
<div class="content">
{{? data.isBeakerLoaded}}
{{? data.beakerContents.length}}
<span>{{=data.beakerCurrentVolume}}/{{=data.beakerMaxVolume}} Units</span><br />
{{~ data.beakerContents :reagent:i}}
<span class="highlight">{{=reagent.volume}} units of {{=reagent.name}}</span><br />
{{~}}
{{??}}
<span class="bad">Beaker Empty</span>
{{?}}
{{??}}
<span class="average">No Beaker Loaded</span>
{{?}}
</div>
</section>
</article>

View File

@@ -1,38 +0,0 @@
<article class="display">
<header><h2>Status</h2></header>
<section>
<span class="label">Power:</span>
<div class="content">
{{=helper.link(data.isActive ? 'On' : 'Off', data.isActive ? 'power-off' : 'close', 'power', null, data.isBeakerLoaded ? null : 'disabled')}}
</div>
</section>
<section>
<span class="label">Target:</span>
<div class="content">
{{=helper.link(data.targetTemp + 'K', 'pencil', 'temperature')}}
</div>
</section>
</article>
<article class="display">
<header><h2>Beaker</h2></header>
<section>
{{=helper.link('Eject', 'eject', 'eject', null, data.isBeakerLoaded ? null : 'disabled')}}
</section>
<section>
<span class="label">Contents:</span>
<div class="content">
{{? data.isBeakerLoaded}}
Temperature: {{=data.currentTemp}}K<br />
{{? data.beakerContents.length}}
{{~ data.beakerContents :reagent:i}}
<span class="highlight">{{=reagent.volume}} units of {{=reagent.name}}</span><br />
{{~}}
{{??}}
<span class="bad">Beaker Empty</span>
{{?}}
{{??}}
<span class="average">No Beaker Loaded</span>
{{?}}
</div>
</section>
</div>

View File

@@ -1,121 +0,0 @@
<article class="display">
<header><h2>Occupant</h2></header>
<section>
<span class="label">Occupant:</span>
<div class="content">
{{? data.hasOccupant}}
<span>{{=data.occupant.name}}</span>
{{??}}
<span class="average">No Occupant</span>
{{?}}
</div>
</section>
{{? data.hasOccupant}}
<section>
<span class="label">State:</span>
<div class="content">
{{? data.occupant.stat == 0}}
<span class="good">Conscious</span>
{{?? data.occupant.stat == 1}}
<span class="average">Unconscious</span>
{{??}}
<span class="bad">Dead</span>
{{?}}
</div>
</section>
<section>
<span class="label">Temperature:</span>
<div class="content">
{{=helper.round(data.occupant.bodyTemperature)}} K
</div>
</section>
{{?}}
{{? data.hasOccupant && data.occupant.stat < 2}}
<section>
<span class="label">Health:</span>
<div class="content">
{{=helper.bar(data.occupant.health, data.occupant.minHealth, data.occupant.Maxhealth, data.occupant.health >= 0 ? 'good' : 'average', helper.round(data.occupant.health))}}
</div>
</section>
<section>
<span class="label">Brute:</span>
<div class="content">
{{=helper.bar(data.occupant.bruteLoss, 0, data.occupant.maxHealth, 'bad', helper.round(data.occupant.bruteLoss))}}
</div>
</section>
<section>
<span class="label">Respiratory:</span>
<div class="content">
{{=helper.bar(data.occupant.oxyLoss, 0, data.occupant.maxHealth, 'bad', helper.round(data.occupant.oxyLoss))}}
</div>
</section>
<section>
<span class="label">Toxin:</span>
<div class="content">
{{=helper.bar(data.occupant.toxLoss, 0, data.occupant.maxHealth, 'bad', helper.round(data.occupant.toxLoss))}}
</div>
<section>
<section>
<span class="label">Burn:</span>
<div class="content">
{{=helper.bar(data.occupant.fireLoss, 0, data.occupant.maxHealth, 'bad', helper.round(data.occupant.fireLoss))}}
</div>
</section>
{{?}}
</article>
<article class="display">
<header><h2>Cell</h2></header>
<section>
<span class="label">Power:</span>
<div class="content">
{{? data.isOperating}}
{{=helper.link('On', 'power-off', 'off')}}
{{??}}
{{=helper.link('Off', 'close', 'on')}}
{{?}}
</div>
</section>
<section>
<span class="label">Temperature:</span>
<div class="content">
<span class="{{=data.cellTemperatureStatus}}">{{=data.cellTemperature}} K</span>
</div>
</section>
<section>
<span class="label">Door:</span>
<div class="content">
{{? data.isOpen}}
{{=helper.link('Open', 'unlock', 'close')}}
{{??}}
{{=helper.link('Closed', 'lock', 'open')}}
{{?}}
{{? data.autoEject}}
{{=helper.link('Auto', 'sign-out', 'autoeject')}}
{{??}}
{{=helper.link('Manual', 'sign-in', 'autoeject')}}
{{?}}
</div>
</section>
</article>
<article class="display">
<header><h2>Beaker</h2></header>
<section>
{{=helper.link('Eject', 'eject', 'ejectbeaker', null, data.isBeakerLoaded ? null : 'disabled')}}
</section>
<section>
<span class="label">Contents:</span>
<div class="content">
{{? data.isBeakerLoaded}}
{{? data.beakerContents.length}}
{{~ data.beakerContents :reagent:i}}
<span class="highlight">{{=reagent.volume}} units of {{=reagent.name}}</span><br />
{{~}}
{{??}}
<span class="bad">Beaker Empty</span>
{{?}}
{{??}}
<span class="average">No Beaker Loaded</span>
{{?}}
</div>
</section>
</display>

View File

@@ -1,89 +0,0 @@
<article class="display">
<header><h2>Storage</h2></header>
<section>
<span class="label">Stored Energy:</span>
<div class="content">
{{=helper.bar(data.capacityPercent, 0, 100, data.capacityPercent >= 50 ? 'good' : data.capacityPercent >= 15 ? 'average' : 'bad', helper.round(data.capacityPercent) + '%')}}
</div>
</section>
</article>
<article class="display">
<header><h2>Input</h2></header>
<section>
<span class="label">Charge Mode:</span>
<div class="content">
{{=helper.link('Auto', 'refresh', 'tryinput', null, data.inputAttempt ? 'selected' : null)}}
{{=helper.link('Off', 'close', 'tryinput', null, data.inputAttempt ? null : 'selected')}}
&nbsp;
{{? data.capacityPercent >= 99}}
[<span class='good'>Fully Charged</span>]
{{?? data.inputting}}
[<span class='average'>Charging</span>]
{{??}}
[<span class='bad'>Not Charging</span>]
{{?}}
</div>
</section>
<section>
<span class="label">Input Setting:</span>
<div class="content">
{{=helper.bar(data.inputLevel, 0, data.inputLevelMax, null, data.inputLevel + ' W')}}
</div>
</section>
<section>
<span class="label">Adjust Input:</span>
<div class="content">
{{=helper.link('', 'fast-backward', 'input', {'set': 'min'}, data.inputLevel ? null : 'selected')}}
{{=helper.link('', 'backward', 'input', {'set': 'minus'}, data.inputLevel ? null : 'disabled')}}
{{=helper.link('Set', 'pencil', 'input', {'set': 'custom'}, null)}}
{{=helper.link('', 'forward', 'input', {'set': 'plus'}, data.inputLevel == data.inputLevelMax ? 'disabled' : null)}}
{{=helper.link('', 'fast-forward', 'input', {'set': 'max'}, data.inputLevel == data.inputLevelMax ? 'selected' : null)}}
</div>
</section>
<section>
<span class="label">Available:</span>
<div class="content">
<span>{{=data.inputAvailable}} W</span>
</div>
</section>
</article>
<article class="display">
<header><h2>Output</h2></header>
<section>
<span class="label">Charge Mode:</span>
<div class="content">
{{=helper.link('On', 'power-off', 'tryoutput', null, data.outputAttempt ? 'selected' : null)}}
{{=helper.link('Off', 'close', 'tryoutput', null, data.outputAttempt ? null : 'selected')}}
&nbsp;
{{? data.outputting}}
[<span class="good">Sending</span>]
{{?? data.charge > 0}}
[<span class="average">Not Sending</span>]
{{??}}
[<span class="bad">No Charge</span>]
{{?}}
</div>
</section>
<section>
<span class="label">Output Setting:</span>
<div class="content">
{{=helper.bar(data.outputLevel, 0, data.outputLevelMax, null, data.outputLevel + ' W')}}
</div>
</section>
<section>
<span class="label">Adjust Output:</span>
<div class="content">
{{=helper.link('', 'fast-backward', 'output', {'set': 'min'}, data.outputLevel ? null : 'selected')}}
{{=helper.link('', 'backward', 'output', {'set': 'minus'}, data.outputLevel ? null : 'disabled')}}
{{=helper.link('Set', 'pencil', 'output', {'set': 'custom'}, null)}}
{{=helper.link('', 'forward', 'output', {'set': 'plus'}, data.outputLevel == data.outputLevelMax ? 'disabled' : null)}}
{{=helper.link('', 'fast-forward', 'output', {'set': 'max'}, data.outputLevel == data.outputLevelMax ? 'selected' : null)}}
</div>
</section>
<section>
<span class="label">Outputting:</span>
<div class="content">
<span>{{=data.outputUsed}} W</span>
</div>
</section>
</article>

View File

@@ -1,85 +0,0 @@
<article class="display">
<header><h2>Status</h2></header>
<section>
<span class="label">Generated Power:</span>
<div class="content">
<span>{{=data.generated}} W</span>
</div>
</section>
<section>
<span class="label">Orientation:</span>
<div class="content">
<span>{{=data.angle}}&deg; ({{=data.direction}})</span>
</div>
</section>
<section>
<span class="label">Adjust:</span>
<div class="content">
{{=helper.link('15&deg;', 'step-backward', 'control', {'cdir': '-15'})}}
{{=helper.link('1&deg;', 'backward', 'control', {'cdir': '-1'})}}
{{=helper.link('1&deg;', 'forward', 'control', {'cdir': '1'})}}
{{=helper.link('15&deg;', 'step-forward', 'control', {'cdir': '15'})}}
</div>
</section>
</article>
<article class="display">
<header><h2>Tracking</h2></header>
<section>
<span class="label">Tracker Mode:</span>
<div class="content">
{{=helper.link('Off', 'close', 'tracking', {'mode': '0'}, (data.tracking_state == 0) ? 'selected' : '')}}
{{=helper.link('Timed', 'clock-o', 'tracking', {'mode': '1'}, (data.tracking_state == 1) ? 'selected' : '')}}
{{? data.connected_tracker}}
{{=helper.link('Auto', 'refresh', 'tracking', {'mode': '2'}, (data.tracking_state == 2) ? 'selected' : '')}}
{{??}}
{{=helper.link('Auto', 'refresh', null, null, 'disabled')}}
{{?}}
</div>
</section>
<section>
<span class="label">Tracking Rate:</span>
<div class="content">
<span>{{=data.tracking_rate}} deg/h ({{=data.rotating_way}})</span>
</div>
</section>
<section>
<span class="label">Adjust:</span>
<div class="content">
{{=helper.link('180&deg;', 'fast-backward', 'control', {'tdir': '-180'})}}
{{=helper.link('30&deg;', 'step-backward', 'control', {'tdir': '-30'})}}
{{=helper.link('1&deg;', 'backward', 'control', {'tdir': '-1'})}}
{{=helper.link('1&deg;', 'forward', 'control', {'tdir': '1'})}}
{{=helper.link('30&deg;', 'step-forward', 'control', {'tdir': '30'})}}
{{=helper.link('180&deg;', 'fast-forward', 'control', {'tdir': '180'})}}
</div>
</section>
</article>
<article class="display">
<header><h2>Devices</h2></header>
<section>
<span class="label">Search:</span>
<div class="content">
{{=helper.link('Refresh', 'refresh', 'refresh')}}
</div>
</section>
<section>
<span class="label">
Solar Tracker:
</span>
<div class="content">
{{? data.connected_tracker}}
<span class="good">Found</span>
{{??}}
<span class="bad">Not Found</span>
{{?}}
</div>
</section>
<section>
<span class="label">
Solars Panels:
</span>
<div class="content">
<span class="{{=data.connected_panels ? 'good' : 'bad'}}">{{=data.connected_panels}} Connected</span>
</div>
</div>
</article>

View File

@@ -1,79 +0,0 @@
<article class="display">
<header><h2>Status</h2></header>
<section>
<span class="label">Power:</span>
<div class="content">
{{=helper.link('On', 'power-off', 'power', null, data.on ? 'selected' : null)}}
{{=helper.link('Off', 'close', 'power', null, data.on ? null : 'selected')}}
</div>
</section>
<section>
<span class="label">Stored Energy:</span>
<div class="content">
{{? data.hasPowercell}}
{{=helper.bar(data.powerLevel, 0, 100, 'good', data.powerLevel + '%')}}
{{??}}
<span class="bad">No power cell loaded.</span>
{{?}}
</div>
</section>
{{? data.open}}
<section>
<span class="label">Cell:</span>
<div class="content">
{{? data.hasPowercell}}
{{=helper.link('Eject', 'eject', 'ejectcell')}}
{{??}}
{{=helper.link('Install', 'eject', 'installcell')}}
{{?}}
</div>
</section>
{{?}}
</article>
<article class="display">
<header><h2>Thermostat</h2></header>
<section>
<span class="label">Current Temp:</span>
<div class="content">
<span>{{=data.currentTemp}}&deg;C</span>
</div>
</section>
<section>
<span class="label">Target Temp:</span>
<div class="content">
<span>{{=data.targetTemp}}&deg;C</span>
</div>
</section>
{{? data.open}}
<section>
<span class="label">Adjustment:</span>
<div class="content">
{{=helper.link('', 'fast-backward', 'temp', {'set': -20}, data.targetTemp > data.minTemp ? null : 'disabled')}}
{{=helper.link('', 'backward', 'temp', {'set': -5}, data.targetTemp > data.minTemp ? null : 'disabled')}}
{{=helper.link('Set', 'pencil', 'temp', {'set': 'custom'}, null)}}
{{=helper.link('', 'forward', 'temp', {'set': 5}, data.targetTemp < data.maxTemp ? null : 'disabled')}}
{{=helper.link('', 'fast-forward', 'temp', {'set': 20}, data.targetTemp < data.maxTemp ? null : 'disabled')}}
</div>
</section>
{{?}}
<section>
<span class="label">
Operational Mode:
</span>
<div class="content">
{{? data.open}}
{{=helper.link('Heat', 'long-arrow-up', 'mode', {'mode': 'heat'}, data.mode != "heat" ? null : 'selected')}}
{{=helper.link('Cool', 'long-arrow-down', 'mode', {'mode': 'cool'}, data.mode != "cool" ? null : 'selected')}}
{{=helper.link('Auto', 'arrows-v', 'mode', {'mode': 'auto'}, (data.mode == "heat" || data.mode == "cool") ? null : 'selected')}}
{{??}}
{{? data.mode == "heat"}}
<span class="bad">Heat</span>
{{?? data.mode == "cool"}}
<span class="highlight">Cool</span>
{{??}}
<span class="good">Auto</span>
{{?}}
{{?}}
</div>
</section>
</article>

View File

@@ -1,37 +0,0 @@
<article class="notice">
{{? data.hasHoldingTank }}
<span>The regulator is connected to a mask.</span>
{{??}}
<span>The regulator is not connected to a mask.</span>
{{?}}
</article>
<article class="display">
<section>
<span class="label">Tank Pressure:</span>
<div class="content">
{{=helper.bar(data.tankPressure, 0, 1013, (data.tankPressure > 200) ? 'good' : ((data.tankPressure > 100) ? 'average' : 'bad'), data.tankPressure + ' kPa')}}
</div>
</div>
<section>
<span class="label">Release Pressure:</span>
<div class="content">
{{=helper.bar(data.releasePressure, data.minReleasePressure, data.maxReleasePressure, null, data.releasePressure + ' kPa')}}
</div>
</section>
<section>
<span class="label">Pressure Regulator:</span>
<div class="content">
{{=helper.link('Reset', 'refresh', 'pressure', {'set': 'reset'}, (data.releasePressure != data.defaultReleasePressure) ? null : 'disabled')}}
{{=helper.link('Min', 'minus', 'pressure', {'set': 'min'}, (data.releasePressure > data.minReleasePressure) ? null : 'disabled')}}
{{=helper.link('Set', 'pencil', 'pressure', {'set': 'custom'}, null)}}
{{=helper.link('Max', 'plus', 'pressure', {'set': 'max'}, (data.releasePressure < data.maxReleasePressure) ? null : 'disabled')}}
</div>
</section>
<section>
<span class="label">Valve:</span>
<div class="content">
{{=helper.link('Open', 'unlock', 'valve', null, data.maskConnected ? (data.valveOpen ? 'selected' : null) : 'disabled')}}
{{=helper.link('Close', 'lock', 'valuve', null, data.valveOpen ? null : 'selected')}}
</div>
</section>
</article>

View File

@@ -1,6 +0,0 @@
# Constants used in NanoUI; these are mirrored from the BYOND code.
module.exports =
NANO_INTERACTIVE: 2
NANO_UPDATE: 1
NANO_DISABLED: 0
NANO_CLOSE: -1

View File

@@ -34,7 +34,6 @@
#include "code\__DEFINES\machines.dm"
#include "code\__DEFINES\math.dm"
#include "code\__DEFINES\misc.dm"
#include "code\__DEFINES\nano.dm"
#include "code\__DEFINES\pipe_construction.dm"
#include "code\__DEFINES\preferences.dm"
#include "code\__DEFINES\qdel.dm"
@@ -44,6 +43,7 @@
#include "code\__DEFINES\sight.dm"
#include "code\__DEFINES\stat.dm"
#include "code\__DEFINES\tablecrafting.dm"
#include "code\__DEFINES\tgui.dm"
#include "code\__HELPERS\_logging.dm"
#include "code\__HELPERS\_string_lists.dm"
#include "code\__HELPERS\cmp.dm"
@@ -156,7 +156,6 @@
#include "code\controllers\subsystem\machines.dm"
#include "code\controllers\subsystem\minimap.dm"
#include "code\controllers\subsystem\mobs.dm"
#include "code\controllers\subsystem\nano.dm"
#include "code\controllers\subsystem\npcpool.dm"
#include "code\controllers\subsystem\objects.dm"
#include "code\controllers\subsystem\pai.dm"
@@ -164,6 +163,7 @@
#include "code\controllers\subsystem\server_maintenance.dm"
#include "code\controllers\subsystem\shuttles.dm"
#include "code\controllers\subsystem\sun.dm"
#include "code\controllers\subsystem\tgui.dm"
#include "code\controllers\subsystem\ticker.dm"
#include "code\controllers\subsystem\timer.dm"
#include "code\controllers\subsystem\voting.dm"
@@ -1365,21 +1365,6 @@
#include "code\modules\mob\new_player\poll.dm"
#include "code\modules\mob\new_player\preferences_setup.dm"
#include "code\modules\mob\new_player\sprite_accessories.dm"
#include "code\modules\nano\external.dm"
#include "code\modules\nano\nanoui.dm"
#include "code\modules\nano\subsystem.dm"
#include "code\modules\nano\states\admin.dm"
#include "code\modules\nano\states\conscious.dm"
#include "code\modules\nano\states\contained.dm"
#include "code\modules\nano\states\deep_inventory.dm"
#include "code\modules\nano\states\default.dm"
#include "code\modules\nano\states\hands.dm"
#include "code\modules\nano\states\inventory.dm"
#include "code\modules\nano\states\notcontained.dm"
#include "code\modules\nano\states\physical.dm"
#include "code\modules\nano\states\self.dm"
#include "code\modules\nano\states\states.dm"
#include "code\modules\nano\states\zlevel.dm"
#include "code\modules\ninja\__ninjaDefines.dm"
#include "code\modules\ninja\admin_ninja_verbs.dm"
#include "code\modules\ninja\energy_katana.dm"
@@ -1601,6 +1586,21 @@
#include "code\modules\telesci\gps.dm"
#include "code\modules\telesci\telepad.dm"
#include "code\modules\telesci\telesci_computer.dm"
#include "code\modules\tgui\external.dm"
#include "code\modules\tgui\subsystem.dm"
#include "code\modules\tgui\tgui.dm"
#include "code\modules\tgui\states\admin.dm"
#include "code\modules\tgui\states\conscious.dm"
#include "code\modules\tgui\states\contained.dm"
#include "code\modules\tgui\states\deep_inventory.dm"
#include "code\modules\tgui\states\default.dm"
#include "code\modules\tgui\states\hands.dm"
#include "code\modules\tgui\states\inventory.dm"
#include "code\modules\tgui\states\notcontained.dm"
#include "code\modules\tgui\states\physical.dm"
#include "code\modules\tgui\states\self.dm"
#include "code\modules\tgui\states\states.dm"
#include "code\modules\tgui\states\zlevel.dm"
#include "code\modules\tooltip\tooltip.dm"
#include "code\modules\vehicles\atv.dm"
#include "code\modules\vehicles\pimpin_ride.dm"

View File

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,6 @@ module.exports =
coffeeify: require "coffeeify"
componentify: require "ractive-componentify"
globify: require "require-globify"
strictify: require "strictify"
gulp: require("gulp-load-plugins")({replaceString: /^gulp(-|\.)|-/g})
postcss:
autoprefixer: require "autoprefixer"

View File

@@ -22,7 +22,6 @@ bundle = ->
.transform b.componentify
.transform b.aliasify
.transform b.globify
.transform b.strictify
.bundle (err, res) ->
return next err if err
file.contents = res

View File

Before

Width:  |  Height:  |  Size: 1013 B

After

Width:  |  Height:  |  Size: 1013 B

View File

@@ -1,5 +1,5 @@
{
"name": "nanoui",
"name": "tgui",
"private": true,
"dependencies": {
"aliasify": "^1.8.0",
@@ -40,7 +40,6 @@
"ractive-transitions-fade": "^0.3.1",
"require-globify": "^1.3.0",
"rfr": "^1.2.3",
"strictify": "^0.2.0",
"stylus": "^0.53.0",
"through2": "^2.0.0",
"webfontloader": "^1.6.16"

View File

@@ -3,7 +3,7 @@
"css":{
"dir":"styles/",
"main":"main.styl",
"out":"nanoui.css"
"out":"tgui.css"
},
"img":{
"dir":"images/",
@@ -12,6 +12,6 @@
"js":{
"dir":"scripts/",
"main":"main.coffee",
"out":"nanoui.js"
"out":"tgui.js"
}
}

View File

@@ -4,7 +4,7 @@ module.exports =
href: (params = {}, url = "") -> # Helper to generate a BYOND href given 'params' as an object (with an optional 'url' for eg winset).
params = (Object.keys(params).map (key) -> "#{encode(key)}=#{encode(params[key])}").join("&")
"byond://#{url}?#{params}"
act: (src, action, params = {}) -> # Helper to make a BYOND ui_act() call on the NanoUI 'src' given an 'action' and optional 'params'.
act: (src, action, params = {}) -> # Helper to make a BYOND ui_act() call on the UI 'src' given an 'action' and optional 'params'.
params.src = src
params.action = action
location.href = @href params

View File

@@ -8,7 +8,7 @@ component.exports =
if @get("enabled") && not @get "state" then true
else false
enabled: ->
if @get("config.status") is constants.NANO_INTERACTIVE then true
if @get("config.status") is constants.UI_INTERACTIVE then true
else false
styles: ->
enabled = @get "enabled"

Some files were not shown because too many files have changed in this diff Show More