mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
[MIRROR] Mass Part Installation For Frames From Storage Boxes/Bags (#11504)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
bb15f3b507
commit
8b43c6a764
@@ -631,34 +631,64 @@ GLOBAL_LIST(construction_frame_floor)
|
||||
else if(istype(P, /obj/item))
|
||||
if(state == FRAME_WIRED)
|
||||
if(frame_type.frame_class == FRAME_CLASS_MACHINE)
|
||||
for(var/I in req_components)
|
||||
if(istype(P, I) && (req_components[I] > 0))
|
||||
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(istype(P, /obj/item/stack))
|
||||
var/obj/item/stack/ST = P
|
||||
if(ST.get_amount() > 1)
|
||||
var/camt = min(ST.get_amount(), req_components[I]) // amount of stack to take, idealy amount required, but limited by amount provided
|
||||
var/obj/item/stack/NS = new ST.stacktype(src, camt)
|
||||
NS.update_icon()
|
||||
ST.use(camt)
|
||||
components += NS
|
||||
req_components[I] -= camt
|
||||
update_desc()
|
||||
break
|
||||
|
||||
user.drop_item()
|
||||
P.forceMove(src)
|
||||
components += P
|
||||
req_components[I]--
|
||||
update_desc()
|
||||
break
|
||||
to_chat(user, desc)
|
||||
if(P && P.loc != src && !istype(P, /obj/item/stack/material))
|
||||
to_chat(user, span_warning("You cannot add that component to the machine!"))
|
||||
return
|
||||
if(istype(P, /obj/item/storage))
|
||||
mass_install_parts(user,P)
|
||||
else
|
||||
install_part(user,P)
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/structure/frame/proc/install_part(var/mob/user, var/obj/item/P, var/defer_feedback = FALSE)
|
||||
var/installed_part = FALSE
|
||||
for(var/I in req_components)
|
||||
if(!istype(P, I) || (req_components[I] == 0))
|
||||
continue
|
||||
|
||||
installed_part = TRUE
|
||||
if(istype(P, /obj/item/stack))
|
||||
var/obj/item/stack/ST = P
|
||||
if(ST.get_amount() > 1)
|
||||
var/camt = min(ST.get_amount(), req_components[I]) // amount of stack to take, idealy amount required, but limited by amount provided
|
||||
var/obj/item/stack/NS = new ST.stacktype(src, camt)
|
||||
NS.update_icon()
|
||||
ST.use(camt)
|
||||
components += NS
|
||||
req_components[I] -= camt
|
||||
break
|
||||
|
||||
if(istype(P.loc,/obj/item/storage))
|
||||
var/obj/item/storage/holder = P.loc
|
||||
holder.remove_from_storage(P, src)
|
||||
else
|
||||
user.drop_item()
|
||||
P.forceMove(src)
|
||||
components += P
|
||||
req_components[I]--
|
||||
break
|
||||
|
||||
if(defer_feedback)
|
||||
return installed_part
|
||||
|
||||
if(installed_part)
|
||||
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
update_desc()
|
||||
to_chat(user, desc)
|
||||
return TRUE
|
||||
|
||||
to_chat(user, span_warning("You cannot add that component to the machine!"))
|
||||
return FALSE
|
||||
|
||||
/obj/structure/frame/proc/mass_install_parts(var/mob/user, var/obj/item/storage/S)
|
||||
var/installed_part = FALSE
|
||||
for(var/obj/item/P in S.contents)
|
||||
installed_part |= install_part(user, P, TRUE)
|
||||
if(!installed_part)
|
||||
return FALSE
|
||||
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
update_desc()
|
||||
to_chat(user, desc)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/frame/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Frame Counter-Clockwise"
|
||||
set category = "Object"
|
||||
|
||||
@@ -130,6 +130,16 @@
|
||||
/obj/item/stack/cable_coil,
|
||||
/obj/item/circuitboard
|
||||
)
|
||||
// Because you deal with so many parts, and the borg needs this anyway...
|
||||
use_to_pickup = TRUE
|
||||
allow_quick_gather = TRUE
|
||||
allow_quick_empty = TRUE
|
||||
collection_mode = TRUE
|
||||
|
||||
/obj/item/storage/pouch/eng_parts/borg
|
||||
name = "parts storage unit"
|
||||
desc = "Can only hold machinery components."
|
||||
max_storage_space = INVENTORY_POUCH_SPACE*5 // Borgs need some love here, so very expanded space
|
||||
|
||||
/obj/item/storage/pouch/medical
|
||||
name = "storage pouch (medical)"
|
||||
|
||||
Reference in New Issue
Block a user