diff --git a/code/__DEFINES/configuration.dm b/code/__DEFINES/configuration.dm index ac5a8ce735..e9881677ba 100644 --- a/code/__DEFINES/configuration.dm +++ b/code/__DEFINES/configuration.dm @@ -1,6 +1,8 @@ //config files #define CONFIG_GET(X) global.config.Get(/datum/config_entry/##X) #define CONFIG_SET(X, Y) global.config.Set(/datum/config_entry/##X, ##Y) +/// Gets the datum of the object, for when editing a const define. +#define CONFIG_GET_ENTRY(X) global.config.GetEntryDatum(/datum/config_entry/##X) #define CONFIG_MAPS_FILE "maps.txt" diff --git a/code/controllers/configuration/configuration.dm b/code/controllers/configuration/configuration.dm index ebcf61b000..81f01219b8 100644 --- a/code/controllers/configuration/configuration.dm +++ b/code/controllers/configuration/configuration.dm @@ -112,7 +112,9 @@ var/list/lines = world.file2list("[directory]/[filename]") var/list/_entries = entries var/list/postload_required = list() + var/linenumber = 0 for(var/L in lines) + linenumber++ L = trim(L) if(!L) continue @@ -140,7 +142,7 @@ if(entry == "$include") if(!value) - log_config("Warning: Invalid $include directive: [value]") + log_config("LINE [linenumber]: Warning: Invalid $include directive: [value]") else LoadEntries(value, stack) ++. @@ -148,7 +150,7 @@ var/datum/config_entry/E = _entries[entry] if(!E) - log_config("Unknown setting in configuration: '[entry]'") + log_config("LINE [linenumber]: Unknown setting in configuration: '[entry]'") continue if(lockthis) @@ -158,7 +160,7 @@ var/datum/config_entry/new_ver = entries_by_type[E.deprecated_by] var/new_value = E.DeprecationUpdate(value) var/good_update = istext(new_value) - log_config("Entry [entry] is deprecated and will be removed soon. Migrate to [new_ver.name]![good_update ? " Suggested new value is: [new_value]" : ""]") + log_config("LINE [linenumber]: Entry [entry] is deprecated and will be removed soon. Migrate to [new_ver.name]![good_update ? " Suggested new value is: [new_value]" : ""]") if(!warned_deprecated_configs) DelayedMessageAdmins("This server is using deprecated configuration settings. Please check the logs and update accordingly.") warned_deprecated_configs = TRUE @@ -170,10 +172,10 @@ var/validated = E.ValidateAndSet(value) if(!validated) - log_config("Failed to validate setting \"[value]\" for [entry]") + log_config("LINE [linenumber]: Failed to validate setting \"[value]\" for [entry]") else if(E.modified && !E.dupes_allowed) - log_config("Duplicate setting for [entry] ([value], [E.resident_file]) detected! Using latest.") + log_config("LINE [linenumber]: Duplicate setting for [entry] ([value], [E.resident_file]) detected! Using latest.") if(E.postload_required) postload_required[E] = TRUE @@ -200,6 +202,20 @@ statclick = new/obj/effect/statclick/debug(null, "Edit", src) stat("[name]:", statclick) +/// Your typical GET but returns a config. +/datum/controller/configuration/proc/GetEntryDatum(entry_type) + var/datum/config_entry/E = entry_type + var/entry_is_abstract = initial(E.abstract_type) == entry_type + if(entry_is_abstract) + CRASH("Tried to retrieve an abstract config_entry: [entry_type]") + E = entries_by_type[entry_type] + if(!E) + CRASH("Missing config entry for [entry_type]!") + if((E.protection & CONFIG_ENTRY_HIDDEN) && IsAdminAdvancedProcCall() && GLOB.LastAdminCalledProc == "Get" && GLOB.LastAdminCalledTargetRef == "[REF(src)]") + log_admin_private("Config access of [entry_type] attempted by [key_name(usr)]") + return + return E + /datum/controller/configuration/proc/Get(entry_type) var/datum/config_entry/E = entry_type var/entry_is_abstract = initial(E.abstract_type) == entry_type diff --git a/code/game/objects/items/devices/radio/electropack.dm b/code/game/objects/items/devices/radio/electropack.dm index e65325587c..c51edc8106 100644 --- a/code/game/objects/items/devices/radio/electropack.dm +++ b/code/game/objects/items/devices/radio/electropack.dm @@ -16,9 +16,6 @@ var/on = TRUE var/shock_cooldown = FALSE - var/ui_x = 260 - var/ui_y = 137 - /obj/item/electropack/suicide_act(mob/living/carbon/user) user.visible_message("[user] hooks [user.p_them()]self to the electropack and spams the trigger! It looks like [user.p_theyre()] trying to commit suicide!") return (FIRELOSS) @@ -201,17 +198,7 @@ else return ..() -/obj/item/electropack/shockcollar/ui_interact(mob/user) //note to src: use tgooey - var/dat = {" - -Frequency/Code for shock collar:
-Frequency: -[format_frequency(src.frequency)] -Set
-Code: -[src.code] -Set
-
"} - user << browse(dat, "window=radio") - onclose(user, "radio") - return +/obj/item/electropack/ui_act(action, params) + if(action == "power") // DO. NOT. + return FALSE + return ..() diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index df38b1a908..bcb658eab8 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -12,10 +12,10 @@ /mob/living/carbon/human/movement_delay() . = ..() if(CHECK_MOBILITY(src, MOBILITY_STAND) && m_intent == MOVE_INTENT_RUN && (combat_flags & COMBAT_FLAG_SPRINT_ACTIVE)) - var/static/SSI + var/static/datum/config_entry/number/movedelay/sprint_speed_increase/SSI if(!SSI) - SSI = CONFIG_GET(number/movedelay/sprint_speed_increase) - . -= SSI //but WHY + SSI = CONFIG_GET_ENTRY(number/movedelay/sprint_speed_increase) + . -= SSI.config_entry_value if (m_intent == MOVE_INTENT_WALK && HAS_TRAIT(src, TRAIT_SPEEDY_STEP)) . -= 1.5