TGUI Engineering: Squashed Edition (Commits Below)

TGUI APCs

 TGUI vending machines

 Fix AI default_tgui_interaction

 TGUI Airlocks

 Station & Atmospheric Alert TGUI + Misc NTOS-TGUI Fixes

 TGUI Air Alarms & Central Atmospheric Control

 Airlock TGUI

 TG... got rid of UI for fire alarm. í´·

 TGUI Gas Heating/Cooling System

 TGUI Gas Pump & Passive Gate + Fixes

 TGUI Omni Atmospherics

 TGUI Pipe Dispensers & RPD

 TGUI IntelliCore & Vending Fix

 TGUI Handheld Tanks

 TGUI Portable Pump & Scrubber

 TGUI Tank Dispenser & Canisters

 TGUI Radios

 TGUI SMES & Air Alarm adjustment

 Tweak vending machine interfaces a tad

 TGUI Algae Farm

 TGUI general_air_control

 - Distro & Waste Console
 - Riot Control Console
 - Atmos Intake Console
 - Engine Cooling Console

 TGUI Heavy Scrubber Control (and body scanner fix)

 TGUI trinary devices & shutoff monitor

 TGUI Telecomms Log Browser

 TGUI Telecomms Machine Browser

 TGUI Spaceheater Internal Panel

 TGUI Gravity Generator

 TGUI Id Cards & Fix ID Card Images

 TGUI Id Card Redesign

 TGUI Turbolift

 TGUI Suit Cycler & Suit Storage Unit & Vending Fixes

 TGUI Power Monitor

 TGUI Signalers

 TGUI Employment Records

 TGUI Drone Console

 TGUI RIGSuits

 TGUI PA & PACMAN, and Margin Fix

 TGUI Solar Panels & Fix Power Monitor

 Adjust TGUI modules & their interaction with NTOS

 TGUI RCON

 TGUI Message Monitor

 Bump TGUI line limit to 120 (ParadiseSS13/Paradise#14002)

 TGUI Exonet & NTNet Relay

 TGUI Telecomms Multitool Menu

 TGUI Shield Capacitor & Shield Generator

 TGUI Supermatter-everything & Refactors
This commit is contained in:
ShadowLarkens
2020-08-09 04:46:31 -07:00
parent f1a95c31f8
commit 951f37d2e3
222 changed files with 13749 additions and 9249 deletions
+171 -250
View File
@@ -1,8 +1,11 @@
#define PAINT_MODE -2
#define EATING_MODE -1
#define ATMOS_MODE 0
#define DISPOSALS_MODE 1
#define TRANSIT_MODE 2
#define ATMOS_CATEGORY 0
#define DISPOSALS_CATEGORY 1
#define TRANSIT_CATEGORY 2
#define BUILD_MODE (1<<0)
#define WRENCH_MODE (1<<1)
#define DESTROY_MODE (1<<2)
#define PAINT_MODE (1<<3)
/obj/item/weapon/pipe_dispenser
name = "Rapid Piping Device (RPD)"
@@ -22,18 +25,16 @@
w_class = ITEMSIZE_NORMAL
matter = list(MAT_STEEL = 50000, MAT_GLASS = 25000)
var/datum/effect/effect/system/spark_spread/spark_system
var/mode = ATMOS_MODE
var/p_dir = NORTH // Next pipe will be built with this dir
var/p_flipped = FALSE // If the next pipe should be built flipped
var/paint_color = "grey" // Pipe color index for next pipe painted/built.
var/screen = ATMOS_MODE // Starts on the atmos tab.
var/category = ATMOS_CATEGORY
var/piping_layer = PIPING_LAYER_DEFAULT
var/wrench_mode = FALSE
var/obj/item/weapon/tool/wrench/tool
var/datum/pipe_recipe/recipe // pipe recipie selected for display/construction
var/static/datum/pipe_recipe/first_atmos
var/static/datum/pipe_recipe/first_disposal
var/static/datum/asset/spritesheet/pipes/icon_assets
var/mode = BUILD_MODE | DESTROY_MODE | WRENCH_MODE
var/static/list/pipe_layers = list(
"Regular" = PIPING_LAYER_REGULAR,
"Supply" = PIPING_LAYER_SUPPLY,
@@ -51,10 +52,10 @@
/obj/item/weapon/pipe_dispenser/proc/SetupPipes()
if(!first_atmos)
first_atmos = atmos_pipe_recipes[atmos_pipe_recipes[1]][1]
first_atmos = GLOB.atmos_pipe_recipes[GLOB.atmos_pipe_recipes[1]][1]
recipe = first_atmos
if(!first_disposal)
first_disposal = disposal_pipe_recipes[disposal_pipe_recipes[1]][1]
first_disposal = GLOB.disposal_pipe_recipes[GLOB.disposal_pipe_recipes[1]][1]
/obj/item/weapon/pipe_dispenser/Destroy()
qdel_null(spark_system)
@@ -69,170 +70,97 @@
return(BRUTELOSS)
/obj/item/weapon/pipe_dispenser/attack_self(mob/user)
src.interact(user)
tgui_interact(user)
// TODO - Wouldn't it be nice to have nanoui?
/obj/item/weapon/pipe_dispenser/interact(mob/user)
/obj/item/weapon/pipe_dispenser/ui_assets(mob/user)
return list(
get_asset_datum(/datum/asset/spritesheet/pipes),
)
/obj/item/weapon/pipe_dispenser/tgui_interact(mob/user, datum/tgui/ui)
SetupPipes()
if(!icon_assets)
icon_assets = get_asset_datum(/datum/asset/spritesheet/pipes)
icon_assets.send(user)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "RapidPipeDispenser", name)
ui.open()
var/list/lines = list()
if(mode >= ATMOS_MODE)
lines += "<div class=\"block\"><h3>Direction:</h3><div class=\"item\">"
switch(recipe.dirtype)
/obj/item/weapon/pipe_dispenser/tgui_data(mob/user)
var/list/data = list(
"category" = category,
"piping_layer" = piping_layer,
"pipe_layers" = pipe_layers,
"preview_rows" = recipe.get_preview(p_dir),
"categories" = list(),
"selected_color" = paint_color,
"paint_colors" = pipe_colors,
"mode" = mode
)
if(PIPE_STRAIGHT) // Straight, N-S, W-E
lines += render_dir_img(recipe.icon_state,user,NORTH,"Vertical","&#8597;")
lines += render_dir_img(recipe.icon_state,user,EAST,"Horizontal","&harr;")
var/list/recipes
switch(category)
if(ATMOS_CATEGORY)
recipes = GLOB.atmos_pipe_recipes
if(DISPOSALS_CATEGORY)
recipes = GLOB.disposal_pipe_recipes
// if(TRANSIT_CATEGORY)
// recipes = transit_tube_recipes
for(var/c in recipes)
var/list/cat = recipes[c]
var/list/r = list()
for(var/i in 1 to cat.len)
var/datum/pipe_recipe/info = cat[i]
r += list(list("pipe_name" = info.name, "pipe_index" = i, "selected" = (info == recipe)))
data["categories"] += list(list("cat_name" = c, "recipes" = r))
if(PIPE_BENDABLE) // Bent, N-W, N-E etc
lines += render_dir_img(recipe.icon_state,user,NORTH,"Vertical","&#8597;")
lines += render_dir_img(recipe.icon_state,user,EAST,"Horizontal","&harr;")
lines += "<br />"
lines += render_dir_img(recipe.icon_state,user,NORTHWEST,"West to North","&#9565;")
lines += render_dir_img(recipe.icon_state,user,NORTHEAST,"North to East","&#9562;")
lines += render_dir_img(recipe.icon_state,user,SOUTHWEST,"South to West","&#9559;")
lines += render_dir_img(recipe.icon_state,user,SOUTHEAST,"East to South","&#9556;")
return data
if(PIPE_TRINARY) // Manifold
lines += render_dir_img(recipe.icon_state,user,NORTH,"West South East","&#9574;")
lines += render_dir_img(recipe.icon_state,user,EAST,"North West South","&#9571;")
lines += render_dir_img(recipe.icon_state,user,SOUTH,"East North West","&#9577;")
lines += render_dir_img(recipe.icon_state,user,WEST,"South East North","&#9568;")
if(PIPE_TRIN_M) // Mirrored ones
//each mirror icon is 45 anticlockwise from it's real direction
lines += render_dir_img(recipe.icon_state,user,NORTH,"West South East","&#9574;")
lines += render_dir_img(recipe.icon_state,user,EAST,"North West South","&#9571;")
lines += render_dir_img(recipe.icon_state,user,SOUTH,"East North West","&#9577;")
lines += render_dir_img(recipe.icon_state,user,WEST,"South East North","&#9568;")
lines += "<br />"
lines += render_dir_img(recipe.icon_state_m,user,SOUTH,"West South East","&#9574;", 1)
lines += render_dir_img(recipe.icon_state_m,user,WEST,"South East North","&#9568;", 1)
lines += render_dir_img(recipe.icon_state_m,user,NORTH,"East North West","&#9577;", 1)
lines += render_dir_img(recipe.icon_state_m,user,EAST,"North West South","&#9571;", 1)
if(PIPE_DIRECTIONAL) // Stuff with four directions - includes pumps etc.
lines += render_dir_img(recipe.icon_state,user,NORTH,"North","&uarr;")
lines += render_dir_img(recipe.icon_state,user,EAST,"East","&rarr;")
lines += render_dir_img(recipe.icon_state,user,SOUTH,"South","&darr;")
lines += render_dir_img(recipe.icon_state,user,WEST,"West","&larr;")
if(PIPE_ONEDIR) // Single icon_state (eg 4-way manifolds)
lines += render_dir_img(recipe.icon_state,user,SOUTH,"Pipe","&#8597;")
lines += "</div></div>"
if(mode == ATMOS_MODE || mode == PAINT_MODE)
lines += "<div class=\"block\"><h3>Color:</h3>"
var/i = 0
for(var/c in pipe_colors)
++i
lines += "<a class='[paint_color == c ? "linkOn" : ""]' href='?src=\ref[src];paint_color=[c]'>[c]</a>"
if(i == 4)
lines += "<br>"
i = 0
lines += "</div>"
lines += "<div class=\"block\"><h3>Mode:</h3>"
lines += "<a class='[mode >= ATMOS_MODE ? "linkOn" : ""]' href='?src=\ref[src];mode=[screen]'>Lay Pipes</a>"
lines += "<a class='[mode == EATING_MODE ? "linkOn" : ""]' href='?src=\ref[src];mode=[EATING_MODE]'>Eat Pipes</a>"
lines += "<a class='[mode == PAINT_MODE ? "linkOn" : ""]' href='?src=\ref[src];mode=[PAINT_MODE]'>Paint Pipes</a>"
lines += "</div>"
lines += "<div class=\"block\"><h3>Category:</h3>"
lines += "<a class='[screen == ATMOS_MODE ? "linkOn" : ""]' href='?src=\ref[src];screen=[ATMOS_MODE]'>Atmospherics</a>"
lines += "<a class='[screen == DISPOSALS_MODE ? "linkOn" : ""]' href='?src=\ref[src];screen=[DISPOSALS_MODE]'>Disposals</a>"
//lines += "<a class='[screen == TRANSIT_MODE ? "linkOn" : ""]' href='?src=\ref[src];screen=[TRANSIT_MODE]'>Transit Tube</a>"
lines += "<br><a class='[wrench_mode ? "linkOn" : ""]' href='?src=\ref[src];switch_wrench=1;wrench_mode=[!wrench_mode]'>Wrench Mode</a>"
lines += "</div>"
if(screen == ATMOS_MODE)
for(var/category in atmos_pipe_recipes)
lines += "<div class=\"block\"><h3>[category]:</h3>"
if(category == "Pipes")
lines += "<div class=\"item\">"
for(var/pipename in pipe_layers)
var/pipelayer = pipe_layers[pipename]
lines += "<a class='[piping_layer == pipelayer ? "linkOn" : "linkOff"]' href='?src=\ref[src];piping_layer=[pipelayer]'>[pipename]</a> "
lines += "</div>"
lines += "<hr>"
for(var/i in 1 to atmos_pipe_recipes[category].len)
var/datum/pipe_recipe/PI = atmos_pipe_recipes[category][i]
lines += "<div class=\"item\">"
lines += "<a class='[recipe == PI ? "linkOn" : ""]' href='?src=\ref[src]&category=[category]&pipe_type=[i]'>[PI.name]</a>"
lines += "</div>"
lines += "</div>"
else if(screen == DISPOSALS_MODE)
for(var/category in disposal_pipe_recipes)
lines += "<div class=\"block\"><h3>[category]:</h3>"
for(var/i in 1 to disposal_pipe_recipes[category].len)
var/datum/pipe_recipe/PI = disposal_pipe_recipes[category][i]
lines += "<div class=\"item\">"
lines += "<a class='[recipe == PI ? "linkOn" : ""]' href='?src=\ref[src]&category=[category]&pipe_type=[i]'>[PI.name]</a>"
lines += "</div>"
lines += "</div>"
var/dat = lines.Join()
var/datum/browser/popup = new(user, "rpd", name, 300, 800, src)
popup.set_content("<TT>[dat]</TT>")
popup.add_head_content(icon_assets.css_tag())
popup.open()
/obj/item/weapon/pipe_dispenser/Topic(href, href_list, state = global.inventory_state)
/obj/item/weapon/pipe_dispenser/tgui_act(action, params)
SetupPipes()
if(..())
return 1
return TRUE
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
return 1
var/playeffect = TRUE // Do we spark the device
var/anyclicked = FALSE // Tells us if we need to refresh the window.
if(href_list["paint_color"])
paint_color = href_list["paint_color"]
playeffect = FALSE
anyclicked = TRUE
if(href_list["mode"])
mode = text2num(href_list["mode"])
anyclicked = TRUE
if(href_list["screen"])
if(mode == screen)
mode = text2num(href_list["screen"])
screen = text2num(href_list["screen"])
switch(screen)
if(DISPOSALS_MODE)
recipe = first_disposal
if(ATMOS_MODE)
recipe = first_atmos
p_dir = NORTH
playeffect = FALSE
anyclicked = TRUE
if(href_list["piping_layer"])
piping_layer = text2num(href_list["piping_layer"])
playeffect = FALSE
anyclicked = TRUE
if(href_list["pipe_type"])
recipe = all_pipe_recipes[href_list["category"]][text2num(href_list["pipe_type"])]
if(recipe.dirtype == PIPE_ONEDIR) // One hell of a hack for the fact that the image previews for the onedir types only show on the south, but the default pipe type is north.
p_dir = SOUTH // Did I fuck this up? Maybe. Or maybe it's just the icon files not being ready for an RPD.
else // If going to try and fix this hack, be aware the pipe dispensers might rely on pipes defaulting south instead of north.
return TRUE
var/playeffect = TRUE
switch(action)
if("color")
paint_color = params["paint_color"]
if("category")
category = text2num(params["category"])
switch(category)
if(DISPOSALS_CATEGORY)
recipe = first_disposal
if(ATMOS_CATEGORY)
recipe = first_atmos
// if(TRANSIT_CATEGORY)
// recipe = first_transit
p_dir = NORTH
p_flipped = FALSE
anyclicked = TRUE
if(href_list["dir"])
p_dir = text2dir(href_list["dir"])
p_flipped = text2num(href_list["flipped"])
playeffect = FALSE
anyclicked = TRUE
if(href_list["switch_wrench"])
wrench_mode = text2num(href_list["wrench_mode"])
anyclicked = TRUE
if(anyclicked)
if(playeffect)
spark_system.start()
playsound(src, 'sound/effects/pop.ogg', 50, 0)
src.interact(usr)
playeffect = FALSE
if("piping_layer")
piping_layer = text2num(params["piping_layer"])
playeffect = FALSE
// if("ducting_layer")
// ducting_layer = text2num(params["ducting_layer"])
// playeffect = FALSE
if("pipe_type")
var/static/list/recipes
if(!recipes)
recipes = GLOB.disposal_pipe_recipes + GLOB.atmos_pipe_recipes
recipe = recipes[params["category"]][text2num(params["pipe_type"])]
p_dir = NORTH
if("setdir")
p_dir = text2dir(params["dir"])
p_flipped = text2num(params["flipped"])
playeffect = FALSE
if("mode")
var/n = text2num(params["mode"])
if(mode & n)
mode &= ~n
else
mode |= n
if(playeffect)
spark_system.start()
playsound(get_turf(src), 'sound/effects/pop.ogg', 50, FALSE)
return TRUE
/obj/item/weapon/pipe_dispenser/afterattack(atom/A, mob/user as mob, proximity)
if(!user.IsAdvancedToolUser() || istype(A, /turf/space/transit) || !proximity)
@@ -249,88 +177,89 @@
make_pipe_whitelist = typecacheof(list(/obj/structure/lattice, /obj/structure/girder, /obj/item/pipe))
var/can_make_pipe = (isturf(A) || is_type_in_typecache(A, make_pipe_whitelist))
. = FALSE
switch(mode) //if we've gotten this var, the target is valid
if(PAINT_MODE) //Paint pipes
if(!istype(A, /obj/machinery/atmospherics/pipe))
return ..()
var/can_destroy_pipe = istype(A, /obj/item/pipe) || istype(A, /obj/item/pipe_meter) || istype(A, /obj/structure/disposalconstruct)
. = TRUE
if((mode & DESTROY_MODE) && can_destroy_pipe)
to_chat(user, "<span class='notice'>You start destroying a pipe...</span>")
playsound(src, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 2, target = A))
activate()
animate_deletion(A)
return
if((mode & PAINT_MODE)) //Paint pipes
if(istype(A, /obj/machinery/atmospherics/pipe))
var/obj/machinery/atmospherics/pipe/P = A
playsound(src, 'sound/machines/click.ogg', 50, 1)
P.change_color(pipe_colors[paint_color])
user.visible_message("<span class='notice'>[user] paints \the [P] [paint_color].</span>", "<span class='notice'>You paint \the [P] [paint_color].</span>")
return
if(EATING_MODE) //Eating pipes
if(!(istype(A, /obj/item/pipe) || istype(A, /obj/item/pipe_meter) || istype(A, /obj/structure/disposalconstruct)))
return ..()
to_chat(user, "<span class='notice'>You start destroying a pipe...</span>")
playsound(src, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 2, target = A))
activate()
animate_deletion(A)
if(mode & BUILD_MODE) //Making pipes
switch(category)
if(ATMOS_CATEGORY)
if(!can_make_pipe)
return ..()
playsound(src, 'sound/machines/click.ogg', 50, 1)
if(istype(recipe, /datum/pipe_recipe/meter))
to_chat(user, "<span class='notice'>You start building a meter...</span>")
if(do_after(user, 2, target = A))
activate()
var/obj/item/pipe_meter/PM = new /obj/item/pipe_meter(get_turf(A))
PM.setAttachLayer(queued_piping_layer)
if(mode & WRENCH_MODE)
do_wrench(PM, user)
else if(istype(recipe, /datum/pipe_recipe/pipe))
var/datum/pipe_recipe/pipe/R = recipe
to_chat(user, "<span class='notice'>You start building a pipe...</span>")
if(do_after(user, 2, target = A))
activate()
var/obj/machinery/atmospherics/path = R.pipe_type
var/pipe_item_type = initial(path.construction_type) || /obj/item/pipe
var/obj/item/pipe/P = new pipe_item_type(get_turf(A), path, queued_p_dir)
if(ATMOS_MODE) //Making pipes
if(!can_make_pipe)
return ..()
playsound(src, 'sound/machines/click.ogg', 50, 1)
if (istype(recipe, /datum/pipe_recipe/meter))
to_chat(user, "<span class='notice'>You start building a meter...</span>")
if(do_after(user, 2, target = A))
activate()
var/obj/item/pipe_meter/PM = new /obj/item/pipe_meter(get_turf(A))
PM.setAttachLayer(queued_piping_layer)
if(wrench_mode)
do_wrench(PM, user)
else if(istype(recipe, /datum/pipe_recipe/pipe))
var/datum/pipe_recipe/pipe/R = recipe
to_chat(user, "<span class='notice'>You start building a pipe...</span>")
if(do_after(user, 2, target = A))
activate()
var/obj/machinery/atmospherics/path = R.pipe_type
var/pipe_item_type = initial(path.construction_type) || /obj/item/pipe
var/obj/item/pipe/P = new pipe_item_type(get_turf(A), path, queued_p_dir)
P.update()
P.add_fingerprint(usr)
if(R.paintable)
P.color = pipe_colors[paint_color]
P.setPipingLayer(queued_piping_layer)
if(queued_p_flipped)
P.do_a_flip()
if(mode & WRENCH_MODE)
do_wrench(P, user)
else
build_effect(P)
P.update()
P.add_fingerprint(usr)
if (R.paintable)
P.color = pipe_colors[paint_color]
P.setPipingLayer(queued_piping_layer)
if(queued_p_flipped)
P.do_a_flip()
if(wrench_mode)
do_wrench(P, user)
else
build_effect(P)
if(DISPOSALS_MODE) //Making disposals pipes
var/datum/pipe_recipe/disposal/R = recipe
if(!istype(R) || !can_make_pipe)
return ..()
A = get_turf(A)
if(istype(A, /turf/unsimulated))
to_chat(user, "<span class='warning'>[src]'s error light flickers; there's something in the way!</span>")
return
to_chat(user, "<span class='notice'>You start building a disposals pipe...</span>")
playsound(src, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 4, target = A))
var/obj/structure/disposalconstruct/C = new(A, R.pipe_type, queued_p_dir, queued_p_flipped, R.subtype)
if(!C.can_place())
to_chat(user, "<span class='warning'>There's not enough room to build that here!</span>")
qdel(C)
if(DISPOSALS_CATEGORY) //Making disposals pipes
var/datum/pipe_recipe/disposal/R = recipe
if(!istype(R) || !can_make_pipe)
return ..()
A = get_turf(A)
if(istype(A, /turf/unsimulated))
to_chat(user, "<span class='warning'>[src]'s error light flickers; there's something in the way!</span>")
return
to_chat(user, "<span class='notice'>You start building a disposals pipe...</span>")
playsound(src, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 4, target = A))
var/obj/structure/disposalconstruct/C = new(A, R.pipe_type, queued_p_dir, queued_p_flipped, R.subtype)
activate()
if(!C.can_place())
to_chat(user, "<span class='warning'>There's not enough room to build that here!</span>")
qdel(C)
return
C.add_fingerprint(usr)
C.update_icon()
if(wrench_mode)
do_wrench(C, user)
else
build_effect(C)
activate()
else
return ..()
C.add_fingerprint(usr)
C.update_icon()
if(mode & WRENCH_MODE)
do_wrench(C, user)
else
build_effect(C)
else
return ..()
/obj/item/weapon/pipe_dispenser/proc/build_effect(var/obj/P, var/time = 1.5)
set waitfor = FALSE
@@ -359,19 +288,11 @@
if(!resolved && tool && target)
tool.afterattack(target,user,1)
/obj/item/weapon/pipe_dispenser/proc/render_dir_img(icon_state, user, _dir, title, noimg, flipped = FALSE)
var/dirtext = dir2text(_dir)
var/attrs = " style=\"height:34px;width:34px;display:inline-block\""
if(_dir == p_dir && flipped == p_flipped)
attrs += " class=\"linkOn\""
if(icon_state)
var/img_tag = icon_assets.icon_tag("[dirtext]-[icon_state]")
return "<a href=\"?src=\ref[src];dir=[dirtext];flipped=[flipped]\" title=\"[title]\"[attrs]>[img_tag]</a>"
else
return "<a href=\"?src=\ref[src];dir=[dirtext];flipped=[flipped]\" title=\"[title]\"[attrs]>[noimg]</a>"
#undef ATMOS_CATEGORY
#undef DISPOSALS_CATEGORY
#undef TRANSIT_CATEGORY
#undef PAINT_MODE
#undef EATING_MODE
#undef ATMOS_MODE
#undef DISPOSALS_MODE
#undef BUILD_MODE
#undef WRENCH_MODE
#undef DESTROY_MODE
#undef PAINT_MODE
@@ -17,8 +17,7 @@
var/dna_hash = "\[UNSET\]"
var/fingerprint_hash = "\[UNSET\]"
var/sex = "\[UNSET\]"
var/icon/front
var/icon/side
var/front
var/primary_color = rgb(0,0,0) // Obtained by eyedroppering the stripe in the middle of the card
var/secondary_color = rgb(0,0,0) // Likewise for the oval in the top-left corner
@@ -34,30 +33,27 @@
/obj/item/weapon/card/id/examine(mob/user)
. = ..()
if(in_range(user, src))
show(user) //Not chat related
tgui_interact(user) //Not chat related
else
. += "<span class='warning'>It is too far away to read.</span>"
/obj/item/weapon/card/id/proc/prevent_tracking()
return 0
/obj/item/weapon/card/id/proc/show(mob/user as mob)
if(front && side)
user << browse_rsc(front, "front.png")
user << browse_rsc(side, "side.png")
var/datum/browser/popup = new(user, "idcard", name, 600, 250)
popup.set_content(dat())
popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
return
/obj/item/weapon/card/id/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "IDCard", name)
ui.open()
/obj/item/weapon/card/id/proc/update_name()
name = "[src.registered_name]'s ID Card ([src.assignment])"
/obj/item/weapon/card/id/proc/set_id_photo(var/mob/M)
var/icon/charicon = cached_character_icon(M)
front = icon(charicon,dir = SOUTH)
side = icon(charicon,dir = WEST)
COMPILE_OVERLAYS(M)
SSoverlays.queue -= M
var/icon/F = getFlatIcon(M, defdir = SOUTH, no_anim = TRUE)
front = "'data:image/png;base64,[icon2base64(F)]'"
/mob/proc/set_id_info(var/obj/item/weapon/card/id/id_card)
id_card.age = 0
@@ -75,19 +71,19 @@
..()
id_card.age = age
/obj/item/weapon/card/id/proc/dat()
var/dat = ("<table><tr><td>")
dat += text("Name: []</A><BR>", registered_name)
dat += text("Sex: []</A><BR>\n", sex)
dat += text("Age: []</A><BR>\n", age)
dat += text("Rank: []</A><BR>\n", assignment)
dat += text("Fingerprint: []</A><BR>\n", fingerprint_hash)
dat += text("Blood Type: []<BR>\n", blood_type)
dat += text("DNA Hash: []<BR><BR>\n", dna_hash)
if(front && side)
dat +="<td align = center valign = top>Photo:<br><img src=front.png height=80 width=80 border=4><img src=side.png height=80 width=80 border=4></td>"
dat += "</tr></table>"
return dat
/obj/item/weapon/card/id/tgui_data(mob/user)
var/list/data = list()
data["registered_name"] = registered_name
data["sex"] = sex
data["age"] = age
data["assignment"] = assignment
data["fingerprint_hash"] = fingerprint_hash
data["blood_type"] = blood_type
data["dna_hash"] = dna_hash
data["photo_front"] = front
return data
/obj/item/weapon/card/id/attack_self(mob/user as mob)
user.visible_message("\The [user] shows you: [bicon(src)] [src.name]. The assignment on the card: [src.assignment]",\
+51 -68
View File
@@ -1,5 +1,5 @@
#define TANK_MAX_RELEASE_PRESSURE (3*ONE_ATMOSPHERE)
#define TANK_DEFAULT_RELEASE_PRESSURE 24
#define TANK_DEFAULT_RELEASE_PRESSURE 21
#define TANK_IDEAL_PRESSURE 1015 //Arbitrary.
var/list/global/tank_gauge_cache = list()
@@ -217,90 +217,73 @@ var/list/global/tank_gauge_cache = list()
add_fingerprint(user)
if (!(src.air_contents))
return
ui_interact(user)
tgui_interact(user)
// There's GOT to be a better way to do this
if (src.proxyassembly.assembly)
src.proxyassembly.assembly.attack_self(user)
/obj/item/weapon/tank/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/mob/living/carbon/location = null
/obj/item/weapon/tank/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Tank", name)
ui.open()
if(istype(loc, /obj/item/weapon/rig)) // check for tanks in rigs
if(istype(loc.loc, /mob/living/carbon))
location = loc.loc
else if(istype(loc, /mob/living/carbon))
location = loc
var/using_internal
if(istype(location))
if(location.internal==src)
using_internal = 1
// this is the data which will be sent to the ui
var/data[0]
/obj/item/weapon/tank/tgui_data(mob/user)
var/list/data = list()
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
data["minReleasePressure"] = 0
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
data["valveOpen"] = using_internal ? 1 : 0
data["maskConnected"] = 0
if(istype(location))
var/mask_check = 0
var/mob/living/carbon/C = user
if(!istype(C))
C = loc.loc
if(!istype(C))
return data
if(location.internal == src) // if tank is current internal
mask_check = 1
else if(src in location) // or if tank is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
else if(istype(src.loc, /obj/item/weapon/rig) && src.loc in location) // or the rig is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
if(C.internal == src)
data["connected"] = TRUE
else
data["connected"] = FALSE
if(mask_check)
if(location.wear_mask && (location.wear_mask.item_flags & AIRTIGHT))
data["maskConnected"] = 1
else if(istype(location, /mob/living/carbon/human))
var/mob/living/carbon/human/H = location
if(H.head && (H.head.item_flags & AIRTIGHT))
data["maskConnected"] = 1
data["maskConnected"] = FALSE
if(C.wear_mask && (C.wear_mask.item_flags & AIRTIGHT))
data["maskConnected"] = TRUE
else if(ishuman(C))
var/mob/living/carbon/human/H = C
if(H.head && (H.head.item_flags & AIRTIGHT))
data["maskConnected"] = TRUE
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "tanks.tmpl", "Tank", 500, 300)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(1)
return data
/obj/item/weapon/tank/Topic(href, href_list)
..()
if (usr.stat|| usr.restrained())
return 0
if (src.loc != usr)
return 0
/obj/item/weapon/tank/tgui_act(action, params)
if(..())
return TRUE
switch(action)
if("pressure")
var/pressure = params["pressure"]
if(pressure == "reset")
pressure = TANK_DEFAULT_RELEASE_PRESSURE
. = TRUE
else if(pressure == "min")
pressure = 0
. = TRUE
else if(pressure == "max")
pressure = TANK_MAX_RELEASE_PRESSURE
. = TRUE
else if(text2num(pressure) != null)
pressure = text2num(pressure)
. = TRUE
if(.)
distribute_pressure = clamp(round(pressure), 0, TANK_MAX_RELEASE_PRESSURE)
if("toggle")
toggle_valve(usr)
. = TRUE
if (href_list["dist_p"])
if (href_list["dist_p"] == "reset")
src.distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
else if (href_list["dist_p"] == "max")
src.distribute_pressure = TANK_MAX_RELEASE_PRESSURE
else
var/cp = text2num(href_list["dist_p"])
src.distribute_pressure += cp
src.distribute_pressure = min(max(round(src.distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
if (href_list["stat"])
toggle_valve(usr)
src.add_fingerprint(usr)
return 1
add_fingerprint(usr)
/obj/item/weapon/tank/proc/toggle_valve(var/mob/user)
if(istype(loc,/mob/living/carbon))