This commit is contained in:
kevinz000
2020-05-09 17:58:58 -07:00
committed by GitHub
parent b131c0e679
commit f7808e97ad
3 changed files with 23 additions and 28 deletions
+11 -11
View File
@@ -4,7 +4,7 @@
layer = BELOW_OBJ_LAYER
var/consoleless_interface = TRUE //Whether it can be used without a console.
var/offstation_security_levels = TRUE
var/efficiency_coeff = 1 //Materials needed / coeff = actual.
var/print_cost_coeff = 1 //Materials needed * coeff = actual.
var/list/categories = list()
var/datum/component/remote_materials/materials
var/allowed_department_flags = ALL
@@ -76,13 +76,13 @@
for(var/obj/item/stock_parts/manipulator/M in component_parts)
total_manip_rating += M.rating
manips++
efficiency_coeff = STANDARD_PART_LEVEL_LATHE_COEFFICIENT(total_manip_rating / (manips? manips : 1))
print_cost_coeff = STANDARD_PART_LEVEL_LATHE_COEFFICIENT(total_manip_rating / (manips? manips : 1))
/obj/machinery/rnd/production/examine(mob/user)
. = ..()
var/datum/component/remote_materials/materials = GetComponent(/datum/component/remote_materials)
if(in_range(user, src) || isobserver(user))
. += "<span class='notice'>The status display reads: Storing up to <b>[materials.local_size]</b> material units locally.<br>Material usage efficiency at <b>[efficiency_coeff*100]%</b>.</span>"
. += "<span class='notice'>The status display reads: Storing up to <b>[materials.local_size]</b> material units locally.<br>Material usage cost at <b>[print_cost_coeff*100]%</b>.</span>"
//we eject the materials upon deconstruction.
/obj/machinery/rnd/production/on_deconstruction()
@@ -112,7 +112,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
var/ef = efficient_with(being_built.build_path) ? print_cost_coeff : 1
return round(A / max(1, all_materials[mat] * ef))
/obj/machinery/rnd/production/proc/efficient_with(path)
@@ -152,7 +152,7 @@
power += round(D.materials[M] * amount / 35)
power = min(3000, power)
use_power(power)
var/coeff = efficient_with(D.build_path) ? efficiency_coeff : 1
var/coeff = efficient_with(D.build_path) ? print_cost_coeff : 1
var/list/efficient_mats = list()
for(var/MAT in D.materials)
efficient_mats[MAT] = D.materials[MAT] * coeff
@@ -170,7 +170,7 @@
busy = TRUE
if(production_animation)
flick(production_animation, src)
var/timecoeff = D.lathe_time_factor * efficiency_coeff
var/timecoeff = D.lathe_time_factor * print_cost_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
@@ -247,7 +247,7 @@
/obj/machinery/rnd/production/proc/ui_screen_search()
var/list/l = list()
var/coeff = efficiency_coeff
var/coeff = print_cost_coeff
l += "<h2>Search Results:</h2>"
l += "<form name='search' action='?src=[REF(src)]'>\
<input type='hidden' name='src' value='[REF(src)]'>\
@@ -264,7 +264,7 @@
if(!istype(D))
return
if(!coeff)
coeff = efficiency_coeff
coeff = print_cost_coeff
if(!efficient_with(D.build_path))
coeff = 1
var/list/l = list()
@@ -276,9 +276,9 @@
t = check_mat(D, M)
temp_material += " | "
if (t < 1)
temp_material += "<span class='bad'>[all_materials[M]/coeff] [CallMaterialName(M)]</span>"
temp_material += "<span class='bad'>[all_materials[M] * coeff] [CallMaterialName(M)]</span>"
else
temp_material += " [all_materials[M]/coeff] [CallMaterialName(M)]"
temp_material += " [all_materials[M] * coeff] [CallMaterialName(M)]"
c = min(c,t)
var/clearance = !(obj_flags & EMAGGED) && (offstation_security_levels || is_station_level(z))
@@ -366,7 +366,7 @@
return ui_screen_main()
var/list/l = list()
l += "<div class='statusDisplay'><h3>Browsing [selected_category]:</h3>"
var/coeff = efficiency_coeff
var/coeff = print_cost_coeff
for(var/v in stored_research.researched_designs)
var/datum/design/D = SSresearch.techweb_design_by_id(v)
if(!(selected_category in D.category)|| !(D.build_type & allowed_buildtypes))
@@ -25,11 +25,6 @@
/obj/machinery/rnd/production/circuit_imprinter/calculate_efficiency()
. = ..()
var/total_rating = 0
for(var/obj/item/stock_parts/manipulator/M in component_parts)
total_rating += M.rating * 2 //There is only one.
total_rating = max(1, total_rating)
efficiency_coeff = total_rating
var/obj/item/circuitboard/machine/circuit_imprinter/C = circuit
offstation_security_levels = C.offstation_security_levels
+12 -12
View File
@@ -290,7 +290,7 @@ Nothing else in the console has ID requirements.
continue
var/temp_material
var/c = 50
var/coeff = linked_lathe.efficiency_coeff
var/coeff = linked_lathe.print_cost_coeff
if(!linked_lathe.efficient_with(D.build_path))
coeff = 1
@@ -299,9 +299,9 @@ Nothing else in the console has ID requirements.
var/t = linked_lathe.check_mat(D, M)
temp_material += " | "
if (t < 1)
temp_material += "<span class='bad'>[all_materials[M]/coeff] [CallMaterialName(M)]</span>"
temp_material += "<span class='bad'>[all_materials[M] * coeff] [CallMaterialName(M)]</span>"
else
temp_material += " [all_materials[M]/coeff] [CallMaterialName(M)]"
temp_material += " [all_materials[M] * coeff] [CallMaterialName(M)]"
c = min(c,t)
var/clearance = !(linked_lathe.obj_flags & EMAGGED) && (linked_lathe.offstation_security_levels || is_station_level(linked_lathe.z))
@@ -356,16 +356,16 @@ Nothing else in the console has ID requirements.
var/temp_material
var/c = 50
var/all_materials = D.materials + D.reagents_list
var/coeff = linked_lathe.efficiency_coeff
var/coeff = linked_lathe.print_cost_coeff
if(!linked_lathe.efficient_with(D.build_path))
coeff = 1
for(var/M in all_materials)
var/t = linked_lathe.check_mat(D, M)
temp_material += " | "
if (t < 1)
temp_material += "<span class='bad'>[all_materials[M]/coeff] [CallMaterialName(M)]</span>"
temp_material += "<span class='bad'>[all_materials[M] * coeff] [CallMaterialName(M)]</span>"
else
temp_material += " [all_materials[M]/coeff] [CallMaterialName(M)]"
temp_material += " [all_materials[M] * coeff] [CallMaterialName(M)]"
c = min(c,t)
if (c >= 1)
@@ -457,7 +457,7 @@ Nothing else in the console has ID requirements.
var/check_materials = TRUE
var/all_materials = D.materials + D.reagents_list
var/coeff = linked_imprinter.efficiency_coeff
var/coeff = linked_imprinter.print_cost_coeff
if(!linked_imprinter.efficient_with(D.build_path))
coeff = 1
@@ -465,9 +465,9 @@ Nothing else in the console has ID requirements.
temp_materials += " | "
if (!linked_imprinter.check_mat(D, M))
check_materials = FALSE
temp_materials += " <span class='bad'>[all_materials[M]/coeff] [CallMaterialName(M)]</span>"
temp_materials += " <span class='bad'>[all_materials[M] * coeff] [CallMaterialName(M)]</span>"
else
temp_materials += " [all_materials[M]/coeff] [CallMaterialName(M)]"
temp_materials += " [all_materials[M] * coeff] [CallMaterialName(M)]"
if (check_materials)
l += "<A href='?src=[REF(src)];imprint=[D.id]'>[D.name]</A>[temp_materials]"
else
@@ -488,16 +488,16 @@ Nothing else in the console has ID requirements.
var/temp_materials
var/check_materials = TRUE
var/all_materials = D.materials + D.reagents_list
var/coeff = linked_imprinter.efficiency_coeff
var/coeff = linked_imprinter.print_cost_coeff
if(!linked_imprinter.efficient_with(D.build_path))
coeff = 1
for(var/M in all_materials)
temp_materials += " | "
if (!linked_imprinter.check_mat(D, M))
check_materials = FALSE
temp_materials += " <span class='bad'>[all_materials[M]/coeff] [CallMaterialName(M)]</span>"
temp_materials += " <span class='bad'>[all_materials[M] * coeff] [CallMaterialName(M)]</span>"
else
temp_materials += " [all_materials[M]/coeff] [CallMaterialName(M)]"
temp_materials += " [all_materials[M] * coeff] [CallMaterialName(M)]"
if (check_materials)
l += "<A href='?src=[REF(src)];imprint=[D.id]'>[D.name]</A>[temp_materials]"
else