mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2025-12-09 21:43:28 +00:00
woohoo let's go
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
/// Gets a VSC prop from a global controller of a name by path and stores it in <varset> variable.
|
||||
#define GET_VSC_PROP(controllerglobal, partialpath, varset) var/##varset = GLOB.controllerglobal.get_value(/datum/variable_setting_entry##partialpath)
|
||||
/// Like [GET_VSC_PROP] but caches the entry for faster access. In theory.
|
||||
#define CACHE_VSC_PROP(controllerglobal, partialpath, varset) \
|
||||
var/static/datum/variable_setting_entry##partialpath/__cachedatum_##varset; \
|
||||
if(QDELETED(__cachedatum_##varset)){ \
|
||||
__cachedatum_##varset = GLOB.controllerglobal.get_datum(/datum/variable_setting_entry##partialpath);} \
|
||||
var/##varset = __cachedatum_##varset.value
|
||||
|
||||
// Value types
|
||||
#define VSC_VALUE_NUMBER "number"
|
||||
#define VSC_VALUE_BOOLEAN "boolean"
|
||||
|
||||
@@ -596,9 +596,7 @@ proc/admin_notice(var/message, var/rights)
|
||||
<A href='?src=\ref[src];quick_create_object=1'>Quick Create Object</A><br>
|
||||
<A href='?src=\ref[src];create_turf=1'>Create Turf</A><br>
|
||||
<A href='?src=\ref[src];create_mob=1'>Create Mob</A><br>
|
||||
<br><A href='?src=\ref[src];vsc=airflow'>Edit Airflow Settings</A><br>
|
||||
<A href='?src=\ref[src];vsc=phoron'>Edit Phoron Settings</A><br>
|
||||
<A href='?src=\ref[src];vsc=default'>Choose a default ZAS setting</A><br>
|
||||
<br><A href='?src=\ref[src];atmos_vsc=1'>Modify Atmospherics Properties</A><br>
|
||||
"}
|
||||
|
||||
usr << browse(dat, "window=admin2;size=210x280")
|
||||
|
||||
@@ -1945,6 +1945,9 @@
|
||||
else
|
||||
error_viewer.show_to(owner, null, href_list["viewruntime_linear"])
|
||||
|
||||
else if(href_list["atmos_vsc"])
|
||||
GLOB.atmos_vsc.ui_interact(usr)
|
||||
|
||||
// player info stuff
|
||||
|
||||
if(href_list["add_player_info"])
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
GLOBAL_DATUM_INIT(atmos_vsc, /datum/variable_settings_controller/atmospherics, new)
|
||||
|
||||
/datum/variable_settings_controller/atmospherics
|
||||
name = "Atmospheric Properties Controller"
|
||||
initial_entries = list(
|
||||
/datum/variable_setting_entry/atmos/fire/consumption_rate = 0.25,
|
||||
/datum/variable_setting_entry/atmos/fire/firelevel_multiplier = 25,
|
||||
@@ -233,6 +234,7 @@ GLOBAL_DATUM_INIT(atmos_vsc, /datum/variable_settings_controller/atmospherics, n
|
||||
/datum/variable_setting_entry/atmos/connection/insulation
|
||||
name = "Insulation"
|
||||
desc = "Should things like doors forbid heat transfer?"
|
||||
value_type = VSC_VALUE_BOOLEAN
|
||||
|
||||
/datum/variable_setting_entry/atmos/connection/temperature_delta
|
||||
name = "Temperature Difference"
|
||||
@@ -248,10 +250,12 @@ GLOBAL_DATUM_INIT(atmos_vsc, /datum/variable_settings_controller/atmospherics, n
|
||||
/datum/variable_setting_entry/atmos/phoron/contamination
|
||||
name = "Cloth Contamination"
|
||||
desc = "If this is on, phoron does damage by getting into cloth."
|
||||
value_type = VSC_VALUE_BOOLEAN
|
||||
|
||||
/datum/variable_setting_entry/atmos/phoron/phoronguard_only
|
||||
name = "Phoronguard Only"
|
||||
desc = "If this is on, only biosuits and spacesuits and other PHORONGUARD flagged items can protect against contamination and ill effects."
|
||||
value_type = VSC_VALUE_BOOLEAN
|
||||
|
||||
/datum/variable_setting_entry/atmos/phoron/genetic_corruption
|
||||
name = "Genetic Corruption"
|
||||
|
||||
@@ -61,11 +61,9 @@
|
||||
|
||||
/datum/variable_settings_controller/proc/html_render(category = entries_by_category[1])
|
||||
. = list()
|
||||
. += "<h1>VSC Controls: [name]</h1><br>"
|
||||
. += "<h3>\[<a href='?src=[REF(src)];category=[category];preset=1'>SET PRESET</a>\]</h3><br>"
|
||||
. += "<h3>\[<a href='?src=[REF(src)];category=[category];reset=1'>RESET DEFAULT</a>\]</h3><br>"
|
||||
. += "<a href='?src=[REF(src)];category=[category];preset=1'>SET PRESET</a> <a href='?src=[REF(src)];category=[category];reset=1'>RESET DEFAULT</a><br>"
|
||||
for(var/cat in entries_by_category)
|
||||
. += "<span class='[(cat == category)? "linkOn" : "linkOff"]'><a href='?src=[REF(src)];category=[cat];refresh=1'>[cat]</a></span> "
|
||||
. += "<span class='[(cat == category)? "linkOn" : ""]'><a href='?src=[REF(src)];category=[cat];refresh=1'>[cat]</a></span> "
|
||||
. += "<hr>"
|
||||
for(var/datum/variable_setting_entry/E in entries_by_category[category])
|
||||
. += "<div class='statusDisplay'>[E.ui_html(src, category)]</div>"
|
||||
@@ -96,7 +94,7 @@
|
||||
if(announce == "Cancel")
|
||||
return
|
||||
else if(announce == "Yes")
|
||||
to_chat(world, "<span class='boldnotice'>[user?.client?.holder?.fakekey? "Administrator" : "user.key"] applied preset [input] to [src].</span>")
|
||||
to_chat(world, "<span class='boldnotice'>[user?.client?.holder?.fakekey? "Administrator" : user.key] applied preset [input] to [src].</span>")
|
||||
message_admins(logstr)
|
||||
log_admin(logstr)
|
||||
if(input == initial_preset_name)
|
||||
|
||||
@@ -12,10 +12,8 @@
|
||||
var/value
|
||||
/// Initial value
|
||||
var/initial_value
|
||||
/// VV class for the default implementation of prompt_value.
|
||||
var/value_vv_class
|
||||
/// Allow nulls?
|
||||
var/allow_null = FALSE
|
||||
/// Value type
|
||||
var/value_type = VSC_VALUE_NUMBER
|
||||
|
||||
/datum/variable_setting_entry/New(_value)
|
||||
if(!islist(_value))
|
||||
@@ -23,8 +21,6 @@
|
||||
else
|
||||
value = deepCopyList(_value)
|
||||
initial_value = deepCopyList(_value)
|
||||
if(initial_value && isnull(value_vv_class))
|
||||
value_vv_class = vv_get_class(initial_value)
|
||||
// we do not handle datums yet.
|
||||
|
||||
/datum/variable_setting_entry/proc/reset_to_default()
|
||||
@@ -36,23 +32,32 @@
|
||||
/datum/variable_setting_entry/proc/set_value(newvalue)
|
||||
value = newvalue
|
||||
|
||||
/datum/variable_setting_entry/proc/render_value()
|
||||
switch(value_type)
|
||||
if(VSC_VALUE_NUMBER)
|
||||
return value
|
||||
if(VSC_VALUE_BOOLEAN)
|
||||
return value? "On" : "Off"
|
||||
else
|
||||
return value
|
||||
|
||||
/datum/variable_setting_entry/proc/ui_html(datum/variable_settings_controller/host, category)
|
||||
. = list()
|
||||
. += "<h3>[name]</h3> - <b>\[<a href='?src=[REF(host)];target=[type];set=1;category=[category]'>SET</a>\]</b><br>"
|
||||
. += "<b>[name]</b><br><a href='?src=[REF(host)];target=[type];set=1;category=[category]'>Set</a> \[[render_value()]\]<br>"
|
||||
. += "[desc]"
|
||||
return jointext(., "")
|
||||
|
||||
#define CANCEL_VALUE "#################____######CANCEL" //heh
|
||||
/datum/variable_setting_entry/proc/prompt_value(mob/user)
|
||||
var/list/vv_return = user.client.vv_get_value(class = value_vv_class, current_value = value)
|
||||
. = vv_return["value"]
|
||||
if((.["class"] != VV_NULL) && isnull(.["value"]))
|
||||
return CANCEL_VALUE
|
||||
switch(value_type)
|
||||
if(VSC_VALUE_NUMBER)
|
||||
return input(user, "Input a number.", "Set Value", value) as num|null
|
||||
if(VSC_VALUE_BOOLEAN)
|
||||
return !value
|
||||
|
||||
/datum/variable_setting_entry/proc/OnTopic(href, href_list)
|
||||
if(href_list["set"])
|
||||
var/val = prompt_value(usr)
|
||||
if((isnull(val) && !allow_null) || (val == CANCEL_VALUE))
|
||||
if(isnull(val))
|
||||
return FALSE
|
||||
var/logstr = "[key_name(usr)] set [src]([type]) to [val]."
|
||||
message_admins(logstr)
|
||||
@@ -66,5 +71,3 @@
|
||||
reset_to_default()
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
#undef CANCEL_VALUE
|
||||
|
||||
Reference in New Issue
Block a user