|
|
|
@@ -80,7 +80,7 @@
|
|
|
|
|
popup.open()
|
|
|
|
|
|
|
|
|
|
/obj/machinery/autoylathe/on_deconstruction()
|
|
|
|
|
GET_COMPONENT(materials, /datum/component/material_container)
|
|
|
|
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
|
|
|
|
materials.retrieve_all()
|
|
|
|
|
|
|
|
|
|
/obj/machinery/autoylathe/attackby(obj/item/O, mob/user, params)
|
|
|
|
@@ -166,7 +166,7 @@
|
|
|
|
|
var/plastic_cost = being_built.materials[MAT_PLASTIC]
|
|
|
|
|
var/power = max(2000, (metal_cost+glass_cost+plastic_cost)*multiplier/5)
|
|
|
|
|
|
|
|
|
|
GET_COMPONENT(materials, /datum/component/material_container)
|
|
|
|
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
|
|
|
|
if((materials.amount(MAT_METAL) >= metal_cost*multiplier*coeff) && (materials.amount(MAT_GLASS) >= glass_cost*multiplier*coeff) && (materials.amount(MAT_PLASTIC) >= plastic_cost*multiplier*coeff))
|
|
|
|
|
busy = TRUE
|
|
|
|
|
use_power(power)
|
|
|
|
@@ -190,7 +190,7 @@
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
/obj/machinery/autoylathe/proc/make_item(power, metal_cost, glass_cost, plastic_cost, multiplier, coeff, is_stack)
|
|
|
|
|
GET_COMPONENT(materials, /datum/component/material_container)
|
|
|
|
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
|
|
|
|
var/atom/A = drop_location()
|
|
|
|
|
use_power(power)
|
|
|
|
|
var/list/materials_used = list(MAT_METAL=metal_cost*coeff*multiplier, MAT_GLASS=glass_cost*coeff*multiplier, MAT_PLASTIC=plastic_cost*coeff*multiplier)
|
|
|
|
@@ -215,7 +215,7 @@
|
|
|
|
|
var/T = 0
|
|
|
|
|
for(var/obj/item/stock_parts/matter_bin/MB in component_parts)
|
|
|
|
|
T += MB.rating*75000
|
|
|
|
|
GET_COMPONENT(materials, /datum/component/material_container)
|
|
|
|
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
|
|
|
|
materials.max_amount = T
|
|
|
|
|
T=1.2
|
|
|
|
|
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
|
|
|
@@ -264,7 +264,7 @@
|
|
|
|
|
dat += "<a href='?src=[REF(src)];make=[D.id];multiplier=1'>[D.name]</a>"
|
|
|
|
|
|
|
|
|
|
if(ispath(D.build_path, /obj/item/stack))
|
|
|
|
|
GET_COMPONENT(materials, /datum/component/material_container)
|
|
|
|
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
|
|
|
|
var/max_multiplier = min(D.maxstack, D.materials[MAT_METAL] ?round(materials.amount(MAT_METAL)/D.materials[MAT_METAL]):INFINITY,D.materials[MAT_GLASS] ?round(materials.amount(MAT_GLASS)/D.materials[MAT_GLASS]):INFINITY,D.materials[MAT_PLASTIC] ?round(materials.amount(MAT_PLASTIC)/D.materials[MAT_PLASTIC]):INFINITY)
|
|
|
|
|
if (max_multiplier>10 && !disabled)
|
|
|
|
|
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=10'>x10</a>"
|
|
|
|
@@ -296,7 +296,7 @@
|
|
|
|
|
dat += "<a href='?src=[REF(src)];make=[D.id];multiplier=1'>[D.name]</a>"
|
|
|
|
|
|
|
|
|
|
if(ispath(D.build_path, /obj/item/stack))
|
|
|
|
|
GET_COMPONENT(materials, /datum/component/material_container)
|
|
|
|
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
|
|
|
|
var/max_multiplier = min(D.maxstack, D.materials[MAT_METAL] ?round(materials.amount(MAT_METAL)/D.materials[MAT_METAL]):INFINITY,D.materials[MAT_GLASS] ?round(materials.amount(MAT_GLASS)/D.materials[MAT_GLASS]):INFINITY,D.materials[MAT_PLASTIC] ?round(materials.amount(MAT_PLASTIC)/D.materials[MAT_PLASTIC]):INFINITY)
|
|
|
|
|
if (max_multiplier>10 && !disabled)
|
|
|
|
|
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=10'>x10</a>"
|
|
|
|
@@ -311,7 +311,7 @@
|
|
|
|
|
return dat
|
|
|
|
|
|
|
|
|
|
/obj/machinery/autoylathe/proc/materials_printout()
|
|
|
|
|
GET_COMPONENT(materials, /datum/component/material_container)
|
|
|
|
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
|
|
|
|
var/dat = "<b>Total amount:</b> [materials.total_amount] / [materials.max_amount] cm<sup>3</sup><br>"
|
|
|
|
|
for(var/mat_id in materials.materials)
|
|
|
|
|
var/datum/material/M = materials.materials[mat_id]
|
|
|
|
@@ -324,7 +324,7 @@
|
|
|
|
|
|
|
|
|
|
var/coeff = (ispath(D.build_path, /obj/item/stack) ? 1 : prod_coeff)
|
|
|
|
|
|
|
|
|
|
GET_COMPONENT(materials, /datum/component/material_container)
|
|
|
|
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
|
|
|
|
if(D.materials[MAT_METAL] && (materials.amount(MAT_METAL) < (D.materials[MAT_METAL] * coeff * amount)))
|
|
|
|
|
return FALSE
|
|
|
|
|
if(D.materials[MAT_GLASS] && (materials.amount(MAT_GLASS) < (D.materials[MAT_GLASS] * coeff * amount)))
|
|
|
|
|