diff --git a/code/__DEFINES/construction.dm b/code/__DEFINES/construction.dm index 2f54d066a0..77ec97f47e 100644 --- a/code/__DEFINES/construction.dm +++ b/code/__DEFINES/construction.dm @@ -59,8 +59,6 @@ //let's just pretend fulltile windows being children of border windows is fine #define FULLTILE_WINDOW_DIR NORTHEAST -//The amount of materials you get from a sheet of mineral like iron/diamond/glass etc -#define MINERAL_MATERIAL_AMOUNT 2000 //The maximum size of a stack object. #define MAX_STACK_SIZE 50 //maximum amount of cable in a coil diff --git a/code/__DEFINES/material/worth.dm b/code/__DEFINES/material/worth.dm new file mode 100644 index 0000000000..db79d7317b --- /dev/null +++ b/code/__DEFINES/material/worth.dm @@ -0,0 +1,2 @@ +/// cm3 of material matter per sheet +#define MINERAL_MATERIAL_AMOUNT 2000 diff --git a/code/__DEFINES/research/stock_parts.dm b/code/__DEFINES/research/stock_parts.dm new file mode 100644 index 0000000000..457e3b632e --- /dev/null +++ b/code/__DEFINES/research/stock_parts.dm @@ -0,0 +1,5 @@ +// the clamps are just sanity checks. +/// Efficiency scaling for stock part level to material usage. All code concerning lathing and production from raw material sheet should be using this. +#define STANDARD_PART_LEVEL_LATHE_COEFFICIENT(level) clamp(1 - (level * 0.1), 0, 1) +/// Efficiency scaling for stock part level to ore factor. All code concerning lathing and production from raw ores to raw material sheets should be using this. +#define STANDARD_PART_LEVEL_ORE_COEFFICIENT(level) clamp(1 + (level * 0.125), 1, 10) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index edb31e9dbd..de92e1c249 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -62,6 +62,9 @@ /datum/material/mythril ) + /// Base print speed + var/base_print_speed = 10 + /obj/machinery/autolathe/Initialize() AddComponent(/datum/component/material_container, allowed_materials, _show_on_examine=TRUE, _after_insert=CALLBACK(src, .proc/AfterMaterialInsert)) . = ..() @@ -206,7 +209,7 @@ busy = TRUE use_power(power) icon_state = "autolathe_n" - var/time = is_stack ? 32 : 32*coeff*multiplier + var/time = is_stack ? 10 : base_print_speed * coeff * multiplier addtimer(CALLBACK(src, .proc/make_item, power, materials_used, custom_materials, multiplier, coeff, is_stack), time) else to_chat(usr, "Not enough materials for this operation.") @@ -254,10 +257,12 @@ T += MB.rating*75000 var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.max_amount = T - T=1.2 + var/manips = 0 + var/total_manip_rating = 0 for(var/obj/item/stock_parts/manipulator/M in component_parts) - T -= M.rating*0.2 - prod_coeff = min(1,max(0,T)) // Coeff going 1 -> 0,8 -> 0,6 -> 0,4 + total_manip_rating += M.rating + manips++ + prod_coeff = STANDARD_PART_LEVEL_LATHE_COEFFICIENT(total_manip_rating / (manips? manips : 1)) /obj/machinery/autolathe/examine(mob/user) . += ..() @@ -440,6 +445,7 @@ hackable = FALSE circuit = /obj/item/circuitboard/machine/autolathe/secure stored_research = /datum/techweb/specialized/autounlocking/autolathe/public + base_print_speed = 20 /obj/machinery/autolathe/toy name = "autoylathe" diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 2f6e8a9b7c..a7b7a84b27 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -37,16 +37,19 @@ /obj/machinery/mineral/ore_redemption/RefreshParts() var/ore_pickup_rate_temp = 15 var/point_upgrade_temp = 1 - var/ore_multiplier_temp = 1 + var/avg_bin_level = 0 + var/bins = 0 for(var/obj/item/stock_parts/matter_bin/B in component_parts) - ore_multiplier_temp = 0.65 + (0.35 * B.rating) + avg_bin_level = B.rating + bins++ for(var/obj/item/stock_parts/manipulator/M in component_parts) ore_pickup_rate_temp = 15 * M.rating for(var/obj/item/stock_parts/micro_laser/L in component_parts) point_upgrade_temp = 0.65 + (0.35 * L.rating) + avg_bin_level /= bins? bins : 1 + ore_multiplier = STANDARD_PART_LEVEL_ORE_COEFFICIENT(avg_bin_level) ore_pickup_rate = ore_pickup_rate_temp point_upgrade = point_upgrade_temp - ore_multiplier = round(ore_multiplier_temp, 0.01) /obj/machinery/mineral/ore_redemption/examine(mob/user) . = ..() diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index 2159e9eba3..6fca686f90 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -61,7 +61,8 @@ popup.open() /obj/machinery/rnd/production/proc/calculate_efficiency() - efficiency_coeff = 1 + var/total_manip_rating = 0 + var/manips = 0 if(reagents) //If reagents/materials aren't initialized, don't bother, we'll be doing this again after reagents init anyways. reagents.maximum_volume = 0 for(var/obj/item/reagent_containers/glass/G in component_parts) @@ -72,11 +73,10 @@ for(var/obj/item/stock_parts/matter_bin/M in component_parts) total_storage += M.rating * 75000 materials.set_local_size(total_storage) - var/total_rating = 0 for(var/obj/item/stock_parts/manipulator/M in component_parts) - total_rating += M.rating - total_rating = max(1, total_rating) - efficiency_coeff = total_rating + total_manip_rating += M.rating + manips++ + efficiency_coeff = STANDARD_PART_LEVEL_LATHE_COEFFICIENT(total_manip_rating / (manips? manips : 1)) /obj/machinery/rnd/production/examine(mob/user) . = ..() @@ -113,7 +113,7 @@ // these types don't have their .materials set in do_print, so don't allow // them to be constructed efficiently var/ef = efficient_with(being_built.build_path) ? efficiency_coeff : 1 - return round(A / max(1, all_materials[mat] / ef)) + return round(A / max(1, all_materials[mat] * ef)) /obj/machinery/rnd/production/proc/efficient_with(path) return !ispath(path, /obj/item/stack/sheet) && !ispath(path, /obj/item/stack/ore/bluespace_crystal) @@ -155,24 +155,24 @@ var/coeff = efficient_with(D.build_path) ? efficiency_coeff : 1 var/list/efficient_mats = list() for(var/MAT in D.materials) - efficient_mats[MAT] = D.materials[MAT]/coeff + efficient_mats[MAT] = D.materials[MAT] * coeff if(!materials.mat_container.has_materials(efficient_mats, amount)) say("Not enough materials to complete prototype[amount > 1? "s" : ""].") return FALSE for(var/R in D.reagents_list) - if(!reagents.has_reagent(R, D.reagents_list[R]*amount/coeff)) + if(!reagents.has_reagent(R, D.reagents_list[R] * amount * coeff)) say("Not enough reagents to complete prototype[amount > 1? "s" : ""].") return FALSE materials.mat_container.use_materials(efficient_mats, amount) materials.silo_log(src, "built", -amount, "[D.name]", efficient_mats) for(var/R in D.reagents_list) - reagents.remove_reagent(R, D.reagents_list[R]*amount/coeff) + reagents.remove_reagent(R, D.reagents_list[R] * amount * coeff) busy = TRUE if(production_animation) flick(production_animation, src) - var/timecoeff = D.lathe_time_factor / efficiency_coeff - addtimer(CALLBACK(src, .proc/reset_busy), (30 * timecoeff * amount) ** 0.5) - addtimer(CALLBACK(src, .proc/do_print, D.build_path, amount, efficient_mats, D.dangerous_construction, usr), (32 * timecoeff * amount) ** 0.8) + var/timecoeff = D.lathe_time_factor * efficiency_coeff + addtimer(CALLBACK(src, .proc/reset_busy), (20 * timecoeff * amount) ** 0.5) + addtimer(CALLBACK(src, .proc/do_print, D.build_path, amount, efficient_mats, D.dangerous_construction, usr), (20 * timecoeff * amount) ** 0.5) return TRUE /obj/machinery/rnd/production/proc/search(string) diff --git a/tgstation.dme b/tgstation.dme index c954e7cb2e..d61a1c4ef9 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -125,8 +125,10 @@ #include "code\__DEFINES\dcs\signals.dm" #include "code\__DEFINES\flags\shields.dm" #include "code\__DEFINES\mapping\maploader.dm" +#include "code\__DEFINES\material\worth.dm" #include "code\__DEFINES\misc\return_values.dm" #include "code\__DEFINES\mobs\slowdowns.dm" +#include "code\__DEFINES\research\stock_parts.dm" #include "code\__DEFINES\skills\skills.dm" #include "code\__HELPERS\_cit_helpers.dm" #include "code\__HELPERS\_lists.dm"