From e6f03d5a8dc03f02d93d7b006e0ea7db1f03fd84 Mon Sep 17 00:00:00 2001 From: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Date: Tue, 19 Jul 2022 02:04:22 -0700 Subject: [PATCH] Fixes circuit dispensers add_item (#68528) adding items to a dispenser shell would hit the shell with the item first little to no feedback from the shell as it just eats your held item bulk adding items could theoretically exceed the weight limit for items or add in nested bags --- code/modules/wiremod/shell/dispenser.dm | 29 +++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/code/modules/wiremod/shell/dispenser.dm b/code/modules/wiremod/shell/dispenser.dm index 2454641ddfb..d8fcfce622c 100644 --- a/code/modules/wiremod/shell/dispenser.dm +++ b/code/modules/wiremod/shell/dispenser.dm @@ -28,7 +28,8 @@ return ..() -/obj/structure/dispenser_bot/proc/add_item(obj/item/to_add) +/obj/structure/dispenser_bot/proc/add_item(mob/user, obj/item/to_add) + balloon_alert(user, "inserted item") stored_items += to_add to_add.forceMove(src) RegisterSignal(to_add, COMSIG_MOVABLE_MOVED, .proc/handle_stored_item_moved) @@ -61,33 +62,33 @@ ), SHELL_CAPACITY_LARGE) /obj/structure/dispenser_bot/attackby(obj/item/item, mob/living/user, params) - . = ..() - if(user.combat_mode || .) - return - + if(user.combat_mode) + return ..() + if(istype(item, /obj/item/wrench) || istype(item, /obj/item/multitool) || istype(item, /obj/item/integrated_circuit)) + return ..() if(item.w_class > max_weight && !istype(item, /obj/item/storage/bag)) balloon_alert(user, "item too big!") - return - + return FALSE if(length(stored_items) >= capacity) balloon_alert(user, "at maximum capacity!") - return - + return FALSE if(istype(item, /obj/item/storage/bag)) for(var/obj/item/bag_item in item.contents) if(length(stored_items) >= capacity) break - add_item(bag_item) - return - - add_item(item) + if(bag_item.w_class > max_weight || istype(bag_item, /obj/item/storage/bag)) + continue + add_item(user, bag_item) + return TRUE + add_item(user, item) + return TRUE /obj/structure/dispenser_bot/wrench_act(mob/living/user, obj/item/tool) if(locked) return set_anchored(!anchored) tool.play_tool_sound(src) - balloon_alert(user, "You [anchored?"secure":"unsecure"] [src].") + balloon_alert(user, "[anchored? "secured" : "unsecured"]") return TRUE /obj/item/circuit_component/dispenser_bot