Merge pull request #1468 from Abi79/master

Limit of items per tick for conveyors, limit for ore boxes and minor ore processor optimization
This commit is contained in:
Albert Iordache
2012-07-13 02:48:08 -07:00
3 changed files with 46 additions and 42 deletions
+23 -34
View File
@@ -313,37 +313,27 @@
continue*/
//if a non valid combination is selected
// A non valid combination was selected
var/b = 1 //this part checks if all required ores are available
if (!(selected_gold || selected_silver ||selected_diamond || selected_uranium | selected_plasma || selected_iron || selected_iron))
if (!(selected_gold || selected_silver || selected_diamond || selected_uranium || selected_plasma || selected_iron || selected_glass || selected_clown))
b = 0
else if (selected_gold == 1 && ore_gold <= 0)
b = 0
else if (selected_silver == 1 && ore_silver <= 0)
b = 0
else if (selected_diamond == 1 && ore_diamond <= 0)
b = 0
else if (selected_uranium == 1 && ore_uranium <= 0)
b = 0
else if (selected_plasma == 1 && ore_plasma <= 0)
b = 0
else if (selected_iron == 1 && ore_iron <= 0)
b = 0
else if (selected_glass == 1 && ore_glass <= 0)
b = 0
else if (selected_clown == 1 && ore_clown <= 0)
b = 0
if (selected_gold == 1)
if (ore_gold <= 0)
b = 0
if (selected_silver == 1)
if (ore_silver <= 0)
b = 0
if (selected_diamond == 1)
if (ore_diamond <= 0)
b = 0
if (selected_uranium == 1)
if (ore_uranium <= 0)
b = 0
if (selected_plasma == 1)
if (ore_plasma <= 0)
b = 0
if (selected_iron == 1)
if (ore_iron <= 0)
b = 0
if (selected_glass == 1)
if (ore_glass <= 0)
b = 0
if (selected_clown == 1)
if (ore_clown <= 0)
b = 0
if (b) //if they are, deduct one from each, produce slag and shut the machine off
if (selected_gold == 1)
@@ -361,13 +351,12 @@
if (selected_clown == 1)
ore_clown--
new /obj/item/weapon/ore/slag(output.loc)
on = 0
else
on = 0
break
break
else
on = 0
else // on == 0
break
for (i = 0; i < 10; i++)
var/obj/item/O
O = locate(/obj/item, input.loc)
+17 -8
View File
@@ -5,7 +5,7 @@
icon_state = "satchel"
name = "Mining Satchel"
var/mode = 1; //0 = pick one at a time, 1 = pick all on tile
var/capacity = 50; //the number of ore pieces it can carry.
var/capacity = 25; //the number of ore pieces it can carry.
flags = FPRINT | TABLEPASS
slot_flags = SLOT_BELT
w_class = 1
@@ -40,7 +40,7 @@
icon_state = "satchel"
name = "Cyborg Mining Satchel"
mode = 1; //0 = pick one at a time, 1 = pick all on tile
capacity = 200; //the number of ore pieces it can carry.
capacity = 75; //the number of ore pieces it can carry.
/**********************Ore box**************************/
@@ -48,8 +48,9 @@
icon = 'mining.dmi'
icon_state = "orebox0"
name = "Ore Box"
desc = "It's heavy"
desc = "A heavy box used for storing ore."
density = 1
var/capacity = 200
New()
if(prob(50))
@@ -57,10 +58,18 @@
/obj/structure/ore_box/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/ore))
src.contents += W;
if (istype(W, /obj/item/weapon/satchel))
src.contents += W.contents
user << "\blue You empty the satchel into the box."
if (src.contents.len + 1 <= src.capacity)
src.contents += W;
else
user << "\blue The ore box is full."
else if (istype(W, /obj/item/weapon/satchel))
if ( src.contents.len + W.contents.len <= src.capacity)
src.contents += W.contents
user << "\blue You empty the satchel into the box."
else
user << "\blue The ore box is full."
return
/obj/structure/ore_box/attack_hand(obj, mob/user as mob)
@@ -122,6 +131,6 @@
for (var/obj/item/weapon/ore/O in contents)
contents -= O
O.loc = src.loc
usr << "\blue You empty the box"
usr << "\blue You empty the box."
src.updateUsrDialog()
return
+6
View File
@@ -116,9 +116,15 @@
affecting = loc.contents - src // moved items will be all in loc
spawn(1) // slight delay to prevent infinite propagation due to map order
var/items_moved = 0
for(var/atom/movable/A in affecting)
if(items_moved >= 10)
break
if(!A.anchored)
if(isturf(A.loc)) // this is to prevent an ugly bug that forces a player to drop what they're holding if they recently pick it up from the conveyer belt
items_moved++
if(!step(A,movedir))
//if it's a crate, move the item into the crate
var/turf/T = get_step(A,movedir)