[MIRROR] Enables the RPED to construct/replace beakers, igniters and bluespace crystals (#5673)
* Enables the RPED to construct/replace beakers, igniters and bluespace crystals (#35779) * - Makes it possible to load the rped with beakers, assemblies and other such parts * - Fixes cell ratings being not really related to desirability * - sorry uhhh emp cells need to be slightly better than regular cells * Enables the RPED to construct/replace beakers, igniters and bluespace crystals
This commit is contained in:
committed by
Poojawa
parent
3755037c28
commit
4351621e7d
@@ -192,7 +192,7 @@
|
||||
var/list/part_list = list()
|
||||
|
||||
//Assemble a list of current parts, then sort them by their rating!
|
||||
for(var/obj/item/stock_parts/co in replacer)
|
||||
for(var/obj/item/co in replacer)
|
||||
part_list += co
|
||||
//Sort the parts. This ensures that higher tier items are applied first.
|
||||
part_list = sortTim(part_list, /proc/cmp_rped_sort)
|
||||
@@ -200,13 +200,28 @@
|
||||
for(var/path in req_components)
|
||||
while(req_components[path] > 0 && (locate(path) in part_list))
|
||||
var/obj/item/part = (locate(path) in part_list)
|
||||
added_components[part] = path
|
||||
replacer.remove_from_storage(part, src)
|
||||
req_components[path]--
|
||||
part_list -= part
|
||||
if(istype(part,/obj/item/stack))
|
||||
var/obj/item/stack/S = part
|
||||
var/used_amt = min(round(S.get_amount()), req_components[path])
|
||||
if(!used_amt || !S.use(used_amt))
|
||||
continue
|
||||
var/NS = new S.merge_type(src, used_amt)
|
||||
added_components[NS] = path
|
||||
req_components[path] -= used_amt
|
||||
else
|
||||
added_components[part] = path
|
||||
replacer.remove_from_storage(part, src)
|
||||
req_components[path]--
|
||||
|
||||
for(var/obj/item/stock_parts/part in added_components)
|
||||
components += part
|
||||
for(var/obj/item/part in added_components)
|
||||
if(istype(part,/obj/item/stack))
|
||||
var/obj/item/stack/S = part
|
||||
var/obj/item/stack/NS = locate(S.merge_type) in components //find a stack to merge with
|
||||
if(NS)
|
||||
S.merge(NS)
|
||||
if(!QDELETED(part)) //If we're a stack and we merged we might not exist anymore
|
||||
components += part
|
||||
to_chat(user, "<span class='notice'>[part.name] applied.</span>")
|
||||
if(added_components.len)
|
||||
replacer.play_rped_sound()
|
||||
@@ -242,7 +257,6 @@
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/structure/frame/machine/deconstruct(disassembled = TRUE)
|
||||
if(!(flags_1 & NODECONSTRUCT_1))
|
||||
if(state >= 2)
|
||||
|
||||
Reference in New Issue
Block a user