diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index b62db80c705..5898d0c14ac 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -402,8 +402,21 @@ component_parts += B B.loc = null to_chat(user, "[A.name] replaced with [B.name].") - shouldplaysound = 1 + shouldplaysound = TRUE break + for(var/obj/item/reagent_containers/glass/beaker/A in component_parts) + for(var/obj/item/reagent_containers/glass/beaker/B in W.contents) + // If it's not better -> next content + if(B.reagents.maximum_volume <= A.reagents.maximum_volume) + continue + W.remove_from_storage(B, src) + W.handle_item_insertion(A, TRUE) + component_parts -= A + component_parts += B + B.loc = null + to_chat(user, "[A.name] replaced with [B.name].") + shouldplaysound = TRUE + break RefreshParts() else to_chat(user, display_parts(user)) diff --git a/code/game/objects/items/weapons/stock_parts.dm b/code/game/objects/items/weapons/stock_parts.dm index 8ed6075ffd2..302ce2f20fc 100644 --- a/code/game/objects/items/weapons/stock_parts.dm +++ b/code/game/objects/items/weapons/stock_parts.dm @@ -6,7 +6,13 @@ icon_state = "RPED" item_state = "RPED" w_class = WEIGHT_CLASS_HUGE - can_hold = list(/obj/item/stock_parts) + can_hold = list( + /obj/item/stock_parts, + // This type is part of can_hold, but is added separately in Initialize to avoid picking up unwanted subtypes. + // /obj/item/reagent_containers/glass/beaker, + /obj/item/reagent_containers/glass/beaker/large, + /obj/item/reagent_containers/glass/beaker/bluespace + ) storage_slots = 50 use_to_pickup = TRUE allow_quick_gather = TRUE @@ -21,6 +27,20 @@ toolspeed = 1 usesound = 'sound/items/rped.ogg' +/obj/item/storage/part_replacer/Initialize(mapload) + . = ..() + can_hold[/obj/item/reagent_containers/glass/beaker] = TRUE + +/obj/item/storage/part_replacer/can_be_inserted(obj/item/I, stop_messages = FALSE) + if(!istype(I, /obj/item/reagent_containers/glass/beaker)) + return ..() + var/obj/item/reagent_containers/glass/beaker/B = I + if(B.reagents?.total_volume) + if(!stop_messages) + to_chat(usr, "[src] cannot hold [I] while it contains liquid.") + return FALSE + return ..() + /obj/item/storage/part_replacer/afterattack(obj/machinery/M, mob/user, flag, params) if(!flag && works_from_distance && istype(M)) // Make sure its in range @@ -56,6 +76,7 @@ new /obj/item/stock_parts/micro_laser/quadultra(src) new /obj/item/stock_parts/scanning_module/triphasic(src) new /obj/item/stock_parts/cell/bluespace(src) + new /obj/item/reagent_containers/glass/beaker/bluespace(src) /obj/item/storage/part_replacer/proc/play_rped_sound() //Plays the sound for RPED exchanging or installing parts. @@ -64,11 +85,6 @@ else playsound(src, primary_sound, 40, 1) -//Sorts stock parts inside an RPED by their rating. -//Only use /obj/item/stock_parts/ with this sort proc! -/proc/cmp_rped_sort(obj/item/stock_parts/A, obj/item/stock_parts/B) - return B.rating - A.rating - /obj/item/stock_parts name = "stock part" desc = "What?"