From a026575ef72e65e2f3405f0ace2dac3a8cff197f Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Sun, 8 Jun 2014 00:04:58 +0930 Subject: [PATCH] Ironed out some bugs. Everything should be working for testing purposes. --- code/modules/mining/drilling/drill.dm | 16 ++++++---- code/modules/mining/machine_processing.dm | 39 +++++++++-------------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/code/modules/mining/drilling/drill.dm b/code/modules/mining/drilling/drill.dm index f19cc76d4b..5dc990ba15 100644 --- a/code/modules/mining/drilling/drill.dm +++ b/code/modules/mining/drilling/drill.dm @@ -148,7 +148,11 @@ else if(!open || active) return ..() if(istype(W,/obj/item/weapon/crowbar)) - if(storage) + if(cell) + user << "You pry out \the [cell]." + cell.loc = get_turf(src) + cell = null + else if(storage) user << "You slip the bolt and pry out \the [storage]." storage.loc = get_turf(src) storage = null @@ -159,11 +163,7 @@ else if(cellmount) user << "You yank out a few wires and pry out \the [cellmount]." cellmount.loc = get_turf(src) - cellmount.loc = null - else if(cell) - user << "You pry out \the [cell]." - cell.loc = get_turf(src) - cell = null + cellmount = null else user << "There's nothing inside the drilling rig to remove." return @@ -171,6 +171,7 @@ if(storage) user << "The drill already has a matter bin installed." else + user.drop_item() W.loc = src storage = W user << "You install \the [W]." @@ -179,6 +180,7 @@ if(cutter) user << "The drill already has a cutting head installed." else + user.drop_item() W.loc = src cutter = W user << "You install \the [W]." @@ -187,6 +189,7 @@ if(cellmount) user << "The drill already has a cell capacitor installed." else + user.drop_item() W.loc = src cellmount = W user << "You install \the [W]." @@ -195,6 +198,7 @@ if(cell) user << "The drill already has a cell installed." else + user.drop_item() W.loc = src cell = W user << "You install \the [W]." diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index dec66231b5..d350e2052c 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -159,47 +159,37 @@ if(!O) continue if(ores_processing[metal] == 3 && O.alloy) //Alloying. - var/can_make_alloy = 0 - var/datum/alloy/alloying for(var/datum/alloy/A in alloy_data) - if(A.metaltag in tick_alloys) continue + + if(A.metaltag in tick_alloys) + continue + tick_alloys += A.metaltag + var/enough_metal if(!isnull(A.requires[metal]) && ores_stored[metal] >= A.requires[metal]) //We have enough of our first metal, we're off to a good start. - alloying = A - can_make_alloy = 0 - var/enough_metal = 1 + + enough_metal = 1 for(var/needs_metal in A.requires) - //Check if we're alloying the needed metal and have it stored. if(ores_processing[needs_metal] != 3 || ores_stored[needs_metal] < A.requires[needs_metal]) enough_metal = 0 break - if(!enough_metal) - can_make_alloy = 0 - else - can_make_alloy = 1 - break - - if(!alloying) - sheets++ - return - - if(!can_make_alloy) + if(!enough_metal) continue else var/total - for(var/needs_metal in alloying.requires) - ores_stored[needs_metal] -= alloying.requires[needs_metal] - total += alloying.requires[needs_metal] - total = round(total*alloying.product_mod) + for(var/needs_metal in A.requires) + ores_stored[needs_metal] -= A.requires[needs_metal] + total += A.requires[needs_metal] + total = max(1,round(total*A.product_mod)) //Always get at least one sheet. sheets += total-1 - for(var/i=0,i