Make RND machines check for upgraded parts when checking if an item is constructable (#15753)

* Protolathe design buildability check efficiency

* Efficiency_coeff rounding error fix

Co-authored-by: adrermail@gmail.com <adrermail@gmail.com>
This commit is contained in:
Adrer
2021-03-31 19:46:15 +01:00
committed by GitHub
co-authored by adrermail@gmail.com <adrermail@gmail.com>
parent cb7aadf62d
commit 53399ff87f
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -63,18 +63,18 @@ Note: Must be placed west/left of and R&D console to function.
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
T += M.rating
materials.max_amount = T * 75000
T = 1.2
T = 12
for(var/obj/item/stock_parts/manipulator/M in component_parts)
T -= M.rating/10
efficiency_coeff = min(max(0, T), 1)
T -= M.rating
efficiency_coeff = min(max(0, T / 10), 1)
/obj/machinery/r_n_d/protolathe/check_mat(datum/design/being_built, M) // now returns how many times the item can be built with the material
var/A = materials.amount(M)
if(!A)
A = reagents.get_reagent_amount(M)
A = A / max(1, (being_built.reagents_list[M]))
A = A / max(1, (being_built.reagents_list[M] * efficiency_coeff))
else
A = A / max(1, (being_built.materials[M]))
A = A / max(1, (being_built.materials[M] * efficiency_coeff))
return A
/obj/machinery/r_n_d/protolathe/attackby(obj/item/O as obj, mob/user as mob, params)
+1 -1
View File
@@ -427,7 +427,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
var/enough_materials = TRUE
if(!machine.materials.has_materials(efficient_mats, amount))
if(!machine.materials.has_materials(being_built.materials, coeff))
atom_say("Not enough materials to complete prototype.")
enough_materials = FALSE
else