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:
Bjorn Neergaard
2015-12-15 22:37:52 -06:00
parent 070a081db8
commit da4842dddf
29 changed files with 354 additions and 168 deletions
@@ -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