Added beaker support to RPEDs. (#24664)

* Added beaker support to RPEDs.

* Apply suggestions from code review

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Comment fix.

* Apply suggestions from code review

Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com>

* Prevented filled beakers from going in the bRPED.

---------

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com>
This commit is contained in:
Charlie Nolan
2024-04-10 18:55:48 +00:00
committed by GitHub
co-authored by Henri215 1080pCat
parent 5e213db6c5
commit 94c93c2537
2 changed files with 36 additions and 7 deletions
+22 -6
View File
@@ -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, "<span class='warning'>[src] cannot hold [I] while it contains liquid.</span>")
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?"