Adds Uranium Capability to Circuit Imprinters

Well, looking over the RUST circuits... They required uranium
which we didn't even have implemented in the code to work with
circuit imprinters. I considered simply changing them to use
a different resource, but it honestly makes more sense to improve
the current code to have it more versatile-- To this end, I've made
circuit imprinters capable of using uranium.

As a further note...

closes #2757
This commit is contained in:
NicholasDV
2013-06-10 00:12:28 -04:00
parent af234f7f1d
commit 0b20496f7d
3 changed files with 24 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
var/g_amount = 0 var/g_amount = 0
var/gold_amount = 0 var/gold_amount = 0
var/diamond_amount = 0 var/diamond_amount = 0
var/uranium_amount = 0
var/max_material_amount = 75000.0 var/max_material_amount = 75000.0
New() New()
@@ -46,7 +47,7 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
return return
proc/TotalMaterials() proc/TotalMaterials()
return g_amount + gold_amount + diamond_amount return g_amount + gold_amount + diamond_amount + uranium_amount
attackby(var/obj/item/O as obj, var/mob/user as mob) attackby(var/obj/item/O as obj, var/mob/user as mob)
if (shocked) if (shocked)
@@ -85,19 +86,23 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
if(diamond_amount >= 2000) if(diamond_amount >= 2000)
var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond(src.loc) var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond(src.loc)
G.amount = round(diamond_amount / 2000) G.amount = round(diamond_amount / 2000)
if(uranium_amount >= 2000)
var/obj/item/stack/sheet/mineral/uranium/G = new /obj/item/stack/sheet/mineral/uranium(src.loc)
G.amount = round(uranium_amount / 2000)
del(src) del(src)
return 1 return 1
else else
user << "\red You can't load the [src.name] while it's opened." user << "\red You can't load the [src.name] while it's opened."
return 1 return 1
if (disabled) if (disabled)
user << "\The [name] appears to not be working!"
return return
if (!linked_console) if (!linked_console)
user << "\The [name] must be linked to an R&D console first!" user << "\The [name] must be linked to an R&D console first!"
return 1 return 1
if (O.is_open_container()) if (O.is_open_container())
return 1 return 1
if (!istype(O, /obj/item/stack/sheet/glass) && !istype(O, /obj/item/stack/sheet/mineral/gold) && !istype(O, /obj/item/stack/sheet/mineral/diamond)) if (!istype(O, /obj/item/stack/sheet/glass) && !istype(O, /obj/item/stack/sheet/mineral/gold) && !istype(O, /obj/item/stack/sheet/mineral/diamond) && !istype(O, /obj/item/stack/sheet/mineral/uranium))
user << "\red You cannot insert this item into the [name]!" user << "\red You cannot insert this item into the [name]!"
return 1 return 1
if (stat) if (stat)
@@ -128,6 +133,8 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
gold_amount += amount * 2000 gold_amount += amount * 2000
else if(istype(stack, /obj/item/stack/sheet/mineral/diamond)) else if(istype(stack, /obj/item/stack/sheet/mineral/diamond))
diamond_amount += amount * 2000 diamond_amount += amount * 2000
else if(istype(stack, /obj/item/stack/sheet/mineral/uranium))
uranium_amount += amount * 2000
stack.use(amount) stack.use(amount)
busy = 0 busy = 0
src.updateUsrDialog() src.updateUsrDialog()

View File

@@ -429,6 +429,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
linked_imprinter.gold_amount = max(0, (linked_imprinter.gold_amount-being_built.materials[M])) linked_imprinter.gold_amount = max(0, (linked_imprinter.gold_amount-being_built.materials[M]))
if("$diamond") if("$diamond")
linked_imprinter.diamond_amount = max(0, (linked_imprinter.diamond_amount-being_built.materials[M])) linked_imprinter.diamond_amount = max(0, (linked_imprinter.diamond_amount-being_built.materials[M]))
if("$uranium")
linked_imprinter.uranium_amount = max(0, (linked_imprinter.uranium_amount-being_built.materials[M]))
else else
linked_imprinter.reagents.remove_reagent(M, being_built.materials[M]) linked_imprinter.reagents.remove_reagent(M, being_built.materials[M])
var/obj/new_item = new being_built.build_path(src) var/obj/new_item = new being_built.build_path(src)
@@ -500,6 +502,9 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if("diamond") if("diamond")
type = /obj/item/stack/sheet/mineral/diamond type = /obj/item/stack/sheet/mineral/diamond
res_amount = "diamond_amount" res_amount = "diamond_amount"
if("uranium")
type = /obj/item/stack/sheet/mineral/uranium
res_amount = "uranium_amount"
if(ispath(type) && hasvar(linked_imprinter, res_amount)) if(ispath(type) && hasvar(linked_imprinter, res_amount))
var/obj/item/stack/sheet/sheet = new type(linked_imprinter.loc) var/obj/item/stack/sheet/sheet = new type(linked_imprinter.loc)
var/available_num_sheets = round(linked_imprinter.vars[res_amount]/sheet.perunit) var/available_num_sheets = round(linked_imprinter.vars[res_amount]/sheet.perunit)
@@ -851,6 +856,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(D.materials[M] > linked_imprinter.gold_amount) check_materials = 0 if(D.materials[M] > linked_imprinter.gold_amount) check_materials = 0
if("$diamond") if("$diamond")
if(D.materials[M] > linked_imprinter.diamond_amount) check_materials = 0 if(D.materials[M] > linked_imprinter.diamond_amount) check_materials = 0
if("$uranium")
if(D.materials[M] > linked_imprinter.uranium_amount) check_materials = 0
else if (!linked_imprinter.reagents.has_reagent(M, D.materials[M])) else if (!linked_imprinter.reagents.has_reagent(M, D.materials[M]))
check_materials = 0 check_materials = 0
if (check_materials) if (check_materials)
@@ -891,6 +898,13 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(linked_imprinter.diamond_amount >= 2000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=diamond;imprinter_ejectsheet_amt=1'>(1 Sheet)</A> " if(linked_imprinter.diamond_amount >= 2000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=diamond;imprinter_ejectsheet_amt=1'>(1 Sheet)</A> "
if(linked_imprinter.diamond_amount >= 10000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=diamond;imprinter_ejectsheet_amt=5'>(5 Sheets)</A> " if(linked_imprinter.diamond_amount >= 10000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=diamond;imprinter_ejectsheet_amt=5'>(5 Sheets)</A> "
if(linked_imprinter.diamond_amount >= 2000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=diamond;imprinter_ejectsheet_amt=50'>(Max Sheets)</A>" if(linked_imprinter.diamond_amount >= 2000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=diamond;imprinter_ejectsheet_amt=50'>(Max Sheets)</A>"
dat += "<BR>"
//Uranium
dat += "* [linked_imprinter.uranium_amount] cm<sup>3</sup> of Uranium || "
dat += "Eject: "
if(linked_imprinter.uranium_amount >= 2000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=uranium;imprinter_ejectsheet_amt=1'>(1 Sheet)</A> "
if(linked_imprinter.uranium_amount >= 10000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=uranium;imprinter_ejectsheet_amt=5'>(5 Sheets)</A> "
if(linked_imprinter.uranium_amount >= 2000) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=uranium;imprinter_ejectsheet_amt=50'>(Max Sheets)</A>"
user << browse("<TITLE>Research and Development Console</TITLE><HR>[dat]", "window=rdconsole;size=575x400") user << browse("<TITLE>Research and Development Console</TITLE><HR>[dat]", "window=rdconsole;size=575x400")
onclose(user, "rdconsole") onclose(user, "rdconsole")

View File

@@ -225,7 +225,7 @@ datum/tech/programming
datum/tech/syndicate datum/tech/syndicate
name = "Illegal Technologies Research" name = "Illegal Technologies Research"
desc = "The study of technologies that violate Nanotrassen regulations." desc = "The study of technologies that violate standard Nanotrasen regulations."
id = "syndicate" id = "syndicate"
/* /*