Stacking machine refactored.

This commit is contained in:
Rob Nelson
2013-11-19 10:35:07 -08:00
parent ab9d7319df
commit 2978f45f4b
2 changed files with 340 additions and 363 deletions

View File

@@ -0,0 +1,299 @@
/sound/turntable/test
file = 'sound/turntable/TestLoop1.ogg'
falloff = 2
repeat = 1
/mob/var/music = 0
/obj/machinery/party/turntable
name = "turntable"
desc = "A turntable used for parties and shit."
icon = 'icons/effects/lasers2.dmi'
icon_state = "turntable"
var/playing = 0
anchored = 1
var/list/music=list()
/obj/machinery/party/mixer
name = "mixer"
desc = "A mixing board for mixing music"
icon = 'icons/effects/lasers2.dmi'
icon_state = "mixer"
anchored = 1
/obj/machinery/party/turntable/New()
..()
sleep(2)
new /sound/turntable/test(src)
return
/obj/machinery/party/turntable/attack_hand(mob/user as mob)
var/t = "<B>Turntable Interface</B><br><br>"
//t += "<A href='?src=\ref[src];on=1'>On</A><br>"
t += "<A href='?src=\ref[src];off=1'>Off</A><br><br>"
t += "<A href='?src=\ref[src];on1=Testloop1'>One</A><br>"
//t += "<A href='?src=\ref[src];on2=Testloop2'>TestLoop2</A><br>"
//t += "<A href='?src=\ref[src];on3=Testloop3'>TestLoop3</A><br>"
user << browse(t, "window=turntable;size=420x700")
/obj/machinery/party/turntable/proc/playSound(var/name)
/obj/machinery/party/turntable/Topic(href, href_list)
..()
if( href_list["on1"] )
if(src.playing == 0)
//world << "Should be working..."
var/sound/S = sound('sound/turntable/TestLoop1.ogg')
S.repeat = 1
S.channel = 10
S.falloff = 2
S.wait = 1
S.environment = 0
//for(var/mob/M in world)
// if(M.loc.loc == src.loc.loc && M.music == 0)
// world << "Found the song..."
// M << S
// M.music = 1
var/area/A = src.loc.loc
for(var/area/RA in A.related)
for(var/obj/machinery/party/lasermachine/L in RA)
L.turnon()
playing = 1
while(playing == 1)
for(var/mob/M in world)
if((M.loc.loc in A.related) && M.music == 0)
//world << "Found the song..."
M << S
M.music = 1
else if(!(M.loc.loc in A.related) && M.music == 1)
var/sound/Soff = sound(null)
Soff.channel = 10
M << Soff
M.music = 0
sleep(10)
return
if( href_list["on2"] )
if(src.playing == 0)
//world << "Should be working..."
var/sound/S = sound('sound/turntable/TestLoop2.ogg')
S.repeat = 1
S.channel = 10
S.falloff = 2
S.wait = 1
S.environment = 0
//for(var/mob/M in world)
// if(M.loc.loc == src.loc.loc && M.music == 0)
// world << "Found the song..."
// M << S
// M.music = 1
var/area/A = src.loc.loc
for(var/obj/machinery/party/lasermachine/L in A)
L.turnon()
playing = 1
while(playing == 1)
for(var/mob/M in world)
if(M.loc.loc == src.loc.loc && M.music == 0)
//world << "Found the song..."
M << S
M.music = 1
else if(M.loc.loc != src.loc.loc && M.music == 1)
var/sound/Soff = sound(null)
Soff.channel = 10
M << Soff
M.music = 0
sleep(10)
return
if( href_list["on3"] )
if(src.playing == 0)
//world << "Should be working..."
var/sound/S = sound('sound/turntable/TestLoop3.ogg')
S.repeat = 1
S.channel = 10
S.falloff = 2
S.wait = 1
S.environment = 0
//for(var/mob/M in world)
// if(M.loc.loc == src.loc.loc && M.music == 0)
// world << "Found the song..."
// M << S
// M.music = 1
var/area/A = src.loc.loc
for(var/obj/machinery/party/lasermachine/L in A)
L.turnon()
playing = 1
while(playing == 1)
for(var/mob/M in world)
if(M.loc.loc == src.loc.loc && M.music == 0)
//world << "Found the song..."
M << S
M.music = 1
else if(M.loc.loc != src.loc.loc && M.music == 1)
var/sound/Soff = sound(null)
Soff.channel = 10
M << Soff
M.music = 0
sleep(10)
return
if( href_list["off"] )
if(src.playing == 1)
var/sound/S = sound(null)
S.channel = 10
S.wait = 1
for(var/mob/M in world)
M << S
M.music = 0
playing = 0
var/area/A = src.loc.loc
for(var/area/RA in A.related)
for(var/obj/machinery/party/lasermachine/L in RA)
L.turnoff()
/obj/machinery/party/lasermachine
name = "laser machine"
desc = "A laser machine that shoots lasers."
icon = 'icons/effects/lasers2.dmi'
icon_state = "lasermachine"
anchored = 1
var/mirrored = 0
/obj/effects/laser
name = "laser"
desc = "A laser..."
icon = 'icons/effects/lasers2.dmi'
icon_state = "laserred1"
anchored = 1
layer = 4
/obj/item/lasermachine/New()
..()
/obj/machinery/party/lasermachine/proc/turnon()
var/wall = 0
var/cycle = 1
var/area/A = get_area(src)
var/X = 1
var/Y = 0
if(mirrored == 0)
while(wall == 0)
if(cycle == 1)
var/obj/effects/laser/F = new/obj/effects/laser(src)
F.x = src.x+X
F.y = src.y+Y
F.z = src.z
F.icon_state = "laserred1"
var/area/AA = get_area(F)
var/turf/T = get_turf(F)
if(T.density == 1 || AA.name != A.name)
del(F)
return
cycle++
if(cycle > 3)
cycle = 1
X++
if(cycle == 2)
var/obj/effects/laser/F = new/obj/effects/laser(src)
F.x = src.x+X
F.y = src.y+Y
F.z = src.z
F.icon_state = "laserred2"
var/area/AA = get_area(F)
var/turf/T = get_turf(F)
if(T.density == 1 || AA.name != A.name)
del(F)
return
cycle++
if(cycle > 3)
cycle = 1
Y++
if(cycle == 3)
var/obj/effects/laser/F = new/obj/effects/laser(src)
F.x = src.x+X
F.y = src.y+Y
F.z = src.z
F.icon_state = "laserred3"
var/area/AA = get_area(F)
var/turf/T = get_turf(F)
if(T.density == 1 || AA.name != A.name)
del(F)
return
cycle++
if(cycle > 3)
cycle = 1
X++
if(mirrored == 1)
while(wall == 0)
if(cycle == 1)
var/obj/effects/laser/F = new/obj/effects/laser(src)
F.x = src.x+X
F.y = src.y-Y
F.z = src.z
F.icon_state = "laserred1m"
var/area/AA = get_area(F)
var/turf/T = get_turf(F)
if(T.density == 1 || AA.name != A.name)
del(F)
return
cycle++
if(cycle > 3)
cycle = 1
Y++
if(cycle == 2)
var/obj/effects/laser/F = new/obj/effects/laser(src)
F.x = src.x+X
F.y = src.y-Y
F.z = src.z
F.icon_state = "laserred2m"
var/area/AA = get_area(F)
var/turf/T = get_turf(F)
if(T.density == 1 || AA.name != A.name)
del(F)
return
cycle++
if(cycle > 3)
cycle = 1
X++
if(cycle == 3)
var/obj/effects/laser/F = new/obj/effects/laser(src)
F.x = src.x+X
F.y = src.y-Y
F.z = src.z
F.icon_state = "laserred3m"
var/area/AA = get_area(F)
var/turf/T = get_turf(F)
if(T.density == 1 || AA.name != A.name)
del(F)
return
cycle++
if(cycle > 3)
cycle = 1
X++
/obj/machinery/party/lasermachine/proc/turnoff()
var/area/A = src.loc.loc
for(var/area/RA in A.related)
for(var/obj/effects/laser/F in RA)
del(F)
/*
/mob/living/carbon/human/verb/Herbize()
set hidden = 1
if(usr.real_name == "Herb Derpman")
var/newsuit = "[usr:wear_suit:icon_state]fat"
var/newuniform = "[usr:w_uniform:item_color]fat"
usr:wear_suit:icon_state = newsuit
usr:w_uniform:item_color = newuniform
else
usr << "You need more donuts before you can do this."
*/

View File

@@ -32,44 +32,10 @@
dat += text("<b>Stacking unit console</b><br><br>")
if(machine.ore_iron)
dat += text("Iron: [machine.ore_iron] <A href='?src=\ref[src];release=iron'>Release</A><br>")
if(machine.ore_plasteel)
dat += text("Plasteel: [machine.ore_plasteel] <A href='?src=\ref[src];release=plasteel'>Release</A><br>")
if(machine.ore_glass)
dat += text("Glass: [machine.ore_glass] <A href='?src=\ref[src];release=glass'>Release</A><br>")
if(machine.ore_rglass)
dat += text("Reinforced Glass: [machine.ore_rglass] <A href='?src=\ref[src];release=rglass'>Release</A><br>")
if(machine.ore_plasma)
dat += text("Plasma: [machine.ore_plasma] <A href='?src=\ref[src];release=plasma'>Release</A><br>")
if(machine.ore_plasmaglass)
dat += text("Plasma Glass: [machine.ore_plasmaglass] <A href='?src=\ref[src];release=plasmaglass'>Release</A><br>")
if(machine.ore_plasmarglass)
dat += text("Reinforced Plasma Glass: [machine.ore_plasmarglass] <A href='?src=\ref[src];release=plasmarglass'>Release</A><br>")
if(machine.ore_gold)
dat += text("Gold: [machine.ore_gold] <A href='?src=\ref[src];release=gold'>Release</A><br>")
if(machine.ore_silver)
dat += text("Silver: [machine.ore_silver] <A href='?src=\ref[src];release=silver'>Release</A><br>")
if(machine.ore_uranium)
dat += text("Uranium: [machine.ore_uranium] <A href='?src=\ref[src];release=uranium'>Release</A><br>")
if(machine.ore_diamond)
dat += text("Diamond: [machine.ore_diamond] <A href='?src=\ref[src];release=diamond'>Release</A><br>")
if(machine.ore_wood)
dat += text("Wood: [machine.ore_wood] <A href='?src=\ref[src];release=wood'>Release</A><br>")
if(machine.ore_cardboard)
dat += text("Cardboard: [machine.ore_cardboard] <A href='?src=\ref[src];release=cardboard'>Release</A><br>")
if(machine.ore_cloth)
dat += text("Cloth: [machine.ore_cloth] <A href='?src=\ref[src];release=cloth'>Release</A><br>")
if(machine.ore_leather)
dat += text("Leather: [machine.ore_leather] <A href='?src=\ref[src];release=leather'>Release</A><br>")
if(machine.ore_clown)
dat += text("Bananium: [machine.ore_clown] <A href='?src=\ref[src];release=clown'>Release</A><br>")
if(machine.ore_adamantine)
dat += text ("Adamantine: [machine.ore_adamantine] <A href='?src=\ref[src];release=adamantine'>Release</A><br>")
if(machine.ore_mythril)
dat += text ("Mythril: [machine.ore_mythril] <A href='?src=\ref[src];release=adamantine'>Release</A><br>")
if(machine.ore_phazon)
dat += text ("Phazon: [machine.ore_phazon] <A href='?src=\ref[src];release=phazon'>Release</A><br>")
for(var/typepath in machine.stacks)
var/obj/item/stack/stack=machine.stacks[typepath]
if(stack.amount)
dat += "[stack.name]: [stack.amount] <A href='?src=\ref[src];release=[typepath] '>Release</A><br>"
dat += text("<br>Stacking: [machine.stack_amt]<br><br>")
@@ -82,121 +48,18 @@
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["release"])
switch(href_list["release"])
if ("plasma")
if (machine.ore_plasma > 0)
var/obj/item/stack/sheet/mineral/plasma/G = new /obj/item/stack/sheet/mineral/plasma
G.amount = machine.ore_plasma
G.loc = machine.output.loc
machine.ore_plasma = 0
if ("plasmaglass")
if (machine.ore_plasmaglass > 0)
var/obj/item/stack/sheet/glass/plasmaglass/G = new /obj/item/stack/sheet/glass/plasmaglass
G.amount = machine.ore_plasmaglass
G.loc = machine.output.loc
machine.ore_plasmaglass = 0
if ("plasmarglass")
if (machine.ore_plasmarglass > 0)
var/obj/item/stack/sheet/glass/plasmarglass/G = new /obj/item/stack/sheet/glass/plasmarglass
G.amount = machine.ore_plasmarglass
G.loc = machine.output.loc
machine.ore_plasmarglass = 0
if ("uranium")
if (machine.ore_uranium > 0)
var/obj/item/stack/sheet/mineral/uranium/G = new /obj/item/stack/sheet/mineral/uranium
G.amount = machine.ore_uranium
G.loc = machine.output.loc
machine.ore_uranium = 0
if ("glass")
if (machine.ore_glass > 0)
var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass
G.amount = machine.ore_glass
G.loc = machine.output.loc
machine.ore_glass = 0
if ("rglass")
if (machine.ore_rglass > 0)
var/obj/item/stack/sheet/rglass/G = new /obj/item/stack/sheet/rglass
G.amount = machine.ore_rglass
G.loc = machine.output.loc
machine.ore_rglass = 0
if ("gold")
if (machine.ore_gold > 0)
var/obj/item/stack/sheet/mineral/gold/G = new /obj/item/stack/sheet/mineral/gold
G.amount = machine.ore_gold
G.loc = machine.output.loc
machine.ore_gold = 0
if ("silver")
if (machine.ore_silver > 0)
var/obj/item/stack/sheet/mineral/silver/G = new /obj/item/stack/sheet/mineral/silver
G.amount = machine.ore_silver
G.loc = machine.output.loc
machine.ore_silver = 0
if ("diamond")
if (machine.ore_diamond > 0)
var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond
G.amount = machine.ore_diamond
G.loc = machine.output.loc
machine.ore_diamond = 0
if ("iron")
if (machine.ore_iron > 0)
var/obj/item/stack/sheet/metal/G = new /obj/item/stack/sheet/metal
G.amount = machine.ore_iron
G.loc = machine.output.loc
machine.ore_iron = 0
if ("plasteel")
if (machine.ore_plasteel > 0)
var/obj/item/stack/sheet/plasteel/G = new /obj/item/stack/sheet/plasteel
G.amount = machine.ore_plasteel
G.loc = machine.output.loc
machine.ore_plasteel = 0
if ("wood")
if (machine.ore_wood > 0)
var/obj/item/stack/sheet/wood/G = new /obj/item/stack/sheet/wood
G.amount = machine.ore_wood
G.loc = machine.output.loc
machine.ore_wood = 0
if ("cardboard")
if (machine.ore_cardboard > 0)
var/obj/item/stack/sheet/cardboard/G = new /obj/item/stack/sheet/cardboard
G.amount = machine.ore_cardboard
G.loc = machine.output.loc
machine.ore_cardboard = 0
if ("cloth")
if (machine.ore_cloth > 0)
var/obj/item/stack/sheet/cloth/G = new /obj/item/stack/sheet/cloth
G.amount = machine.ore_cloth
G.loc = machine.output.loc
machine.ore_cloth = 0
if ("leather")
if (machine.ore_leather > 0)
var/obj/item/stack/sheet/leather/G = new /obj/item/stack/sheet/leather
G.amount = machine.ore_diamond
G.loc = machine.output.loc
machine.ore_leather = 0
if ("clown")
if (machine.ore_clown > 0)
var/obj/item/stack/sheet/mineral/clown/G = new /obj/item/stack/sheet/mineral/clown
G.amount = machine.ore_clown
G.loc = machine.output.loc
machine.ore_clown = 0
if ("adamantine")
if (machine.ore_adamantine > 0)
var/obj/item/stack/sheet/mineral/adamantine/G = new /obj/item/stack/sheet/mineral/adamantine
G.amount = machine.ore_adamantine
G.loc = machine.output.loc
machine.ore_adamantine = 0
if ("mythril")
if (machine.ore_mythril > 0)
var/obj/item/stack/sheet/mineral/mythril/G = new /obj/item/stack/sheet/mineral/mythril
G.amount = machine.ore_mythril
G.loc = machine.output.loc
machine.ore_mythril = 0
if ("phazon")
if (machine.ore_phazon > 0)
var/obj/item/stack/sheet/mineral/phazon/G = new /obj/item/stack/sheet/mineral/phazon
G.amount = machine.ore_phazon
G.loc = machine.output.loc
machine.ore_phazon = 0
var/typepath = href_list["release"]
if(typepath in machine.stacks)
var/obj/item/stack/stack=machine.stacks[typepath]
if (stack.amount > 0)
var/obj/item/stack/stacked=new typepath
stacked.amount=stack.amount
stacked.loc=machine.output.loc
stack.amount = 0
if(stack.amount==0)
machine.stacks.Remove(typepath)
else
machine.stacks[typepath]=stack
src.updateUsrDialog()
return
@@ -215,26 +78,10 @@
var/stk_amt = list()
var/obj/machinery/mineral/input = null
var/obj/machinery/mineral/output = null
var/ore_gold = 0;
var/ore_silver = 0;
var/ore_diamond = 0;
var/ore_plasma = 0;
var/ore_plasmaglass = 0;
var/ore_plasmarglass = 0;
var/ore_iron = 0;
var/ore_uranium = 0;
var/ore_clown = 0;
var/ore_glass = 0;
var/ore_rglass = 0;
var/ore_plasteel = 0;
var/ore_wood = 0
var/ore_cardboard = 0
var/ore_cloth = 0;
var/ore_leather = 0;
var/ore_adamantine = 0;
var/ore_mythril = 0;
var/ore_phazon = 0
var/stack_amt = 50; //ammount to stack before releassing
var/list/stacks=list()
var/stack_amt = 50 //amount to stack before releassing
/obj/machinery/mineral/stacking_machine/New()
..()
@@ -252,202 +99,33 @@
/obj/machinery/mineral/stacking_machine/process()
if (src.output && src.input)
var/obj/item/O
var/obj/item/stack/stack
while (locate(/obj/item, input.loc))
O = locate(/obj/item, input.loc)
if (istype(O,/obj/item/stack/sheet/metal))
ore_iron+= O:amount;
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/diamond))
ore_diamond+= O:amount;
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/plasma))
ore_plasma+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/gold))
ore_gold+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/silver))
ore_silver+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/clown))
ore_clown+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/uranium))
ore_uranium+= O:amount
del(O)
continue
// MUST COME BEFORE GLASS!
if (istype(O,/obj/item/stack/sheet/glass/plasmaglass))
ore_plasmaglass+= O:amount
del(O)
continue
// MUST COME BEFORE GLASS!
if (istype(O,/obj/item/stack/sheet/glass/plasmarglass))
ore_plasmarglass+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/glass))
ore_glass+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/rglass))
ore_rglass+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/plasteel))
ore_plasteel+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/adamantine))
ore_adamantine+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/mythril))
ore_mythril+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/cardboard))
ore_cardboard+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/wood))
ore_wood+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/cloth))
ore_cloth+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/leather))
ore_leather+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/mineral/phazon))
ore_phazon += O:amount
if (istype(O,/obj/item/stack))
if(!("[O.type]" in stacks))
stack=new O.type
stack.amount=O:amount
else
stack=stacks["[O.type]"]
stack.amount += O:amount
stacks["[O.type]"]=stack
del(O)
continue
if (istype(O,/obj/item/weapon/ore/slag))
del(O)
continue
O.loc = src.output.loc
if (ore_gold >= stack_amt)
var/obj/item/stack/sheet/mineral/gold/G = new /obj/item/stack/sheet/mineral/gold
G.amount = stack_amt
G.loc = output.loc
ore_gold -= stack_amt
return
if (ore_silver >= stack_amt)
var/obj/item/stack/sheet/mineral/silver/G = new /obj/item/stack/sheet/mineral/silver
G.amount = stack_amt
G.loc = output.loc
ore_silver -= stack_amt
return
if (ore_diamond >= stack_amt)
var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond
G.amount = stack_amt
G.loc = output.loc
ore_diamond -= stack_amt
return
if (ore_plasma >= stack_amt)
var/obj/item/stack/sheet/mineral/plasma/G = new /obj/item/stack/sheet/mineral/plasma
G.amount = stack_amt
G.loc = output.loc
ore_plasma -= stack_amt
return
if (ore_iron >= stack_amt)
var/obj/item/stack/sheet/metal/G = new /obj/item/stack/sheet/metal
G.amount = stack_amt
G.loc = output.loc
ore_iron -= stack_amt
return
if (ore_clown >= stack_amt)
var/obj/item/stack/sheet/mineral/clown/G = new /obj/item/stack/sheet/mineral/clown
G.amount = stack_amt
G.loc = output.loc
ore_clown -= stack_amt
return
if (ore_uranium >= stack_amt)
var/obj/item/stack/sheet/mineral/uranium/G = new /obj/item/stack/sheet/mineral/uranium
G.amount = stack_amt
G.loc = output.loc
ore_uranium -= stack_amt
return
if (ore_glass >= stack_amt)
var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass
G.amount = stack_amt
G.loc = output.loc
ore_glass -= stack_amt
return
if (ore_rglass >= stack_amt)
var/obj/item/stack/sheet/rglass/G = new /obj/item/stack/sheet/rglass
G.amount = stack_amt
G.loc = output.loc
ore_rglass -= stack_amt
return
if (ore_plasmaglass >= stack_amt)
var/obj/item/stack/sheet/glass/plasmaglass/G = new /obj/item/stack/sheet/glass/plasmaglass
G.amount = stack_amt
G.loc = output.loc
ore_plasmaglass -= stack_amt
return
if (ore_plasmarglass >= stack_amt)
var/obj/item/stack/sheet/glass/plasmarglass/G = new /obj/item/stack/sheet/glass/plasmarglass
G.amount = stack_amt
G.loc = output.loc
ore_plasmarglass -= stack_amt
return
if (ore_plasteel >= stack_amt)
var/obj/item/stack/sheet/plasteel/G = new /obj/item/stack/sheet/plasteel
G.amount = stack_amt
G.loc = output.loc
ore_plasteel -= stack_amt
return
if (ore_wood >= stack_amt)
var/obj/item/stack/sheet/wood/G = new /obj/item/stack/sheet/wood
G.amount = stack_amt
G.loc = output.loc
ore_wood -= stack_amt
return
if (ore_cardboard >= stack_amt)
var/obj/item/stack/sheet/cardboard/G = new /obj/item/stack/sheet/cardboard
G.amount = stack_amt
G.loc = output.loc
ore_cardboard -= stack_amt
return
if (ore_cloth >= stack_amt)
var/obj/item/stack/sheet/cloth/G = new /obj/item/stack/sheet/cloth
G.amount = stack_amt
G.loc = output.loc
ore_cloth -= stack_amt
return
if (ore_leather >= stack_amt)
var/obj/item/stack/sheet/leather/G = new /obj/item/stack/sheet/leather
G.amount = stack_amt
G.loc = output.loc
ore_leather -= stack_amt
return
if (ore_adamantine >= stack_amt)
var/obj/item/stack/sheet/mineral/adamantine/G = new /obj/item/stack/sheet/mineral/adamantine
G.amount = stack_amt
G.loc = output.loc
ore_adamantine -= stack_amt
return
if (ore_mythril >= stack_amt)
var/obj/item/stack/sheet/mineral/mythril/G = new /obj/item/stack/sheet/mineral/mythril
G.amount = stack_amt
G.loc = output.loc
ore_mythril -= stack_amt
return
if (ore_phazon >= stack_amt)
var/obj/item/stack/sheet/mineral/phazon/G = new /obj/item/stack/sheet/mineral/phazon
G.amount = stack_amt
G.loc = output.loc
ore_phazon -= stack_amt
return
for(var/typepath in stacks)
stack=stacks[typepath]
if(stack.amount >= stack_amt)
var/obj/item/stack/stacked=new stack.type
stacked.amount=stack_amt
stacked.loc=output.loc
stack.amount -= stack_amt
if(stack.amount==0)
stacks.Remove(typepath)
else
stacks[typepath]=stack
return
return