diff --git a/code/WorkInProgress/Tastyfish/wallmount_frame.dm b/code/WorkInProgress/Tastyfish/wallmount_frame.dm index d747a5c1ea4..1134dd6a463 100644 --- a/code/WorkInProgress/Tastyfish/wallmount_frame.dm +++ b/code/WorkInProgress/Tastyfish/wallmount_frame.dm @@ -63,7 +63,16 @@ req_components = circuit.req_components.Copy() for(var/A in circuit.req_components) req_components[A] = circuit.req_components[A] - if(circuit.frame_desc) desc = circuit.frame_desc + req_component_names = circuit.req_components.Copy() + for(var/A in req_components) + var/cp = text2path(A) + var/obj/ct = new cp() // have to quickly instantiate it get name + req_component_names[A] = ct.name + if(circuit.frame_desc) + desc = circuit.frame_desc + else + update_desc() + user << desc else user << "\red This frame does not accept circuit boards of this type!" if(istype(P, /obj/item/weapon/wirecutters)) @@ -126,19 +135,26 @@ if(istype(P, /obj/item/weapon)) for(var/I in req_components) if(istype(P, text2path(I)) && (req_components[I] > 0)) + playsound(src.loc, 'Deconstruct.ogg', 50, 1) if(istype(P, /obj/item/weapon/cable_coil)) var/obj/item/weapon/cable_coil/CP = P if(CP.amount > 1) + var/camt = min(CP.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided var/obj/item/weapon/cable_coil/CC = new /obj/item/weapon/cable_coil(src) - CC.amount = 1 + CC.amount = camt + CC.update_icon() + CP.use(camt) components += CC - req_components[I]-- + req_components[I] -= camt + update_desc() break user.drop_item() P.loc = src components += P req_components[I]-- + update_desc() break + user << desc if(P.loc != src && !istype(P, /obj/item/weapon/cable_coil)) user << "\red You cannot add that component to the machine!" diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index 75a2ed70f87..1b253966adb 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -9,8 +9,23 @@ obj/item/weapon/circuitboard/circuit = null list/components = null list/req_components = null + list/req_component_names = null state = 1 + proc/update_desc() + var/D + if(req_components) + D = "Requires " + var/first = 1 + for(var/I in req_components) + if(req_components[I] > 0) + D += "[first?"":", "][num2text(req_components[I])] [req_component_names[I]]" + first = 0 + if(first) // nothing needs to be added, then + D += "nothing" + D += "." + desc = D + /obj/machinery/constructable_frame/machine_frame attackby(obj/item/P as obj, mob/user as mob) if(P.crit_fail) @@ -48,7 +63,16 @@ req_components = circuit.req_components.Copy() for(var/A in circuit.req_components) req_components[A] = circuit.req_components[A] - if(circuit.frame_desc) desc = circuit.frame_desc + req_component_names = circuit.req_components.Copy() + for(var/A in req_components) + var/cp = text2path(A) + var/obj/ct = new cp() // have to quickly instantiate it get name + req_component_names[A] = ct.name + if(circuit.frame_desc) + desc = circuit.frame_desc + else + update_desc() + user << desc else user << "\red This frame does not accept circuit boards of this type!" if(istype(P, /obj/item/weapon/wirecutters)) @@ -104,19 +128,26 @@ if(istype(P, /obj/item/weapon)) for(var/I in req_components) if(istype(P, text2path(I)) && (req_components[I] > 0)) + playsound(src.loc, 'Deconstruct.ogg', 50, 1) if(istype(P, /obj/item/weapon/cable_coil)) var/obj/item/weapon/cable_coil/CP = P if(CP.amount > 1) + var/camt = min(CP.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided var/obj/item/weapon/cable_coil/CC = new /obj/item/weapon/cable_coil(src) - CC.amount = 1 + CC.amount = camt + CC.update_icon() + CP.use(camt) components += CC - req_components[I]-- + req_components[I] -= camt + update_desc() break user.drop_item() P.loc = src components += P req_components[I]-- + update_desc() break + user << desc if(P.loc != src && !istype(P, /obj/item/weapon/cable_coil)) user << "\red You cannot add that component to the machine!"