mirror of
https://github.com/Aurorastation/Aurora-Old.git
synced 2026-07-19 11:42:21 +01:00
Initial Commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/**********************Ore to material recipes datum**************************/
|
||||
|
||||
var/list/AVAILABLE_ORES = typesof(/obj/item/weapon/ore)
|
||||
|
||||
/datum/material_recipe
|
||||
var/name
|
||||
var/list/obj/item/weapon/ore/recipe
|
||||
var/obj/prod_type //produced material/object type
|
||||
|
||||
New(var/param_name, var/param_recipe, var/param_prod_type)
|
||||
name = param_name
|
||||
recipe = param_recipe
|
||||
prod_type = param_prod_type
|
||||
|
||||
var/list/datum/material_recipe/MATERIAL_RECIPES = list(
|
||||
new/datum/material_recipe("Metal",list(/obj/item/weapon/ore/iron),/obj/item/stack/sheet/metal),
|
||||
new/datum/material_recipe("Glass",list(/obj/item/weapon/ore/glass),/obj/item/stack/sheet/glass),
|
||||
new/datum/material_recipe("Gold",list(/obj/item/weapon/ore/gold),/obj/item/stack/sheet/mineral/gold),
|
||||
new/datum/material_recipe("Silver",list(/obj/item/weapon/ore/silver),/obj/item/stack/sheet/mineral/silver),
|
||||
new/datum/material_recipe("Diamond",list(/obj/item/weapon/ore/diamond),/obj/item/stack/sheet/mineral/diamond),
|
||||
new/datum/material_recipe("Plasma",list(/obj/item/weapon/ore/plasma),/obj/item/stack/sheet/mineral/plasma),
|
||||
new/datum/material_recipe("Bananium",list(/obj/item/weapon/ore/clown),/obj/item/stack/sheet/mineral/clown),
|
||||
)
|
||||
@@ -0,0 +1,235 @@
|
||||
/*********************NEW AUTOLATHE / CRAFT LATHE***********************/
|
||||
|
||||
var/list/datum/craftlathe_item/CRAFT_ITEMS = list()
|
||||
var/CRAFT_ITEMS_SETUP = 1 //this should probably be a pre-game thing, but i'll do it so the first lathe2 that's created will set-up the recipes.
|
||||
|
||||
proc/check_craftlathe_recipe(var/list/param_recipe)
|
||||
if(param_recipe.len != 9)
|
||||
return
|
||||
var/i
|
||||
var/match = 0 //this one counts if there is at least one non-"" ingredient.
|
||||
for(var/datum/craftlathe_item/CI in CRAFT_ITEMS)
|
||||
match = 0
|
||||
for(i = 1; i <= 9; i++)
|
||||
if(CI.recipe[i] != param_recipe[i])
|
||||
match = 0 //use this so it passes by the match > 0 check below, otherwise i'd need a new variable to tell the return CI below that the check failed
|
||||
break
|
||||
if(CI.recipe[i] != "")
|
||||
match++
|
||||
if(match > 0)
|
||||
return CI
|
||||
return 0
|
||||
|
||||
/datum/craftlathe_item
|
||||
var/id = "" //must be unique for each item type. used to create recipes
|
||||
var/name = "unknown" //what the lathe will show as it's contents
|
||||
var/list/recipe = list("","","","","","","","","") //the 9 items here represent what items need to be placed in the lathe to produce this item.
|
||||
var/item_type = null //this is used on items like sheets which are added when inserted into the lathe.
|
||||
var/amount = 1
|
||||
var/amount_attackby = 1
|
||||
|
||||
/datum/craftlathe_item/New(var/param_id,var/param_name,var/param_amount,var/param_ammount_per_attackby,var/list/param_recipe,var/param_type = null)
|
||||
..()
|
||||
id = param_id
|
||||
name = param_name
|
||||
recipe = param_recipe
|
||||
item_type = param_type
|
||||
amount = param_amount;
|
||||
amount_attackby = param_ammount_per_attackby
|
||||
return
|
||||
|
||||
//this proc checks the recipe you give in it's parameter with the entire list of available items. If any match, it returns the item from CRAFT_ITEMS. the returned item should not be changed!!
|
||||
|
||||
/obj/machinery/autolathe2
|
||||
name = "Craft lathe"
|
||||
icon_state = "autolathe"
|
||||
density = 1
|
||||
anchored = 1
|
||||
var/datum/craftlathe_item/selected = null
|
||||
var/datum/craftlathe_item/make = null
|
||||
var/list/datum/craftlathe_item/craft_contents = list()
|
||||
var/list/current_recipe = list("","","","","","","","","")
|
||||
|
||||
/obj/machinery/autolathe2/New()
|
||||
..()
|
||||
if(CRAFT_ITEMS_SETUP)
|
||||
CRAFT_ITEMS_SETUP = 0
|
||||
build_recipes()
|
||||
return
|
||||
|
||||
/obj/machinery/autolathe2/attack_hand(mob/user as mob)
|
||||
var/dat
|
||||
dat = text("<h3>Craft Lathe</h3>")
|
||||
dat += text("<table><tr><td valign='top'>")
|
||||
|
||||
dat += text("<b>Materials</b><p>")
|
||||
var/datum/craftlathe_item/CI
|
||||
var/i
|
||||
for(i = 1; i <= craft_contents.len; i++)
|
||||
CI = craft_contents[i]
|
||||
if (CI == selected)
|
||||
dat += text("[CI.name] ([CI.amount])<br>")
|
||||
else
|
||||
dat += text("<A href='?src=\ref[src];select=[i]'>[CI.name]</a> ([CI.amount])<br>")
|
||||
|
||||
dat += text("</td><td valign='top'>")
|
||||
|
||||
dat += text("<b>Crafting Table</b><p>")
|
||||
|
||||
dat += text(" <table bgcolor='#cccccc' cellpadding='4' cellspacing='0'>")
|
||||
|
||||
var/j = 0
|
||||
var/k = 0
|
||||
for (i = 0; i < 3; i++)
|
||||
dat += text(" <tr>")
|
||||
for (j = 1; j <= 3; j++)
|
||||
k = i * 3 + j
|
||||
if (current_recipe[k])
|
||||
dat += text(" <td><A href='?src=\ref[src];remove=[k]'>[current_recipe[k]]</a></td>")
|
||||
else
|
||||
dat += text(" <td><A href='?src=\ref[src];add=[k]'>----</a></td>")
|
||||
dat += text(" </tr>")
|
||||
dat += text(" </table>")
|
||||
|
||||
dat += text("<br><br>")
|
||||
dat += text("<b>Will make: </b>")
|
||||
if (make)
|
||||
dat += text("<A href='?src=\ref[src];make=[1]'>[make.name]</a>")
|
||||
else
|
||||
dat += text("nothing useful")
|
||||
|
||||
dat += text("</td></tr></table>")
|
||||
user << browse("[dat]", "window=craft")
|
||||
|
||||
/obj/machinery/autolathe2/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["remove"])
|
||||
var/n = text2num(href_list["remove"])
|
||||
if(!n || n < 1 || n > 9)
|
||||
return
|
||||
current_recipe[n] = ""
|
||||
if(href_list["select"])
|
||||
var/n = text2num(href_list["select"])
|
||||
if(!n || n < 1 || n > 9)
|
||||
return
|
||||
selected = craft_contents[n]
|
||||
if(href_list["add"])
|
||||
var/n = text2num(href_list["add"])
|
||||
if(!n || n < 1 || n > 9)
|
||||
return
|
||||
if(selected)
|
||||
current_recipe[n] = selected.id
|
||||
if(href_list["make"])
|
||||
var/datum/craftlathe_item/MAKE = check_craftlathe_recipe(src.current_recipe)
|
||||
if(MAKE)
|
||||
for (var/datum/craftlathe_item/CI2 in craft_contents)
|
||||
if(CI2.id == MAKE.id)
|
||||
CI2.amount += CI2.amount_attackby
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
craft_contents += new/datum/craftlathe_item(MAKE.id,MAKE.name,MAKE.amount,MAKE.amount_attackby,MAKE.recipe,MAKE.item_type)
|
||||
var/datum/craftlathe_item/CI = check_craftlathe_recipe(src.current_recipe)
|
||||
if(CI)
|
||||
make = CI
|
||||
else
|
||||
make = null
|
||||
src.updateUsrDialog()
|
||||
|
||||
|
||||
|
||||
/obj/machinery/autolathe2/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
for (var/datum/craftlathe_item/CI in CRAFT_ITEMS)
|
||||
if(W.type == CI.item_type)
|
||||
for (var/datum/craftlathe_item/CI2 in craft_contents)
|
||||
if(CI2.item_type == W.type)
|
||||
CI2.amount += CI2.amount_attackby
|
||||
rmv_item(W)
|
||||
return
|
||||
craft_contents += new/datum/craftlathe_item(CI.id,CI.name,CI.amount,CI.amount_attackby,CI.recipe,CI.item_type)
|
||||
rmv_item(W)
|
||||
return
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/autolathe2/proc/rmv_item(obj/item/W as obj)
|
||||
if(istype(W,/obj/item/stack))
|
||||
var/obj/item/stack/S = W
|
||||
S.amount--
|
||||
if (S.amount <= 0)
|
||||
del(S)
|
||||
else
|
||||
del(W)
|
||||
|
||||
/obj/machinery/autolathe2/proc/build_recipes()
|
||||
//Parameters: ID, Name, Amount, Amount_added_per_attackby, Recipe, Object type
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("METAL","Metal",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/metal)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("R METAL","Reinforced Metal",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/r_metal)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("GLASS","Glass",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/glass)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("R GLASS","Reinforced Glass",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/rglass)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("GOLD","Gold",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/mineral/gold)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SILVER","Silver",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/mineral/silver)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("DIAMOND","Diamond",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/mineral/diamond)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("PLASMA","Plasma",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/mineral/plasma)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("URANIUM","Uranium",1,1,list("","","","","","","","",""),/obj/item/weapon/ore/mineral/uranium)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("CLOWN","Bananium",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/mineral/clown)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("ADMAMANTINE","Adamantine",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/mineral/adamantine)
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SCREWS","Screws",9,9,list("","","","","METAL","","","METAL",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("COGS","Cogs",9,9,list("","METAL","","METAL","METAL","METAL","","METAL",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SWITCH","Switch",12,12,list("METAL","","METAL","METAL","METAL","","METAL","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("KEYBOARD","Keyboard",1,1,list("","","","SWITCH","SWITCH","SWITCH","SWITCH","SWITCH","SWITCH"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("M PANEL","Metal Panel",10,10,list("","","","","METAL","METAL","","METAL","METAL"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("CASE","Equipment Case",1,1,list("M PANEL","M PANEL","M PANEL","M PANEL","","M PANEL","M PANEL","M PANEL","M PANEL"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("G PANEL","Glass Panel",10,10,list("","","","","GLASS","GLASS","","GLASS","GLASS"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SCREEN","Screen",1,1,list("","GLASS","","GLASS","PLASMA","GLASS","","GLASS",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("EL SILVER","Electronics Silver",30,30,list("","","","","SILVER","","","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("EL GOLD","Electronics Gold",6,6,list("","","","","GOLD","","","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("TINTED GL","Tinted Glass",2,2,list("","METAL","","","GLASS","","","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("TANK VALVE","Tank Transfer Valuve",1,1,list("","PIPE","","","PIPE","SWITCH","","PIPE",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("PIPE","Pipe",1,1,list("","M PANEL","","","M PANEL","","","M PANEL",""))
|
||||
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("CB FRAME","Circuitboard Frame",1,1,list("","","","M PANEL","G PANEL","M PANEL","G PANEL","M PANEL","G PANEL"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("ROM","ROM Module",1,1,list("EL SILVER","EL SILVER","EL SILVER","EL SILVER","","EL SILVER","EL SILVER","EL SILVER","EL SILVER"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("RAM","RAM Module",1,1,list("EL SILVER","EL SILVER","EL SILVER","EL SILVER","EL GOLD","EL SILVER","EL SILVER","EL SILVER","EL SILVER"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("PROCESSOR","Processor",1,1,list("EL GOLD","EL SILVER","EL GOLD","EL SILVER","EL SILVER","EL SILVER","EL SILVER","EL GOLD","EL SILVER"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("ANTENNA","Antenna",1,1,list("","","EL SILVER","","","EL SILVER","EL SILVER","EL SILVER","EL SILVER"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("OP RECEPTOR","Optic Receptor",1,1,list("G PANEL","G PANEL","G PANEL","","EL GOLD","","G PANEL","G PANEL","G PANEL"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("THERMAL OP R","Thermal Optic Receptor",1,1,list("","OP RECEPTOR","","ROM","DIAMOND","DIAMOND","","OP RECEPTOR",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("MASON OP R","Mason Optic Receptor",1,1,list("","OP RECEPTOR","","ROM","EL SILVER","EL SILVER","","OP RECEPTOR",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("EAR FRAME","Earpiece Frame",1,1,list("M PANEL","M PANEL","M PANEL","M PANEL","","M PANEL","M PANEL","M PANEL",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("RADIO M","Radio Module",1,1,list("","ANTENNA","","","ROM","","CB FRAME","CB FRAME","CB FRAME"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("EARPIECE","Radio Earpiece",1,1,list("","","","","RADIO M","","","EAR FRAME",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("EARMUFFS","Earmuffs",1,1,list("","M PANEL","","EAR FRAME","","EAR FRAME","","",""))
|
||||
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("GLASSES FRAME","Glasses Frame",1,1,list("M PANEL","","M PANEL","M PANEL","","M PANEL","M PANEL","M PANEL","M PANEL"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("MASONS","Mason Scanners",1,1,list("","","","MASON OP R","GLASSES FRAME","MASON OP R","","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("THERMALS","Thermal Scanners",1,1,list("","","","THERMAL OP R","GLASSES FRAME","THERMAL OP R","","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SUNGLASSES","Sunglasses",1,1,list("","","","TINTED GL","GLASSES FRAME","TINTED GL","","",""))
|
||||
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("HELMET FR","Helmet Frame",1,1,list("METAL","METAL","METAL","METAL","","METAL","","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("HELMET","Security Helmet",1,1,list("R METAL","R METAL","R METAL","R METAL","HELMET FR","R METAL","","GLASS",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("HOS HELMET","HoS Helmet",1,1,list("SILVER","GOLD","SILVER","SILVER","HELMET","SILVER","","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("HARDHAT","Hardhat",1,1,list("","FLASHLIGHT","","","HELMET FR","","","",""))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SWAT HELMET","SWAT Helmet",1,1,list("","","","","HELMET","","R GLASS","R GLASS","R GLASS"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("WELDING HELM","Welding Helmet",1,1,list("","","","","HELMET FR","","TINTED GL","TINTED GL","TINTED GL"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SPACE HELMET","Space Helmet",1,1,list("R METAL","SILVER","R METAL","SILVER","HELMET FR","SILVER","R GLASS","R GLASS","R GLASS"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("RIG HELMET","RIG Helmet",1,1,list("R METAL","SILVER","R METAL","SILVER","SPACE HELMET","SILVER","R GLASS","R GLASS","R GLASS"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("GAS MASK","Gas Mask",1,1,list("","","","","HELMET FR","TANK VALVE","","G PANEL",""))
|
||||
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("ARMOR FRAME","Armor Frame",1,1,list("R METAL","","R METAL","R METAL","R METAL","R METAL","R METAL","R METAL","R METAL"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("ARMOR","Armored Vest",1,1,list("R METAL","","R METAL","R METAL","ARMOR FRAME","R METAL","R METAL","R METAL","R METAL"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("HOS ARMOR","HoS Armor",1,1,list("DIAMOND","","DIAMOND","URANIUM","ARMOR","URANIUM","URANIUM","R METAL","URANIUM"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("CAP ARMOR","Captain Armor",1,1,list("DIAMOND","","DIAMOND","URANIUM","HOS ARMOR","URANIUM","URANIUM","R METAL","URANIUM"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SPACE S FR","Space Suit Frame",1,1,list("SILVER","","SILVER","SILVER","SILVER","SILVER","SILVER","SILVER","SILVER"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("SPACE SUIT","Space Suit",1,1,list("SILVER","","SILVER","RAM","SPACE S FR","RADIO M","SILVER","SILVEr","SILVER"))
|
||||
CRAFT_ITEMS += new/datum/craftlathe_item("RIG SUIT","RIG Suit",1,1,list("SILVER","","SILVER","SILVER","SPACE SUIT","SILVER","SILVER","SILVER","SILVER"))
|
||||
//TODO: Flashlight, type paths
|
||||
return
|
||||
|
||||
|
||||
|
||||
return
|
||||
@@ -0,0 +1,78 @@
|
||||
/**********************Gas extractor**************************/
|
||||
|
||||
/obj/machinery/mineral/gasextractor
|
||||
name = "Gas extractor"
|
||||
desc = "A machine which extracts gasses from ores"
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "aiupload"
|
||||
var/obj/machinery/mineral/input = null
|
||||
var/obj/machinery/mineral/output = null
|
||||
var/message = "";
|
||||
var/processing = 0
|
||||
var/newtoxins = 0
|
||||
density = 1
|
||||
anchored = 1.0
|
||||
|
||||
/obj/machinery/mineral/gasextractor/New()
|
||||
..()
|
||||
spawn( 5 )
|
||||
for (var/dir in cardinal)
|
||||
src.input = locate(/obj/machinery/mineral/input, get_step(src, dir))
|
||||
if(src.input) break
|
||||
for (var/dir in cardinal)
|
||||
src.output = locate(/obj/machinery/mineral/output, get_step(src, dir))
|
||||
if(src.output) break
|
||||
return
|
||||
return
|
||||
|
||||
/obj/machinery/mineral/gasextractor/attack_hand(user as mob)
|
||||
|
||||
if(processing == 1)
|
||||
user << "The machine is processing"
|
||||
return
|
||||
|
||||
var/dat
|
||||
dat = text("input connection status: ")
|
||||
if (input)
|
||||
dat += text("<b><font color='green'>CONNECTED</font></b>")
|
||||
else
|
||||
dat += text("<b><font color='red'>NOT CONNECTED</font></b>")
|
||||
dat += text("<br>output connection status: ")
|
||||
if (output)
|
||||
dat += text("<b><font color='green'>CONNECTED</font></b>")
|
||||
else
|
||||
dat += text("<b><font color='red'>NOT CONNECTED</font></b>")
|
||||
|
||||
dat += text("<br><br><A href='?src=\ref[src];extract=[input]'>Extract gas</A>")
|
||||
|
||||
dat += text("<br><br>Message: [message]")
|
||||
|
||||
user << browse("[dat]", "window=purifier")
|
||||
|
||||
/obj/machinery/mineral/gasextractor/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["extract"])
|
||||
if (src.output)
|
||||
if (locate(/obj/machinery/portable_atmospherics/canister,output.loc))
|
||||
newtoxins = 0
|
||||
processing = 1
|
||||
var/obj/item/weapon/ore/O
|
||||
while(locate(/obj/item/weapon/ore/plasma, input.loc) && locate(/obj/machinery/portable_atmospherics/canister,output.loc))
|
||||
O = locate(/obj/item/weapon/ore/plasma, input.loc)
|
||||
if (istype(O,/obj/item/weapon/ore/plasma))
|
||||
var/obj/machinery/portable_atmospherics/canister/C
|
||||
C = locate(/obj/machinery/portable_atmospherics/canister,output.loc)
|
||||
C.air_contents.toxins += 100
|
||||
newtoxins += 100
|
||||
del(O)
|
||||
sleep(5);
|
||||
processing = 0;
|
||||
message = "Canister filled with [newtoxins] units of toxins"
|
||||
else
|
||||
message = "No canister found"
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
@@ -0,0 +1,88 @@
|
||||
/**********************Mineral purifier (not used, replaced with mineral processing unit)**************************/
|
||||
|
||||
/obj/machinery/mineral/purifier
|
||||
name = "Ore Purifier"
|
||||
desc = "A machine which makes building material out of ores"
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "aiupload"
|
||||
var/obj/machinery/mineral/input = null
|
||||
var/obj/machinery/mineral/output = null
|
||||
var/processed = 0
|
||||
var/processing = 0
|
||||
density = 1
|
||||
anchored = 1.0
|
||||
|
||||
/obj/machinery/mineral/purifier/attack_hand(user as mob)
|
||||
|
||||
if(processing == 1)
|
||||
user << "The machine is processing"
|
||||
return
|
||||
|
||||
var/dat
|
||||
dat = text("input connection status: ")
|
||||
if (input)
|
||||
dat += text("<b><font color='green'>CONNECTED</font></b>")
|
||||
else
|
||||
dat += text("<b><font color='red'>NOT CONNECTED</font></b>")
|
||||
dat += text("<br>output connection status: ")
|
||||
if (output)
|
||||
dat += text("<b><font color='green'>CONNECTED</font></b>")
|
||||
else
|
||||
dat += text("<b><font color='red'>NOT CONNECTED</font></b>")
|
||||
|
||||
dat += text("<br><br><A href='?src=\ref[src];purify=[input]'>Purify</A>")
|
||||
|
||||
dat += text("<br><br>found: <font color='green'><b>[processed]</b></font>")
|
||||
user << browse("[dat]", "window=purifier")
|
||||
|
||||
/obj/machinery/mineral/purifier/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["purify"])
|
||||
if (src.output)
|
||||
processing = 1;
|
||||
var/obj/item/weapon/ore/O
|
||||
processed = 0;
|
||||
while(locate(/obj/item/weapon/ore, input.loc))
|
||||
O = locate(/obj/item/weapon/ore, input.loc)
|
||||
if (istype(O,/obj/item/weapon/ore/iron))
|
||||
new /obj/item/stack/sheet/metal(output.loc)
|
||||
del(O)
|
||||
if (istype(O,/obj/item/weapon/ore/diamond))
|
||||
new /obj/item/stack/sheet/mineral/diamond(output.loc)
|
||||
del(O)
|
||||
if (istype(O,/obj/item/weapon/ore/plasma))
|
||||
new /obj/item/stack/sheet/mineral/plasma(output.loc)
|
||||
del(O)
|
||||
if (istype(O,/obj/item/weapon/ore/gold))
|
||||
new /obj/item/stack/sheet/mineral/gold(output.loc)
|
||||
del(O)
|
||||
if (istype(O,/obj/item/weapon/ore/silver))
|
||||
new /obj/item/stack/sheet/mineral/silver(output.loc)
|
||||
del(O)
|
||||
if (istype(O,/obj/item/weapon/ore/uranium))
|
||||
new /obj/item/weapon/ore/mineral/uranium(output.loc)
|
||||
del(O)
|
||||
/*if (istype(O,/obj/item/weapon/ore/adamantine))
|
||||
new /obj/item/weapon/ore/adamantine(output.loc)
|
||||
del(O)*/ //Dunno what this area does so I'll keep it commented out for now -Durandan
|
||||
processed++
|
||||
sleep(5);
|
||||
processing = 0;
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/mineral/purifier/New()
|
||||
..()
|
||||
spawn( 5 )
|
||||
for (var/dir in cardinal)
|
||||
src.input = locate(/obj/machinery/mineral/input, get_step(src, dir))
|
||||
if(src.input) break
|
||||
for (var/dir in cardinal)
|
||||
src.output = locate(/obj/machinery/mineral/output, get_step(src, dir))
|
||||
if(src.output) break
|
||||
return
|
||||
return
|
||||
@@ -0,0 +1,174 @@
|
||||
/**********************Random mine generator************************/
|
||||
|
||||
//this item is intended to give the effect of entering the mine, so that light gradually fades
|
||||
/obj/effect/mine_generator
|
||||
name = "Random mine generator"
|
||||
anchored = 1
|
||||
unacidable = 1
|
||||
var/turf/last_loc
|
||||
var/turf/target_loc
|
||||
var/turf/start_loc
|
||||
var/randXParam //the value of these two parameters are generated by the code itself and used to
|
||||
var/randYParam //determine the random XY parameters
|
||||
var/mineDirection = 3
|
||||
/*
|
||||
0 = none
|
||||
1 = N
|
||||
2 = NNW
|
||||
3 = NW
|
||||
4 = WNW
|
||||
5 = W
|
||||
6 = WSW
|
||||
7 = SW
|
||||
8 = SSW
|
||||
9 = S
|
||||
10 = SSE
|
||||
11 = SE
|
||||
12 = ESE
|
||||
13 = E
|
||||
14 = ENE
|
||||
15 = NE
|
||||
16 = NNE
|
||||
*/
|
||||
|
||||
/obj/effect/mine_generator/New()
|
||||
last_loc = src.loc
|
||||
var/i
|
||||
for(i = 0; i < 50; i++)
|
||||
gererateTargetLoc()
|
||||
//target_loc = locate(last_loc.x + rand(5), last_loc.y + rand(5), src.z)
|
||||
fillWithAsteroids()
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/effect/mine_generator/proc/gererateTargetLoc() //this proc determines where the next square-room will end.
|
||||
switch(mineDirection)
|
||||
if(1)
|
||||
randXParam = 0
|
||||
randYParam = 4
|
||||
if(2)
|
||||
randXParam = 1
|
||||
randYParam = 3
|
||||
if(3)
|
||||
randXParam = 2
|
||||
randYParam = 2
|
||||
if(4)
|
||||
randXParam = 3
|
||||
randYParam = 1
|
||||
if(5)
|
||||
randXParam = 4
|
||||
randYParam = 0
|
||||
if(6)
|
||||
randXParam = 3
|
||||
randYParam = -1
|
||||
if(7)
|
||||
randXParam = 2
|
||||
randYParam = -2
|
||||
if(8)
|
||||
randXParam = 1
|
||||
randYParam = -3
|
||||
if(9)
|
||||
randXParam = 0
|
||||
randYParam = -4
|
||||
if(10)
|
||||
randXParam = -1
|
||||
randYParam = -3
|
||||
if(11)
|
||||
randXParam = -2
|
||||
randYParam = -2
|
||||
if(12)
|
||||
randXParam = -3
|
||||
randYParam = -1
|
||||
if(13)
|
||||
randXParam = -4
|
||||
randYParam = 0
|
||||
if(14)
|
||||
randXParam = -3
|
||||
randYParam = 1
|
||||
if(15)
|
||||
randXParam = -2
|
||||
randYParam = 2
|
||||
if(16)
|
||||
randXParam = -1
|
||||
randYParam = 3
|
||||
target_loc = last_loc
|
||||
if (randXParam > 0)
|
||||
target_loc = locate(target_loc.x+rand(randXParam),target_loc.y,src.z)
|
||||
if (randYParam > 0)
|
||||
target_loc = locate(target_loc.x,target_loc.y+rand(randYParam),src.z)
|
||||
if (randXParam < 0)
|
||||
target_loc = locate(target_loc.x-rand(-randXParam),target_loc.y,src.z)
|
||||
if (randYParam < 0)
|
||||
target_loc = locate(target_loc.x,target_loc.y-rand(-randXParam),src.z)
|
||||
if (mineDirection == 1 || mineDirection == 5 || mineDirection == 9 || mineDirection == 13) //if N,S,E,W, turn quickly
|
||||
if(prob(50))
|
||||
mineDirection += 2
|
||||
else
|
||||
mineDirection -= 2
|
||||
if(mineDirection < 1)
|
||||
mineDirection += 16
|
||||
else
|
||||
if(prob(50))
|
||||
if(prob(50))
|
||||
mineDirection += 1
|
||||
else
|
||||
mineDirection -= 1
|
||||
if(mineDirection < 1)
|
||||
mineDirection += 16
|
||||
return
|
||||
|
||||
|
||||
/obj/effect/mine_generator/proc/fillWithAsteroids()
|
||||
|
||||
if(last_loc)
|
||||
start_loc = last_loc
|
||||
|
||||
if(start_loc && target_loc)
|
||||
var/x1
|
||||
var/y1
|
||||
|
||||
var/turf/line_start = start_loc
|
||||
var/turf/column = line_start
|
||||
|
||||
if(start_loc.x <= target_loc.x)
|
||||
if(start_loc.y <= target_loc.y) //GOING NORTH-EAST
|
||||
for(y1 = start_loc.y; y1 <= target_loc.y; y1++)
|
||||
for(x1 = start_loc.x; x1 <= target_loc.x; x1++)
|
||||
new/turf/simulated/floor/plating/airless/asteroid(column)
|
||||
column = get_step(column,EAST)
|
||||
line_start = get_step(line_start,NORTH)
|
||||
column = line_start
|
||||
last_loc = target_loc
|
||||
return
|
||||
else //GOING NORTH-WEST
|
||||
for(y1 = start_loc.y; y1 >= target_loc.y; y1--)
|
||||
for(x1 = start_loc.x; x1 <= target_loc.x; x1++)
|
||||
new/turf/simulated/floor/plating/airless/asteroid(column)
|
||||
column = get_step(column,WEST)
|
||||
line_start = get_step(line_start,NORTH)
|
||||
column = line_start
|
||||
last_loc = target_loc
|
||||
return
|
||||
else
|
||||
if(start_loc.y <= target_loc.y) //GOING SOUTH-EAST
|
||||
for(y1 = start_loc.y; y1 <= target_loc.y; y1++)
|
||||
for(x1 = start_loc.x; x1 >= target_loc.x; x1--)
|
||||
new/turf/simulated/floor/plating/airless/asteroid(column)
|
||||
column = get_step(column,EAST)
|
||||
line_start = get_step(line_start,SOUTH)
|
||||
column = line_start
|
||||
last_loc = target_loc
|
||||
return
|
||||
else //GOING SOUTH-WEST
|
||||
for(y1 = start_loc.y; y1 >= target_loc.y; y1--)
|
||||
for(x1 = start_loc.x; x1 >= target_loc.x; x1--)
|
||||
new/turf/simulated/floor/plating/airless/asteroid(column)
|
||||
column = get_step(column,WEST)
|
||||
line_start = get_step(line_start,SOUTH)
|
||||
column = line_start
|
||||
last_loc = target_loc
|
||||
return
|
||||
|
||||
|
||||
return
|
||||
@@ -0,0 +1,338 @@
|
||||
/**********************Rail track**************************/
|
||||
|
||||
/obj/machinery/rail_track
|
||||
name = "Rail track"
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "rail"
|
||||
dir = 2
|
||||
var/id = null //this is needed for switches to work Set to the same on the whole length of the track
|
||||
anchored = 1
|
||||
|
||||
/**********************Rail intersection**************************/
|
||||
|
||||
/obj/machinery/rail_track/intersections
|
||||
name = "Rail track intersection"
|
||||
icon_state = "rail_intersection"
|
||||
|
||||
/obj/machinery/rail_track/intersections/attack_hand(user as mob)
|
||||
switch (dir)
|
||||
if (1) dir = 5
|
||||
if (5) dir = 4
|
||||
if (4) dir = 9
|
||||
if (9) dir = 2
|
||||
if (2) dir = 10
|
||||
if (10) dir = 8
|
||||
if (8) dir = 6
|
||||
if (6) dir = 1
|
||||
return
|
||||
|
||||
/obj/machinery/rail_track/intersections/NSE
|
||||
name = "Rail track T intersection"
|
||||
icon_state = "rail_intersection_NSE"
|
||||
dir = 2
|
||||
|
||||
/obj/machinery/rail_track/intersections/NSE/attack_hand(user as mob)
|
||||
switch (dir)
|
||||
if (1) dir = 5
|
||||
if (2) dir = 5
|
||||
if (5) dir = 9
|
||||
if (9) dir = 2
|
||||
return
|
||||
|
||||
/obj/machinery/rail_track/intersections/SEW
|
||||
name = "Rail track T intersection"
|
||||
icon_state = "rail_intersection_SEW"
|
||||
dir = 8
|
||||
|
||||
/obj/machinery/rail_track/intersections/SEW/attack_hand(user as mob)
|
||||
switch (dir)
|
||||
if (8) dir = 6
|
||||
if (4) dir = 6
|
||||
if (6) dir = 5
|
||||
if (5) dir = 8
|
||||
return
|
||||
|
||||
/obj/machinery/rail_track/intersections/NSW
|
||||
name = "Rail track T intersection"
|
||||
icon_state = "rail_intersection_NSW"
|
||||
dir = 2
|
||||
|
||||
/obj/machinery/rail_track/intersections/NSW/attack_hand(user as mob)
|
||||
switch (dir)
|
||||
if (1) dir = 10
|
||||
if (2) dir = 10
|
||||
if (10) dir = 6
|
||||
if (6) dir = 2
|
||||
return
|
||||
|
||||
/obj/machinery/rail_track/intersections/NEW
|
||||
name = "Rail track T intersection"
|
||||
icon_state = "rail_intersection_NEW"
|
||||
dir = 8
|
||||
|
||||
/obj/machinery/rail_track/intersections/NEW/attack_hand(user as mob)
|
||||
switch (dir)
|
||||
if (4) dir = 9
|
||||
if (8) dir = 9
|
||||
if (9) dir = 10
|
||||
if (10) dir = 8
|
||||
return
|
||||
|
||||
/**********************Rail switch**************************/
|
||||
|
||||
/obj/machinery/rail_switch
|
||||
name = "Rail switch"
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "rail"
|
||||
dir = 2
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "switch-off"
|
||||
var/obj/machinery/rail_track/track = null
|
||||
var/id //used for to change the track pieces
|
||||
|
||||
/obj/machinery/rail_switch/New()
|
||||
spawn(10)
|
||||
src.track = locate(/obj/machinery/rail_track, get_step(src, NORTH))
|
||||
if(track)
|
||||
id = track.id
|
||||
return
|
||||
|
||||
/obj/machinery/rail_switch/attack_hand(user as mob)
|
||||
user << "You switch the rail track's direction"
|
||||
for (var/obj/machinery/rail_track/T in world)
|
||||
if (T.id == src.id)
|
||||
var/obj/machinery/rail_car/C = locate(/obj/machinery/rail_car, T.loc)
|
||||
if (C)
|
||||
switch (T.dir)
|
||||
if(1)
|
||||
switch(C.direction)
|
||||
if("N") C.direction = "S"
|
||||
if("S") C.direction = "N"
|
||||
if("E") C.direction = "S"
|
||||
if("W") C.direction = "S"
|
||||
if(2)
|
||||
switch(C.direction)
|
||||
if("N") C.direction = "S"
|
||||
if("S") C.direction = "N"
|
||||
if("E") C.direction = "S"
|
||||
if("W") C.direction = "S"
|
||||
if(4)
|
||||
switch(C.direction)
|
||||
if("N") C.direction = "E"
|
||||
if("S") C.direction = "E"
|
||||
if("E") C.direction = "W"
|
||||
if("W") C.direction = "E"
|
||||
if(8)
|
||||
switch(C.direction)
|
||||
if("N") C.direction = "E"
|
||||
if("S") C.direction = "E"
|
||||
if("E") C.direction = "W"
|
||||
if("W") C.direction = "E"
|
||||
if(5)
|
||||
switch(C.direction)
|
||||
if("N") C.direction = "S"
|
||||
if("S") C.direction = "E"
|
||||
if("E") C.direction = "S"
|
||||
if("W") C.direction = "S"
|
||||
if(6)
|
||||
switch(C.direction)
|
||||
if("N") C.direction = "S"
|
||||
if("S") C.direction = "W"
|
||||
if("E") C.direction = "S"
|
||||
if("W") C.direction = "S"
|
||||
if(9)
|
||||
switch(C.direction)
|
||||
if("N") C.direction = "E"
|
||||
if("S") C.direction = "E"
|
||||
if("E") C.direction = "N"
|
||||
if("W") C.direction = "E"
|
||||
if(10)
|
||||
switch(C.direction)
|
||||
if("N") C.direction = "W"
|
||||
if("S") C.direction = "W"
|
||||
if("E") C.direction = "W"
|
||||
if("W") C.direction = "N"
|
||||
return
|
||||
|
||||
/**********************Rail car**************************/
|
||||
|
||||
/obj/machinery/rail_car
|
||||
name = "Rail car"
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "miningcar"
|
||||
var/direction = "S" //S = south, N = north, E = east, W = west. Determines whichw ay it'll look first
|
||||
var/moving = 0;
|
||||
anchored = 1
|
||||
density = 1
|
||||
var/speed = 0
|
||||
var/slowing = 0
|
||||
var/atom/movable/load = null //what it's carrying
|
||||
|
||||
/obj/machinery/rail_car/attack_hand(user as mob)
|
||||
if (moving == 0)
|
||||
processing_items.Add(src)
|
||||
moving = 1
|
||||
else
|
||||
processing_items.Remove(src)
|
||||
moving = 0
|
||||
return
|
||||
|
||||
/*
|
||||
for (var/client/C)
|
||||
C << "Dela."
|
||||
*/
|
||||
|
||||
/obj/machinery/rail_car/MouseDrop_T(var/atom/movable/C, mob/user)
|
||||
|
||||
if(user.stat)
|
||||
return
|
||||
|
||||
if (!istype(C) || C.anchored || get_dist(user, src) > 1 || get_dist(src,C) > 1 )
|
||||
return
|
||||
|
||||
if(ismob(C))
|
||||
load(C)
|
||||
|
||||
|
||||
/obj/machinery/rail_car/proc/load(var/atom/movable/C)
|
||||
|
||||
if(get_dist(C, src) > 1)
|
||||
return
|
||||
//mode = 1
|
||||
|
||||
C.loc = src.loc
|
||||
sleep(2)
|
||||
C.loc = src
|
||||
load = C
|
||||
|
||||
C.pixel_y += 9
|
||||
if(C.layer < layer)
|
||||
C.layer = layer + 0.1
|
||||
overlays += C
|
||||
|
||||
if(ismob(C))
|
||||
var/mob/M = C
|
||||
if(M.client)
|
||||
M.client.perspective = EYE_PERSPECTIVE
|
||||
M.client.eye = src
|
||||
|
||||
//mode = 0
|
||||
//send_status()
|
||||
|
||||
/obj/machinery/rail_car/proc/unload(var/dirn = 0)
|
||||
if(!load)
|
||||
return
|
||||
|
||||
overlays.Cut()
|
||||
|
||||
load.loc = src.loc
|
||||
load.pixel_y -= 9
|
||||
load.layer = initial(load.layer)
|
||||
if(ismob(load))
|
||||
var/mob/M = load
|
||||
if(M.client)
|
||||
M.client.perspective = MOB_PERSPECTIVE
|
||||
M.client.eye = src
|
||||
|
||||
|
||||
if(dirn)
|
||||
step(load, dirn)
|
||||
|
||||
load = null
|
||||
|
||||
// in case non-load items end up in contents, dump every else too
|
||||
// this seems to happen sometimes due to race conditions
|
||||
// with items dropping as mobs are loaded
|
||||
|
||||
for(var/atom/movable/AM in src)
|
||||
AM.loc = src.loc
|
||||
AM.layer = initial(AM.layer)
|
||||
AM.pixel_y = initial(AM.pixel_y)
|
||||
if(ismob(AM))
|
||||
var/mob/M = AM
|
||||
if(M.client)
|
||||
M.client.perspective = MOB_PERSPECTIVE
|
||||
M.client.eye = src
|
||||
|
||||
/obj/machinery/rail_car/relaymove(var/mob/user)
|
||||
if(user.stat)
|
||||
return
|
||||
if(load == user)
|
||||
unload(0)
|
||||
return
|
||||
|
||||
/obj/machinery/rail_car/process()
|
||||
if (moving == 1)
|
||||
if (slowing == 1)
|
||||
if (speed > 0)
|
||||
speed--;
|
||||
if (speed == 0)
|
||||
slowing = 0
|
||||
else
|
||||
if (speed < 10)
|
||||
speed++;
|
||||
var/i = 0
|
||||
for (i = 0; i < speed; i++)
|
||||
if (moving == 1)
|
||||
switch (direction)
|
||||
if ("S")
|
||||
for (var/obj/machinery/rail_track/R in locate(src.x,src.y-1,src.z))
|
||||
if (R.dir == 10)
|
||||
direction = "W"
|
||||
if (R.dir == 9)
|
||||
direction = "E"
|
||||
if (R.dir == 2 || R.dir == 1 || R.dir == 10 || R.dir == 9)
|
||||
for (var/mob/living/M in locate(src.x,src.y-1,src.z))
|
||||
step(M,get_dir(src,R))
|
||||
step(src,get_dir(src,R))
|
||||
break
|
||||
else
|
||||
moving = 0
|
||||
speed = 0
|
||||
if ("N")
|
||||
for (var/obj/machinery/rail_track/R in locate(src.x,src.y+1,src.z))
|
||||
if (R.dir == 5)
|
||||
direction = "E"
|
||||
if (R.dir == 6)
|
||||
direction = "W"
|
||||
if (R.dir == 5 || R.dir == 1 || R.dir == 6 || R.dir == 2)
|
||||
for (var/mob/living/M in locate(src.x,src.y+1,src.z))
|
||||
step(M,get_dir(src,R))
|
||||
step(src,get_dir(src,R))
|
||||
break
|
||||
else
|
||||
moving = 0
|
||||
speed = 0
|
||||
if ("E")
|
||||
for (var/obj/machinery/rail_track/R in locate(src.x+1,src.y,src.z))
|
||||
if (R.dir == 6)
|
||||
direction = "S"
|
||||
if (R.dir == 10)
|
||||
direction = "N"
|
||||
if (R.dir == 4 || R.dir == 8 || R.dir == 10 || R.dir == 6)
|
||||
for (var/mob/living/M in locate(src.x+1,src.y,src.z))
|
||||
step(M,get_dir(src,R))
|
||||
step(src,get_dir(src,R))
|
||||
break
|
||||
else
|
||||
moving = 0
|
||||
speed = 0
|
||||
if ("W")
|
||||
for (var/obj/machinery/rail_track/R in locate(src.x-1,src.y,src.z))
|
||||
if (R.dir == 9)
|
||||
direction = "N"
|
||||
if (R.dir == 5)
|
||||
direction = "S"
|
||||
if (R.dir == 8 || R.dir == 9 || R.dir == 5 || R.dir == 4)
|
||||
for (var/mob/living/M in locate(src.x-1,src.y,src.z))
|
||||
step(M,get_dir(src,R))
|
||||
step(src,get_dir(src,R))
|
||||
break
|
||||
else
|
||||
moving = 0
|
||||
speed = 0
|
||||
sleep(1)
|
||||
else
|
||||
processing_items.Remove(src)
|
||||
moving = 0
|
||||
return
|
||||
@@ -0,0 +1,173 @@
|
||||
/**********************Spaceship builder area definitions**************************/
|
||||
|
||||
/area/shipbuilder
|
||||
requires_power = 0
|
||||
luminosity = 1
|
||||
sd_lighting = 0
|
||||
|
||||
/area/shipbuilder/station
|
||||
name = "shipbuilder station"
|
||||
icon_state = "teleporter"
|
||||
|
||||
/area/shipbuilder/ship1
|
||||
name = "shipbuilder ship1"
|
||||
icon_state = "teleporter"
|
||||
|
||||
/area/shipbuilder/ship2
|
||||
name = "shipbuilder ship2"
|
||||
icon_state = "teleporter"
|
||||
|
||||
/area/shipbuilder/ship3
|
||||
name = "shipbuilder ship3"
|
||||
icon_state = "teleporter"
|
||||
|
||||
/area/shipbuilder/ship4
|
||||
name = "shipbuilder ship4"
|
||||
icon_state = "teleporter"
|
||||
|
||||
/area/shipbuilder/ship5
|
||||
name = "shipbuilder ship5"
|
||||
icon_state = "teleporter"
|
||||
|
||||
/area/shipbuilder/ship6
|
||||
name = "shipbuilder ship6"
|
||||
icon_state = "teleporter"
|
||||
|
||||
|
||||
/**********************Spaceship builder**************************/
|
||||
|
||||
/obj/machinery/spaceship_builder
|
||||
name = "Robotic Fabricator"
|
||||
icon = 'icons/obj/surgery.dmi'
|
||||
icon_state = "fab-idle"
|
||||
density = 1
|
||||
anchored = 1
|
||||
var/metal_amount = 0
|
||||
var/operating = 0
|
||||
var/area/currentShuttleArea = null
|
||||
var/currentShuttleName = null
|
||||
|
||||
/obj/machinery/spaceship_builder/proc/buildShuttle(var/shuttle)
|
||||
|
||||
var/shuttleat = null
|
||||
var/shuttleto = "/area/shipbuilder/station"
|
||||
|
||||
var/req_metal = 0
|
||||
switch(shuttle)
|
||||
if("hopper")
|
||||
shuttleat = "/area/shipbuilder/ship1"
|
||||
currentShuttleName = "Planet hopper"
|
||||
req_metal = 25000
|
||||
if("bus")
|
||||
shuttleat = "/area/shipbuilder/ship2"
|
||||
currentShuttleName = "Blnder Bus"
|
||||
req_metal = 60000
|
||||
if("dinghy")
|
||||
shuttleat = "/area/shipbuilder/ship3"
|
||||
currentShuttleName = "Space dinghy"
|
||||
req_metal = 100000
|
||||
if("van")
|
||||
shuttleat = "/area/shipbuilder/ship4"
|
||||
currentShuttleName = "Boxvan MMDLVI"
|
||||
req_metal = 120000
|
||||
if("secvan")
|
||||
shuttleat = "/area/shipbuilder/ship5"
|
||||
currentShuttleName = "Boxvan MMDLVI - Security edition"
|
||||
req_metal = 125000
|
||||
if("station4")
|
||||
shuttleat = "/area/shipbuilder/ship6"
|
||||
currentShuttleName = "Space station 4"
|
||||
req_metal = 250000
|
||||
|
||||
if (metal_amount - req_metal < 0)
|
||||
return
|
||||
|
||||
if (!shuttleat)
|
||||
return
|
||||
|
||||
var/area/from = locate(shuttleat)
|
||||
var/area/dest = locate(shuttleto)
|
||||
|
||||
if(!from || !dest)
|
||||
return
|
||||
|
||||
currentShuttleArea = shuttleat
|
||||
from.move_contents_to(dest)
|
||||
return
|
||||
|
||||
/obj/machinery/spaceship_builder/proc/scrapShuttle()
|
||||
|
||||
var/shuttleat = "/area/shipbuilder/station"
|
||||
var/shuttleto = currentShuttleArea
|
||||
|
||||
if (!shuttleto)
|
||||
return
|
||||
|
||||
var/area/from = locate(shuttleat)
|
||||
var/area/dest = locate(shuttleto)
|
||||
|
||||
if(!from || !dest)
|
||||
return
|
||||
|
||||
currentShuttleArea = null
|
||||
currentShuttleName = null
|
||||
from.move_contents_to(dest)
|
||||
return
|
||||
|
||||
/obj/machinery/spaceship_builder/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
if(operating == 1)
|
||||
user << "The machine is processing"
|
||||
return
|
||||
|
||||
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
|
||||
usr << "\red You don't have the dexterity to do this!"
|
||||
return
|
||||
|
||||
if (istype(W, /obj/item/stack/sheet/metal))
|
||||
|
||||
var/obj/item/stack/sheet/metal/M = W
|
||||
user << "\blue You insert all the metal into the machine."
|
||||
metal_amount += M.amount * 100
|
||||
del(M)
|
||||
|
||||
else
|
||||
return attack_hand(user)
|
||||
return
|
||||
|
||||
/obj/machinery/spaceship_builder/attack_hand(user as mob)
|
||||
if(operating == 1)
|
||||
user << "The machine is processing"
|
||||
return
|
||||
|
||||
var/dat
|
||||
dat = text("<b>Ship fabricator</b><br><br>")
|
||||
dat += text("Current ammount of <font color='gray'>Metal: <b>[metal_amount]</b></font><br><hr>")
|
||||
|
||||
if (currentShuttleArea)
|
||||
dat += text("<b>Currently building</b><br><br>[currentShuttleName]<br><br>")
|
||||
dat += text("<b>Build the shuttle to your liking.</b><br>This shuttle will be sent to the station in the event of an emergency along with a centcom emergency shuttle.")
|
||||
dat += text("<br><br><br><A href='?src=\ref[src];scrap=1'>Scrap current shuttle</A>")
|
||||
else
|
||||
dat += text("<b>Available ships to build:</b><br><br>")
|
||||
dat += text("<A href='?src=\ref[src];ship=hopper'>Planet hopper</A> - Tiny, Slow, 25000 metal<br>")
|
||||
dat += text("<A href='?src=\ref[src];ship=bus'>Blunder Bus</A> - Small, Decent speed, 60000 metal<br>")
|
||||
dat += text("<A href='?src=\ref[src];ship=dinghy'>Space dinghy</A> - Medium size, Decent speed, 100000 metal<br>")
|
||||
dat += text("<A href='?src=\ref[src];ship=van'>Boxvan MMDLVIr</A> - Medium size, Decent speed, 120000 metal<br>")
|
||||
dat += text("<A href='?src=\ref[src];ship=secvan'>Boxvan MMDLVI - Security eidition</A> - Large, Rather slow, 125000 metal<br>")
|
||||
dat += text("<A href='?src=\ref[src];ship=station4'>Space station 4</A> - Huge, Slow, 250000 metal<br>")
|
||||
|
||||
user << browse("[dat]", "window=shipbuilder")
|
||||
|
||||
|
||||
/obj/machinery/spaceship_builder/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["ship"])
|
||||
buildShuttle(href_list["ship"])
|
||||
if(href_list["scrap"])
|
||||
scrapShuttle(href_list["ship"])
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
Reference in New Issue
Block a user