mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
Make NanoUI resistant to Topic spoofs
Move Topic() into a NanoUI-specific ui_act proc Update to @YotaXP's latest JSON code. Return focus to the mapwindow if a key is pressed in a NanoUI.
This commit is contained in:
@@ -149,22 +149,21 @@ Passive gate is similar to the regular pump except:
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/Topic(href, href_list)
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(href_list["nano"])
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if("pressure")
|
||||
switch(href_list["set"])
|
||||
switch(params["set"])
|
||||
if ("max")
|
||||
target_pressure = MAX_OUTPUT_PRESSURE
|
||||
if ("custom")
|
||||
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa)", target_pressure)))
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -157,22 +157,21 @@ Thus, the two variables affect pump operation are set in New():
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/pump/Topic(href,href_list)
|
||||
/obj/machinery/atmospherics/components/binary/pump/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(href_list["nano"])
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if("pressure")
|
||||
switch(href_list["set"])
|
||||
switch(params["set"])
|
||||
if ("max")
|
||||
target_pressure = MAX_OUTPUT_PRESSURE
|
||||
if ("custom")
|
||||
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa)", target_pressure)))
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -155,22 +155,21 @@ Thus, the two variables affect pump operation are set in New():
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/Topic(href,href_list)
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(href_list["nano"])
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if("transfer")
|
||||
switch(href_list["set"])
|
||||
switch(params)
|
||||
if ("max")
|
||||
transfer_rate = MAX_TRANSFER_RATE
|
||||
if ("custom")
|
||||
transfer_rate = max(0, min(MAX_TRANSFER_RATE, safe_input("Pressure control", "Enter new transfer rate (0-[MAX_TRANSFER_RATE] L/s)", transfer_rate)))
|
||||
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", "atmos")
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -137,10 +137,6 @@ Pipenet stuff; housekeeping
|
||||
T.assume_air(to_release)
|
||||
air_update_turf(1)
|
||||
|
||||
/*
|
||||
I think this is NanoUI?
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/safe_input(var/title, var/text, var/default_set)
|
||||
var/new_value = input(usr,text,title,default_set) as num
|
||||
if(usr.canUseTopic(src))
|
||||
|
||||
@@ -182,23 +182,23 @@ Filter types:
|
||||
data["filter_type"] = filter_type
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/filter/Topic(href, href_list)
|
||||
/obj/machinery/atmospherics/components/trinary/filter/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(href_list["nano"])
|
||||
switch(action)
|
||||
if("power")
|
||||
on=!on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if("pressure")
|
||||
switch(href_list["set"])
|
||||
switch(params["set"])
|
||||
if("max")
|
||||
target_pressure = MAX_OUTPUT_PRESSURE
|
||||
if("custom")
|
||||
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa):", target_pressure)))
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
if("filter")
|
||||
src.filter_type = text2num(href_list["mode"])
|
||||
src.filter_type = text2num(params["mode"])
|
||||
var/filtering_name = "nothing"
|
||||
switch(filter_type)
|
||||
if(FILTER_PLASMA)
|
||||
@@ -212,6 +212,5 @@ Filter types:
|
||||
if(FILTER_NITROUSOXIDE)
|
||||
filtering_name = "nitrous oxide"
|
||||
investigate_log("was set to filter [filtering_name] by [key_name(usr)]", "atmos")
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
@@ -147,31 +147,30 @@
|
||||
data["node2_concentration"] = round(node2_concentration*100)
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/Topic(href,href_list)
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(href_list["nano"])
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
|
||||
if("pressure")
|
||||
switch(href_list["set"])
|
||||
switch(params["set"])
|
||||
if("max")
|
||||
target_pressure = MAX_OUTPUT_PRESSURE
|
||||
if("custom")
|
||||
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa):", target_pressure)))
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
if("node1")
|
||||
var/value = text2num(href_list["concentration"])
|
||||
var/value = text2num(params["concentration"])
|
||||
src.node1_concentration = max(0, min(1, src.node1_concentration + value))
|
||||
src.node2_concentration = max(0, min(1, src.node2_concentration - value))
|
||||
investigate_log("was set to [node1_concentration] % on node 1 by [key_name(usr)]", "atmos")
|
||||
if("node2")
|
||||
var/value = text2num(href_list["concentration"])
|
||||
var/value = text2num(params["concentration"])
|
||||
src.node2_concentration = max(0, min(1, src.node2_concentration + value))
|
||||
src.node1_concentration = max(0, min(1, src.node1_concentration - value))
|
||||
investigate_log("was set to [node2_concentration] % on node 2 by [key_name(usr)]", "atmos")
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
return 1
|
||||
@@ -166,11 +166,11 @@
|
||||
data["beakerContents"] = beakerContents
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/Topic(href, href_list)
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(href_list["nano"])
|
||||
switch(action)
|
||||
if("open")
|
||||
open_machine()
|
||||
if("close")
|
||||
@@ -186,7 +186,6 @@
|
||||
if(beaker)
|
||||
beaker.loc = get_step(loc, SOUTH)
|
||||
beaker = null
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user