mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
A bunch of nano UI fixes + new Chem Dispenser UI!
This commit is contained in:
+44
-25
@@ -5,7 +5,7 @@
|
||||
density = 1
|
||||
anchored = 1.0
|
||||
layer = 2.8
|
||||
|
||||
|
||||
var/on = 0
|
||||
var/temperature_archived
|
||||
var/mob/living/carbon/occupant = null
|
||||
@@ -13,8 +13,6 @@
|
||||
|
||||
var/current_heat_capacity = 50
|
||||
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
@@ -65,17 +63,22 @@
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main")
|
||||
|
||||
|
||||
if(user == occupant || user.stat)
|
||||
return
|
||||
|
||||
var/data[0]
|
||||
data["isOperating"] = on
|
||||
|
||||
data["hasOccupant"] = occupant ? 1 : 0
|
||||
|
||||
|
||||
var/occupantData[0]
|
||||
if (!occupant)
|
||||
occupantData["name"] = null
|
||||
occupantData["stat"] = null
|
||||
occupantData["health"] = null
|
||||
occupantData["maxHealth"] = null
|
||||
occupantData["minHealth"] = null
|
||||
occupantData["bruteLoss"] = null
|
||||
occupantData["oxyLoss"] = null
|
||||
occupantData["toxLoss"] = null
|
||||
@@ -84,12 +87,14 @@
|
||||
else
|
||||
occupantData["name"] = occupant.name
|
||||
occupantData["stat"] = occupant.stat
|
||||
occupantData["health"] = round(occupant.health)
|
||||
occupantData["bruteLoss"] = round(occupant.getBruteLoss())
|
||||
occupantData["oxyLoss"] = round(occupant.getOxyLoss())
|
||||
occupantData["toxLoss"] = round(occupant.getToxLoss())
|
||||
occupantData["fireLoss"] = round(occupant.getFireLoss())
|
||||
occupantData["bodyTemperature"] = round(occupant.bodytemperature)
|
||||
occupantData["health"] = occupant.health
|
||||
occupantData["maxHealth"] = occupant.maxHealth
|
||||
occupantData["minHealth"] = config.health_threshold_dead
|
||||
occupantData["bruteLoss"] = occupant.getBruteLoss()
|
||||
occupantData["oxyLoss"] = occupant.getOxyLoss()
|
||||
occupantData["toxLoss"] = occupant.getToxLoss()
|
||||
occupantData["fireLoss"] = occupant.getFireLoss()
|
||||
occupantData["bodyTemperature"] = occupant.bodytemperature
|
||||
data["occupant"] = occupantData;
|
||||
|
||||
data["cellTemperature"] = round(air_contents.temperature)
|
||||
@@ -103,9 +108,9 @@
|
||||
var beakerContents[0]
|
||||
if(beaker && beaker:reagents && beaker:reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in beaker:reagents.reagent_list)
|
||||
beakerContents.Add(list(list("name" = R.name, "volume" = R.volume))) // list in a list because Byond merges the first list...
|
||||
beakerContents.Add(list(list("name" = R.name, "volume" = R.volume))) // list in a list because Byond merges the first list...
|
||||
data["beakerContents"] = beakerContents
|
||||
|
||||
|
||||
//user << list2json(data)
|
||||
|
||||
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key)
|
||||
@@ -123,19 +128,33 @@
|
||||
//user.set_machine(src)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/Topic(href, href_list)
|
||||
if ((get_dist(src, usr) <= 1) || istype(usr, /mob/living/silicon/ai))
|
||||
if(href_list["start"])
|
||||
on = !on
|
||||
update_icon()
|
||||
if(href_list["eject"])
|
||||
if (beaker)
|
||||
var/obj/item/weapon/reagent_containers/glass/B = beaker
|
||||
B.loc = get_step(loc, SOUTH)
|
||||
beaker = null
|
||||
if(usr == occupant)
|
||||
return 0 // don't update UIs attached to this object
|
||||
|
||||
nanomanager.update_uis(src) // update all UIs attached to this object
|
||||
add_fingerprint(usr)
|
||||
return
|
||||
if(..())
|
||||
return 0 // don't update UIs attached to this object
|
||||
|
||||
if(href_list["switchOn"])
|
||||
on = 1
|
||||
update_icon()
|
||||
|
||||
if(href_list["switchOff"])
|
||||
on = 0
|
||||
update_icon()
|
||||
|
||||
if(href_list["ejectBeaker"])
|
||||
if(beaker)
|
||||
var/obj/item/weapon/reagent_containers/glass/B = beaker
|
||||
B.loc = get_step(loc, SOUTH)
|
||||
beaker = null
|
||||
|
||||
if(href_list["ejectOccupant"])
|
||||
if(!occupant || isslime(usr) || ispAI(usr))
|
||||
return 0 // don't update UIs attached to this object
|
||||
go_out()
|
||||
|
||||
add_fingerprint(usr)
|
||||
return 1 // update UIs attached to this object
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/attackby(var/obj/item/weapon/G as obj, var/mob/user as mob)
|
||||
if(istype(G, /obj/item/weapon/reagent_containers/glass))
|
||||
|
||||
Reference in New Issue
Block a user