Files
GS13NG/code/modules/research/circuitprinter.dm
Poojawa 0bca862419 Overhauls and 2/28 sync (#244)
* map tweaks/shuttle engines

* helpers and defines

* global/onclick

* controllers and datums

* mapping

* game folder

* some other stuff

* some modules

* modules that aren't mobs

* some mob stuff

* new player stuff

* mob living

* silicon stuff

* simple animal things

* carbon/ayylmao

* update_icons

* carbon/human

* sounds and tools

* icons and stuff

* hippie grinder changes + tgui

* kitchen.dmi

* compile issues fixed

* mapfix

* Mapfixes 2.0

* mapedit2.0

* mapmerger pls

* Revert "mapedit2.0"

This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481.

* clean up vore folder + 2 hotfixes

* admin ticket refinement

* Blob tweaks and LAZYADD

* LAZYADD IS LAZY

* Magic strings purged

* DEFINES NEED HIGHER PRIORITIES

* Only a sleepless idiot deals in absolute TRUE|FALSE

* u h g

* progress bar fix

* reverts ticket logs

* there's always that one guy

* fixes and stuff

* 2/27 fixes

* game folder stuff

* stats

* some modules again

* clothing stuff

gets vg clothing out of the main files

* everything not mobs again

* mob stuff

* maps, tgui, sql stuff

* icons

* additional fixes and compile errors

* don't need this anymore

* Oh right this isn't needed anymore

* maint bar re-added

* that doesn't need to be here

* stupid events

* wtfeven

* probably makes Travis happy

* don't care to fix the grinder atm

* fixes vending sprites, changes turret

* lethal, not lethals

* overylays are finicky creatures

* lazy fix for bleeding edgy (#252)

* map tweaks/shuttle engines

* helpers and defines

* global/onclick

* controllers and datums

* mapping

* game folder

* some other stuff

* some modules

* modules that aren't mobs

* some mob stuff

* new player stuff

* mob living

* silicon stuff

* simple animal things

* carbon/ayylmao

* update_icons

* carbon/human

* sounds and tools

* icons and stuff

* hippie grinder changes + tgui

* kitchen.dmi

* compile issues fixed

* mapfix

* Mapfixes 2.0

* mapedit2.0

* mapmerger pls

* Revert "mapedit2.0"

This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481.

* clean up vore folder + 2 hotfixes

* admin ticket refinement

* Blob tweaks and LAZYADD

* LAZYADD IS LAZY

* Magic strings purged

* DEFINES NEED HIGHER PRIORITIES

* Only a sleepless idiot deals in absolute TRUE|FALSE

* u h g

* progress bar fix

* reverts ticket logs

* there's always that one guy

* fixes and stuff

* 2/27 fixes

* game folder stuff

* stats

* some modules again

* clothing stuff

gets vg clothing out of the main files

* everything not mobs again

* mob stuff

* maps, tgui, sql stuff

* icons

* additional fixes and compile errors

* don't need this anymore

* Oh right this isn't needed anymore

* maint bar re-added

* that doesn't need to be here

* stupid events

* wtfeven

* probably makes Travis happy

* don't care to fix the grinder atm

* fixes vending sprites, changes turret

* lethal, not lethals

* overylays are finicky creatures
2017-02-28 09:30:49 -06:00

138 lines
4.8 KiB
Plaintext

/*///////////////Circuit Imprinter (By Darem)////////////////////////
Used to print new circuit boards (for computers and similar systems) and AI modules. Each circuit board pattern are stored in
a /datum/desgin on the linked R&D console. You can then print them out in a fasion similar to a regular lathe. However, instead of
using metal and glass, it uses glass and reagents (usually sulfuric acis).
*/
/obj/machinery/r_n_d/circuit_imprinter
name = "Circuit Imprinter"
desc = "Manufactures circuit boards for the construction of machines."
icon_state = "circuit_imprinter"
container_type = OPENCONTAINER
var/datum/material_container/materials
var/efficiency_coeff
var/list/categories = list(
"AI Modules",
"Computer Boards",
"Teleportation Machinery",
"Medical Machinery",
"Engineering Machinery",
"Exosuit Modules",
"Hydroponics Machinery",
"Subspace Telecomms",
"Research Machinery",
"Misc. Machinery",
"Computer Parts"
)
/obj/machinery/r_n_d/circuit_imprinter/New()
..()
materials = new(src, list(MAT_GLASS, MAT_GOLD, MAT_DIAMOND, MAT_METAL, MAT_BLUESPACE))
create_reagents(0)
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/circuit_imprinter(null)
B.apply_default_parts(src)
/obj/machinery/r_n_d/circuit_imprinter/Destroy()
qdel(materials)
return ..()
/obj/item/weapon/circuitboard/machine/circuit_imprinter
name = "Circuit Imprinter (Machine Board)"
build_path = /obj/machinery/r_n_d/circuit_imprinter
origin_tech = "engineering=2;programming=2"
req_components = list(
/obj/item/weapon/stock_parts/matter_bin = 1,
/obj/item/weapon/stock_parts/manipulator = 1,
/obj/item/weapon/reagent_containers/glass/beaker = 2)
/obj/machinery/r_n_d/circuit_imprinter/RefreshParts()
reagents.maximum_volume = 0
for(var/obj/item/weapon/reagent_containers/glass/G in component_parts)
reagents.maximum_volume += G.volume
G.reagents.trans_to(src, G.reagents.total_volume)
materials.max_amount = 0
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
materials.max_amount += M.rating * 75000
var/T = 0
for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts)
T += M.rating
efficiency_coeff = 2 ** (T - 1) //Only 1 manipulator here, you're making runtimes Razharas
/obj/machinery/r_n_d/circuit_imprinter/blob_act(obj/structure/blob/B)
if (prob(50))
qdel(src)
/obj/machinery/r_n_d/circuit_imprinter/proc/check_mat(datum/design/being_built, M) // now returns how many times the item can be built with the material
var/list/all_materials = being_built.reagents_list + being_built.materials
var/A = materials.amount(M)
if(!A)
A = reagents.get_reagent_amount(M)
return round(A / max(1, (all_materials[M]/efficiency_coeff)))
//we eject the materials upon deconstruction.
/obj/machinery/r_n_d/circuit_imprinter/on_deconstruction()
for(var/obj/item/weapon/reagent_containers/glass/G in component_parts)
reagents.trans_to(G, G.reagents.maximum_volume)
materials.retrieve_all()
..()
/obj/machinery/r_n_d/circuit_imprinter/disconnect_console()
linked_console.linked_imprinter = null
..()
/obj/machinery/r_n_d/circuit_imprinter/Insert_Item(obj/item/O, mob/user)
if(istype(O,/obj/item/stack/sheet))
. = 1
if(!is_insertion_ready(user))
return
var/sheet_material = materials.get_item_material_amount(O)
if(!sheet_material)
return
if(!materials.has_space(sheet_material))
user << "<span class='warning'>The [src.name]'s material bin is full! Please remove material before adding more.</span>"
return 1
var/obj/item/stack/sheet/stack = O
var/amount = round(input("How many sheets do you want to add?") as num)//No decimals
if(!in_range(src, stack) || !user.Adjacent(src))
return
var/amount_inserted = materials.insert_stack(O,amount)
if(!amount_inserted)
return 1
else
use_power(max(1000, (MINERAL_MATERIAL_AMOUNT*amount_inserted/10)))
user << "<span class='notice'>You add [amount_inserted] sheets to the [src.name].</span>"
updateUsrDialog()
else if(istype(O, /obj/item/weapon/ore/bluespace_crystal)) //Bluespace crystals can be either a stack or an item
. = 1
if(!is_insertion_ready(user))
return
var/bs_material = materials.get_item_material_amount(O)
if(!bs_material)
return
if(!materials.has_space(bs_material))
user << "<span class='warning'>The [src.name]'s material bin is full! Please remove material before adding more.</span>"
return 1
materials.insert_item(O)
use_power(MINERAL_MATERIAL_AMOUNT/10)
user << "<span class='notice'>You add [O] to the [src.name].</span>"
qdel(O)
updateUsrDialog()
else if(user.a_intent != INTENT_HARM)
user << "<span class='warning'>You cannot insert this item into the [name]!</span>"
return 1
else
return 0