mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
Wraps lowertext() to ensure proper stringification. (#82442)
## About The Pull Request Fixes #82440 This PR just creates a new macro, `LOWER_TEXT()` (yes the irony is not lost on me) to wrap around all calls of `lowertext()` and ensure that whatever we input into that proc will be stringified using the `"[]"` (or `tostring()` for the nerds) operator. very simple. I also added a linter to enforce this (and prevent all forms of regression) because I think that machines should do the menial work and we shouldn't expect maintainers to remember this, let me know if you disagree. if there is a time when it should be opted out for some reason, the linter does respect it if you wrap your input with the `UNLINT()` function.
This commit is contained in:
@@ -89,4 +89,4 @@
|
||||
for(var/ref in granted_to)
|
||||
var/datum/action/granted_action = granted_to[ref]
|
||||
granted_action.name = button_name.value || "Action"
|
||||
granted_action.button_icon_state = "bci_[replacetextEx(lowertext(icon_options.value), " ", "_")]"
|
||||
granted_action.button_icon_state = "bci_[replacetextEx(LOWER_TEXT(icon_options.value), " ", "_")]"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
var/result
|
||||
switch(textcase_options.value)
|
||||
if(COMP_TEXT_LOWER)
|
||||
result = lowertext(value)
|
||||
result = LOWER_TEXT(value)
|
||||
if(COMP_TEXT_UPPER)
|
||||
result = uppertext(value)
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
/obj/item/circuit_component/Initialize(mapload)
|
||||
. = ..()
|
||||
if(name == COMPONENT_DEFAULT_NAME)
|
||||
name = "[lowertext(display_name)] [COMPONENT_DEFAULT_NAME]"
|
||||
name = "[LOWER_TEXT(display_name)] [COMPONENT_DEFAULT_NAME]"
|
||||
populate_options()
|
||||
populate_ports()
|
||||
if((circuit_flags & CIRCUIT_FLAG_INPUT_SIGNAL) && !trigger_input)
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
action_comp.granted_to[REF(user)] = src
|
||||
circuit_component = action_comp
|
||||
name = action_comp.button_name.value
|
||||
button_icon_state = "bci_[replacetextEx(lowertext(action_comp.icon_options.value), " ", "_")]"
|
||||
button_icon_state = "bci_[replacetextEx(LOWER_TEXT(action_comp.icon_options.value), " ", "_")]"
|
||||
|
||||
/datum/action/item_action/mod/pinnable/circuit/Destroy()
|
||||
circuit_component.granted_to -= REF(pinner)
|
||||
|
||||
Reference in New Issue
Block a user