mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-12 07:35:31 +01:00
Fixed client side UI failure caused by apostrophes in text.
Updated the Chem Dispenser UI with an Energy bar. UIs attached to the Chem Dispenser will now update on recharge(), recharge now recharges 1 every 15 ticks instead of 2 every 30 (to make it feel more fluid).
This commit is contained in:
@@ -41,10 +41,15 @@ json_writer
|
||||
if(!i)
|
||||
break
|
||||
if(targ == "\n")
|
||||
txt = copytext(txt, 1, i) + "\\n" + copytext(txt, i+1)
|
||||
txt = copytext(txt, 1, i) + "\\n" + copytext(txt, i+2)
|
||||
start = i + 1 // 1 character added
|
||||
if(targ == "'")
|
||||
txt = copytext(txt, 1, i) + "`" + copytext(txt, i+1) // apostrophies fuck shit up...
|
||||
start = i + 1 // 1 character added
|
||||
else
|
||||
txt = copytext(txt, 1, i) + "\\" + copytext(txt, i)
|
||||
start = i + 2
|
||||
start = i + 2 // 2 characters added
|
||||
|
||||
return {""[txt]""}
|
||||
|
||||
is_associative(list/L)
|
||||
|
||||
@@ -139,11 +139,13 @@
|
||||
|
||||
var/template_data_json = "{}" // An empty JSON object
|
||||
if (templatel_data.len > 0)
|
||||
template_data_json = list2json(templatel_data)
|
||||
template_data_json = list2json(templatel_data)
|
||||
|
||||
var/initial_data_json = "{}" // An empty JSON object
|
||||
if (initial_data.len > 0)
|
||||
initial_data_json = list2json(initial_data)
|
||||
|
||||
//user << initial_data_json
|
||||
|
||||
var/url_parameters_json = list2json(list("src" = "\ref[src]"))
|
||||
|
||||
@@ -254,7 +256,7 @@
|
||||
return // Cannot update UI, no visibility
|
||||
|
||||
data = modify_data(data)
|
||||
|
||||
//user << list2json(data)
|
||||
user << output(list2params(list(list2json(data))),"[window_id].browser:receiveUpdateData")
|
||||
on_close_winset()
|
||||
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
|
||||
/obj/machinery/chem_dispenser/proc/recharge()
|
||||
if(stat & (BROKEN|NOPOWER)) return
|
||||
var/addenergy = 2
|
||||
var/addenergy = 1
|
||||
var/oldenergy = energy
|
||||
energy = min(energy + addenergy, max_energy)
|
||||
if(energy != oldenergy)
|
||||
use_power(3000) // This thing uses up alot of power (this is still low as shit for creating reagents from thin air)
|
||||
use_power(1500) // This thing uses up alot of power (this is still low as shit for creating reagents from thin air)
|
||||
nanomanager.update_uis(src) // update all UIs attached to src
|
||||
|
||||
/obj/machinery/chem_dispenser/power_change()
|
||||
if(powered())
|
||||
@@ -33,6 +34,7 @@
|
||||
else
|
||||
spawn(rand(0, 15))
|
||||
stat |= NOPOWER
|
||||
nanomanager.update_uis(src) // update all UIs attached to src
|
||||
|
||||
/obj/machinery/chem_dispenser/process()
|
||||
|
||||
@@ -73,6 +75,7 @@
|
||||
|
||||
data["amount"] = amount
|
||||
data["energy"] = energy
|
||||
data["maxEnergy"] = max_energy
|
||||
|
||||
data["isBeakerLoaded"] = beaker ? 1 : 0
|
||||
|
||||
@@ -103,7 +106,7 @@
|
||||
|
||||
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "chem_dispenser.tmpl", "Chem Dispenser 5000", 370, 585)
|
||||
ui = new(user, src, ui_key, "chem_dispenser.tmpl", "Chem Dispenser 5000", 370, 605)
|
||||
// When the UI is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
|
||||
Reference in New Issue
Block a user