Files
Bubberstation/code/game/research/protolathe.dm
T
morikou@gmail.com 470964c12c I'm-too-lazy-to-think-of-something-clever update:
- Moved circuit imprinter to code/game/research. Also, while it's being overhauled as part of the R&D update, it'll be removed from the rest of the station. Don't worry, it'll come back! Also, all the disk closets were removed as well.
- Circuit Imprinter now works like the protolathe: It needs to be connected to an R&D console and it get's it's production list from it.
- Replaced destructive analyzer icon (thanks Deuryn).
- New item type: Stock Parts. Used in the construction of certain items (none added yet but they're there for when they DO get added).

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@937 316c924e-a436-60f5-8080-3fe189b3f50e
2011-02-02 06:47:54 +00:00

69 lines
2.3 KiB
Plaintext

/*
Protolathe
Similar to an autolathe, you load glass and metal sheets (but not other objects) into it to be used as raw materials for the stuff
it creates. All the menus and other manipulation commands are in the R&D console.
Note: Must be placed west/left of and R&D console to function.
*/
/obj/machinery/protolathe
name = "Protolathe"
density = 1
anchored = 1.0
icon_state = "protolathe"
var/busy = 0 //
var/max_m_amount = 150000.0
var/max_g_amount = 75000.0
var/m_amount = 0.0
var/g_amount = 0.0
var/obj/machinery/computer/rdconsole/linked_console = null
/obj/machinery/protolathe/attackby(var/obj/item/O as obj, var/mob/user as mob)
if (!linked_console)
user << "\The protolathe must be linked to an R&D console first!"
return 1
if (!istype(O, /obj/item/stack))
user << "\red You cannot insert this item into the protolathe!"
return 1
if (stat)
return 1
if (busy)
user << "\red The protolathe is busy. Please wait for completion of previous operation."
return 1
if (src.m_amount + O.m_amt > max_m_amount)
user << "\red The protolathe is full. Please remove metal from the protolathe in order to insert more."
return 1
if (src.g_amount + O.g_amt > max_g_amount)
user << "\red The protolathe is full. Please remove glass from the protolathe in order to insert more."
return 1
if (O.m_amt == 0 && O.g_amt == 0)
user << "\red This object does not contain significant amounts of metal or glass, or cannot be accepted by the protolathe due to size or hazardous materials."
return 1
var/amount = 1
var/obj/item/stack/stack
var/m_amt = O.m_amt
var/g_amt = O.g_amt
stack = O
amount = stack.amount
if (m_amt)
amount = min(amount, round((max_m_amount-src.m_amount)/m_amt))
flick("protolathe_o",src)//plays metal insertion animation
if (g_amt)
amount = min(amount, round((max_g_amount-src.g_amount)/g_amt))
flick("protolathe_r",src)//plays glass insertion animation
stack.use(amount)
icon_state = "protolathe"
busy = 1
use_power(max(1000, (m_amt+g_amt)*amount/10))
spawn(16)
icon_state = "protolathe"
flick("protolathe_o",src)
src.m_amount += m_amt * amount
src.g_amount += g_amt * amount
if (O && O.loc == src)
del(O)
busy = 0
src.updateUsrDialog()
return