Skip to content

Commit e9084e3

Browse files
authored
Interaction component fixes + improvements (#6030)
## About The Pull Request Fixes #4569 I refactored and improved interaction component code quite a bit, with the goal of preventing further bugs/exploits, and making them more reliable overall. I've added config options in case further exploits pop up, to help prevent the exploit without code-side disabling, until its properly fixed: ``` ## Uncomment to prevent mechcomp interaction components from holding items. #DISABLE_MECHCOMP_INTERACTION_ITEMS ## Uncomment to prevent mechcomp interaction components from using storage. #DISABLE_MECHCOMP_INTERACTION_STORAGE ## Additional typepaths to prevent mechcomp interaction components from interacting with. #BLACKLIST_MECHCOMP_INTERACTION /obj/item/doohickey #BLACKLIST_MECHCOMP_INTERACTION /obj/item/thingymajig ``` also added some (currently unused) precursor code for a future refactor of regex find/replace components <details> <summary><h3>Proof of Testing</h3></summary> ![2025-03-24 (1742841779) ~ dreamseeker](https://github.com/user-attachments/assets/9a3c9940-0f29-4535-8cb1-f571f918c360) ![2025-03-24 (1742841790) ~ dreamseeker](https://github.com/user-attachments/assets/5fbe2704-5846-4cfe-8db9-678f9fa6ed83) </details> ## Why It's Good For The Game i want my funny interaction components back ## Changelog :cl: add: Re-added interaction components to the mechcomp vendor. fix: Fixed some further potential exploits with interaction components. code: Cleaned up a lot of interaction component code. map: Added a mechcomp vendor to runtimestation. config: Added config options to disable interaction components holding items or interacting with storage components. config: Added a config option to add more item types to the interaction component blacklist. /:cl:
1 parent 0d49ca7 commit e9084e3

File tree

12 files changed

+303
-87
lines changed

12 files changed

+303
-87
lines changed

_maps/map_files/debug/runtimestation.dmm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,11 @@
959959
"dV" = (
960960
/turf/open/floor/plating,
961961
/area/station/hallway/secondary/entry)
962+
"dW" = (
963+
/obj/effect/turf_decal/stripes/line,
964+
/obj/machinery/vending/mechcomp,
965+
/turf/open/floor/iron,
966+
/area/station/commons/storage/primary)
962967
"dY" = (
963968
/turf/closed/wall/r_wall,
964969
/area/station/hallway/secondary/entry)
@@ -8318,7 +8323,7 @@ Ut
83188323
cm
83198324
cK
83208325
by
8321-
dB
8326+
dW
83228327
dx
83238328
dl
83248329
dl

code/__DEFINES/traits/monkestation/declarations.dm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,11 @@
127127
#define TRAIT_GIFT_ITEM "gift_item"
128128
/// The mob can see pathogen clouds and such.
129129
#define TRAIT_VIRUS_SCANNER "virus_scanner"
130-
///This item always renders. (only used for stupid magboots rn)
130+
/// This item always renders. (only used for stupid magboots rn)
131131
#define TRAIT_ALWAYS_RENDER "always_render"
132+
/// Prevents mechcomp interaction components from interacting with this object.
133+
#define TRAIT_MECHCOMP_INTERACTION_BANNED "mechcomp_interaction_banned"
134+
132135
// /atom/movable
133136
/// Things with this trait can pass through wooden barricades.
134137
#define TRAIT_GOES_THROUGH_WOODEN_BARRICADES "goes_through_wooden_barricades"

code/_globalvars/traits/_traits.dm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
642642
"TRAIT_LABOURED_BREATHING" = TRAIT_LABOURED_BREATHING,
643643
"TRAIT_MAT_TRANSMUTED" = TRAIT_MAT_TRANSMUTED,
644644
"TRAIT_MAY_CONTAIN_BLENDED_DUST" = TRAIT_MAY_CONTAIN_BLENDED_DUST,
645+
"TRAIT_MECHCOMP_INTERACTION_BANNED" = TRAIT_MECHCOMP_INTERACTION_BANNED,
645646
"TRAIT_NEEDS_TWO_HANDS" = TRAIT_NEEDS_TWO_HANDS,
646647
"TRAIT_NODROP" = TRAIT_NODROP,
647648
"TRAIT_NO_WORN_ICON" = TRAIT_NO_WORN_ICON,
@@ -658,6 +659,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
658659
"TRAIT_T_RAY_VISIBLE" = TRAIT_T_RAY_VISIBLE,
659660
"TRAIT_UNCATCHABLE" = TRAIT_UNCATCHABLE,
660661
"TRAIT_WIELDED" = TRAIT_WIELDED,
662+
"TRAIT_MECHCOMP_INTERACTION_BANNED" = TRAIT_MECHCOMP_INTERACTION_BANNED,
661663
/* "TRAIT_BAIT_UNCONSUMABLE" = TRAIT_BAIT_UNCONSUMABLE, */
662664
/* "TRAIT_BAKEABLE" = TRAIT_BAKEABLE, */
663665
/* "TRAIT_BYPASS_RANGED_ARMOR" = TRAIT_BYPASS_RANGED_ARMOR, */

code/controllers/configuration/entries/monkestation.dm

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,27 @@
4545

4646
/datum/config_entry/flag/disable_storyteller
4747

48+
/datum/config_entry/flag/disable_mechcomp_interaction_items
49+
50+
/datum/config_entry/flag/disable_mechcomp_interaction_storage
51+
52+
/datum/config_entry/str_list/blacklist_mechcomp_interaction
53+
54+
/datum/config_entry/str_list/blacklist_mechcomp_interaction/ValidateAndSet(str_val)
55+
. = ..()
56+
if(!.)
57+
return
58+
var/list/config_entry_value = src.config_entry_value
59+
var/list/list_values = config_entry_value.Copy()
60+
config_entry_value.Cut()
61+
for(var/path_to_blacklist in list_values)
62+
var/path = text2path(trimtext(path_to_blacklist))
63+
if(isnull(path))
64+
log_config("Warning: invalid typepath [path_to_blacklist] in BLACKLIST_MECHCOMP_INTERACTION")
65+
continue
66+
for(var/current_path in typesof(path))
67+
config_entry_value[current_path] = TRUE
68+
4869
/datum/config_entry/number/transfer_vote_time
4970
default = 90 MINUTES
5071
min_val = 0

code/datums/elements/food/fried_item.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
this_food.name = "\proper the physical manifestation of the very concept of fried foods"
3838
this_food.desc = "A heavily-fried... something. Who can tell anymore?"
3939

40-
ADD_TRAIT(this_food, TRAIT_FOOD_FRIED, ELEMENT_TRAIT(type))
40+
this_food.add_traits(list(TRAIT_FOOD_FRIED, TRAIT_MECHCOMP_INTERACTION_BANNED), ELEMENT_TRAIT(type)) // monkestation edit: also add TRAIT_MECHCOMP_INTERACTION_BANNED
4141
SEND_SIGNAL(this_food, COMSIG_ITEM_FRIED, fry_time)
4242
// Already edible items will inherent these parameters
4343
// Otherwise, we will become edible.
@@ -55,6 +55,6 @@
5555
source.remove_atom_colour(FIXED_COLOUR_PRIORITY, color)
5656
source.name = initial(source.name)
5757
source.desc = initial(source.desc)
58-
REMOVE_TRAIT(source, TRAIT_FOOD_FRIED, ELEMENT_TRAIT(type))
58+
source.remove_traits(list(TRAIT_FOOD_FRIED, TRAIT_MECHCOMP_INTERACTION_BANNED), ELEMENT_TRAIT(type)) // monkestation edit: also add TRAIT_MECHCOMP_INTERACTION_BANNED
5959
qdel(source.GetComponent(/datum/component/edible)) // Don't care if it was initially edible
6060
return ..()

code/modules/unit_tests/mob_faction.dm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var/list/ignored = list(
77
/mob/living/carbon,
88
/mob/dview,
9-
/mob/oranges_ear
9+
/mob/oranges_ear,
10+
/mob/living/carbon/human/dummy/mechcomp, // monkestation addition: should not exist outside of interaction components
1011
)
1112
ignored += typesof(/mob/camera/imaginary_friend)
1213
ignored += typesof(/mob/living/simple_animal/pet/gondola/gondolapod)

code/modules/unit_tests/unit_test.dm

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,18 @@ GLOBAL_VAR_INIT(focused_tests, focused_tests())
247247
//Both are abstract types meant to scream bloody murder if spawned in raw
248248
/obj/item/organ/external,
249249
/obj/item/organ/external/wings,
250+
// monkestation start
250251
/obj/effect/spawner/random_engines,
251252
/obj/effect/spawner/random_bar,
252-
///this instant starts a timer, and if its being instantly deleted it can cause issues
253-
/obj/machinery/atm,
254-
/datum/hotspot,
253+
/obj/machinery/atm, // starts a timer, and if its being instantly deleted it can cause issues
255254
/obj/machinery/ocean_elevator,
256255
/atom/movable/outdoor_effect,
257256
/turf/closed/mineral/random/regrowth,
258-
/obj/effect/abstract/signboard_holder, // monkestation addition: shouldn't exist outside of signboards
259-
/obj/effect/transmission_beam, // monkestation addition: relies on the existence of a PTL
260-
/obj/item/radio/entertainment/speakers/pda, // monkestation addition: should never exist outside of a modular computer
257+
/obj/effect/abstract/signboard_holder, // shouldn't exist outside of signboards
258+
/obj/effect/transmission_beam, // relies on the existence of a PTL
259+
/obj/item/radio/entertainment/speakers/pda, // shouldn't outside of a modular computer
260+
/mob/living/carbon/human/dummy/mechcomp, // shouldn't outside of an interaction component
261+
// monkestation end
261262
)
262263
//Say it with me now, type template
263264
ignore += typesof(/obj/effect/mapping_helpers)
@@ -328,14 +329,14 @@ GLOBAL_VAR_INIT(focused_tests, focused_tests())
328329
ignore += subtypesof(/atom/movable/screen/escape_menu)
329330
///we generate mobs in these and create destroy does this in null space
330331
ignore += typesof(/obj/item/loot_table_maker)
332+
333+
// monkestation start
331334
///we need to use json_decode to run randoms properly
332335
ignore += typesof(/obj/item/device/cassette_tape)
333-
ignore += typesof(/datum/cassette/cassette_tape)
334336
///we also dont want weathers or weather events as they will hold refs to alot of stuff as they shouldn't be deleted
335-
ignore += typesof(/datum/weather_event)
336-
ignore += typesof(/datum/particle_weather)
337337
ignore += typesof(/mob/living/basic/aquatic)
338338
ignore += typesof(/obj/machinery/station_map)
339+
// monkestation end
339340

340341
return ignore
341342

config/game_options.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,3 +604,13 @@ MODERATE_POP_SCALE_PENALTY 30
604604
MAJOR_POP_SCALE_PENALTY 30
605605
ROLESET_POP_SCALE_PENALTY 30
606606
OBJECTIVES_POP_SCALE_PENALTY 30
607+
608+
## Uncomment to prevent mechcomp interaction components from holding items.
609+
#DISABLE_MECHCOMP_INTERACTION_ITEMS
610+
611+
## Uncomment to prevent mechcomp interaction components from using storage.
612+
#DISABLE_MECHCOMP_INTERACTION_STORAGE
613+
614+
## Additional typepaths to prevent mechcomp interaction components from interacting with.
615+
#BLACKLIST_MECHCOMP_INTERACTION /obj/item/doohickey
616+
#BLACKLIST_MECHCOMP_INTERACTION /obj/item/thingymajig

0 commit comments

Comments
 (0)