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
This commit is contained in:
Jeremiah
2022-07-19 02:04:22 -07:00
committed by GitHub
parent d0462f6eb1
commit e6f03d5a8d
+15 -14
View File
@@ -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