diff --git a/aurora.dme b/aurora.dme index d823f29d..97939030 100644 --- a/aurora.dme +++ b/aurora.dme @@ -971,6 +971,8 @@ #include "code\modules\maps\swapmaps.dm" #include "code\modules\maps\writer.dm" #include "code\modules\mining\abandonedcrates.dm" +#include "code\modules\mining\alloys.dm" +#include "code\modules\mining\coins.dm" #include "code\modules\mining\machine_input_output_plates.dm" #include "code\modules\mining\machine_processing.dm" #include "code\modules\mining\machine_stacking.dm" @@ -979,10 +981,15 @@ #include "code\modules\mining\mine_items.dm" #include "code\modules\mining\mine_turfs.dm" #include "code\modules\mining\minerals.dm" +#include "code\modules\mining\mining_shuttle.dm" #include "code\modules\mining\mint.dm" #include "code\modules\mining\money_bag.dm" -#include "code\modules\mining\ores_coins.dm" +#include "code\modules\mining\ore.dm" +#include "code\modules\mining\ore_datum.dm" #include "code\modules\mining\satchel_ore_boxdm.dm" +#include "code\modules\mining\drilling\distribution.dm" +#include "code\modules\mining\drilling\drill.dm" +#include "code\modules\mining\drilling\scanner.dm" #include "code\modules\mob\abilities.dm" #include "code\modules\mob\death.dm" #include "code\modules\mob\emote.dm" diff --git a/code/WorkInProgress/Cael_Aislinn/Jungle/jungle_temple.dm b/code/WorkInProgress/Cael_Aislinn/Jungle/jungle_temple.dm index 7eb9c011..bb4ed3d4 100644 --- a/code/WorkInProgress/Cael_Aislinn/Jungle/jungle_temple.dm +++ b/code/WorkInProgress/Cael_Aislinn/Jungle/jungle_temple.dm @@ -86,9 +86,6 @@ for(var/coin_type in typesof(/obj/item/weapon/coin)) possible_spawns += coin_type - //no icon_state for mythril coins - possible_spawns -= /obj/item/weapon/coin/mythril - var/coin_type = pick(possible_spawns) for(var/i=0,iThe crate's anti-tamper system is activated, and the crate is locked down." + else user << "You attempt to interact with the device using a hand gesture, but it appears this crate is from before the DECANECT came out." return diff --git a/code/modules/mining/alloys.dm b/code/modules/mining/alloys.dm new file mode 100644 index 00000000..ce29725d --- /dev/null +++ b/code/modules/mining/alloys.dm @@ -0,0 +1,27 @@ +//Alloys that contain subsets of each other's ingredients must be ordered in the desired sequence +//eg. steel comes after plasteel because plasteel's ingredients contain the ingredients for steel and +//it would be impossible to produce. + +/datum/alloy + var/list/requires + var/product_mod = 1 + var/product + var/metaltag + +/datum/alloy/plasteel + metaltag = "plasteel" + requires = list( + "platinum" = 1, + "coal" = 2, + "hematite" = 2 + ) + product_mod = 0.3 + product = /obj/item/stack/sheet/plasteel + +/datum/alloy/steel + metaltag = "steel" + requires = list( + "coal" = 1, + "hematite" = 1 + ) + product = /obj/item/stack/sheet/metal \ No newline at end of file diff --git a/code/modules/mining/coins.dm b/code/modules/mining/coins.dm new file mode 100644 index 00000000..306c16d6 --- /dev/null +++ b/code/modules/mining/coins.dm @@ -0,0 +1,92 @@ +/*****************************Coin********************************/ + +/obj/item/weapon/coin + icon = 'icons/obj/items.dmi' + name = "Coin" + icon_state = "coin" + flags = FPRINT | TABLEPASS| CONDUCT + force = 0.0 + throwforce = 0.0 + w_class = 1.0 + var/string_attached + var/sides = 2 + +/obj/item/weapon/coin/New() + pixel_x = rand(0,16)-8 + pixel_y = rand(0,8)-8 + +/obj/item/weapon/coin/gold + name = "gold coin" + icon_state = "coin_gold" + +/obj/item/weapon/coin/silver + name = "silver coin" + icon_state = "coin_silver" + +/obj/item/weapon/coin/diamond + name = "diamond coin" + icon_state = "coin_diamond" + +/obj/item/weapon/coin/iron + name = "iron coin" + icon_state = "coin_iron" + +/obj/item/weapon/coin/plasma + name = "solid plasma coin" + icon_state = "coin_plasma" + +/obj/item/weapon/coin/uranium + name = "uranium coin" + icon_state = "coin_uranium" + +/obj/item/weapon/coin/platinum + name = "platinum coin" + icon_state = "coin_adamantine" + +/obj/item/weapon/coin/clown + name = "bananaium coin" + icon_state = "coin_clown" + +/obj/item/weapon/coin/adamantine + name = "adamantine coin" + icon_state = "coin_adamantine" + +/obj/item/weapon/coin/mythril + name = "mythril coin" + icon_state = "coin_mythril" + +/obj/item/weapon/coin/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W,/obj/item/weapon/cable_coil)) + var/obj/item/weapon/cable_coil/CC = W + if(string_attached) + user << "There already is a string attached to this coin." + return + if (CC.use(1)) + overlays += image('icons/obj/items.dmi',"coin_string_overlay") + string_attached = 1 + user << "You attach a string to the coin." + else + user << "This cable coil appears to be empty." + return + else if(istype(W,/obj/item/weapon/wirecutters)) + if(!string_attached) + ..() + return + + var/obj/item/weapon/cable_coil/CC = new /obj/item/weapon/cable_coil(user.loc) + CC.amount = 1 + CC.update_icon() + overlays = list() + string_attached = null + user << "\blue You detach the string from the coin." + else ..() + +/obj/item/weapon/coin/attack_self(mob/user as mob) + var/result = rand(1, sides) + var/comment = "" + if(result == 1) + comment = "tails" + else if(result == 2) + comment = "heads" + user.visible_message("[user] has thrown \the [src]. It lands on [comment]! ", \ + "You throw \the [src]. It lands on [comment]! ") diff --git a/code/modules/mining/drilling/distribution.dm b/code/modules/mining/drilling/distribution.dm new file mode 100644 index 00000000..33654da2 --- /dev/null +++ b/code/modules/mining/drilling/distribution.dm @@ -0,0 +1,233 @@ +//If anyone can think of a less shitty way to work out x,y points on a linear string of integers please tell me. +#define MAP_CELL ((y-1)*real_size)+x +#define MAP_CENTRE (((y-1)+size/2)*real_size)+(x+size/2) +#define MAP_TOP_LEFT ((y-1)*real_size)+x +#define MAP_TOP_RIGHT ((y-1)*real_size)+(x+size) +#define MAP_BOTTOM_LEFT (((y+size)-1)*real_size)+x +#define MAP_BOTTOM_RIGHT ((((y+size)-1)*real_size)+(x+size)) +#define MAP_MID_TOP MAP_TOP_LEFT + (size/2) +#define MAP_MID_BOTTOM MAP_BOTTOM_LEFT + (size/2) +#define MAP_MID_LEFT (((y-1)+size/2)*real_size)+x +#define MAP_MID_RIGHT (((y-1)+size/2)*real_size)+(x+size) + +#define MIN_SURFACE_COUNT 1000 +#define MAX_SURFACE_COUNT 5000 +#define MIN_RARE_COUNT 1000 +#define MAX_RARE_COUNT 5000 +#define MIN_DEEP_COUNT 100 +#define MAX_DEEP_COUNT 300 +#define ITERATE_BEFORE_FAIL 200 + +#define RESOURCE_HIGH_MAX 4 +#define RESOURCE_HIGH_MIN 2 +#define RESOURCE_MID_MAX 3 +#define RESOURCE_MID_MIN 1 +#define RESOURCE_LOW_MAX 1 +#define RESOURCE_LOW_MIN 0 + +/* +Surface minerals: + silicates + iron + gold + silver + +Rare minerals: + uranium + diamond + +Deep minerals: + phoron + osmium (platinum) + tritium (hydrogen) +*/ + +/datum/ore_distribution + + var/real_size = 65 //Overall map size ((must be power of 2)+1) + var/chunk_size = 4 //Size each cell represents on map (like hell we're generating up to 100 256^2 grids at roundstart) + var/list/map[4225] //The actual map. real_size squared. + var/range = 255 //Max random range of cells in map. + + var/random_variance_chance = 25 + var/random_element = 0.5 + +/datum/ore_distribution/proc/map_is_sane() + if(!map) return 0 + + var/rare_count = 0 + var/surface_count = 0 + var/deep_count = 0 + + for(var/cell in map) + if(cell>(range*0.60)) + deep_count++ + else if(cell>(range*0.40)) + rare_count++ + else + surface_count++ + + if(surface_count < MIN_SURFACE_COUNT || surface_count > MAX_SURFACE_COUNT) return 0 + if(rare_count < MIN_RARE_COUNT || rare_count > MAX_RARE_COUNT) return 0 + if(deep_count < MIN_DEEP_COUNT || deep_count > MAX_DEEP_COUNT) return 0 + return 1 + +//Halfassed diamond-square algorithm with some fuckery since it's a single dimension array. +/datum/ore_distribution/proc/populate_distribution_map() + + //Seed beginning values. + var/x = 1 + var/y = 1 + var/size = real_size-1 + map[MAP_TOP_LEFT] = (range/3)+rand(range/5) + map[MAP_TOP_RIGHT] = (range/3)+rand(range/5) + map[MAP_BOTTOM_LEFT] = (range/3)+rand(range/5) + map[MAP_BOTTOM_RIGHT] = (range/3)+rand(range/5) + + //Fill in and smooth it out. + var/attempts = 0 + do + attempts++ + generate_distribution_map(1,1,size) + while(attempts < ITERATE_BEFORE_FAIL && !map_is_sane()) + + if(attempts >= ITERATE_BEFORE_FAIL) + world << "Could not generate a sane distribution map. Aborting." + map = null + return + else + apply_to_asteroid() + +/datum/ore_distribution/proc/clear_distribution_map() + for(var/x = 1, x <= real_size, x++) + for(var/y = 1, y <= real_size, y++) + map[MAP_CELL] = 0 + +/datum/ore_distribution/proc/print_distribution_map(var/mob/usr) + var/line = "" + for(var/x = 1, x <= real_size, x++) + for(var/y = 1, y <= real_size, y++) + line += num2text(round(map[MAP_CELL]/25.5)) + if(usr) + usr << line + else + world << line + line = "" + +/datum/ore_distribution/proc/generate_distribution_map(var/x,var/y,var/input_size) + + var/size = input_size + + map[MAP_MID_TOP] = (map[MAP_TOP_LEFT] + map[MAP_TOP_RIGHT])/2 + map[MAP_MID_RIGHT] = (map[MAP_BOTTOM_RIGHT] + map[MAP_TOP_RIGHT])/2 + map[MAP_MID_BOTTOM] = (map[MAP_BOTTOM_LEFT] + map[MAP_BOTTOM_RIGHT])/2 + map[MAP_MID_LEFT] = (map[MAP_TOP_LEFT] + map[MAP_BOTTOM_RIGHT])/2 + map[MAP_CENTRE] = (map[MAP_MID_LEFT]+map[MAP_MID_RIGHT]+map[MAP_MID_BOTTOM]+map[MAP_MID_TOP])/4 + + if(prob(random_variance_chance)) + map[MAP_CENTRE] *= (rand(1) ? (1.0-random_element) : (1.0+random_element)) + map[MAP_CENTRE] = max(0,min(range,map[MAP_CENTRE])) + + if(size>3) + generate_distribution_map(x,y,input_size/2) + generate_distribution_map(x+(input_size/2),y,input_size/2) + generate_distribution_map(x,y+(input_size/2),input_size/2) + generate_distribution_map(x+(input_size/2),y+(input_size/2),input_size/2) + +/datum/ore_distribution/proc/apply_to_asteroid() + + // THESE VALUES DETERMINE THE AREA THAT THE DISTRIBUTION MAP IS APPLIED TO. + // IF YOU DO NOT RUN OFFICIAL BAYCODE ASTEROID MAP YOU NEED TO CHANGE THEM. + // ORIGIN IS THE BOTTOM LEFT CORNER OF THE SQUARE CONTAINING ALL ASTEROID + // TILES YOU WISH TO APPLY THE DISTRIBUTION MAP TO. + + var/origin_x = 13 //We start here... + var/origin_y = 32 //...and here... + var/limit_x = 217 //...and iterate until here... + var/limit_y = 223 //...and here... + var/asteroid_z = 5 //...on this Z-level. + + var/tx = origin_x + var/ty = origin_y + + for(var/y = 1, y <= real_size, y++) + + for(var/x = 1, x <= real_size, x++) + + var/turf/target_turf + + for(var/i=0,i limit_x || ty+i > limit_y) + continue + + target_turf = locate(tx+j, ty+i, asteroid_z) + + if(target_turf && target_turf.has_resources) + target_turf.resources = list() + target_turf.resources["silicates"] = rand(3,5) + target_turf.resources["carbonaceous rock"] = rand(3,5) + + switch(map[MAP_CELL]) + if(0 to 100) + target_turf.resources["iron"] = rand(RESOURCE_HIGH_MIN,RESOURCE_HIGH_MAX) + target_turf.resources["gold"] = rand(RESOURCE_LOW_MIN,RESOURCE_LOW_MAX) + target_turf.resources["silver"] = rand(RESOURCE_LOW_MIN,RESOURCE_LOW_MAX) + target_turf.resources["uranium"] = rand(RESOURCE_LOW_MIN,RESOURCE_LOW_MAX) + target_turf.resources["diamond"] = 0 + target_turf.resources["phoron"] = 0 + target_turf.resources["osmium"] = 0 + target_turf.resources["hydrogen"] = 0 + if(100 to 124) + target_turf.resources["iron"] = 0 + target_turf.resources["gold"] = rand(RESOURCE_MID_MIN,RESOURCE_MID_MAX) + target_turf.resources["silver"] = rand(RESOURCE_MID_MIN,RESOURCE_MID_MAX) + target_turf.resources["uranium"] = rand(RESOURCE_MID_MIN,RESOURCE_MID_MAX) + target_turf.resources["diamond"] = 0 + target_turf.resources["phoron"] = rand(RESOURCE_MID_MIN,RESOURCE_MID_MAX) + target_turf.resources["osmium"] = rand(RESOURCE_MID_MIN,RESOURCE_MID_MAX) + target_turf.resources["hydrogen"] = 0 + if(125 to 255) + target_turf.resources["iron"] = 0 + target_turf.resources["gold"] = 0 + target_turf.resources["silver"] = 0 + target_turf.resources["uranium"] = rand(RESOURCE_LOW_MIN,RESOURCE_LOW_MAX) + target_turf.resources["diamond"] = rand(RESOURCE_LOW_MIN,RESOURCE_LOW_MAX) + target_turf.resources["phoron"] = rand(RESOURCE_HIGH_MIN,RESOURCE_HIGH_MAX) + target_turf.resources["osmium"] = rand(RESOURCE_HIGH_MIN,RESOURCE_HIGH_MAX) + target_turf.resources["hydrogen"] = rand(RESOURCE_MID_MIN,RESOURCE_MID_MAX) + + tx += chunk_size + tx = origin_x + ty += chunk_size + + world << "Resource map generation complete." + return + +#undef MAP_CELL +#undef MAP_CENTRE +#undef MAP_TOP_LEFT +#undef MAP_TOP_RIGHT +#undef MAP_BOTTOM_LEFT +#undef MAP_BOTTOM_RIGHT +#undef MAP_MID_TOP +#undef MAP_MID_BOTTOM +#undef MAP_MID_LEFT +#undef MAP_MID_RIGHT + +#undef MIN_SURFACE_COUNT +#undef MAX_SURFACE_COUNT +#undef MIN_RARE_COUNT +#undef MAX_RARE_COUNT +#undef MIN_DEEP_COUNT +#undef MAX_DEEP_COUNT +#undef ITERATE_BEFORE_FAIL + +#undef RESOURCE_HIGH_MAX +#undef RESOURCE_HIGH_MIN +#undef RESOURCE_MID_MAX +#undef RESOURCE_MID_MIN +#undef RESOURCE_LOW_MAX +#undef RESOURCE_LOW_MIN diff --git a/code/modules/mining/drilling/drill.dm b/code/modules/mining/drilling/drill.dm new file mode 100644 index 00000000..112d7e24 --- /dev/null +++ b/code/modules/mining/drilling/drill.dm @@ -0,0 +1,392 @@ +/obj/machinery/mining + icon = 'icons/obj/mining_drill.dmi' + anchored = 0 + use_power = 0 //The drill takes power directly from a cell. + density = 1 + layer = MOB_LAYER+0.1 //So it draws over mobs in the tile north of it. + +/obj/machinery/mining/drill + name = "mining drill head" + desc = "An enormous drill." + icon_state = "mining_drill" + var/braces_needed = 2 + var/list/supports = list() + var/supported = 0 + var/active = 0 + var/list/resource_field = list() + var/open = 0 + + var/ore_types = list( + "iron" = /obj/item/weapon/ore/iron, + "uranium" = /obj/item/weapon/ore/uranium, + "gold" = /obj/item/weapon/ore/gold, + "silver" = /obj/item/weapon/ore/silver, + "diamond" = /obj/item/weapon/ore/diamond, + "plasma" = /obj/item/weapon/ore/plasma, + "osmium" = /obj/item/weapon/ore/osmium, + "hydrogen" = /obj/item/weapon/ore/hydrogen, + "silicates" = /obj/item/weapon/ore/glass, + "carbonaceous rock" = /obj/item/weapon/ore/coal + ) + + //Upgrades + var/obj/item/weapon/stock_parts/matter_bin/storage + var/obj/item/weapon/stock_parts/micro_laser/cutter + var/obj/item/weapon/stock_parts/capacitor/cellmount + var/obj/item/weapon/cell/cell + + //Flags + var/need_update_field = 0 + var/need_player_check = 0 + +/obj/machinery/mining/drill/New() + + ..() + + storage = new(src) + cutter = new(src) + cellmount = new(src) + + cell = new(src) + cell.maxcharge = 10000 + cell.charge = cell.maxcharge + +/obj/machinery/mining/drill/process() + + if(need_player_check) + return + + check_supports() + + if(!active) return + + if(!anchored || !use_cell_power()) + system_error("system configuration or charge error") + return + + if(need_update_field) + get_resource_field() + + if(world.time % 10 == 0) + update_icon() + + if(!active) + return + + //Drill through the flooring, if any. + if(istype(get_turf(src),/turf/simulated/floor/plating/airless/asteroid)) + var/turf/simulated/floor/plating/airless/asteroid/T = get_turf(src) + if(!T.dug) + T.gets_dug() + else if(istype(get_turf(src),/turf/simulated/floor)) + var/turf/simulated/floor/T = get_turf(src) + T.ex_act(2.0) + + //Dig out the tasty ores. + if(resource_field.len) + var/turf/harvesting = pick(resource_field) + + while(resource_field.len && !harvesting.resources) + harvesting.has_resources = 0 + harvesting.resources = null + resource_field -= harvesting + harvesting = pick(resource_field) + + if(!harvesting) return + + var/total_harvest = get_harvest_capacity() //Ore harvest-per-tick. + var/found_resource = 0 //If this doesn't get set, the area is depleted and the drill errors out. + + for(var/metal in ore_types) + + if(contents.len >= get_storage_capacity()) + system_error("insufficient storage space") + active = 0 + need_player_check = 1 + update_icon() + return + + if(contents.len + total_harvest >= get_storage_capacity()) + total_harvest = get_storage_capacity() - contents.len + + if(total_harvest <= 0) break + if(harvesting.resources[metal]) + + found_resource = 1 + + var/create_ore = 0 + if(harvesting.resources[metal] >= total_harvest) + harvesting.resources[metal] -= total_harvest + create_ore = total_harvest + total_harvest = 0 + else + total_harvest -= harvesting.resources[metal] + create_ore = harvesting.resources[metal] + harvesting.resources[metal] = 0 + + for(var/i=1,i<=create_ore,i++) + var/oretype = ore_types[metal] + new oretype(src) + + if(!found_resource) + harvesting.has_resources = 0 + harvesting.resources = null + resource_field -= harvesting + else + active = 0 + need_player_check = 1 + update_icon() + +/obj/machinery/mining/drill/attack_ai(var/mob/user as mob) + return src.attack_hand(user) + +/obj/machinery/mining/drill/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W,/obj/item/weapon/screwdriver)) + if(active) return + open = !open + user << "\blue You [open ? "open" : "close"] the maintenance panel." //TODO: Sprite. + return + else + if(!open || active) return ..() + if(istype(W,/obj/item/weapon/crowbar)) + 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 + else if(cutter) + user << "You carefully detatch and pry out \the [cutter]." + cutter.loc = get_turf(src) + cutter = null + else if(cellmount) + user << "You yank out a few wires and pry out \the [cellmount]." + cellmount.loc = get_turf(src) + cellmount = null + else + user << "There's nothing inside the drilling rig to remove." + return + else if(istype(W,/obj/item/weapon/stock_parts/matter_bin)) + 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]." + return + else if(istype(W,/obj/item/weapon/stock_parts/micro_laser)) + 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]." + return + else if(istype(W,/obj/item/weapon/stock_parts/capacitor)) + 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]." + return + else if(istype(W,/obj/item/weapon/cell)) + if(cell) + user << "The drill already has a cell installed." + else + user.drop_item() + W.loc = src + cell = W + user << "You install \the [W]." + return + ..() +/obj/machinery/mining/drill/attack_hand(mob/user as mob) + check_supports() + + if(need_player_check) + user << "You hit the manual override and reset the drill's error checking." + need_player_check = 0 + if(anchored) get_resource_field() + update_icon() + return + + else if(supported) + if(use_cell_power()) + active = !active + if(active) + user << "\blue You engage \the [src] and it lurches downwards, grinding noisily." + need_update_field = 1 + else + user << "\blue You disengage \the [src] and it shudders to a grinding halt." + else + user << "\blue The drill is unpowered." + else + user << "\blue Turning on a piece of industrial machinery without sufficient bracing is a bad idea." + + update_icon() + +/obj/machinery/mining/drill/update_icon() + if(need_player_check) + icon_state = "mining_drill_error" + else if(active) + icon_state = "mining_drill_active" + else if(supported) + icon_state = "mining_drill_braced" + else + icon_state = "mining_drill" + return + +/obj/machinery/mining/drill/proc/check_supports() + + supported = 0 + + if((!supports || !supports.len) && initial(anchored) == 0) + icon_state = "mining_drill" + anchored = 0 + active = 0 + else + anchored = 1 + + if(supports && supports.len >= braces_needed) + supported = 1 + + update_icon() + +/obj/machinery/mining/drill/proc/system_error(var/error) + + if(error) src.visible_message("\red \The [src] flashes a '[error]' warning.") + need_player_check = 1 + active = 0 + update_icon() + +/obj/machinery/mining/drill/proc/get_harvest_capacity() + return (cutter ? cutter.rating : 0) + +/obj/machinery/mining/drill/proc/get_storage_capacity() + return 200 * (storage ? storage.rating : 0) + +/obj/machinery/mining/drill/proc/get_charge_use() + return 50 - (10 * (cellmount ? cellmount.rating : 0)) + +/obj/machinery/mining/drill/proc/get_resource_field() + + resource_field = list() + need_update_field = 0 + + var/turf/T = get_turf(src) + if(!istype(T)) return + + var/tx = T.x-2 + var/ty = T.y-2 + var/turf/mine_turf + for(var/iy=0,iy<5,iy++) + for(var/ix=0,ix<5,ix++) + mine_turf = locate(tx+ix,ty+iy,T.z) + if(mine_turf && istype(mine_turf) && mine_turf.has_resources) + resource_field += mine_turf + + if(!resource_field.len) + system_error("resources depleted") + +/obj/machinery/mining/drill/proc/use_cell_power() + if(!cell) return 0 + var/req = get_charge_use() + if(cell.charge >= req) + cell.use(req) + return 1 + return 0 + +/obj/machinery/mining/drill/verb/unload() + set name = "Unload Drill" + set category = "Object" + set src in oview(1) + + if(usr.stat) return + + var/obj/structure/ore_box/B = locate() in orange(1) + if(B) + for(var/obj/item/weapon/ore/O in contents) + O.loc = B + usr << "\red You unload the drill's storage cache into the ore box." + else + usr << "\red You must move an ore box up to the drill before you can unload it." + + +/obj/machinery/mining/brace + name = "mining drill brace" + desc = "A machinery brace for an industrial drill. It looks easily two feet thick." + icon_state = "mining_brace" + var/obj/machinery/mining/drill/connected + +/obj/machinery/mining/brace/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W,/obj/item/weapon/wrench)) + + if(istype(get_turf(src),/turf/space)) + user << "\blue You can't anchor something to empty space. Idiot." + return + + if(connected && connected.active) + user << "\blue You can't unanchor the brace of a running drill!" + return + + playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1) + user << "\blue You [anchored ? "un" : ""]anchor the brace." + + anchored = !anchored + if(anchored) + connect() + else + disconnect() + +/obj/machinery/mining/brace/proc/connect() + + var/turf/T = get_step(get_turf(src), src.dir) + + if(!T.has_resources) + src.visible_message("\red The terrain near the brace is unsuitable!") + return + + for(var/thing in T.contents) + if(istype(thing,/obj/machinery/mining/drill)) + connected = thing + break + + if(!connected) return + + if(!connected.supports) connected.supports = list() + + icon_state = "mining_brace_active" + + connected.supports += src + connected.check_supports() + +/obj/machinery/mining/brace/proc/disconnect() + + if(!connected) return + + if(!connected.supports) connected.supports = list() + + icon_state = "mining_brace" + + connected.supports -= src + connected.check_supports() + connected = null + +/obj/machinery/mining/brace/verb/rotate() + set name = "Rotate" + set category = "Object" + set src in oview(1) + + if(usr.stat) return + + if (src.anchored) + usr << "It is anchored in place!" + return 0 + + src.dir = turn(src.dir, 90) + return 1 \ No newline at end of file diff --git a/code/modules/mining/drilling/scanner.dm b/code/modules/mining/drilling/scanner.dm new file mode 100644 index 00000000..40cdafc1 --- /dev/null +++ b/code/modules/mining/drilling/scanner.dm @@ -0,0 +1,54 @@ +/obj/item/weapon/mining_scanner + name = "ore detector" + desc = "A complex device used to locate ore deep underground." + icon = 'icons/obj/device.dmi' + icon_state = "forensic0-old" //GET A BETTER SPRITE. + item_state = "electronic" + matter = list("metal" = 150) + + origin_tech = "magnets=1;engineering=1" + +/obj/item/weapon/mining_scanner/attack_self(mob/user as mob) + + user << "You begin sweeping \the [src] about, scanning for metal deposits." + + if(!do_after(user,50)) return + + if(!user || !src) return + + var/list/metals = list( + "surface minerals" = 0, + "precious metals" = 0, + "nuclear fuel" = 0, + "exotic matter" = 0 + ) + + for(var/turf/T in oview(3,get_turf(user))) + + if(!T.has_resources) + continue + + for(var/metal in T.resources) + + var/ore_type + + switch(metal) + if("silicates" || "carbonaceous rock" || "iron") ore_type = "surface minerals" + if("gold" || "silver" || "diamond") ore_type = "precious metals" + if("uranium") ore_type = "nuclear fuel" + if("plasma" || "osmium" || "hydrogen") ore_type = "exotic matter" + + if(ore_type) metals[ore_type] += T.resources[metal] + + user << "\icon[src] \blue The scanner beeps and displays a readout." + + for(var/ore_type in metals) + + var/result = "no sign" + + switch(metals[ore_type]) + if(1 to 50) result = "trace amounts" + if(51 to 150) result = "significant amounts" + if(151 to INFINITY) result = "huge quantities" + + user << "- [result] of [ore_type]." \ No newline at end of file diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 01e00923..2a029b42 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -1,12 +1,3 @@ -#define ORE_PROC_GOLD 1 -#define ORE_PROC_SILVER 2 -#define ORE_PROC_DIAMOND 4 -#define ORE_PROC_GLASS 8 -#define ORE_PROC_PLASMA 16 -#define ORE_PROC_URANIUM 32 -#define ORE_PROC_IRON 64 -#define ORE_PROC_CLOWN 128 - /**********************Mineral processing unit console**************************/ /obj/machinery/mineral/processing_unit_console @@ -15,175 +6,92 @@ icon_state = "console" density = 1 anchored = 1 + var/obj/machinery/mineral/processing_unit/machine = null var/machinedir = EAST + var/show_all_ores = 0 /obj/machinery/mineral/processing_unit_console/New() ..() spawn(7) src.machine = locate(/obj/machinery/mineral/processing_unit, get_step(src, machinedir)) if (machine) - machine.CONSOLE = src + machine.console = src else del(src) -/obj/machinery/mineral/processing_unit_console/process() - updateDialog() - /obj/machinery/mineral/processing_unit_console/attack_hand(mob/user) add_fingerprint(user) interact(user) /obj/machinery/mineral/processing_unit_console/interact(mob/user) + + if(..()) + return + + if(!allowed(user)) + user << "\red Access denied." + return + user.set_machine(src) - var/dat = "Smelter control console

" - //iron - if(machine.ore_iron || machine.ore_glass || machine.ore_plasma || machine.ore_uranium || machine.ore_gold || machine.ore_silver || machine.ore_diamond || machine.ore_clown || machine.ore_adamantine) - if(machine.ore_iron) - if (machine.selected & ORE_PROC_IRON) - dat += text("Smelting ") - else - dat += text("Not smelting ") - dat += text("Iron: [machine.ore_iron]
") + var/dat = "

Ore processor console

" + + dat += "
" + + for(var/ore in machine.ores_processing) + + if(!machine.ores_stored[ore] && !show_all_ores) continue + + dat += "" + dat += "
[capitalize(ore)][machine.ores_stored[ore]]not processing" + if(1) + dat += "orange'>smelting" + if(2) + dat += "blue'>compressing" + if(3) + dat += "gray'>alloying" else - machine.selected &= ~ORE_PROC_IRON - - //sand - glass - if(machine.ore_glass) - if (machine.selected & ORE_PROC_GLASS) - dat += text("Smelting ") - else - dat += text("Not smelting ") - dat += text("Sand: [machine.ore_glass]
") - else - machine.selected &= ~ORE_PROC_GLASS - - //plasma - if(machine.ore_plasma) - if (machine.selected & ORE_PROC_PLASMA) - dat += text("Smelting ") - else - dat += text("Not smelting ") - dat += text("Plasma: [machine.ore_plasma]
") - else - machine.selected &= ~ORE_PROC_PLASMA - - //uranium - if(machine.ore_uranium) - if (machine.selected & ORE_PROC_URANIUM) - dat += text("Smelting ") - else - dat += text("Not smelting ") - dat += text("Uranium: [machine.ore_uranium]
") - else - machine.selected &= ~ORE_PROC_URANIUM - - //gold - if(machine.ore_gold) - if (machine.selected & ORE_PROC_GOLD) - dat += text("Smelting ") - else - dat += text("Not smelting ") - dat += text("Gold: [machine.ore_gold]
") - else - machine.selected &= ~ORE_PROC_GOLD - - //silver - if(machine.ore_silver) - if (machine.selected & ORE_PROC_SILVER) - dat += text("Smelting ") - else - dat += text("Not smelting ") - dat += text("Silver: [machine.ore_silver]
") - else - machine.selected &= ~ORE_PROC_SILVER - - //diamond - if(machine.ore_diamond) - if (machine.selected & ORE_PROC_DIAMOND) - dat += text("Smelting ") - else - dat += text("Not smelting ") - dat += text("Diamond: [machine.ore_diamond]
") - else - machine.selected &= ~ORE_PROC_DIAMOND - - //bananium - if(machine.ore_clown) - if (machine.selected & ORE_PROC_CLOWN) - dat += text("Smelting ") - else - dat += text("Not smelting ") - dat += text("Bananium: [machine.ore_clown]
") - else - machine.selected &= ~ORE_PROC_CLOWN - - //On or off - dat += text("Machine is currently ") - if (machine.on==1) - dat += text("On ") - else - dat += text("Off ") - else - dat+="---No Materials Loaded---" - - - user << browse("[dat]", "window=console_processing_unit") - onclose(user, "console_processing_unit") + dat += "red'>not processing" + dat += "
.
\[change\]

" + dat += "Currently displaying [show_all_ores ? "all ore types" : "only available ore types"]. \[[show_all_ores ? "show less" : "show more"]\]
" + dat += "The ore processor is currently [(machine.active ? "processing" : "disabled")]." + user << browse(dat, "window=processor_console;size=400x500") + onclose(user, "processor_console") + return /obj/machinery/mineral/processing_unit_console/Topic(href, href_list) if(..()) return usr.set_machine(src) src.add_fingerprint(usr) - if(href_list["sel_iron"]) - if (href_list["sel_iron"] == "yes") - machine.selected |= ORE_PROC_IRON - else - machine.selected &= ~ORE_PROC_IRON - if(href_list["sel_glass"]) - if (href_list["sel_glass"] == "yes") - machine.selected |= ORE_PROC_GLASS - else - machine.selected &= ~ORE_PROC_GLASS - if(href_list["sel_plasma"]) - if (href_list["sel_plasma"] == "yes") - machine.selected |= ORE_PROC_PLASMA - else - machine.selected &= ~ORE_PROC_PLASMA - if(href_list["sel_uranium"]) - if (href_list["sel_uranium"] == "yes") - machine.selected |= ORE_PROC_URANIUM - else - machine.selected &= ~ORE_PROC_URANIUM - if(href_list["sel_gold"]) - if (href_list["sel_gold"] == "yes") - machine.selected |= ORE_PROC_GOLD - else - machine.selected &= ~ORE_PROC_GOLD - if(href_list["sel_silver"]) - if (href_list["sel_silver"] == "yes") - machine.selected |= ORE_PROC_SILVER - else - machine.selected &= ~ORE_PROC_SILVER - if(href_list["sel_diamond"]) - if (href_list["sel_diamond"] == "yes") - machine.selected |= ORE_PROC_DIAMOND - else - machine.selected &= ~ORE_PROC_DIAMOND - if(href_list["sel_clown"]) - if (href_list["sel_clown"] == "yes") - machine.selected |= ORE_PROC_CLOWN - else - machine.selected &= ~ORE_PROC_CLOWN - if(href_list["set_on"]) - if (href_list["set_on"] == "on") - machine.on = 1 - else - machine.on = 0 + if(href_list["toggle_smelting"]) + + var/choice = input("What setting do you wish to use for processing [href_list["toggle_smelting"]]?") as null|anything in list("Smelting","Compressing","Alloying","Nothing") + if(!choice) return + + switch(choice) + if("Nothing") choice = 0 + if("Smelting") choice = 1 + if("Compressing") choice = 2 + if("Alloying") choice = 3 + + machine.ores_processing[href_list["toggle_smelting"]] = choice + + if(href_list["toggle_power"]) + + machine.active = !machine.active + + if(href_list["toggle_ores"]) + + show_all_ores = !show_all_ores + src.updateUsrDialog() return @@ -191,271 +99,136 @@ /obj/machinery/mineral/processing_unit - name = "furnace" + name = "material processor" //This isn't actually a goddamn furnace, we're in space and it's processing platinum and flammable phoron... icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "furnace" density = 1 - anchored = 1.0 - luminosity = 3 //Big fire with window, yeah it puts out a little light. + anchored = 1 + luminosity = 3 var/obj/machinery/mineral/input = null var/obj/machinery/mineral/output = null - var/obj/machinery/mineral/CONSOLE = null - var/ore_gold = 0; - var/ore_silver = 0; - var/ore_diamond = 0; - var/ore_glass = 0; - var/ore_plasma = 0; - var/ore_uranium = 0; - var/ore_iron = 0; - var/ore_clown = 0; - var/ore_adamantine = 0; - var/selected = 0 -/* - var/selected_gold = 0 - var/selected_silver = 0 - var/selected_diamond = 0 - var/selected_glass = 0 - var/selected_plasma = 0 - var/selected_uranium = 0 - var/selected_iron = 0 - var/selected_clown = 0 -*/ - var/on = 0 //0 = off, 1 =... oh you know! - + var/obj/machinery/mineral/console = null + var/sheets_per_tick = 10 + var/list/ores_processing[0] + var/list/ores_stored[0] + var/list/ore_data[0] + var/list/alloy_data[0] + var/active = 0 /obj/machinery/mineral/processing_unit/New() + ..() - spawn( 5 ) + + //TODO: Ore and alloy global storage datum. + for(var/alloytype in typesof(/datum/alloy)-/datum/alloy) + alloy_data += new alloytype() + + for(var/oretype in typesof(/datum/ore)-/datum/ore) + var/datum/ore/OD = new oretype() + ore_data[OD.oretag] = OD + ores_processing[OD.oretag] = 0 + ores_stored[OD.oretag] = 0 + + //Locate our output and input machinery. + 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 - processing_objects.Add(src) return return /obj/machinery/mineral/processing_unit/process() - if (src.output && src.input) - var/i - for (i = 0; i < 10; i++) - if (on) + if (!src.output || !src.input) return + var/list/tick_alloys = list() - if (selected == ORE_PROC_GLASS) - if (ore_glass > 0) - ore_glass--; - new /obj/item/stack/sheet/glass(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_GLASS + ORE_PROC_IRON) - if (ore_glass > 0 && ore_iron > 0) - ore_glass--; - ore_iron--; - new /obj/item/stack/sheet/rglass(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_GOLD) - if (ore_gold > 0) - ore_gold--; - new /obj/item/stack/sheet/mineral/gold(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_SILVER) - if (ore_silver > 0) - ore_silver--; - new /obj/item/stack/sheet/mineral/silver(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_DIAMOND) - if (ore_diamond > 0) - ore_diamond--; - new /obj/item/stack/sheet/mineral/diamond(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_PLASMA) - if (ore_plasma > 0) - ore_plasma--; - new /obj/item/stack/sheet/mineral/plasma(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_URANIUM) - if (ore_uranium > 0) - ore_uranium--; - new /obj/item/stack/sheet/mineral/uranium(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_IRON) - if (ore_iron > 0) - ore_iron--; - new /obj/item/stack/sheet/metal(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_IRON + ORE_PROC_PLASMA) - if (ore_iron > 0 && ore_plasma > 0) - ore_iron--; - ore_plasma--; - new /obj/item/stack/sheet/plasteel(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_CLOWN) - if (ore_clown > 0) - ore_clown--; - new /obj/item/stack/sheet/mineral/clown(output.loc) - else - on = 0 - continue - /* - if (selected == ORE_PROC_GLASS + ORE_PROC_PLASMA) - if (ore_glass > 0 && ore_plasma > 0) - ore_glass--; - ore_plasma--; - new /obj/item/stack/sheet/glass/plasmaglass(output.loc) - else - on = 0 - continue - if (selected == ORE_PROC_GLASS + ORE_PROC_IRON + ORE_PROC_PLASMA) - if (ore_glass > 0 && ore_plasma > 0 && ore_iron > 0) - ore_glass--; - ore_iron--; - ore_plasma--; - new /obj/item/stack/sheet/glass/plasmarglass(output.loc) - else - on = 0 - continue - */ + //Grab some more ore to process this tick. + for(var/i = 0,i= 2 && ore_diamond >= 1) - ore_uranium -= 2 - ore_diamond -= 1 - new /obj/item/stack/sheet/mineral/adamantine(output.loc) + //Process our stored ores and spit out sheets. + var/sheets = 0 + for(var/metal in ores_stored) + + if(sheets >= sheets_per_tick) break + + if(ores_stored[metal] > 0 && ores_processing[metal] != 0) + + var/datum/ore/O = ore_data[metal] + + if(!O) continue + + if(ores_processing[metal] == 3 && O.alloy) //Alloying. + + for(var/datum/alloy/A in alloy_data) + + 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. + + 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) + continue else - on = 0 - continue - if (selected == ORE_PROC_SILVER + ORE_PROC_PLASMA) - if (ore_silver >= 1 && ore_plasma >= 3) - ore_silver -= 1 - ore_plasma -= 3 - new /obj/item/stack/sheet/mineral/mythril(output.loc) - else - on = 0 + var/total + 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,i0) can_make-- + + if(!can_make || ores_stored[metal] < 1) continue + for(var/i=0,iStacking unit console

") + dat += text("

Stacking unit console


") - if(machine.ore_iron) - dat += text("Iron: [machine.ore_iron] Release
") - if(machine.ore_plasteel) - dat += text("Plasteel: [machine.ore_plasteel] Release
") - if(machine.ore_glass) - dat += text("Glass: [machine.ore_glass] Release
") - if(machine.ore_rglass) - dat += text("Reinforced Glass: [machine.ore_rglass] Release
") - if(machine.ore_plasma) - dat += text("Plasma: [machine.ore_plasma] Release
") - if(machine.ore_plasmaglass) - dat += text("Plasma Glass: [machine.ore_plasmaglass] Release
") - if(machine.ore_plasmarglass) - dat += text("Reinforced Plasma Glass: [machine.ore_plasmarglass] Release
") - if(machine.ore_gold) - dat += text("Gold: [machine.ore_gold] Release
") - if(machine.ore_silver) - dat += text("Silver: [machine.ore_silver] Release
") - if(machine.ore_uranium) - dat += text("Uranium: [machine.ore_uranium] Release
") - if(machine.ore_diamond) - dat += text("Diamond: [machine.ore_diamond] Release
") - if(machine.ore_wood) - dat += text("Wood: [machine.ore_wood] Release
") - if(machine.ore_cardboard) - dat += text("Cardboard: [machine.ore_cardboard] Release
") - if(machine.ore_cloth) - dat += text("Cloth: [machine.ore_cloth] Release
") - if(machine.ore_leather) - dat += text("Leather: [machine.ore_leather] Release
") - if(machine.ore_clown) - dat += text("Bananium: [machine.ore_clown] Release
") - if(machine.ore_adamantine) - dat += text ("Adamantine: [machine.ore_adamantine] Release
") - if(machine.ore_mythril) - dat += text ("Mythril: [machine.ore_mythril] Release
") - - dat += text("
Stacking: [machine.stack_amt]

") + for(var/stacktype in machine.stack_storage) + if(machine.stack_storage[stacktype] > 0) + dat += "" + dat += "
[capitalize(stacktype)]:[machine.stack_storage[stacktype]]\[release\]

" + dat += text("
Stacking: [machine.stack_amt] \[change\]

") user << browse("[dat]", "window=console_stacking_machine") onclose(user, "console_stacking_machine") + /obj/machinery/mineral/stacking_unit_console/Topic(href, href_list) if(..()) return - 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 - src.updateUsrDialog() - return + if(href_list["change_stack"]) + var/choice = input("What would you like to set the stack amount to?") as null|anything in list(1,5,10,20,50) + if(!choice) return + machine.stack_amt = choice + + if(href_list["release_stack"]) + if(machine.stack_storage[href_list["release_stack"]] > 0) + var/stacktype = machine.stack_paths[href_list["release_stack"]] + var/obj/item/stack/sheet/S = new stacktype (get_turf(machine.output)) + S.amount = machine.stack_storage[href_list["release_stack"]] + machine.stack_storage[href_list["release_stack"]] = 0 + + src.add_fingerprint(usr) + src.updateUsrDialog() + + return /**********************Mineral stacking unit**************************/ @@ -202,33 +71,29 @@ icon_state = "stacker" density = 1 anchored = 1.0 - var/obj/machinery/mineral/stacking_unit_console/CONSOLE - var/stk_types = list() - var/stk_amt = list() + var/obj/machinery/mineral/stacking_unit_console/console 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/stack_amt = 50; //ammount to stack before releassing + var/list/stack_storage[0] + var/list/stack_paths[0] + var/stack_amt = 50; // Amount to stack before releassing /obj/machinery/mineral/stacking_machine/New() ..() + + for(var/stacktype in typesof(/obj/item/stack/sheet/mineral)-/obj/item/stack/sheet/mineral) + var/obj/item/stack/S = new stacktype(src) + stack_storage[S.name] = 0 + stack_paths[S.name] = stacktype + del(S) + + stack_storage["glass"] = 0 + stack_paths["glass"] = /obj/item/stack/sheet/glass + stack_storage["metal"] = 0 + stack_paths["metal"] = /obj/item/stack/sheet/metal + stack_storage["plasteel"] = 0 + stack_paths["plasteel"] = /obj/item/stack/sheet/plasteel + spawn( 5 ) for (var/dir in cardinal) src.input = locate(/obj/machinery/mineral/input, get_step(src, dir)) @@ -236,220 +101,31 @@ for (var/dir in cardinal) src.output = locate(/obj/machinery/mineral/output, get_step(src, dir)) if(src.output) break - processing_objects.Add(src) return return /obj/machinery/mineral/stacking_machine/process() if (src.output && src.input) - var/obj/item/stack/O - while (locate(/obj/item, input.loc)) - O = locate(/obj/item/stack, input.loc) - if(isnull(O)) - var/obj/item/I = locate(/obj/item, input.loc) - if (istype(I,/obj/item/weapon/ore/slag)) - I.loc = null + var/turf/T = get_turf(input) + for(var/obj/item/O in T.contents) + if(!O) return + if(istype(O,/obj/item/stack)) + if(!isnull(stack_storage[O.name])) + stack_storage[O.name]++ + O.loc = null else - I.loc = output.loc - continue - if (istype(O,/obj/item/stack/sheet/metal)) - ore_iron+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/mineral/diamond)) - ore_diamond+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/mineral/plasma)) - ore_plasma+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/mineral/gold)) - ore_gold+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/mineral/silver)) - ore_silver+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/mineral/clown)) - ore_clown+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/mineral/uranium)) - ore_uranium+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/glass/plasmaglass)) - ore_plasmaglass+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/glass/plasmarglass)) - ore_plasmarglass+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/glass)) - ore_glass+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/rglass)) - ore_rglass+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/plasteel)) - ore_plasteel+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/mineral/adamantine)) - ore_adamantine+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/mineral/mythril)) - ore_mythril+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/cardboard)) - ore_cardboard+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/wood)) - ore_wood+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/cloth)) - ore_cloth+= O.amount - O.loc = null - //del(O) - continue - if (istype(O,/obj/item/stack/sheet/leather)) - ore_leather+= O.amount - O.loc = null - //del(O) - continue - O.loc = src.output.loc + O.loc = output.loc + else + O.loc = 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 + //Output amounts that are past stack_amt. + for(var/sheet in stack_storage) + if(stack_storage[sheet] >= stack_amt) + var/stacktype = stack_paths[sheet] + var/obj/item/stack/sheet/S = new stacktype (get_turf(output)) + S.amount = stack_amt + stack_storage[sheet] -= stack_amt + + console.updateUsrDialog() return + diff --git a/code/modules/mining/mine_areas.dm b/code/modules/mining/mine_areas.dm index 841bb8b3..bcc714c2 100644 --- a/code/modules/mining/mine_areas.dm +++ b/code/modules/mining/mine_areas.dm @@ -7,10 +7,12 @@ /area/mine/explored name = "Mine" icon_state = "explored" + ambience = list('sound/ambience/ambimine.ogg', 'sound/ambience/song_game.ogg') /area/mine/unexplored name = "Mine" icon_state = "unexplored" + ambience = list('sound/ambience/ambimine.ogg', 'sound/ambience/song_game.ogg') /area/mine/lobby name = "Mining station" diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index cfa1e5af..8f35b32c 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -38,132 +38,6 @@ new /obj/item/clothing/glasses/meson(src) -/**********************Shuttle Computer**************************/ - -var/mining_shuttle_tickstomove = 10 -var/mining_shuttle_moving = 0 -var/mining_shuttle_location = 0 // 0 = station 13, 1 = mining station - -proc/move_mining_shuttle() - if(mining_shuttle_moving) return - mining_shuttle_moving = 1 - spawn(mining_shuttle_tickstomove*10) - var/area/fromArea - var/area/toArea - if (mining_shuttle_location == 1) - fromArea = locate(/area/shuttle/mining/outpost) - toArea = locate(/area/shuttle/mining/station) - - else - fromArea = locate(/area/shuttle/mining/station) - toArea = locate(/area/shuttle/mining/outpost) - - var/list/dstturfs = list() - var/throwy = world.maxy - - for(var/turf/T in toArea) - dstturfs += T - if(T.y < throwy) - throwy = T.y - - // hey you, get out of the way! - for(var/turf/T in dstturfs) - // find the turf to move things to - var/turf/D = locate(T.x, throwy - 1, 1) - //var/turf/E = get_step(D, SOUTH) - for(var/atom/movable/AM as mob|obj in T) - AM.Move(D) - // NOTE: Commenting this out to avoid recreating mass driver glitch - /* - spawn(0) - AM.throw_at(E, 1, 1) - return - */ - - if(istype(T, /turf/simulated)) - del(T) - - for(var/mob/living/carbon/bug in toArea) // If someone somehow is still in the shuttle's docking area... - bug.gib() - - for(var/mob/living/simple_animal/pest in toArea) // And for the other kind of bug... - pest.gib() - - fromArea.move_contents_to(toArea) - if (mining_shuttle_location) - mining_shuttle_location = 0 - else - mining_shuttle_location = 1 - - for(var/mob/M in toArea) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 3, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 1) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(3) - - mining_shuttle_moving = 0 - return - -/obj/machinery/computer/mining_shuttle - name = "mining shuttle console" - icon = 'icons/obj/computer.dmi' - icon_state = "shuttle" - req_access = list(access_mining) - circuit = "/obj/item/weapon/circuitboard/mining_shuttle" - var/hacked = 0 - var/location = 0 //0 = station, 1 = mining base - -/obj/machinery/computer/mining_shuttle/attack_hand(user as mob) - if(..(user)) - return - src.add_fingerprint(usr) - var/dat - - dat = "
Mining Shuttle Control
" - - if(mining_shuttle_moving) - dat += "Location: Moving
" - else - dat += "Location: [mining_shuttle_location ? "Outpost" : "Station"]
" - - dat += "Send
" - - - user << browse("[dat]", "window=miningshuttle;size=200x150") - -/obj/machinery/computer/mining_shuttle/Topic(href, href_list) - if(..()) - return - usr.set_machine(src) - src.add_fingerprint(usr) - if(href_list["move"]) - //if(ticker.mode.name == "blob") - // if(ticker.mode:declared) - // usr << "Under directive 7-10, [station_name()] is quarantined until further notice." - // return - - if (!mining_shuttle_moving) - usr << "\blue Shuttle recieved message and will be sent shortly." - move_mining_shuttle() - else - usr << "\blue Shuttle is already moving." - - updateUsrDialog() - -/obj/machinery/computer/mining_shuttle/attackby(obj/item/weapon/W as obj, mob/user as mob) - - if (istype(W, /obj/item/weapon/card/emag)) - src.req_access = list() - hacked = 1 - usr << "You fried the consoles ID checking system. It's now available to everyone!" - else - ..() - /******************************Lantern*******************************/ /obj/item/device/flashlight/lantern @@ -195,80 +69,80 @@ proc/move_mining_shuttle() var/excavation_amount = 100 - hammer - name = "sledgehammer" - //icon_state = "sledgehammer" Waiting on sprite - desc = "A mining hammer made of reinforced metal. You feel like smashing your boss in the face with this." +/obj/item/weapon/pickaxe/hammer + name = "sledgehammer" + //icon_state = "sledgehammer" Waiting on sprite + desc = "A mining hammer made of reinforced metal. You feel like smashing your boss in the face with this." - silver - name = "silver pickaxe" - icon_state = "spickaxe" - item_state = "spickaxe" - digspeed = 30 - origin_tech = "materials=3" - desc = "This makes no metallurgic sense." +/obj/item/weapon/pickaxe/silver + name = "silver pickaxe" + icon_state = "spickaxe" + item_state = "spickaxe" + digspeed = 30 + origin_tech = "materials=3" + desc = "This makes no metallurgic sense." - drill - name = "mining drill" // Can dig sand as well! - icon_state = "handdrill" - item_state = "jackhammer" - digspeed = 30 - origin_tech = "materials=2;powerstorage=3;engineering=2" - desc = "Yours is the drill that will pierce through the rock walls." - drill_verb = "drilling" +/obj/item/weapon/pickaxe/drill + name = "mining drill" // Can dig sand as well! + icon_state = "handdrill" + item_state = "jackhammer" + digspeed = 30 + origin_tech = "materials=2;powerstorage=3;engineering=2" + desc = "Yours is the drill that will pierce through the rock walls." + drill_verb = "drilling" - jackhammer - name = "sonic jackhammer" - icon_state = "jackhammer" - item_state = "jackhammer" - digspeed = 20 //faster than drill, but cannot dig - origin_tech = "materials=3;powerstorage=2;engineering=2" - desc = "Cracks rocks with sonic blasts, perfect for killing cave lizards." - drill_verb = "hammering" +/obj/item/weapon/pickaxe/jackhammer + name = "sonic jackhammer" + icon_state = "jackhammer" + item_state = "jackhammer" + digspeed = 20 //faster than drill, but cannot dig + origin_tech = "materials=3;powerstorage=2;engineering=2" + desc = "Cracks rocks with sonic blasts, perfect for killing cave lizards." + drill_verb = "hammering" - gold - name = "golden pickaxe" - icon_state = "gpickaxe" - item_state = "gpickaxe" - digspeed = 20 - origin_tech = "materials=4" - desc = "This makes no metallurgic sense." +/obj/item/weapon/pickaxe/gold + name = "golden pickaxe" + icon_state = "gpickaxe" + item_state = "gpickaxe" + digspeed = 20 + origin_tech = "materials=4" + desc = "This makes no metallurgic sense." - plasmacutter - name = "plasma cutter" - icon_state = "plasmacutter" - item_state = "gun" - w_class = 3.0 //it is smaller than the pickaxe - damtype = "fire" - digspeed = 20 //Can slice though normal walls, all girders, or be used in reinforced wall deconstruction/ light thermite on fire - origin_tech = "materials=4;plasmatech=3;engineering=3" - desc = "A rock cutter that uses bursts of hot plasma. You could use it to cut limbs off of xenos! Or, you know, mine stuff." - drill_verb = "cutting" +/obj/item/weapon/pickaxe/plasmacutter + name = "plasma cutter" + icon_state = "plasmacutter" + item_state = "gun" + w_class = 3.0 //it is smaller than the pickaxe + damtype = "fire" + digspeed = 20 //Can slice though normal walls, all girders, or be used in reinforced wall deconstruction/ light thermite on fire + origin_tech = "materials=4;phorontech=3;engineering=3" + desc = "A rock cutter that uses bursts of hot plasma. You could use it to cut limbs off of xenos! Or, you know, mine stuff." + drill_verb = "cutting" - diamond - name = "diamond pickaxe" - icon_state = "dpickaxe" - item_state = "dpickaxe" - digspeed = 10 - origin_tech = "materials=6;engineering=4" - desc = "A pickaxe with a diamond pick head, this is just like minecraft." +/obj/item/weapon/pickaxe/diamond + name = "diamond pickaxe" + icon_state = "dpickaxe" + item_state = "dpickaxe" + digspeed = 10 + origin_tech = "materials=6;engineering=4" + desc = "A pickaxe with a diamond pick head, this is just like minecraft." - diamonddrill //When people ask about the badass leader of the mining tools, they are talking about ME! - name = "diamond mining drill" - icon_state = "diamonddrill" - item_state = "jackhammer" - digspeed = 5 //Digs through walls, girders, and can dig up sand - origin_tech = "materials=6;powerstorage=4;engineering=5" - desc = "Yours is the drill that will pierce the heavens!" - drill_verb = "drilling" +/obj/item/weapon/pickaxe/diamonddrill //When people ask about the badass leader of the mining tools, they are talking about ME! + name = "diamond mining drill" + icon_state = "diamonddrill" + item_state = "jackhammer" + digspeed = 5 //Digs through walls, girders, and can dig up sand + origin_tech = "materials=6;powerstorage=4;engineering=5" + desc = "Yours is the drill that will pierce the heavens!" + drill_verb = "drilling" - borgdrill - name = "cyborg mining drill" - icon_state = "diamonddrill" - item_state = "jackhammer" - digspeed = 15 - desc = "" - drill_verb = "drilling" +/obj/item/weapon/pickaxe/borgdrill + name = "cyborg mining drill" + icon_state = "diamonddrill" + item_state = "jackhammer" + digspeed = 15 + desc = "" + drill_verb = "drilling" /*****************************Shovel********************************/ @@ -286,6 +160,8 @@ proc/move_mining_shuttle() matter = list("metal" = 50) origin_tech = "materials=1;engineering=1" attack_verb = list("bashed", "bludgeoned", "thrashed", "whacked") + sharp = 0 + edge = 1 /obj/item/weapon/shovel/spade name = "spade" @@ -308,3 +184,70 @@ proc/move_mining_shuttle() icon_opened = "miningcaropen" icon_closed = "miningcar" +// Flags. + +/obj/item/stack/flag + name = "flags" + desc = "Some colourful flags." + singular_name = "flag" + amount = 10 + max_amount = 10 + icon = 'icons/obj/mining.dmi' + var/upright = 0 + var/base_state + +/obj/item/stack/flag/New() + ..() + base_state = icon_state + +/obj/item/stack/flag/red + name = "red flags" + singular_name = "red flag" + icon_state = "redflag" + +/obj/item/stack/flag/yellow + name = "yellow flags" + singular_name = "yellow flag" + icon_state = "yellowflag" + +/obj/item/stack/flag/green + name = "green flags" + singular_name = "green flag" + icon_state = "greenflag" + +/obj/item/stack/flag/attackby(obj/item/W as obj, mob/user as mob) + if(upright && istype(W,src.type)) + src.attack_hand(user) + else + ..() + +/obj/item/stack/flag/attack_hand(user as mob) + if(upright) + upright = 0 + icon_state = base_state + anchored = 0 + src.visible_message("[user] knocks down [src].") + else + ..() + +/obj/item/stack/flag/attack_self(mob/user as mob) + + var/obj/item/stack/flag/F = locate() in get_turf(src) + + var/turf/T = get_turf(src) + if(!T || !istype(T,/turf/simulated/floor/plating/airless/asteroid)) + user << "The flag won't stand up in this terrain." + return + + if(F && F.upright) + user << "There is already a flag here." + return + + var/obj/item/stack/flag/newflag = new src.type(T) + newflag.amount = 1 + newflag.upright = 1 + anchored = 1 + newflag.name = newflag.singular_name + newflag.icon_state = "[newflag.base_state]_open" + newflag.visible_message("[user] plants [newflag] firmly in the ground.") + src.use(1) diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 1127ed1d..e3924ece 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -1,9 +1,9 @@ -/**********************Mineral deposits**************************/ - - datum/controller/game_controller/var/list/artifact_spawning_turfs = list() var/list/artifact_spawn = list() // Runtime fix for geometry loading before controller is instantiated. +/**********************Mineral deposits**************************/ + + /turf/simulated/mineral //wall piece name = "Rock" icon = 'icons/turf/walls.dmi' @@ -17,6 +17,7 @@ var/list/artifact_spawn = list() // Runtime fix for geometry loading before cont var/mineral/mineral var/mined_ore = 0 var/last_act = 0 + var/emitter_blasts_taken = 0 // EMITTER MINING! Muhehe. var/datum/geosample/geologic_data var/excavation_level = 0 @@ -27,364 +28,369 @@ var/list/artifact_spawn = list() // Runtime fix for geometry loading before cont var/obj/item/weapon/last_find var/datum/artifact_find/artifact_find + has_resources = 1 - New() - . = ..() +/turf/simulated/mineral/New() - MineralSpread() + MineralSpread() - spawn(1) - var/turf/T - if((istype(get_step(src, NORTH), /turf/simulated/floor)) || (istype(get_step(src, NORTH), /turf/space)) || (istype(get_step(src, NORTH), /turf/simulated/shuttle/floor))) - T = get_step(src, NORTH) - if (T) - T.overlays += image('icons/turf/walls.dmi', "rock_side_s") - if((istype(get_step(src, SOUTH), /turf/simulated/floor)) || (istype(get_step(src, SOUTH), /turf/space)) || (istype(get_step(src, SOUTH), /turf/simulated/shuttle/floor))) - T = get_step(src, SOUTH) - if (T) - T.overlays += image('icons/turf/walls.dmi', "rock_side_n", layer=6) - if((istype(get_step(src, EAST), /turf/simulated/floor)) || (istype(get_step(src, EAST), /turf/space)) || (istype(get_step(src, EAST), /turf/simulated/shuttle/floor))) - T = get_step(src, EAST) - if (T) - T.overlays += image('icons/turf/walls.dmi', "rock_side_w", layer=6) - if((istype(get_step(src, WEST), /turf/simulated/floor)) || (istype(get_step(src, WEST), /turf/space)) || (istype(get_step(src, WEST), /turf/simulated/shuttle/floor))) - T = get_step(src, WEST) - if (T) - T.overlays += image('icons/turf/walls.dmi', "rock_side_e", layer=6) + spawn(2) + var/list/step_overlays = list("s" = NORTH, "n" = SOUTH, "w" = EAST, "e" = WEST) + for(var/direction in step_overlays) + var/turf/turf_to_check = get_step(src,step_overlays[direction]) + if(istype(turf_to_check,/turf/simulated/floor/plating/airless/asteroid)) + var/turf/simulated/floor/plating/airless/asteroid/T = turf_to_check + T.updateMineralOverlays() - ex_act(severity) - switch(severity) - if(2.0) - if (prob(70)) - mined_ore = 1 //some of the stuff gets blown up - GetDrilled() - if(1.0) - mined_ore = 2 //some of the stuff gets blown up + else if(istype(turf_to_check,/turf/space) || istype(turf_to_check,/turf/simulated/floor)) + turf_to_check.overlays += image('icons/turf/walls.dmi', "rock_side_[direction]") + +/turf/simulated/mineral/ex_act(severity) + switch(severity) + if(2.0) + if (prob(70)) + mined_ore = 1 //some of the stuff gets blown up GetDrilled() + if(1.0) + mined_ore = 2 //some of the stuff gets blown up + GetDrilled() + +/turf/simulated/mineral/bullet_act(var/obj/item/projectile/Proj) + + // Emitter blasts + if(istype(Proj, /obj/item/projectile/beam/emitter)) + emitter_blasts_taken++ + + if(emitter_blasts_taken > 2) // 3 blasts per tile + mined_ore = 1 + GetDrilled() + +/turf/simulated/mineral/Bumped(AM) + . = ..() + if(istype(AM,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = AM + if((istype(H.l_hand,/obj/item/weapon/pickaxe)) && (!H.hand)) + attackby(H.l_hand,H) + else if((istype(H.r_hand,/obj/item/weapon/pickaxe)) && H.hand) + attackby(H.r_hand,H) + + else if(istype(AM,/mob/living/silicon/robot)) + var/mob/living/silicon/robot/R = AM + if(istype(R.module_active,/obj/item/weapon/pickaxe)) + attackby(R.module_active,R) + + else if(istype(AM,/obj/mecha)) + var/obj/mecha/M = AM + if(istype(M.selected,/obj/item/mecha_parts/mecha_equipment/tool/drill)) + M.selected.action(src) + +/turf/simulated/mineral/proc/MineralSpread() + if(mineral && mineral.spread) + for(var/trydir in cardinal) + if(prob(mineral.spread_chance)) + var/turf/simulated/mineral/random/target_turf = get_step(src, trydir) + if(istype(target_turf) && !target_turf.mineral) + target_turf.mineral = mineral + target_turf.UpdateMineral() + target_turf.MineralSpread() - Bumped(AM) - . = ..() - if(istype(AM,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = AM - if((istype(H.l_hand,/obj/item/weapon/pickaxe)) && (!H.hand)) - attackby(H.l_hand,H) - else if((istype(H.r_hand,/obj/item/weapon/pickaxe)) && H.hand) - attackby(H.r_hand,H) +/turf/simulated/mineral/proc/UpdateMineral() + if(!mineral) + name = "\improper Rock" + icon_state = "rock" + return + name = "\improper [mineral.display_name] deposit" + overlays.Cut() + overlays += "rock_[mineral.name]" - else if(istype(AM,/mob/living/silicon/robot)) - var/mob/living/silicon/robot/R = AM - if(istype(R.module_active,/obj/item/weapon/pickaxe)) - attackby(R.module_active,R) +//Not even going to touch this pile of spaghetti +/turf/simulated/mineral/attackby(obj/item/weapon/W as obj, mob/user as mob) - else if(istype(AM,/obj/mecha)) - var/obj/mecha/M = AM - if(istype(M.selected,/obj/item/mecha_parts/mecha_equipment/tool/drill)) - M.selected.action(src) + 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/device/core_sampler)) + geologic_data.UpdateNearbyArtifactInfo(src) + var/obj/item/device/core_sampler/C = W + C.sample_item(src, user) + return - proc/MineralSpread() - if(mineral && mineral.spread) - for(var/trydir in cardinal) - if(prob(mineral.spread_chance)) - var/turf/simulated/mineral/random/target_turf = get_step(src, trydir) - if(istype(target_turf) && !target_turf.mineral) - target_turf.mineral = mineral - target_turf.UpdateMineral() - target_turf.MineralSpread() + if (istype(W, /obj/item/device/depth_scanner)) + var/obj/item/device/depth_scanner/C = W + C.scan_atom(user, src) + return + if (istype(W, /obj/item/device/measuring_tape)) + var/obj/item/device/measuring_tape/P = W + user.visible_message("\blue[user] extends [P] towards [src].","\blue You extend [P] towards [src].") + if(do_after(user,25)) + user << "\blue \icon[P] [src] has been excavated to a depth of [2*excavation_level]cm." + return - proc/UpdateMineral() - if(!mineral) - name = "\improper Rock" - icon_state = "rock" - return - name = "\improper [mineral.display_name] deposit" - icon_state = "rock_[mineral.name]" - - - //Not even going to touch this pile of spaghetti - attackby(obj/item/weapon/W as obj, mob/user as mob) - - if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey") - usr << "\red You don't have the dexterity to do this!" + if (istype(W, /obj/item/weapon/pickaxe)) + var/turf/T = user.loc + if (!( istype(T, /turf) )) return - if (istype(W, /obj/item/device/core_sampler)) - geologic_data.UpdateNearbyArtifactInfo(src) - var/obj/item/device/core_sampler/C = W - C.sample_item(src, user) + var/obj/item/weapon/pickaxe/P = W + if(last_act + P.digspeed > world.time)//prevents message spam return + last_act = world.time - if (istype(W, /obj/item/device/depth_scanner)) - var/obj/item/device/depth_scanner/C = W - C.scan_atom(user, src) - return + playsound(user, P.drill_sound, 20, 1) - if (istype(W, /obj/item/device/measuring_tape)) - var/obj/item/device/measuring_tape/P = W - user.visible_message("\blue[user] extends [P] towards [src].","\blue You extend [P] towards [src].") - if(do_after(user,25)) - user << "\blue \icon[P] [src] has been excavated to a depth of [2*excavation_level]cm." - return + //handle any archaeological finds we might uncover + var/fail_message + if(finds && finds.len) + var/datum/find/F = finds[1] + if(excavation_level + P.excavation_amount > F.excavation_required) + //Chance to destroy / extract any finds here + fail_message = ". [pick("There is a crunching noise","[W] collides with some different rock","Part of the rock face crumbles away","Something breaks under [W]")]" - if (istype(W, /obj/item/weapon/pickaxe)) - var/turf/T = user.loc - if (!( istype(T, /turf) )) - return + user << "\red You start [P.drill_verb][fail_message ? fail_message : ""]." - var/obj/item/weapon/pickaxe/P = W - if(last_act + P.digspeed > world.time)//prevents message spam - return - last_act = world.time + if(fail_message && prob(90)) + if(prob(25)) + excavate_find(5, finds[1]) + else if(prob(50)) + finds.Remove(finds[1]) + if(prob(50)) + artifact_debris() - playsound(user, P.drill_sound, 20, 1) + if(do_after(user,P.digspeed)) + user << "\blue You finish [P.drill_verb] the rock." - //handle any archaeological finds we might uncover - var/fail_message if(finds && finds.len) var/datum/find/F = finds[1] - if(excavation_level + P.excavation_amount > F.excavation_required) - //Chance to destroy / extract any finds here - fail_message = ", [pick("there is a crunching noise","[W] collides with some different rock","part of the rock face crumbles away","something breaks under [W]")]" - - user << "\red You start [P.drill_verb][fail_message ? fail_message : ""]." - - if(fail_message && prob(90)) - if(prob(25)) - excavate_find(5, finds[1]) - else if(prob(50)) - finds.Remove(finds[1]) - if(prob(50)) - artifact_debris() - - if(do_after(user,P.digspeed)) - user << "\blue You finish [P.drill_verb] the rock." - - if(finds && finds.len) - var/datum/find/F = finds[1] - if(round(excavation_level + P.excavation_amount) == F.excavation_required) - //Chance to extract any items here perfectly, otherwise just pull them out along with the rock surrounding them - if(excavation_level + P.excavation_amount > F.excavation_required) - //if you can get slightly over, perfect extraction - excavate_find(100, F) - else - excavate_find(80, F) - - else if(excavation_level + P.excavation_amount > F.excavation_required - F.clearance_range) - //just pull the surrounding rock out - excavate_find(0, F) - - if( excavation_level + P.excavation_amount >= 100 ) - //if players have been excavating this turf, leave some rocky debris behind - var/obj/structure/boulder/B - if(artifact_find) - if( excavation_level > 0 || prob(15) ) - //boulder with an artifact inside - B = new(src) - if(artifact_find) - B.artifact_find = artifact_find - else - artifact_debris(1) - else if(prob(15)) - //empty boulder - B = new(src) - - if(B) - GetDrilled(0) + if(round(excavation_level + P.excavation_amount) == F.excavation_required) + //Chance to extract any items here perfectly, otherwise just pull them out along with the rock surrounding them + if(excavation_level + P.excavation_amount > F.excavation_required) + //if you can get slightly over, perfect extraction + excavate_find(100, F) else - GetDrilled(1) - return + excavate_find(80, F) - excavation_level += P.excavation_amount + else if(excavation_level + P.excavation_amount > F.excavation_required - F.clearance_range) + //just pull the surrounding rock out + excavate_find(0, F) - //archaeo overlays - if(!archaeo_overlay && finds && finds.len) - var/datum/find/F = finds[1] - if(F.excavation_required <= excavation_level + F.view_range) - archaeo_overlay = "overlay_archaeo[rand(1,3)]" - overlays += archaeo_overlay + if( excavation_level + P.excavation_amount >= 100 ) + //if players have been excavating this turf, leave some rocky debris behind + var/obj/structure/boulder/B + if(artifact_find) + if( excavation_level > 0 || prob(15) ) + //boulder with an artifact inside + B = new(src) + if(artifact_find) + B.artifact_find = artifact_find + else + artifact_debris(1) + else if(prob(15)) + //empty boulder + B = new(src) - //there's got to be a better way to do this - var/update_excav_overlay = 0 - if(excavation_level >= 75) - if(excavation_level - P.excavation_amount < 75) - update_excav_overlay = 1 - else if(excavation_level >= 50) - if(excavation_level - P.excavation_amount < 50) - update_excav_overlay = 1 - else if(excavation_level >= 25) - if(excavation_level - P.excavation_amount < 25) - update_excav_overlay = 1 - - //update overlays displaying excavation level - if( !(excav_overlay && excavation_level > 0) || update_excav_overlay ) - var/excav_quadrant = round(excavation_level / 25) + 1 - excav_overlay = "overlay_excv[excav_quadrant]_[rand(1,3)]" - overlays += excav_overlay - - /* Nope. - //extract pesky minerals while we're excavating - while(excavation_minerals.len && excavation_level > excavation_minerals[excavation_minerals.len]) - DropMineral() - pop(excavation_minerals) - mineralAmt-- */ - - //drop some rocks - next_rock += P.excavation_amount * 10 - while(next_rock > 100) - next_rock -= 100 - var/obj/item/weapon/ore/O = new(src) - geologic_data.UpdateNearbyArtifactInfo(src) - O.geologic_data = geologic_data - - else - return attack_hand(user) - - - proc/DropMineral() - if(!mineral) - return - - var/obj/item/weapon/ore/O = new mineral.ore (src) - if(istype(O)) - geologic_data.UpdateNearbyArtifactInfo(src) - O.geologic_data = geologic_data - return O - - - proc/GetDrilled(var/artifact_fail = 0) - //var/destroyed = 0 //used for breaking strange rocks - if (mineral && mineral.result_amount) - - //if the turf has already been excavated, some of it's ore has been removed - for (var/i = 1 to mineral.result_amount - mined_ore) - DropMineral() - - //destroyed artifacts have weird, unpleasant effects - //make sure to destroy them before changing the turf though - if(artifact_find && artifact_fail) - var/pain = 0 - if(prob(50)) - pain = 1 - for(var/mob/living/M in range(src, 200)) - M << "[pick("A high pitched [pick("keening","wailing","whistle")]","A rumbling noise like [pick("thunder","heavy machinery")]")] somehow penetrates your mind before fading away!" - if(pain) - flick("pain",M.pain) - if(prob(50)) - M.adjustBruteLoss(5) + if(B) + GetDrilled(0) else - flick("flash",M.flash) - if(prob(50)) - M.Stun(5) - M.apply_effect(25, IRRADIATE) + GetDrilled(1) + return - var/turf/simulated/floor/plating/airless/asteroid/N = ChangeTurf(/turf/simulated/floor/plating/airless/asteroid) - N.fullUpdateMineralOverlays() + excavation_level += P.excavation_amount - if(rand(1,75) == 1) - visible_message("An old dusty crate was buried within!") - new /obj/structure/closet/crate/secure/loot(src) + //archaeo overlays + if(!archaeo_overlay && finds && finds.len) + var/datum/find/F = finds[1] + if(F.excavation_required <= excavation_level + F.view_range) + archaeo_overlay = "overlay_archaeo[rand(1,3)]" + overlays += archaeo_overlay + + //there's got to be a better way to do this + var/update_excav_overlay = 0 + if(excavation_level >= 75) + if(excavation_level - P.excavation_amount < 75) + update_excav_overlay = 1 + else if(excavation_level >= 50) + if(excavation_level - P.excavation_amount < 50) + update_excav_overlay = 1 + else if(excavation_level >= 25) + if(excavation_level - P.excavation_amount < 25) + update_excav_overlay = 1 + + //update overlays displaying excavation level + if( !(excav_overlay && excavation_level > 0) || update_excav_overlay ) + var/excav_quadrant = round(excavation_level / 25) + 1 + excav_overlay = "overlay_excv[excav_quadrant]_[rand(1,3)]" + overlays += excav_overlay + + //drop some rocks + next_rock += P.excavation_amount * 10 + while(next_rock > 100) + next_rock -= 100 + var/obj/item/weapon/ore/O = new(src) + geologic_data.UpdateNearbyArtifactInfo(src) + O.geologic_data = geologic_data + + else + return attack_hand(user) + +/turf/simulated/mineral/proc/DropMineral() + if(!mineral) + return + + var/obj/item/weapon/ore/O = new mineral.ore (src) + if(istype(O)) + geologic_data.UpdateNearbyArtifactInfo(src) + O.geologic_data = geologic_data + return O + +/turf/simulated/mineral/proc/GetDrilled(var/artifact_fail = 0) + //var/destroyed = 0 //used for breaking strange rocks + if (mineral && mineral.result_amount) + + //if the turf has already been excavated, some of it's ore has been removed + for (var/i = 1 to mineral.result_amount - mined_ore) + DropMineral() + + //destroyed artifacts have weird, unpleasant effects + //make sure to destroy them before changing the turf though + if(artifact_find && artifact_fail) + var/pain = 0 + if(prob(50)) + pain = 1 + for(var/mob/living/M in range(src, 200)) + M << "[pick("A high pitched [pick("keening","wailing","whistle")]","A rumbling noise like [pick("thunder","heavy machinery")]")] somehow penetrates your mind before fading away!" + if(pain) + flick("pain",M.pain) + if(prob(50)) + M.adjustBruteLoss(5) + else + flick("flash",M.flash) + if(prob(50)) + M.Stun(5) + M.apply_effect(25, IRRADIATE) - proc/excavate_find(var/prob_clean = 0, var/datum/find/F) - //with skill and luck, players can cleanly extract finds - //otherwise, they come out inside a chunk of rock - var/obj/item/weapon/X - if(prob_clean) - X = new /obj/item/weapon/archaeological_find(src, new_item_type = F.find_type) - else - X = new /obj/item/weapon/ore/strangerock(src, inside_item_type = F.find_type) - geologic_data.UpdateNearbyArtifactInfo(src) - X:geologic_data = geologic_data + var/list/step_overlays = list("n" = NORTH, "s" = SOUTH, "e" = EAST, "w" = WEST) - //some find types delete the /obj/item/weapon/archaeological_find and replace it with something else, this handles when that happens - //yuck - var/display_name = "something" - if(!X) - X = last_find - if(X) - display_name = X.name + //Add some rubble, you did just clear out a big chunk of rock. + var/turf/simulated/floor/plating/airless/asteroid/N = ChangeTurf(/turf/simulated/floor/plating/airless/asteroid) + N.overlay_detail = "asteroid[rand(0,9)]" - //many finds are ancient and thus very delicate - luckily there is a specialised energy suspension field which protects them when they're being extracted - if(prob(F.prob_delicate)) - var/obj/effect/suspension_field/S = locate() in src - if(!S || S.field_type != get_responsive_reagent(F.find_type)) - if(X) - visible_message("\red[pick("[display_name] crumbles away into dust","[display_name] breaks apart")].") - del(X) + // Kill and update the space overlays around us. + for(var/direction in step_overlays) + var/turf/space/T = get_step(src, step_overlays[direction]) + if(istype(T)) + T.overlays.Cut() + for(var/next_direction in step_overlays) + if(istype(get_step(T, step_overlays[next_direction]),/turf/simulated/mineral)) + T.overlays += image('icons/turf/walls.dmi', "rock_side_[next_direction]") - finds.Remove(F) + // Update the + N.updateMineralOverlays(1) + + if(rand(1,500) == 1) + visible_message("An old dusty crate was buried within!") + new /obj/structure/closet/crate/secure/loot(src) - proc/artifact_debris(var/severity = 0) - //cael's patented random limited drop componentized loot system! - //sky's patented not-fucking-retarded overhaul! +/turf/simulated/mineral/proc/excavate_find(var/prob_clean = 0, var/datum/find/F) + //with skill and luck, players can cleanly extract finds + //otherwise, they come out inside a chunk of rock + var/obj/item/weapon/X + if(prob_clean) + X = new /obj/item/weapon/archaeological_find(src, new_item_type = F.find_type) + else + X = new /obj/item/weapon/ore/strangerock(src, inside_item_type = F.find_type) + geologic_data.UpdateNearbyArtifactInfo(src) + X:geologic_data = geologic_data - //Give a random amount of loot from 1 to 3 or 5, varying on severity. - for(var/j in 1 to rand(1, 3 + max(min(severity, 1), 0) * 2)) - switch(rand(1,7)) - if(1) - var/obj/item/stack/rods/R = new(src) - R.amount = rand(5,25) + //some find types delete the /obj/item/weapon/archaeological_find and replace it with something else, this handles when that happens + //yuck + var/display_name = "something" + if(!X) + X = last_find + if(X) + display_name = X.name - if(2) - var/obj/item/stack/tile/R = new(src) - R.amount = rand(1,5) + //many finds are ancient and thus very delicate - luckily there is a specialised energy suspension field which protects them when they're being extracted + if(prob(F.prob_delicate)) + var/obj/effect/suspension_field/S = locate() in src + if(!S || S.field_type != get_responsive_reagent(F.find_type)) + if(X) + visible_message("\red[pick("[display_name] crumbles away into dust","[display_name] breaks apart")].") + del(X) - if(3) - var/obj/item/stack/sheet/metal/R = new(src) - R.amount = rand(5,25) + finds.Remove(F) - if(4) - var/obj/item/stack/sheet/plasteel/R = new(src) - R.amount = rand(5,25) - if(5) - var/quantity = rand(1,3) - for(var/i=0, i" + + dat += "Send" + + + user << browse("[dat]", "window=miningshuttle;size=200x150") + +/obj/machinery/computer/mining_shuttle/Topic(href, href_list) + if(..()) + return + usr.set_machine(src) + src.add_fingerprint(usr) + if(href_list["move"]) + //if(ticker.mode.name == "blob") + // if(ticker.mode:declared) + // usr << "Under directive 7-10, [station_name()] is quarantined until further notice." + // return + + if (!mining_shuttle_moving) + usr << "\blue Shuttle recieved message and will be sent shortly." + move_mining_shuttle() + else + usr << "\blue Shuttle is already moving." + + updateUsrDialog() + +/obj/machinery/computer/mining_shuttle/attackby(obj/item/weapon/W as obj, mob/user as mob) + + if (istype(W, /obj/item/weapon/card/emag)) + src.req_access = list() + hacked = 1 + usr << "You fried the consoles ID checking system. It's now available to everyone!" + else + ..() diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm index 0b1c493d..d3c79914 100644 --- a/code/modules/mining/mint.dm +++ b/code/modules/mining/mint.dm @@ -24,6 +24,7 @@ var/coinsToProduce = 10 + /obj/machinery/mineral/mint/New() ..() spawn( 5 ) @@ -44,22 +45,22 @@ O = locate(/obj/item/stack/sheet, input.loc) if(O) if (istype(O,/obj/item/stack/sheet/mineral/gold)) - amt_gold += 100 * O.amount + amt_gold += 100 * O.get_amount() del(O) if (istype(O,/obj/item/stack/sheet/mineral/silver)) - amt_silver += 100 * O.amount + amt_silver += 100 * O.get_amount() del(O) if (istype(O,/obj/item/stack/sheet/mineral/diamond)) - amt_diamond += 100 * O.amount + amt_diamond += 100 * O.get_amount() del(O) if (istype(O,/obj/item/stack/sheet/mineral/plasma)) - amt_plasma += 100 * O.amount + amt_plasma += 100 * O.get_amount() del(O) if (istype(O,/obj/item/stack/sheet/mineral/uranium)) - amt_uranium += 100 * O.amount + amt_uranium += 100 * O.get_amount() del(O) if (istype(O,/obj/item/stack/sheet/metal)) - amt_iron += 100 * O.amount + amt_iron += 100 * O.get_amount() del(O) if (istype(O,/obj/item/stack/sheet/mineral/clown)) amt_clown += 100 * O.amount @@ -68,8 +69,7 @@ amt_adamantine += 100 * O.amount del(O) //Commented out for now. -Durandan - -/obj/machinery/mineral/mint/attack_hand(user as mob) //TODO: Adamantine coins! -Durandan +/obj/machinery/mineral/mint/attack_hand(user as mob) var/dat = "Coin Press
" @@ -105,22 +105,11 @@ dat += text("chosen") else dat += text("Choose") - dat += text("
uranium inserted: [amt_uranium] ") + dat += text("
Uranium inserted: [amt_uranium] ") if (chosen == "uranium") dat += text("chosen") else dat += text("Choose") - if(amt_clown > 0) - dat += text("
Bananium inserted: [amt_clown] ") - if (chosen == "clown") - dat += text("chosen") - else - dat += text("Choose") - dat += text("
Adamantine inserted: [amt_adamantine] ")//I don't even know these color codes, so fuck it. - if (chosen == "adamantine") - dat += text("chosen") - else - dat += text("Choose") dat += text("

Will produce [coinsToProduce] [chosen] coins if enough materials are available.
") //dat += text("The dial which controls the number of conins to produce seems to be stuck. A technician has already been dispatched to fix this.") diff --git a/code/modules/mining/money_bag.dm b/code/modules/mining/money_bag.dm index 691264c5..b142da3d 100644 --- a/code/modules/mining/money_bag.dm +++ b/code/modules/mining/money_bag.dm @@ -16,8 +16,6 @@ var/amt_iron = 0 var/amt_plasma = 0 var/amt_uranium = 0 - var/amt_clown = 0 - var/amt_adamantine = 0 for (var/obj/item/weapon/coin/C in contents) if (istype(C,/obj/item/weapon/coin/diamond)) @@ -32,10 +30,6 @@ amt_gold++; if (istype(C,/obj/item/weapon/coin/uranium)) amt_uranium++; - if (istype(C,/obj/item/weapon/coin/clown)) - amt_clown++; - if (istype(C,/obj/item/weapon/coin/adamantine)) - amt_adamantine++; var/dat = text("The contents of the moneybag reveal...
") if (amt_gold) @@ -50,10 +44,6 @@ dat += text("Plasma coins: [amt_plasma] Remove one
") if (amt_uranium) dat += text("Uranium coins: [amt_uranium] Remove one
") - if (amt_clown) - dat += text("Bananium coins: [amt_clown] Remove one
") - if (amt_adamantine) - dat += text("Adamantine coins: [amt_adamantine] Remove one
") user << browse("[dat]", "window=moneybag") /obj/item/weapon/moneybag/attackby(obj/item/weapon/W as obj, mob/user as mob) @@ -90,10 +80,6 @@ COIN = locate(/obj/item/weapon/coin/plasma,src.contents) if("uranium") COIN = locate(/obj/item/weapon/coin/uranium,src.contents) - if("clown") - COIN = locate(/obj/item/weapon/coin/clown,src.contents) - if("adamantine") - COIN = locate(/obj/item/weapon/coin/adamantine,src.contents) if(!COIN) return COIN.loc = src.loc @@ -110,5 +96,4 @@ new /obj/item/weapon/coin/silver(src) new /obj/item/weapon/coin/silver(src) new /obj/item/weapon/coin/gold(src) - new /obj/item/weapon/coin/gold(src) - new /obj/item/weapon/coin/adamantine(src) \ No newline at end of file + new /obj/item/weapon/coin/gold(src) \ No newline at end of file diff --git a/code/modules/mining/ore.dm b/code/modules/mining/ore.dm new file mode 100644 index 00000000..a2d1cc78 --- /dev/null +++ b/code/modules/mining/ore.dm @@ -0,0 +1,86 @@ +/obj/item/weapon/ore + name = "rock" + icon = 'icons/obj/mining.dmi' + icon_state = "ore2" + var/datum/geosample/geologic_data + var/oretag + +/obj/item/weapon/ore/clown + name = "Bananium ore" + icon_state = "Clown ore" + origin_tech = "materials=4" + +/obj/item/weapon/ore/uranium + name = "pitchblende" + icon_state = "Uranium ore" + origin_tech = "materials=5" + oretag = "uranium" + +/obj/item/weapon/ore/iron + name = "hematite" + icon_state = "Iron ore" + origin_tech = "materials=1" + oretag = "hematite" + +/obj/item/weapon/ore/coal + name = "carbonaceous rock" + icon_state = "Coal ore" + origin_tech = "materials=1" + oretag = "coal" + +/obj/item/weapon/ore/glass + name = "impure silicates" + icon_state = "Glass ore" + origin_tech = "materials=1" + oretag = "sand" + +/obj/item/weapon/ore/plasma + name = "plasma crystals" + icon_state = "Plasma ore" + origin_tech = "materials=2" + oretag = "plasma" + +/obj/item/weapon/ore/silver + name = "native silver ore" + icon_state = "Silver ore" + origin_tech = "materials=3" + oretag = "silver" + +/obj/item/weapon/ore/gold + name = "native gold ore" + icon_state = "Gold ore" + origin_tech = "materials=4" + oretag = "gold" + +/obj/item/weapon/ore/diamond + name = "diamonds" + icon_state = "Diamond ore" + origin_tech = "materials=6" + oretag = "diamond" + +/obj/item/weapon/ore/osmium + name = "raw platinum" + icon_state = "Platinum ore" + oretag = "platinum" + +/obj/item/weapon/ore/hydrogen + name = "raw hydrogen" + icon_state = "Phazon" + oretag = "hydrogen" + +/obj/item/weapon/ore/slag + name = "Slag" + desc = "Completely useless" + icon_state = "slag" + oretag = "slag" + +/obj/item/weapon/ore/New() + pixel_x = rand(0,16)-8 + pixel_y = rand(0,8)-8 + +/obj/item/weapon/ore/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W,/obj/item/device/core_sampler)) + var/obj/item/device/core_sampler/C = W + C.sample_item(src, user) + else + return ..() \ No newline at end of file diff --git a/code/modules/mining/ore_datum.dm b/code/modules/mining/ore_datum.dm new file mode 100644 index 00000000..b3689d3a --- /dev/null +++ b/code/modules/mining/ore_datum.dm @@ -0,0 +1,52 @@ +/datum/ore + var/oretag + var/alloy + var/smelts_to + var/compresses_to + +/datum/ore/uranium + smelts_to = /obj/item/stack/sheet/mineral/uranium + oretag = "uranium" + +/datum/ore/iron + smelts_to = /obj/item/stack/sheet/mineral/iron + alloy = 1 + oretag = "hematite" + +/datum/ore/coal + smelts_to = /obj/item/stack/sheet/mineral/plastic + alloy = 1 + oretag = "coal" + +/datum/ore/glass + smelts_to = /obj/item/stack/sheet/glass + compresses_to = /obj/item/stack/sheet/mineral/sandstone + oretag = "sand" + +/datum/ore/phoron + //smelts_to = something that explodes violently on the conveyor, huhuhuhu + compresses_to = /obj/item/stack/sheet/mineral/phoron + oretag = "phoron" + +/datum/ore/silver + smelts_to = /obj/item/stack/sheet/mineral/silver + oretag = "silver" + +/datum/ore/gold + smelts_to = /obj/item/stack/sheet/mineral/gold + oretag = "gold" + +/datum/ore/diamond + compresses_to = /obj/item/stack/sheet/mineral/diamond + oretag = "diamond" + +/datum/ore/osmium + smelts_to = /obj/item/stack/sheet/mineral/platinum + compresses_to = /obj/item/stack/sheet/mineral/osmium + alloy = 1 + oretag = "platinum" + +/datum/ore/hydrogen + smelts_to = /obj/item/stack/sheet/mineral/tritium + compresses_to = /obj/item/stack/sheet/mineral/mhydrogen + oretag = "hydrogen" diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm deleted file mode 100644 index 1c3be4e6..00000000 --- a/code/modules/mining/ores_coins.dm +++ /dev/null @@ -1,163 +0,0 @@ -/**********************Mineral ores**************************/ - -/obj/item/weapon/ore - name = "Rock" - icon = 'icons/obj/mining.dmi' - icon_state = "ore2" - var/datum/geosample/geologic_data - -/obj/item/weapon/ore/uranium - name = "Uranium ore" - icon_state = "Uranium ore" - origin_tech = "materials=5" - -/obj/item/weapon/ore/iron - name = "Iron ore" - icon_state = "Iron ore" - origin_tech = "materials=1" - -/obj/item/weapon/ore/glass - name = "Sand" - icon_state = "Glass ore" - origin_tech = "materials=1" - - attack_self(mob/living/user as mob) //It's magic I ain't gonna explain how instant conversion with no tool works. -- Urist - var/location = get_turf(user) - for(var/obj/item/weapon/ore/glass/sandToConvert in location) - new /obj/item/stack/sheet/mineral/sandstone(location) - del(sandToConvert) - new /obj/item/stack/sheet/mineral/sandstone(location) - del(src) - -/obj/item/weapon/ore/plasma - name = "Plasma ore" - icon_state = "Plasma ore" - origin_tech = "materials=2" - -/obj/item/weapon/ore/silver - name = "Silver ore" - icon_state = "Silver ore" - origin_tech = "materials=3" - -/obj/item/weapon/ore/gold - name = "Gold ore" - icon_state = "Gold ore" - origin_tech = "materials=4" - -/obj/item/weapon/ore/diamond - name = "Diamond ore" - icon_state = "Diamond ore" - origin_tech = "materials=6" - -/obj/item/weapon/ore/clown - name = "Bananium ore" - icon_state = "Clown ore" - origin_tech = "materials=4" - -/obj/item/weapon/ore/slag - name = "Slag" - desc = "Completely useless" - icon_state = "slag" - -/obj/item/weapon/ore/New() - pixel_x = rand(0,16)-8 - pixel_y = rand(0,8)-8 - -/obj/item/weapon/ore/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(istype(W,/obj/item/device/core_sampler)) - var/obj/item/device/core_sampler/C = W - C.sample_item(src, user) - else - return ..() - -/*****************************Coin********************************/ - -/obj/item/weapon/coin - icon = 'icons/obj/items.dmi' - name = "Coin" - icon_state = "coin" - flags = FPRINT | TABLEPASS| CONDUCT - force = 0.0 - throwforce = 0.0 - w_class = 1.0 - var/string_attached - var/sides = 2 - -/obj/item/weapon/coin/New() - pixel_x = rand(0,16)-8 - pixel_y = rand(0,8)-8 - -/obj/item/weapon/coin/gold - name = "gold coin" - icon_state = "coin_gold" - -/obj/item/weapon/coin/silver - name = "silver coin" - icon_state = "coin_silver" - -/obj/item/weapon/coin/diamond - name = "diamond coin" - icon_state = "coin_diamond" - -/obj/item/weapon/coin/iron - name = "iron coin" - icon_state = "coin_iron" - -/obj/item/weapon/coin/plasma - name = "solid plasma coin" - icon_state = "coin_plasma" - -/obj/item/weapon/coin/uranium - name = "uranium coin" - icon_state = "coin_uranium" - -/obj/item/weapon/coin/clown - name = "bananaium coin" - icon_state = "coin_clown" - -/obj/item/weapon/coin/adamantine - name = "adamantine coin" - icon_state = "coin_adamantine" - -/obj/item/weapon/coin/mythril - name = "mythril coin" - icon_state = "coin_mythril" - -/obj/item/weapon/coin/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(istype(W,/obj/item/weapon/cable_coil) ) - var/obj/item/weapon/cable_coil/CC = W - if(string_attached) - user << "\blue There already is a string attached to this coin." - return - - if(CC.amount <= 0) - user << "\blue This cable coil appears to be empty." - del(CC) - return - - overlays += image('icons/obj/items.dmi',"coin_string_overlay") - string_attached = 1 - user << "\blue You attach a string to the coin." - CC.use(1) - else if(istype(W,/obj/item/weapon/wirecutters) ) - if(!string_attached) - ..() - return - - var/obj/item/weapon/cable_coil/CC = new/obj/item/weapon/cable_coil(user.loc) - CC.amount = 1 - CC.updateicon() - overlays = list() - string_attached = null - user << "\blue You detach the string from the coin." - else ..() - -/obj/item/weapon/coin/attack_self(mob/user as mob) - var/result = rand(1, sides) - var/comment = "" - if(result == 1) - comment = "tails" - else if(result == 2) - comment = "heads" - user.visible_message("[user] has thrown \the [src]. It lands on [comment]! ", \ - "You throw \the [src]. It lands on [comment]! ") diff --git a/code/modules/mining/satchel_ore_boxdm.dm b/code/modules/mining/satchel_ore_boxdm.dm index ebbf0ec6..eb596309 100644 --- a/code/modules/mining/satchel_ore_boxdm.dm +++ b/code/modules/mining/satchel_ore_boxdm.dm @@ -4,9 +4,11 @@ /obj/structure/ore_box icon = 'icons/obj/mining.dmi' icon_state = "orebox0" - name = "Ore Box" + name = "ore box" desc = "A heavy box used for storing ore." density = 1 + var/last_update = 0 + var/list/stored_ore = list() /obj/structure/ore_box/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/ore)) @@ -18,74 +20,82 @@ for(var/obj/item/weapon/ore/O in S.contents) S.remove_from_storage(O, src) //This will move the item to this item's contents user << "\blue You empty the satchel into the box." + + update_ore_count() + return -/obj/structure/ore_box/attack_hand(obj, mob/user as mob) - 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 - var/amt_strange = 0 +/obj/structure/ore_box/proc/update_ore_count() + stored_ore = list() - for (var/obj/item/weapon/ore/C in contents) - if (istype(C,/obj/item/weapon/ore/diamond)) - amt_diamond++; - if (istype(C,/obj/item/weapon/ore/glass)) - amt_glass++; - if (istype(C,/obj/item/weapon/ore/plasma)) - amt_plasma++; - if (istype(C,/obj/item/weapon/ore/iron)) - amt_iron++; - if (istype(C,/obj/item/weapon/ore/silver)) - amt_silver++; - if (istype(C,/obj/item/weapon/ore/gold)) - amt_gold++; - if (istype(C,/obj/item/weapon/ore/uranium)) - amt_uranium++; - if (istype(C,/obj/item/weapon/ore/clown)) - amt_clown++; - if (istype(C,/obj/item/weapon/ore/strangerock)) - amt_strange++; + for(var/obj/item/weapon/ore/O in contents) - var/dat = text("The contents of the ore box reveal...
") - if (amt_gold) - dat += text("Gold ore: [amt_gold]
") - if (amt_silver) - dat += text("Silver ore: [amt_silver]
") - if (amt_iron) - dat += text("Metal ore: [amt_iron]
") - if (amt_glass) - dat += text("Sand: [amt_glass]
") - if (amt_diamond) - dat += text("Diamond ore: [amt_diamond]
") - if (amt_plasma) - dat += text("Plasma ore: [amt_plasma]
") - if (amt_uranium) - dat += text("Uranium ore: [amt_uranium]
") - if (amt_clown) - dat += text("Bananium ore: [amt_clown]
") - if (amt_strange) - dat += text("Strange rocks: [amt_strange]
") + if(stored_ore[O.name]) + stored_ore[O.name]++ + else + stored_ore[O.name] = 1 - dat += text("

Empty box") - user << browse("[dat]", "window=orebox") - return +/obj/structure/ore_box/examine(mob/user) + user << "That's an [src]." + user << desc -/obj/structure/ore_box/Topic(href, href_list) - if(..()) + // Borgs can now check contents too. + if((!istype(user, /mob/living/carbon/human)) && (!istype(user, /mob/living/silicon/robot))) return - usr.set_machine(src) - src.add_fingerprint(usr) - if(href_list["removeall"]) - for (var/obj/item/weapon/ore/O in contents) - contents -= O - O.loc = src.loc - usr << "\blue You empty the box" - src.updateUsrDialog() + + if(!Adjacent(user)) //Can only check the contents of ore boxes if you can physically reach them. + return + + add_fingerprint(user) + + if(!contents.len) + user << "It is empty." + return + + if(world.time > last_update + 10) + update_ore_count() + last_update = world.time + + user << "It holds:" + for(var/ore in stored_ore) + user << "- [stored_ore[ore]] [ore]" return + +/obj/structure/ore_box/verb/empty_box() + set name = "Empty Ore Box" + set category = "Object" + set src in view(1) + + if(!istype(usr, /mob/living/carbon/human)) //Only living, intelligent creatures with hands can empty ore boxes. + usr << "\red You are physically incapable of emptying the ore box." + return + + if( usr.stat || usr.restrained() ) + return + + if(!Adjacent(usr)) //You can only empty the box if you can physically reach it + usr << "You cannot reach the ore box." + return + + add_fingerprint(usr) + + if(contents.len < 1) + usr << "\red The ore box is empty" + return + + for (var/obj/item/weapon/ore/O in contents) + contents -= O + O.loc = src.loc + usr << "\blue You empty the ore box" + + return + +/obj/structure/ore_box/ex_act(severity) + if(severity == 1.0 || (severity < 3.0 && prob(50))) + for (var/obj/item/weapon/ore/O in contents) + O.loc = src.loc + O.ex_act(severity++) + del(src) + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/alien/alien_powers.dm b/code/modules/mob/living/carbon/human/alien/alien_powers.dm index e23bdfbd..a87188db 100644 --- a/code/modules/mob/living/carbon/human/alien/alien_powers.dm +++ b/code/modules/mob/living/carbon/human/alien/alien_powers.dm @@ -35,7 +35,7 @@ return if(P.stored_plasma < cost) - src << "\red You don't have enough phoron stored to do that." + src << "\red You don't have enough plasma stored to do that." return 0 if(needs_foundation) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 16f1c68a..5abdcc27 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -42,7 +42,7 @@ var/death_message = "seizes up and falls limp, their eyes dead and lifeless..." var/breath_type = "oxygen" // Non-oxygen gas breathed, if any. - var/poison_type = "phoron" // Poisonous air. + var/poison_type = "plasma" // Poisonous air. var/exhale_type = "carbon_dioxide" // Exhaled gas type. var/total_health = 100 //Point at which the mob will enter crit. diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index f8132cf6..8837307a 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -18,7 +18,7 @@ var/mutantrace // Safeguard due to old code. var/breath_type = "oxygen" // Non-oxygen gas breathed, if any. - var/poison_type = "plasma" // Poisonous air. + var/poison_type = "phoron" // Poisonous air. var/exhale_type = "carbon_dioxide" // Exhaled gas type. var/cold_level_1 = 260 // Cold damage level 1 below this point. diff --git a/icons/obj/mining_drill.dmi b/icons/obj/mining_drill.dmi new file mode 100644 index 00000000..7a9ad6b0 Binary files /dev/null and b/icons/obj/mining_drill.dmi differ