From 5a8f905b912d4f77ea532dc87502a3ef4959f2bb Mon Sep 17 00:00:00 2001 From: LatD Date: Fri, 13 May 2016 01:48:31 +0300 Subject: [PATCH] Efficiency coeff changes --- code/game/machinery/autolathe.dm | 34 ++++++++++++------------- code/game/mecha/mech_fabricator.dm | 9 ++++++- code/modules/research/circuitprinter.dm | 6 ++--- code/modules/research/protolathe.dm | 2 +- code/modules/research/rdconsole.dm | 18 ++++++------- 5 files changed, 37 insertions(+), 32 deletions(-) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 4014ad407ec..8038902c66c 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -22,7 +22,7 @@ idle_power_usage = 10 active_power_usage = 100 var/busy = 0 - var/prod_coeff + var/prod_coeff = 1 var/datum/design/being_built var/datum/research/files @@ -193,18 +193,18 @@ return ///////////////// - var/coeff = (is_stack ? 1 : 2 ** prod_coeff) //stacks are unaffected by production coefficient + var/coeff = (is_stack ? 1 : prod_coeff) //stacks are unaffected by production coefficient var/metal_cost = being_built.materials[MAT_METAL] var/glass_cost = being_built.materials[MAT_GLASS] var/power = max(2000, (metal_cost+glass_cost)*multiplier/5) - if((materials.amount(MAT_METAL) >= metal_cost*multiplier/coeff) && (materials.amount(MAT_GLASS) >= glass_cost*multiplier/coeff)) + if((materials.amount(MAT_METAL) >= metal_cost*multiplier*coeff) && (materials.amount(MAT_GLASS) >= glass_cost*multiplier*coeff)) busy = 1 use_power(power) icon_state = "autolathe" flick("autolathe_n",src) - spawn(32/coeff) + spawn(32*coeff) use_power(power) if(is_stack) var/list/materials_used = list(MAT_METAL=metal_cost*multiplier, MAT_GLASS=glass_cost*multiplier) @@ -218,7 +218,7 @@ if(istype(S, N.merge_type)) N.merge(S) else - var/list/materials_used = list(MAT_METAL=metal_cost/coeff, MAT_GLASS=glass_cost/coeff) + var/list/materials_used = list(MAT_METAL=metal_cost*coeff, MAT_GLASS=glass_cost*coeff) materials.use_amount(materials_used) var/obj/item/new_item = new being_built.build_path(T) new_item.materials = materials_used.Copy() @@ -241,14 +241,14 @@ return /obj/machinery/autolathe/RefreshParts() - var/tot_rating = 0 - prod_coeff = 0 + var/T =1.2 for(var/obj/item/weapon/stock_parts/matter_bin/MB in component_parts) - tot_rating += MB.rating - tot_rating *= 25000 - materials.max_amount = tot_rating * 3 + T += MB.rating*75000 + materials.max_amount = T + T=1.2 for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts) - prod_coeff += M.rating - 1 + T -= M.rating*0.2 + prod_coeff = min(1,max(0,T)) // Coeff going 1 -> 0,8 -> 0,6 -> 0,4 /obj/machinery/autolathe/proc/main_win(mob/user) var/dat = "

Autolathe Menu:


" @@ -338,21 +338,21 @@ return dat /obj/machinery/autolathe/proc/can_build(datum/design/D) - var/coeff = (ispath(D.build_path,/obj/item/stack) ? 1 : 2 ** prod_coeff) + var/coeff = (ispath(D.build_path,/obj/item/stack) ? 1 : prod_coeff) - if(D.materials[MAT_METAL] && (materials.amount(MAT_METAL) < (D.materials[MAT_METAL] / coeff))) + if(D.materials[MAT_METAL] && (materials.amount(MAT_METAL) < (D.materials[MAT_METAL] * coeff))) return 0 - if(D.materials[MAT_GLASS] && (materials.amount(MAT_GLASS) < (D.materials[MAT_GLASS] / coeff))) + if(D.materials[MAT_GLASS] && (materials.amount(MAT_GLASS) < (D.materials[MAT_GLASS] * coeff))) return 0 return 1 /obj/machinery/autolathe/proc/get_design_cost(datum/design/D) - var/coeff = (ispath(D.build_path,/obj/item/stack) ? 1 : 2 ** prod_coeff) + var/coeff = (ispath(D.build_path,/obj/item/stack) ? 1 : prod_coeff) var/dat if(D.materials[MAT_METAL]) - dat += "[D.materials[MAT_METAL] / coeff] metal " + dat += "[D.materials[MAT_METAL] * coeff] metal " if(D.materials[MAT_GLASS]) - dat += "[D.materials[MAT_GLASS] / coeff] glass" + dat += "[D.materials[MAT_GLASS] * coeff] glass" return dat /obj/machinery/autolathe/proc/reset(wire) diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 5de9c676059..fa648b28849 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -10,6 +10,7 @@ active_power_usage = 5000 req_access = list(access_robotics) var/time_coeff = 1 + var/component_coeff = 1 var/list/resources = list( MAT_METAL=0, MAT_GLASS=0, @@ -68,6 +69,12 @@ T += M.rating res_max_amount = (187000+(T * 37500)) + //resources adjustment coefficient (1 -> 0.85 -> 0.7 -> 0.55) + T = 1.15 + for(var/obj/item/weapon/stock_parts/micro_laser/Ma in component_parts) + T -= Ma.rating*0.15 + component_coeff = T + //building time adjustment coefficient (1 -> 0.8 -> 0.6) T = -1 for(var/obj/item/weapon/stock_parts/manipulator/Ml in component_parts) @@ -266,7 +273,7 @@ return /obj/machinery/mecha_part_fabricator/proc/get_resource_cost_w_coeff(datum/design/D, resource, roundto = 1) - return round(D.materials[resource], roundto) + return round(D.materials[resource]*component_coeff, roundto) /obj/machinery/mecha_part_fabricator/proc/get_construction_time_w_coeff(datum/design/D, roundto = 1) //aran return round(initial(D.construction_time)*time_coeff, roundto) diff --git a/code/modules/research/circuitprinter.dm b/code/modules/research/circuitprinter.dm index 7e8d88b8d92..2cdc11189e1 100644 --- a/code/modules/research/circuitprinter.dm +++ b/code/modules/research/circuitprinter.dm @@ -66,11 +66,11 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis). /obj/machinery/r_n_d/circuit_imprinter/proc/check_mat(datum/design/being_built, M) switch(M) if(MAT_GLASS) - return (g_amount - (being_built.materials[M]/efficiency_coeff) >= 0) + return (g_amount - (being_built.materials[M]) >= 0) if(MAT_GOLD) - return (gold_amount - (being_built.materials[M]/efficiency_coeff) >= 0) + return (gold_amount - (being_built.materials[M]) >= 0) if(MAT_DIAMOND) - return (diamond_amount - (being_built.materials[M]/efficiency_coeff) >= 0) + return (diamond_amount - (being_built.materials[M]) >= 0) else return (reagents.has_reagent(M, (being_built.materials[M]/efficiency_coeff)) != 0) diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index 25f944841f2..3c6d0b2437f 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -63,7 +63,7 @@ Note: Must be placed west/left of and R&D console to function. T = 1.2 for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts) T -= M.rating/10 - efficiency_coeff = max(min(0.1, T), 1) + efficiency_coeff = min(max(0, T), 1) /obj/machinery/r_n_d/protolathe/proc/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) diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index 1e2b4ade56a..cdaf530fa85 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -436,13 +436,13 @@ proc/CallMaterialName(ID) break switch(M) if(MAT_GLASS) - linked_imprinter.g_amount = max(0, (linked_imprinter.g_amount-being_built.materials[M])*coeff) + linked_imprinter.g_amount = max(0, (linked_imprinter.g_amount-being_built.materials[M])) if(MAT_GOLD) - linked_imprinter.gold_amount = max(0, (linked_imprinter.gold_amount-being_built.materials[M])*coeff) + linked_imprinter.gold_amount = max(0, (linked_imprinter.gold_amount-being_built.materials[M])) if(MAT_DIAMOND) - linked_imprinter.diamond_amount = max(0, (linked_imprinter.diamond_amount-being_built.materials[M])*coeff) + linked_imprinter.diamond_amount = max(0, (linked_imprinter.diamond_amount-being_built.materials[M])) else - linked_imprinter.reagents.remove_reagent(M, being_built.materials[M]) + linked_imprinter.reagents.remove_reagent(M, being_built.materials[M]/coeff) var/P = being_built.build_path //lets save these values before the spawn() just in case. Nobody likes runtimes. spawn(16) @@ -973,7 +973,6 @@ proc/CallMaterialName(ID) dat += "Material Amount: [linked_imprinter.TotalMaterials()]
" dat += "Chemical Volume: [linked_imprinter.reagents.total_volume]
" - var/coeff = linked_imprinter.efficiency_coeff for(var/v in files.known_designs) var/datum/design/D = files.known_designs[v] if(!(selected_category in D.category) || !(D.build_type & IMPRINTER)) @@ -984,9 +983,9 @@ proc/CallMaterialName(ID) temp_materials += " | " if (!linked_imprinter.check_mat(D, M)) check_materials = 0 - temp_materials += " [D.materials[M]*coeff] [CallMaterialName(M)]" + temp_materials += " [D.materials[M]] [CallMaterialName(M)]" else - temp_materials += " [D.materials[M]*coeff] [CallMaterialName(M)]" + temp_materials += " [D.materials[M]] [CallMaterialName(M)]" if (check_materials) dat += "[D.name][temp_materials]
" else @@ -1000,7 +999,6 @@ proc/CallMaterialName(ID) dat += "Material Amount: [linked_imprinter.TotalMaterials()]
" dat += "Chemical Volume: [linked_imprinter.reagents.total_volume]
" - var/coeff = linked_imprinter.efficiency_coeff for(var/datum/design/D in matching_designs) var/temp_materials var/check_materials = 1 @@ -1008,9 +1006,9 @@ proc/CallMaterialName(ID) temp_materials += " | " if (!linked_imprinter.check_mat(D, M)) check_materials = 0 - temp_materials += " [D.materials[M]*coeff] [CallMaterialName(M)]" + temp_materials += " [D.materials[M]] [CallMaterialName(M)]" else - temp_materials += " [D.materials[M]*coeff] [CallMaterialName(M)]" + temp_materials += " [D.materials[M]] [CallMaterialName(M)]" if (check_materials) dat += "[D.name][temp_materials]
" else