mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Ores now stack when released from ore box. Should help reduce some mining lag.
This commit is contained in:
@@ -362,35 +362,35 @@
|
||||
O = locate(/obj/item, input.loc)
|
||||
if (O)
|
||||
if (istype(O,/obj/item/weapon/ore/iron))
|
||||
ore_iron++;
|
||||
ore_iron = ore_iron + O:amount;
|
||||
del(O)
|
||||
continue
|
||||
if (istype(O,/obj/item/weapon/ore/glass))
|
||||
ore_glass++;
|
||||
ore_glass = ore_glass + O:amount;
|
||||
del(O)
|
||||
continue
|
||||
if (istype(O,/obj/item/weapon/ore/diamond))
|
||||
ore_diamond++;
|
||||
ore_diamond = ore_diamond + O:amount;
|
||||
del(O)
|
||||
continue
|
||||
if (istype(O,/obj/item/weapon/ore/plasma))
|
||||
ore_plasma++
|
||||
ore_plasma = ore_plasma + O:amount
|
||||
del(O)
|
||||
continue
|
||||
if (istype(O,/obj/item/weapon/ore/gold))
|
||||
ore_gold++
|
||||
ore_gold = ore_gold + O:amount
|
||||
del(O)
|
||||
continue
|
||||
if (istype(O,/obj/item/weapon/ore/silver))
|
||||
ore_silver++
|
||||
ore_silver = ore_silver + O:amount
|
||||
del(O)
|
||||
continue
|
||||
if (istype(O,/obj/item/weapon/ore/uranium))
|
||||
ore_uranium++
|
||||
ore_uranium = ore_uranium + O:amount
|
||||
del(O)
|
||||
continue
|
||||
if (istype(O,/obj/item/weapon/ore/clown))
|
||||
ore_clown++
|
||||
ore_clown = ore_clown + O:amount
|
||||
del(O)
|
||||
continue
|
||||
O.loc = src.output.loc
|
||||
|
||||
@@ -27,6 +27,48 @@
|
||||
if (src.output && src.input)
|
||||
if (locate(/obj/structure/ore_box, input.loc))
|
||||
var/obj/structure/ore_box/BOX = locate(/obj/structure/ore_box, input.loc)
|
||||
BOX.update()
|
||||
if (BOX.amt_diamond > 0)
|
||||
var/obj/item/weapon/ore/diamond/G = new /obj/item/weapon/ore/diamond
|
||||
G.amount = BOX.amt_diamond
|
||||
G.loc = output.loc
|
||||
BOX.amt_diamond = 0
|
||||
if (BOX.amt_glass > 0)
|
||||
var/obj/item/weapon/ore/glass/G = new /obj/item/weapon/ore/glass
|
||||
G.amount = BOX.amt_glass
|
||||
G.loc = output.loc
|
||||
BOX.amt_glass = 0
|
||||
if (BOX.amt_plasma > 0)
|
||||
var/obj/item/weapon/ore/plasma/G = new /obj/item/weapon/ore/plasma
|
||||
G.amount = BOX.amt_plasma
|
||||
G.loc = output.loc
|
||||
BOX.amt_plasma = 0
|
||||
if (BOX.amt_iron > 0)
|
||||
var/obj/item/weapon/ore/iron/G = new /obj/item/weapon/ore/iron
|
||||
G.amount = BOX.amt_iron
|
||||
G.loc = output.loc
|
||||
BOX.amt_iron = 0
|
||||
if (BOX.amt_silver > 0)
|
||||
var/obj/item/weapon/ore/silver/G = new /obj/item/weapon/ore/silver
|
||||
G.amount = BOX.amt_silver
|
||||
G.loc = output.loc
|
||||
BOX.amt_silver = 0
|
||||
if (BOX.amt_gold > 0)
|
||||
var/obj/item/weapon/ore/gold/G = new /obj/item/weapon/ore/gold
|
||||
G.amount = BOX.amt_gold
|
||||
G.loc = output.loc
|
||||
BOX.amt_gold = 0
|
||||
if (BOX.amt_uranium > 0)
|
||||
var/obj/item/weapon/ore/uranium/G = new /obj/item/weapon/ore/uranium
|
||||
G.amount = BOX.amt_uranium
|
||||
G.loc = output.loc
|
||||
BOX.amt_uranium = 0
|
||||
if (BOX.amt_clown > 0)
|
||||
var/obj/item/weapon/ore/clown/G = new /obj/item/weapon/ore/clown
|
||||
G.amount = BOX.amt_clown
|
||||
G.loc = output.loc
|
||||
BOX.amt_clown = 0
|
||||
|
||||
var/i = 0
|
||||
for (var/obj/item/weapon/ore/O in BOX.contents)
|
||||
BOX.contents -= O
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
name = "Rock"
|
||||
icon = 'Mining.dmi'
|
||||
icon_state = "ore"
|
||||
var/amount = 1
|
||||
|
||||
/obj/item/weapon/ore/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
..()
|
||||
|
||||
@@ -51,6 +51,14 @@
|
||||
desc = "A heavy box used for storing ore."
|
||||
density = 1
|
||||
var/capacity = 200
|
||||
var/amt_gold = 0
|
||||
var/amt_silver = 0
|
||||
var/amt_diamond = 0
|
||||
var/amt_glass = 0
|
||||
var/amt_iron = 0
|
||||
var/amt_plasma = 0
|
||||
var/amt_uranium = 0
|
||||
var/amt_clown = 0
|
||||
|
||||
New()
|
||||
if(prob(50))
|
||||
@@ -69,9 +77,45 @@
|
||||
user << "\blue You empty the satchel into the box."
|
||||
else
|
||||
user << "\blue The ore box is full."
|
||||
|
||||
return
|
||||
|
||||
/obj/structure/ore_box/proc/update(obj, mob/user as mob)
|
||||
for (var/obj/item/weapon/ore/C in contents)
|
||||
if (istype(C,/obj/item/weapon/ore/diamond))
|
||||
amt_diamond++
|
||||
del(C)
|
||||
continue
|
||||
else if (istype(C,/obj/item/weapon/ore/glass))
|
||||
amt_glass++
|
||||
del(C)
|
||||
continue
|
||||
else if (istype(C,/obj/item/weapon/ore/plasma))
|
||||
amt_plasma++
|
||||
del(C)
|
||||
continue
|
||||
else if (istype(C,/obj/item/weapon/ore/iron))
|
||||
amt_iron++
|
||||
del(C)
|
||||
continue
|
||||
else if (istype(C,/obj/item/weapon/ore/silver))
|
||||
amt_silver++
|
||||
del(C)
|
||||
continue
|
||||
else if (istype(C,/obj/item/weapon/ore/gold))
|
||||
amt_gold++
|
||||
del(C)
|
||||
continue
|
||||
else if (istype(C,/obj/item/weapon/ore/uranium))
|
||||
amt_uranium++
|
||||
del(C)
|
||||
continue
|
||||
else if (istype(C,/obj/item/weapon/ore/clown))
|
||||
amt_clown++
|
||||
del(C)
|
||||
continue
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/ore_box/attack_hand(obj, mob/user as mob)
|
||||
var/amt_gold = 0
|
||||
var/amt_silver = 0
|
||||
@@ -126,12 +170,53 @@
|
||||
user << browse("[dat]", "window=orebox")
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/ore_box/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["removeall"])
|
||||
if (amt_diamond > 0)
|
||||
var/obj/item/weapon/ore/diamond/G = new /obj/item/weapon/ore/diamond
|
||||
G.amount = src.amt_diamond
|
||||
G.loc = src.loc
|
||||
src.amt_diamond = 0
|
||||
if (amt_glass > 0)
|
||||
var/obj/item/weapon/ore/glass/G = new /obj/item/weapon/ore/glass
|
||||
G.amount = src.amt_glass
|
||||
G.loc = src.loc
|
||||
src.amt_glass = 0
|
||||
if (amt_plasma > 0)
|
||||
var/obj/item/weapon/ore/plasma/G = new /obj/item/weapon/ore/plasma
|
||||
G.amount = src.amt_plasma
|
||||
G.loc = src.loc
|
||||
src.amt_plasma = 0
|
||||
if (amt_iron > 0)
|
||||
var/obj/item/weapon/ore/iron/G = new /obj/item/weapon/ore/iron
|
||||
G.amount = src.amt_iron
|
||||
G.loc = src.loc
|
||||
src.amt_iron = 0
|
||||
if (amt_silver > 0)
|
||||
var/obj/item/weapon/ore/silver/G = new /obj/item/weapon/ore/silver
|
||||
G.amount = src.amt_silver
|
||||
G.loc = src.loc
|
||||
src.amt_silver = 0
|
||||
if (amt_gold > 0)
|
||||
var/obj/item/weapon/ore/gold/G = new /obj/item/weapon/ore/gold
|
||||
G.amount = src.amt_gold
|
||||
G.loc = src.loc
|
||||
src.amt_gold = 0
|
||||
if (amt_uranium > 0)
|
||||
var/obj/item/weapon/ore/uranium/G = new /obj/item/weapon/ore/uranium
|
||||
G.amount = src.amt_uranium
|
||||
G.loc = src.loc
|
||||
src.amt_uranium = 0
|
||||
if (amt_clown > 0)
|
||||
var/obj/item/weapon/ore/clown/G = new /obj/item/weapon/ore/clown
|
||||
G.amount = src.amt_clown
|
||||
G.loc = src.loc
|
||||
src.amt_clown = 0
|
||||
for (var/obj/item/weapon/ore/O in contents)
|
||||
contents -= O
|
||||
O.loc = src.loc
|
||||
|
||||
Reference in New Issue
Block a user