mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-30 11:32:20 +00:00
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs. Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines. Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing. Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc. (Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
61 lines
2.2 KiB
Plaintext
61 lines
2.2 KiB
Plaintext
/datum/buildmode_mode/varedit
|
|
key = "edit"
|
|
// Varedit mode
|
|
var/varholder = null
|
|
var/valueholder = null
|
|
|
|
/datum/buildmode_mode/varedit/Destroy()
|
|
varholder = null
|
|
valueholder = null
|
|
return ..()
|
|
|
|
/datum/buildmode_mode/varedit/show_help(client/c)
|
|
to_chat(c, span_notice("***********************************************************"))
|
|
to_chat(c, span_notice("Right Mouse Button on buildmode button = Select var(type) & value"))
|
|
to_chat(c, span_notice("Left Mouse Button on turf/obj/mob = Set var(type) & value"))
|
|
to_chat(c, span_notice("Right Mouse Button on turf/obj/mob = Reset var's value"))
|
|
to_chat(c, span_notice("***********************************************************"))
|
|
|
|
/datum/buildmode_mode/varedit/Reset()
|
|
. = ..()
|
|
varholder = null
|
|
valueholder = null
|
|
|
|
/datum/buildmode_mode/varedit/change_settings(client/c)
|
|
varholder = input(c, "Enter variable name:" ,"Name", "name")
|
|
|
|
if(!vv_varname_lockcheck(varholder))
|
|
return
|
|
|
|
var/temp_value = c.vv_get_value()
|
|
if(isnull(temp_value["class"]))
|
|
Reset()
|
|
to_chat(c, span_notice("Variable unset."))
|
|
return
|
|
valueholder = temp_value["value"]
|
|
|
|
/datum/buildmode_mode/varedit/handle_click(client/c, params, obj/object)
|
|
var/list/modifiers = params2list(params)
|
|
|
|
if(isnull(varholder))
|
|
to_chat(c, span_warning("Choose a variable to modify first."))
|
|
return
|
|
if(LAZYACCESS(modifiers, LEFT_CLICK))
|
|
if(object.vars.Find(varholder))
|
|
if(object.vv_edit_var(varholder, valueholder) == FALSE)
|
|
to_chat(c, span_warning("Your edit was rejected by the object."))
|
|
return
|
|
log_admin("Build Mode: [key_name(c)] modified [object.name]'s [varholder] to [valueholder]")
|
|
else
|
|
to_chat(c, span_warning("[initial(object.name)] does not have a var called '[varholder]'"))
|
|
if(LAZYACCESS(modifiers, RIGHT_CLICK))
|
|
if(object.vars.Find(varholder))
|
|
var/reset_value = initial(object.vars[varholder])
|
|
if(object.vv_edit_var(varholder, reset_value) == FALSE)
|
|
to_chat(c, span_warning("Your edit was rejected by the object."))
|
|
return
|
|
log_admin("Build Mode: [key_name(c)] modified [object.name]'s [varholder] to [reset_value]")
|
|
else
|
|
to_chat(c, span_warning("[initial(object.name)] does not have a var called '[varholder]'"))
|
|
|