Merge pull request #797 from Kelenius/lathefix

Fixes #94
This commit is contained in:
Datraen
2016-01-24 18:19:48 -05:00
5 changed files with 23 additions and 57 deletions
+1 -2
View File
@@ -9,7 +9,7 @@
var/default_type = DEFAULT_WALL_MATERIAL
var/material/material
var/perunit
var/perunit = SHEET_MATERIAL_AMOUNT
var/apply_colour //temp pending icon rewrite
/obj/item/stack/material/New()
@@ -28,7 +28,6 @@
stacktype = material.stack_type
if(islist(material.stack_origin_tech))
origin_tech = material.stack_origin_tech.Copy()
perunit = SHEET_MATERIAL_AMOUNT
if(apply_colour)
color = material.icon_colour
+2 -2
View File
@@ -8,8 +8,6 @@ using metal and glass, it uses glass and reagents (usually sulphuric acid).
name = "Circuit Imprinter"
icon_state = "circuit_imprinter"
flags = OPENCONTAINER
var/list/materials = list("metal" = 0, "glass" = 0, "gold" = 0, "silver" = 0, "phoron" = 0, "uranium" = 0, "diamond" = 0)
var/list/datum/design/queue = list()
var/progress = 0
@@ -17,6 +15,8 @@ using metal and glass, it uses glass and reagents (usually sulphuric acid).
var/mat_efficiency = 1
var/speed = 1
materials = list("metal" = 0, "glass" = 0, "gold" = 0, "silver" = 0, "phoron" = 0, "uranium" = 0, "diamond" = 0)
use_power = 1
idle_power_usage = 30
active_power_usage = 2500
+2 -1
View File
@@ -8,7 +8,6 @@
active_power_usage = 5000
var/max_material_storage = 100000
var/list/materials = list(DEFAULT_WALL_MATERIAL = 0, "glass" = 0, "gold" = 0, "silver" = 0, "phoron" = 0, "uranium" = 0, "diamond" = 0)
var/list/datum/design/queue = list()
var/progress = 0
@@ -16,6 +15,8 @@
var/mat_efficiency = 1
var/speed = 1
materials = list(DEFAULT_WALL_MATERIAL = 0, "glass" = 0, "gold" = 0, "silver" = 0, "phoron" = 0, "uranium" = 0, "diamond" = 0)
/obj/machinery/r_n_d/protolathe/New()
..()
component_parts = list()
+2 -51
View File
@@ -360,59 +360,10 @@ won't update every console in existence) but it's more of a hassle to do. Also,
linked_lathe.removeFromQueue(text2num(href_list["removeP"]))
else if(href_list["lathe_ejectsheet"] && linked_lathe) //Causes the protolathe to eject a sheet of material
var/desired_num_sheets = text2num(href_list["amount"])
var/res_amount, type
var/material/M = get_material_by_name(href_list["lathe_ejectsheet"])
if(istype(M))
type = M.stack_type
switch(M.name)
if(DEFAULT_WALL_MATERIAL)
res_amount = "m_amount"
if("glass")
res_amount = "g_amount"
if("gold")
res_amount = "gold_amount"
if("silver")
res_amount = "silver_amount"
if("phoron")
res_amount = "phoron_amount"
if("uranium")
res_amount = "uranium_amount"
if("diamond")
res_amount = "diamond_amount"
linked_lathe.eject(href_list["lathe_ejectsheet"], text2num(href_list["amount"]))
if(ispath(type) && hasvar(linked_lathe, res_amount))
var/obj/item/stack/material/sheet = new type(linked_lathe.loc)
var/available_num_sheets = round(linked_lathe.vars[res_amount]/sheet.perunit)
if(available_num_sheets > 0)
sheet.amount = min(available_num_sheets, desired_num_sheets)
linked_lathe.vars[res_amount] = max(0, (linked_lathe.vars[res_amount] - sheet.amount * sheet.perunit))
else
qdel(sheet)
else if(href_list["imprinter_ejectsheet"] && linked_imprinter) //Causes the protolathe to eject a sheet of material
var/desired_num_sheets = text2num(href_list["amount"])
var/res_amount, type
switch(href_list["imprinter_ejectsheet"])
if("glass")
type = /obj/item/stack/material/glass
res_amount = "g_amount"
if("gold")
type = /obj/item/stack/material/gold
res_amount = "gold_amount"
if("diamond")
type = /obj/item/stack/material/diamond
res_amount = "diamond_amount"
if("uranium")
type = /obj/item/stack/material/uranium
res_amount = "uranium_amount"
if(ispath(type) && hasvar(linked_imprinter, res_amount))
var/obj/item/stack/material/sheet = new type(linked_imprinter.loc)
var/available_num_sheets = round(linked_imprinter.vars[res_amount]/sheet.perunit)
if(available_num_sheets>0)
sheet.amount = min(available_num_sheets, desired_num_sheets)
linked_imprinter.vars[res_amount] = max(0, (linked_imprinter.vars[res_amount] - sheet.amount * sheet.perunit))
else
qdel(sheet)
linked_imprinter.eject(href_list["imprinter_ejectsheet"], text2num(href_list["amount"]))
else if(href_list["find_device"]) //The R&D console looks for devices nearby to link up with.
screen = 0.0
+16 -1
View File
@@ -11,6 +11,8 @@
var/busy = 0
var/obj/machinery/computer/rdconsole/linked_console
var/list/materials = list()
/obj/machinery/r_n_d/attack_hand(mob/user as mob)
return
@@ -47,4 +49,17 @@
if(/obj/item/stack/material/uranium)
return "uranium"
if(/obj/item/stack/material/diamond)
return "diamond"
return "diamond"
/obj/machinery/r_n_d/proc/eject(var/material, var/amount)
if(!(material in materials))
return
var/obj/item/stack/material/sheetType = getMaterialType(material)
var/perUnit = initial(sheetType.perunit)
var/eject = round(materials[material] / perUnit)
eject = amount == -1 ? eject : min(eject, amount)
if(eject < 1)
return
var/obj/item/stack/material/S = new sheetType(loc)
S.amount = eject
materials[material] -= eject * perUnit