From b94c3deaf2f2d3bff149f96e6d8a3f3c23a99d6a Mon Sep 17 00:00:00 2001 From: DZD Date: Wed, 8 Jul 2015 16:19:26 -0400 Subject: [PATCH 01/20] Initial Commit for -tg- Mining I can guarantee this will not compile, very much a WIP and currently consists of mostly copy+pasting -tg-'s modules/mining folder over ours, and unticking a few of our own files. --- code/game/objects/items.dm | 6 + code/modules/mining/coins.dm | 10 + code/modules/mining/equipment_locker.dm | 497 ++++++---- .../modules/mining/laborcamp/laborminerals.dm | 6 +- .../mining/machine_input_output_plates.dm | 12 +- code/modules/mining/machine_processing.dm | 530 +++++++---- code/modules/mining/machine_stacking.dm | 133 +-- code/modules/mining/machine_unloading.dm | 4 +- code/modules/mining/mine_areas.dm | 14 + code/modules/mining/mine_items.dm | 140 ++- code/modules/mining/mine_turfs.dm | 886 +++++++++--------- code/modules/mining/mint.dm | 256 +++-- code/modules/mining/money_bag.dm | 42 +- code/modules/mining/ore.dm | 210 ++++- code/modules/mining/satchel_ore_boxdm.dm | 179 ++-- .../mob/living/silicon/robot/robot_modules.dm | 2 +- icons/turf/mining.dmi | Bin 0 -> 33905 bytes icons/turf/walls.dmi | Bin 272365 -> 202430 bytes paradise.dme | 12 - 19 files changed, 1607 insertions(+), 1332 deletions(-) create mode 100644 icons/turf/mining.dmi diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index e1b8e41baf8..b82ac4a50ae 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -65,6 +65,12 @@ src:my_atom = null*/ return ..() +/obj/item/proc/check_allowed_items(atom/target, not_inside, target_self) + if(((src in target) && !target_self) || ((!istype(target.loc, /turf)) && (!istype(target, /turf)) && (not_inside)) || is_type_in_list(target, can_be_placed_into)) + return 0 + else + return 1 + /obj/item/device icon = 'icons/obj/device.dmi' diff --git a/code/modules/mining/coins.dm b/code/modules/mining/coins.dm index 16c4f90fde1..5fe7d37bc09 100644 --- a/code/modules/mining/coins.dm +++ b/code/modules/mining/coins.dm @@ -74,6 +74,16 @@ sideslist = list("heads") credits = 20 +/obj/item/weapon/coin/antagtoken + name = "antag token" + icon_state = "coin_valid_valid" + cmineral = "valid" + desc = "A novelty coin that helps the heart know what hard evidence cannot prove." + sideslist = list("valid", "salad") + value = 20 + +/obj/item/weapon/coin/antagtoken/New() + return /obj/item/weapon/coin/attackby(obj/item/weapon/W as obj, mob/user as mob, params) if(istype(W, /obj/item/stack/cable_coil)) diff --git a/code/modules/mining/equipment_locker.dm b/code/modules/mining/equipment_locker.dm index 52998277e5a..563cc3b1493 100644 --- a/code/modules/mining/equipment_locker.dm +++ b/code/modules/mining/equipment_locker.dm @@ -8,6 +8,8 @@ icon_state = "ore_redemption" density = 1 anchored = 1.0 + input_dir = NORTH + output_dir = SOUTH var/obj/machinery/mineral/input = null var/obj/machinery/mineral/output = null req_one_access = list( @@ -15,51 +17,116 @@ access_chemistry, access_bar, access_research, - access_ce, - access_virology + access_ce ) - var/datum/materials/materials = new - var/stack_amt = 50; //amount to stack before releasing + var/stk_types = list() + var/stk_amt = list() + var/stack_list[0] //Key: Type. Value: Instance of type. var/obj/item/weapon/card/id/inserted_id var/points = 0 + var/ore_pickup_rate = 15 + var/sheet_per_ore = 1 + var/point_upgrade = 1 + var/list/ore_values = list(("sand" = 1), ("iron" = 1), ("gold" = 20), ("silver" = 20), ("uranium" = 20), ("bananium" = 30), ("diamond" = 40), ("plasma" = 40)) /obj/machinery/mineral/ore_redemption/New() - 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 + ..() + component_parts = list() + component_parts += new /obj/item/weapon/circuitboard/ore_redemption(null) + component_parts += new /obj/item/weapon/stock_parts/matter_bin(null) + component_parts += new /obj/item/weapon/stock_parts/manipulator(null) + component_parts += new /obj/item/weapon/stock_parts/micro_laser(null) + component_parts += new /obj/item/device/assembly/igniter(null) + component_parts += new /obj/item/weapon/stock_parts/console_screen(null) + RefreshParts() + +/obj/machinery/mineral/ore_redemption/RefreshParts() + var/ore_pickup_rate_temp = 15 + var/point_upgrade_temp = 1 + var/sheet_per_ore_temp = 1 + for(var/obj/item/weapon/stock_parts/matter_bin/B in component_parts) + sheet_per_ore_temp = B.rating + for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts) + ore_pickup_rate_temp = 15 * M.rating + for(var/obj/item/weapon/stock_parts/micro_laser/L in component_parts) + point_upgrade_temp = L.rating + ore_pickup_rate = ore_pickup_rate_temp + point_upgrade = point_upgrade_temp + sheet_per_ore = sheet_per_ore_temp /obj/machinery/mineral/ore_redemption/proc/process_sheet(obj/item/weapon/ore/O) var/obj/item/stack/sheet/processed_sheet = SmeltMineral(O) if(processed_sheet) - var/datum/material/mat = materials.getMaterial(O.oretag) - mat.stored += processed_sheet.amount //Stack the sheets - O.loc = null //Let the old sheet garbage collect - while(mat.stored > stack_amt) //Get rid of excessive stackage - var/obj/item/stack/sheet/out = new mat.sheettype(output.loc) - out.amount = stack_amt-mat.stored - mat.stored -= out.amount + if(!(processed_sheet in stack_list)) //It's the first of this sheet added + var/obj/item/stack/sheet/s = new processed_sheet(src,0) + s.amount = 0 + stack_list[processed_sheet] = s + if(s.name != "glass" && s.name != "metal") //we can get these from cargo anyway + var/msg = "[capitalize(s.name)] sheets are now available in the Cargo Bay." + for(var/obj/machinery/requests_console/D in allConsoles) + if(D.department == "Science" || D.department == "Robotics" || D.department == "Research Director's Desk" || (D.department == "Chemistry" && s.name == "uranium")) + D.createmessage("Ore Redemption Machine", "New minerals available!", msg, 1, 0) + var/obj/item/stack/sheet/storage = stack_list[processed_sheet] + storage.amount += sheet_per_ore //Stack the sheets + O.loc = null //Let the old sheet... + qdel(O) //... garbage collect /obj/machinery/mineral/ore_redemption/process() - var/turf/T = get_turf(input) - if(T) - var/obj/item/weapon/ore/O - for(O in T) - process_sheet(O) - for(var/obj/structure/ore_box/B in T) - for(O in B.contents) - process_sheet(O) + if(!panel_open) //If the machine is partially dissassembled, it should not process minerals + var/turf/T = get_turf(get_step(src, input_dir)) + var/i + if(T) + if(locate(/obj/item/weapon/ore) in T) + for (i = 0; i < ore_pickup_rate; i++) + var/obj/item/weapon/ore/O = locate() in T + if(O) + process_sheet(O) + else + break + else + var/obj/structure/ore_box/B = locate() in T + if(B) + for (i = 0; i < ore_pickup_rate; i++) + var/obj/item/weapon/ore/O = locate() in B.contents + if(O) + process_sheet(O) + else + break + +/obj/machinery/mineral/ore_redemption/attackby(var/obj/item/weapon/W, var/mob/user, params) + if(istype(W,/obj/item/weapon/card/id)) + var/obj/item/weapon/card/id/I = usr.get_active_hand() + if(istype(I) && !istype(inserted_id)) + if(!user.drop_item()) + return + I.loc = src + inserted_id = I + interact(user) + return + if(exchange_parts(user, W)) + return + + if(default_pry_open(W)) + return + + if(default_unfasten_wrench(user, W)) + return + if(default_deconstruction_screwdriver(user, "ore_redemption-open", "ore_redemption", W)) + updateUsrDialog() + return + if(panel_open) + if(istype(W, /obj/item/weapon/crowbar)) + empty_content() + default_deconstruction_crowbar(W) + return 1 + ..() /obj/machinery/mineral/ore_redemption/proc/SmeltMineral(var/obj/item/weapon/ore/O) - if(O.oretag) - var/datum/material/mat = materials.getMaterial(O.oretag) - var/obj/item/stack/sheet/M = new mat.sheettype(src) - points += mat.value + if(O.refined_type) + var/obj/item/stack/sheet/M = O.refined_type + points += O.points * point_upgrade return M - del(O)//No refined type? Purge it. + qdel(O)//No refined type? Purge it. return /obj/machinery/mineral/ore_redemption/attack_hand(user as mob) @@ -68,9 +135,9 @@ interact(user) /obj/machinery/mineral/ore_redemption/interact(mob/user) + var/obj/item/stack/sheet/s var/dat - dat += text("Ore Redemption Machine

") dat += text("This machine only accepts ore. Gibtonite and Slag are not accepted.

") dat += text("Current unclaimed points: [points]
") @@ -80,24 +147,31 @@ else dat += text("No ID inserted. Insert ID.
") - for(var/O in materials.storage) - var/datum/material/mat = materials.getMaterial(O) - if(mat.stored > 0) - dat += text("[capitalize(mat.processed_name)]: [mat.stored] Release
") + for(var/O in stack_list) + s = stack_list[O] + if(s.amount > 0) + if(O == stack_list[1]) + dat += "
" //just looks nicer + dat += text("[capitalize(s.name)]: [s.amount] Release
") - dat += text("
This unit can hold stacks of [stack_amt] sheets of each mineral type.

") + if((/obj/item/stack/sheet/metal in stack_list) && (/obj/item/stack/sheet/mineral/plasma in stack_list)) + var/obj/item/stack/sheet/metalstack = stack_list[/obj/item/stack/sheet/metal] + var/obj/item/stack/sheet/plasmastack = stack_list[/obj/item/stack/sheet/mineral/plasma] + if(min(metalstack.amount, plasmastack.amount)) + dat += text("Plasteel Alloy (Metal + Plasma): Smelt
") - dat += text("
Mineral Value List:
[get_ore_values()]") - - user << browse("[dat]", "window=console_stacking_machine") + dat += text("
Mineral Value List:
[get_ore_values()]
") + var/datum/browser/popup = new(user, "console_stacking_machine", "Ore Redemption Machine", 400, 500) + popup.set_content(dat) + popup.open() return /obj/machinery/mineral/ore_redemption/proc/get_ore_values() var/dat = "" - for(var/mat_id in materials.storage) - var/datum/material/mat = materials.getMaterial(mat_id) - dat += "" + for(var/ore in ore_values) + var/value = ore_values[ore] + dat += "" dat += "
[capitalize(mat.processed_name)][mat.value]
[capitalize(ore)][value * point_upgrade]
" return dat @@ -111,35 +185,80 @@ inserted_id.verb_pickup() inserted_id = null if(href_list["choice"] == "claim") - inserted_id.mining_points += points - points = 0 - src << "Points transferred." + if(access_mining_station in inserted_id.access) + inserted_id.mining_points += points + points = 0 + else + usr << "Required access not found." else if(href_list["choice"] == "insert") var/obj/item/weapon/card/id/I = usr.get_active_hand() if(istype(I)) - usr.drop_item() + if(!usr.drop_item()) + return I.loc = src inserted_id = I - else usr << "\red No valid ID." - if(href_list["release"] && istype(inserted_id)) - if(check_access(inserted_id)) - var/release=href_list["release"] - var/datum/material/mat = materials.getMaterial(release) - if(!mat) return - var/desired = input("How much?","How much [mat.processed_name] to eject?",mat.stored) as num - if(desired==0) return - var/obj/item/stack/sheet/out = new mat.sheettype() - out.amount = min(mat.stored,desired) - mat.stored=desired + else usr << "No valid ID." + if(href_list["release"]) + if(check_access(inserted_id) || allowed(usr)) //Check the ID inside, otherwise check the user. + if(!(text2path(href_list["release"]) in stack_list)) return + var/obj/item/stack/sheet/inp = stack_list[text2path(href_list["release"])] + var/obj/item/stack/sheet/out = new inp.type() + var/desired = input("How much?", "How much to eject?", 1) as num + out.amount = min(desired,50,inp.amount) + if(out.amount >= 1) + inp.amount -= out.amount + unload_mineral(out) + if(inp.amount < 1) + stack_list -= text2path(href_list["release"]) + else + usr << "Required access not found." + if(href_list["plasteel"]) + if(check_access(inserted_id) || allowed(usr)) + if(!(/obj/item/stack/sheet/metal in stack_list)) return + if(!(/obj/item/stack/sheet/mineral/plasma in stack_list)) return + var/obj/item/stack/sheet/metalstack = stack_list[/obj/item/stack/sheet/metal] + var/obj/item/stack/sheet/plasmastack = stack_list[/obj/item/stack/sheet/mineral/plasma] + + var/desired = input("How much?", "How much would you like to smelt?", 1) as num + var/obj/item/stack/sheet/plasteel/plasteelout = new + plasteelout.amount = min(desired,50,metalstack.amount,plasmastack.amount) + if(plasteelout.amount >= 1) + metalstack.amount -= plasteelout.amount + plasmastack.amount -= plasteelout.amount + unload_mineral(plasteelout) + else + usr << "Required access not found." updateUsrDialog() return -/obj/machinery/mineral/ore_redemption/ex_act() - return //So some chucklefuck doesn't ruin miners reward with an explosion +/obj/machinery/mineral/ore_redemption/ex_act(severity, target) + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, src) + s.start() + if(severity == 1) + if(prob(50)) + empty_content() + qdel(src) + else if(severity == 2) + if(prob(25)) + empty_content() + qdel(src) + +//empty the redemption machine by stacks of at most max_amount (50 at this time) size +/obj/machinery/mineral/ore_redemption/proc/empty_content() + var/obj/item/stack/sheet/s + + for(var/O in stack_list) + s = stack_list[O] + while(s.amount > s.max_amount) + new s.type(loc,s.max_amount) + s.use(s.max_amount) + s.loc = loc + s.layer = initial(s.layer) /**********************Mining Equipment Locker**************************/ -/obj/machinery/mineral/equipment_locker +/obj/machinery/mineral/equipment_vendor name = "mining equipment vendor" desc = "An equipment vendor for miners, points collected at an ore redemption machine can be spent here." icon = 'icons/obj/machines/mining_machines.dmi' @@ -148,24 +267,24 @@ anchored = 1.0 var/obj/item/weapon/card/id/inserted_id var/list/prize_list = list( - new /datum/data/mining_equipment("Stimpack MediPen", /obj/item/weapon/reagent_containers/hypospray/autoinjector/stimpack, 50), - new /datum/data/mining_equipment("Teporone MediPen", /obj/item/weapon/reagent_containers/hypospray/autoinjector/teporone, 50), - new /datum/data/mining_equipment("MediPen Bundle", /obj/item/weapon/storage/box/autoinjector/utility, 200), - new /datum/data/mining_equipment("Whiskey", /obj/item/weapon/reagent_containers/food/drinks/bottle/whiskey, 100), - new /datum/data/mining_equipment("Cigar", /obj/item/clothing/mask/cigarette/cigar/havana, 150), - new /datum/data/mining_equipment("Soap", /obj/item/weapon/soap/nanotrasen, 200), - new /datum/data/mining_equipment("Jaunter", /obj/item/device/wormhole_jaunter, 250), - new /datum/data/mining_equipment("Advanced Scanner", /obj/item/device/t_scanner/adv_mining_scanner, 300), - new /datum/data/mining_equipment("Laser Pointer", /obj/item/device/laser_pointer, 400), - new /datum/data/mining_equipment("Alien Toy", /obj/item/clothing/mask/facehugger/toy, 450), - new /datum/data/mining_equipment("Mining Drone", /mob/living/simple_animal/hostile/mining_drone/, 500), - new /datum/data/mining_equipment("Resonator", /obj/item/weapon/resonator, 650), - new /datum/data/mining_equipment("Kinetic Accelerator", /obj/item/weapon/gun/energy/kinetic_accelerator, 650), - new /datum/data/mining_equipment("Sonic Jackhammer", /obj/item/weapon/pickaxe/jackhammer, 800), - new /datum/data/mining_equipment("Lazarus Injector", /obj/item/weapon/lazarus_injector, 1000), - new /datum/data/mining_equipment("Jetpack", /obj/item/weapon/tank/jetpack/carbondioxide/mining, 2000), - new /datum/data/mining_equipment("Space Cash", /obj/item/weapon/spacecash/c1000, 5000), - new /datum/data/mining_equipment("Point Card", /obj/item/weapon/card/mining_point_card, 500), + new /datum/data/mining_equipment("Stimpack", /obj/item/weapon/reagent_containers/hypospray/autoinjector/stimpack, 50), + new /datum/data/mining_equipment("Teporone MediPen", /obj/item/weapon/reagent_containers/hypospray/autoinjector/teporone, 50), + new /datum/data/mining_equipment("MediPen Bundle", /obj/item/weapon/storage/box/autoinjector/utility, 200), + new /datum/data/mining_equipment("Whiskey", /obj/item/weapon/reagent_containers/food/drinks/bottle/whiskey, 100), + new /datum/data/mining_equipment("Cigar", /obj/item/clothing/mask/cigarette/cigar/havana, 150), + new /datum/data/mining_equipment("Soap", /obj/item/weapon/soap/nanotrasen, 200), + new /datum/data/mining_equipment("Jaunter", /obj/item/device/wormhole_jaunter, 250), + new /datum/data/mining_equipment("Laser Pointer", /obj/item/device/laser_pointer, 300), + new /datum/data/mining_equipment("Alien Toy", /obj/item/clothing/mask/facehugger/toy, 300), + new /datum/data/mining_equipment("Advanced Scanner", /obj/item/device/t_scanner/adv_mining_scanner, 400), + new /datum/data/mining_equipment("Mining Drone", /mob/living/simple_animal/hostile/mining_drone, 500), + new /datum/data/mining_equipment("Kinetic Accelerator", /obj/item/weapon/gun/energy/kinetic_accelerator, 750), + new /datum/data/mining_equipment("Resonator", /obj/item/weapon/resonator, 800), + new /datum/data/mining_equipment("Lazarus Injector", /obj/item/weapon/lazarus_injector, 1000), + new /datum/data/mining_equipment("Diamond Pickaxe", /obj/item/weapon/pickaxe/diamond, 1200), + new /datum/data/mining_equipment("Jetpack", /obj/item/weapon/tank/jetpack/carbondioxide/mining, 1500), + new /datum/data/mining_equipment("Space Cash", /obj/item/stack/spacecash/c1000, 2000), + new /datum/data/mining_equipment("Point Transfer Card", /obj/item/weapon/card/mining_point_card, 500), ) @@ -174,17 +293,22 @@ var/equipment_path = null var/cost = 0 -/datum/data/mining_equipment/New(name, path, cost) - src.equipment_name = name - src.equipment_path = path - src.cost = cost +/obj/machinery/mineral/equipment_vendor/New() + ..() + component_parts = list() + component_parts += new /obj/item/weapon/circuitboard/mining_equipment_vendor(null) + component_parts += new /obj/item/weapon/stock_parts/matter_bin(null) + component_parts += new /obj/item/weapon/stock_parts/matter_bin(null) + component_parts += new /obj/item/weapon/stock_parts/matter_bin(null) + component_parts += new /obj/item/weapon/stock_parts/console_screen(null) + RefreshParts() /obj/machinery/mineral/equipment_locker/attack_hand(user as mob) if(..()) return interact(user) -/obj/machinery/mineral/equipment_locker/interact(mob/user) +/obj/machinery/mineral/equipment_vendor/interact(mob/user) var/dat dat +="
" if(istype(inserted_id)) @@ -192,15 +316,16 @@ else dat += "No ID inserted. Insert ID.
" dat += "
" - dat += "
Equipment point cost list:
" + dat += "
Equipment point cost list:
" for(var/datum/data/mining_equipment/prize in prize_list) dat += "" dat += "
[prize.equipment_name][prize.cost]Purchase
" - - user << browse("[dat]", "window=mining_equipment_locker") + var/datum/browser/popup = new(user, "miningvendor", "Mining Equipment Vendor", 400, 350) + popup.set_content(dat) + popup.open() return -/obj/machinery/mineral/equipment_locker/Topic(href, href_list) +/obj/machinery/mineral/equipment_vendor/Topic(href, href_list) if(..()) return if(href_list["choice"]) @@ -212,10 +337,11 @@ else if(href_list["choice"] == "insert") var/obj/item/weapon/card/id/I = usr.get_active_hand() if(istype(I)) - usr.drop_item() + if(!usr.drop_item()) + return I.loc = src inserted_id = I - else usr << "\red No valid ID." + else usr << "No valid ID." if(href_list["purchase"]) if(istype(inserted_id)) var/datum/data/mining_equipment/prize = locate(href_list["purchase"]) @@ -228,38 +354,45 @@ updateUsrDialog() return -/obj/machinery/mineral/equipment_locker/attackby(obj/item/I as obj, mob/user as mob, params) +/obj/machinery/mineral/equipment_vendor/attackby(obj/item/I as obj, mob/user as mob, params) if(istype(I, /obj/item/weapon/mining_voucher)) RedeemVoucher(I, user) return if(istype(I,/obj/item/weapon/card/id)) var/obj/item/weapon/card/id/C = usr.get_active_hand() if(istype(C) && !istype(inserted_id)) - usr.drop_item() + if(!usr.drop_item()) + return C.loc = src inserted_id = C interact(user) return + if(default_deconstruction_screwdriver(user, "mining-open", "mining", I)) + updateUsrDialog() + return + if(panel_open) + if(istype(I, /obj/item/weapon/crowbar)) + default_deconstruction_crowbar(I) + return 1 ..() -/obj/machinery/mineral/equipment_locker/proc/RedeemVoucher(voucher, redeemer) - var/selection = input(redeemer, "Pick your equipment", "Mining Voucher Redemption") in list("Mining Drill", "Kinetic Accelerator", "Mining Drone", "Advanced Scanner", "Cancel") - if(!selection || !Adjacent(redeemer)) +/obj/machinery/mineral/equipment_vendor/proc/RedeemVoucher(obj/item/weapon/mining_voucher/voucher, mob/redeemer) + var/selection = input(redeemer, "Pick your equipment", "Mining Voucher Redemption") as null|anything in list("Kinetic Accelerator", "Resonator", "Mining Drone", "Advanced Scanner") + if(!selection || !Adjacent(redeemer) || voucher.gc_destroyed || voucher.loc != redeemer) return switch(selection) - if("Mining Drill") - new /obj/item/weapon/pickaxe/drill(src.loc) if("Kinetic Accelerator") new /obj/item/weapon/gun/energy/kinetic_accelerator(src.loc) + if("Resonator") + new /obj/item/weapon/resonator(src.loc) if("Mining Drone") new /mob/living/simple_animal/hostile/mining_drone(src.loc) + new /obj/item/weapon/weldingtool/hugetank(src.loc) if("Advanced Scanner") new /obj/item/device/t_scanner/adv_mining_scanner(src.loc) - if("Cancel") - return - del(voucher) + qdel(voucher) -/obj/machinery/mineral/equipment_locker/ex_act(severity) +/obj/machinery/mineral/equipment_vendor/ex_act(severity, target) var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread s.set_up(5, 1, src) s.start() @@ -324,7 +457,7 @@ var/list/L = list() for(var/obj/item/device/radio/beacon/B in world) var/turf/T = get_turf(B) - if((T.z in config.station_levels)) + if(T.z == ZLEVEL_STATION) L += B if(!L.len) user << "The [src.name] failed to create a wormhole." @@ -334,7 +467,7 @@ J.target = chosen_beacon try_move_adjacent(J) playsound(src,'sound/effects/sparks4.ogg',50,1) - del(src) + qdel(src) /obj/effect/portal/wormhole/jaunt_tunnel name = "jaunt tunnel" @@ -346,19 +479,20 @@ if(istype(M, /obj/effect)) return if(istype(M, /atom/movable)) - do_teleport(M, target, 6) - if(isliving(M)) - var/mob/living/L = M - L.Weaken(3) - if(ishuman(L)) - shake_camera(L, 20, 1) - spawn(20) - L.visible_message("[L.name] vomits from travelling through the [src.name]!") - L.nutrition -= 20 - L.adjustToxLoss(-3) - var/turf/T = get_turf(L) - T.add_vomit_floor(L) - playsound(L, 'sound/effects/splat.ogg', 50, 1) + if(do_teleport(M, target, 6)) + if(isliving(M)) + var/mob/living/L = M + L.Weaken(3) + if(ishuman(L)) + shake_camera(L, 20, 1) + spawn(20) + if(L) + L.visible_message("[L.name] vomits from travelling through the [src.name]!", "You throw up from travelling through the [src.name]!") + L.nutrition -= 20 + L.adjustToxLoss(-3) + var/turf/T = get_turf(L) + T.add_vomit_floor(L) + playsound(L, 'sound/effects/splat.ogg', 50, 1) /**********************Resonator**********************/ @@ -369,27 +503,35 @@ item_state = "resonator" desc = "A handheld device that creates small fields of energy that resonate until they detonate, crushing rock. It can also be activated without a target to create a field at the user's location, to act as a delayed time trap. It's more effective in a vaccuum." w_class = 3 - force = 10 + force = 8 throwforce = 10 var/cooldown = 0 + var/fieldsactive = 0 + var/burst_time = 50 + var/fieldlimit = 3 /obj/item/weapon/resonator/proc/CreateResonance(var/target, var/creator) - if(cooldown <= 0) + var/turf/T = get_turf(target) + if(locate(/obj/effect/resonance) in T) + return + if(fieldsactive < fieldlimit) playsound(src,'sound/weapons/resonator_fire.ogg',50,1) - var/obj/effect/resonance/R = new /obj/effect/resonance(get_turf(target)) - R.creator = creator - cooldown = 1 - spawn(20) - cooldown = 0 + new /obj/effect/resonance(T, creator, burst_time) + fieldsactive++ + spawn(burst_time) + fieldsactive-- /obj/item/weapon/resonator/attack_self(mob/user as mob) - CreateResonance(src, user) - ..() + if(burst_time == 50) + burst_time = 30 + user << "You set the resonator's fields to detonate after 3 seconds." + else + burst_time = 50 + user << "You set the resonator's fields to detonate after 5 seconds." /obj/item/weapon/resonator/afterattack(atom/target, mob/user, proximity_flag) - if(target in user.contents) - return if(proximity_flag) + if(!check_allowed_items(target, 1)) return CreateResonance(target, user) /obj/effect/resonance @@ -400,36 +542,35 @@ layer = 4.1 mouse_opacity = 0 var/resonance_damage = 20 - var/creator = null -/obj/effect/resonance/New() +/obj/effect/resonance/New(loc, var/creator = null, var/timetoburst) var/turf/proj_turf = get_turf(src) if(!istype(proj_turf)) return if(istype(proj_turf, /turf/simulated/mineral)) var/turf/simulated/mineral/M = proj_turf - playsound(src,'sound/weapons/resonator_blast.ogg',50,1) - M.GetDrilled() - spawn(5) - del(src) + spawn(timetoburst) + playsound(src,'sound/weapons/resonator_blast.ogg',50,1) + M.gets_drilled(creator) + qdel(src) else var/datum/gas_mixture/environment = proj_turf.return_air() var/pressure = environment.return_pressure() if(pressure < 50) name = "strong resonance field" - resonance_damage = 45 - spawn(50) + resonance_damage = 50 + spawn(timetoburst) playsound(src,'sound/weapons/resonator_blast.ogg',50,1) if(creator) for(var/mob/living/L in src.loc) - add_logs(L, creator, "used a resonator field on", object="resonator") + add_logs(creator, L, "used a resonator field on", object="resonator") L << "The [src.name] ruptured with you in it!" L.adjustBruteLoss(resonance_damage) else for(var/mob/living/L in src.loc) L << "The [src.name] ruptured with you in it!" L.adjustBruteLoss(resonance_damage) - del(src) + qdel(src) /**********************Facehugger toy**********************/ @@ -438,6 +579,7 @@ throwforce = 0 real = 0 sterile = 1 + tint = 3 //Makes it feel more authentic when it latches on /obj/item/clothing/mask/facehugger/toy/Die() return @@ -445,7 +587,7 @@ /**********************Mining drone**********************/ -/mob/living/simple_animal/hostile/mining_drone/ +/mob/living/simple_animal/hostile/mining_drone name = "nanotrasen minebot" desc = "The instructions printed on the side read: This is a small robot used to support miners, can be set to search and collect loose ore, or to help fend off wildlife. A mining scanner can instruct it to drop loose ore. Field repairs can be done with a welder." icon = 'icons/obj/aibots.dmi' @@ -456,14 +598,7 @@ mouse_opacity = 1 faction = list("neutral") a_intent = "harm" - min_oxy = 0 - max_oxy = 0 - min_tox = 0 - max_tox = 0 - min_co2 = 0 - max_co2 = 0 - min_n2 = 0 - max_n2 = 0 + atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 wander = 0 idle_vision_range = 5 @@ -482,7 +617,10 @@ ranged_cooldown_cap = 3 projectiletype = /obj/item/projectile/kinetic projectilesound = 'sound/weapons/Gunshot4.ogg' - wanted_objects = list(/obj/item/weapon/ore) + speak_emote = list("states") + wanted_objects = list(/obj/item/weapon/ore/diamond, /obj/item/weapon/ore/gold, /obj/item/weapon/ore/silver, + /obj/item/weapon/ore/plasma, /obj/item/weapon/ore/uranium, /obj/item/weapon/ore/iron, + /obj/item/weapon/ore/bananium) /mob/living/simple_animal/hostile/mining_drone/attackby(obj/item/I as obj, mob/user as mob, params) if(istype(I, /obj/item/weapon/weldingtool)) @@ -503,12 +641,12 @@ return ..() -/mob/living/simple_animal/hostile/mining_drone/Die() +/mob/living/simple_animal/hostile/mining_drone/death() ..() visible_message("[src] is destroyed!") - new /obj/effect/decal/remains/robot(src.loc) + new /obj/effect/decal/cleanable/robot_debris(src.loc) DropOre() - del src + qdel(src) return /mob/living/simple_animal/hostile/mining_drone/New() @@ -633,6 +771,7 @@ user << "The display on [src] seems to be flickering." /**********************Mining Scanner**********************/ + /obj/item/device/mining_scanner desc = "A scanner that checks surrounding rock for useful minerals, it can also be used to stop gibtonite detonations. Requires you to wear mesons to work properly." name = "mining scanner" @@ -650,23 +789,9 @@ cooldown = 1 spawn(40) cooldown = 0 - var/client/C = user.client - var/list/L = list() - var/turf/simulated/mineral/M - for(M in range(7, user)) - if(M.scan_state) - L += M - if(!L.len) - user << "[src] reports that nothing was detected nearby." - return - else - for(M in L) - var/turf/T = get_turf(M) - var/image/I = image('icons/turf/walls.dmi', loc = T, icon_state = M.scan_state, layer = 18) - C.images += I - spawn(30) - if(C) - C.images -= I + var/list/mobs = list() + mobs |= user + mineral_scan_pulse(mobs, get_turf(user)) //Debug item to identify all ore spread quickly @@ -676,7 +801,7 @@ for(var/turf/simulated/mineral/M in world) if(M.scan_state) M.icon_state = M.scan_state - del(src) + qdel(src) /obj/item/device/t_scanner/adv_mining_scanner desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations. Requires you to wear mesons to function properly." @@ -691,28 +816,30 @@ /obj/item/device/t_scanner/adv_mining_scanner/scan() if(!cooldown) cooldown = 1 - spawn(80) + spawn(35) cooldown = 0 var/turf/t = get_turf(src) var/list/mobs = recursive_mob_check(t, 1,0,0) if(!mobs.len) return - var/list/L = list() - var/turf/simulated/mineral/M - for(M in range(7, t)) - if(M.scan_state) - L += M - if(L.len) - for(var/mob/user in mobs) - if(user.client) - var/client/C = user.client - for(M in L) - var/turf/T = get_turf(M) - var/image/I = image('icons/turf/walls.dmi', loc = T, icon_state = M.scan_state, layer = 18) - C.images += I - spawn(30) - if(C) - C.images -= I + mineral_scan_pulse(mobs, t) + +/proc/mineral_scan_pulse(list/mobs, turf/T, range = world.view) + var/list/minerals = list() + for(var/turf/simulated/mineral/M in range(range, T)) + if(M.scan_state) + minerals += M + if(minerals.len) + for(var/mob/user in mobs) + if(user.client) + var/client/C = user.client + for(var/turf/simulated/mineral/M in minerals) + var/turf/F = get_turf(M) + var/image/I = image('icons/turf/mining.dmi', loc = F, icon_state = M.scan_state, layer = 18) + C.images += I + spawn(30) + if(C) + C.images -= I /**********************Xeno Warning Sign**********************/ /obj/structure/sign/xeno_warning_mining diff --git a/code/modules/mining/laborcamp/laborminerals.dm b/code/modules/mining/laborcamp/laborminerals.dm index d4d31fc84e3..6d963bcd773 100644 --- a/code/modules/mining/laborcamp/laborminerals.dm +++ b/code/modules/mining/laborcamp/laborminerals.dm @@ -1,2 +1,6 @@ /turf/simulated/mineral/random/labormineral - mineralSpawnChanceList = list("Uranium" = 1, "Iron" = 100, "Diamond" = 1, "Gold" = 1, "Silver" = 1, "Plasma" = 1/*, "Adamantine" =5, "Cave" = 1 */) //Don't suffocate the prisoners with caves \ No newline at end of file + mineralSpawnChanceList = list("Uranium" = 1, "Iron" = 100, "Diamond" = 1, "Gold" = 1, "Silver" = 1, "Plasma" = 1) + +/turf/simulated/mineral/random/labormineral/New() + icon_state = "rock" + ..() \ No newline at end of file diff --git a/code/modules/mining/machine_input_output_plates.dm b/code/modules/mining/machine_input_output_plates.dm index d8693a1316b..e63918d77fa 100644 --- a/code/modules/mining/machine_input_output_plates.dm +++ b/code/modules/mining/machine_input_output_plates.dm @@ -16,4 +16,14 @@ density = 0 anchored = 1.0 New() - icon_state = "blank" \ No newline at end of file + icon_state = "blank" + +/obj/machinery/mineral + var/input_dir = NORTH + var/output_dir = SOUTH + +/obj/machinery/mineral/proc/unload_mineral(var/atom/movable/S) + S.loc = loc + var/turf/T = get_step(src,output_dir) + if(T) + S.loc = T \ No newline at end of file diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 6f37a1279b3..ece1595eeb6 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -6,92 +6,165 @@ 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) + qdel(src) -/obj/machinery/mineral/processing_unit_console/attack_hand(mob/user) - add_fingerprint(user) - interact(user) +/obj/machinery/mineral/processing_unit_console/attack_hand(user as mob) -/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 = "

Ore processor console

" - - dat += "
" - - for(var/ore in machine.ores_processing) - - if(!machine.ores_stored[ore] && !show_all_ores) continue - - dat += "" + machine.selected_iron = 0 - dat += "
[capitalize(ore)][machine.ores_stored[ore]]not processing" - if(1) - dat += "orange'>smelting" - if(2) - dat += "blue'>compressing" - if(3) - dat += "gray'>alloying" + 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_iron==1) + dat += text("Smelting ") + else + dat += text("Not smelting ") + dat += text("Iron: [machine.ore_iron]
") else - 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, "computer") - return + //sand - glass + if(machine.ore_glass) + if (machine.selected_glass==1) + dat += text("Smelting ") + else + dat += text("Not smelting ") + dat += text("Sand: [machine.ore_glass]
") + else + machine.selected_glass = 0 + + //plasma + if(machine.ore_plasma) + if (machine.selected_plasma==1) + dat += text("Smelting ") + else + dat += text("Not smelting ") + dat += text("Plasma: [machine.ore_plasma]
") + else + machine.selected_plasma = 0 + + //uranium + if(machine.ore_uranium) + if (machine.selected_uranium==1) + dat += text("Smelting ") + else + dat += text("Not smelting ") + dat += text("Uranium: [machine.ore_uranium]
") + else + machine.selected_uranium = 0 + + //gold + if(machine.ore_gold) + if (machine.selected_gold==1) + dat += text("Smelting ") + else + dat += text("Not smelting ") + dat += text("Gold: [machine.ore_gold]
") + else + machine.selected_gold = 0 + + //silver + if(machine.ore_silver) + if (machine.selected_silver==1) + dat += text("Smelting ") + else + dat += text("Not smelting ") + dat += text("Silver: [machine.ore_silver]
") + else + machine.selected_silver = 0 + + //diamond + if(machine.ore_diamond) + if (machine.selected_diamond==1) + dat += text("Smelting ") + else + dat += text("Not smelting ") + dat += text("Diamond: [machine.ore_diamond]
") + else + machine.selected_diamond = 0 + + //bananium + if(machine.ore_clown) + if (machine.selected_clown==1) + dat += text("Smelting ") + else + dat += text("Not smelting ") + dat += text("Bananium: [machine.ore_clown]
") + else + machine.selected_clown = 0 + + + //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") /obj/machinery/mineral/processing_unit_console/Topic(href, href_list) if(..()) return usr.set_machine(src) src.add_fingerprint(usr) - - 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 - + if(href_list["sel_iron"]) + if (href_list["sel_iron"] == "yes") + machine.selected_iron = 1 + else + machine.selected_iron = 0 + if(href_list["sel_glass"]) + if (href_list["sel_glass"] == "yes") + machine.selected_glass = 1 + else + machine.selected_glass = 0 + if(href_list["sel_plasma"]) + if (href_list["sel_plasma"] == "yes") + machine.selected_plasma = 1 + else + machine.selected_plasma = 0 + if(href_list["sel_uranium"]) + if (href_list["sel_uranium"] == "yes") + machine.selected_uranium = 1 + else + machine.selected_uranium = 0 + if(href_list["sel_gold"]) + if (href_list["sel_gold"] == "yes") + machine.selected_gold = 1 + else + machine.selected_gold = 0 + if(href_list["sel_silver"]) + if (href_list["sel_silver"] == "yes") + machine.selected_silver = 1 + else + machine.selected_silver = 0 + if(href_list["sel_diamond"]) + if (href_list["sel_diamond"] == "yes") + machine.selected_diamond = 1 + else + machine.selected_diamond = 0 + if(href_list["sel_clown"]) + if (href_list["sel_clown"] == "yes") + machine.selected_clown = 1 + else + machine.selected_clown = 0 + if(href_list["set_on"]) + if (href_list["set_on"] == "on") + machine.on = 1 + else + machine.on = 0 src.updateUsrDialog() return @@ -99,136 +172,223 @@ /obj/machinery/mineral/processing_unit - name = "material processor" //This isn't actually a goddamn furnace, we're in space and it's processing platinum and flammable plasma... + name = "furnace" icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "furnace" density = 1 anchored = 1 - light_range = 3 - var/obj/machinery/mineral/input = null - var/obj/machinery/mineral/output = null - 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() - - ..() - - //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 - return - return + 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_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! /obj/machinery/mineral/processing_unit/process() + var/i + for (i = 0; i < 10; i++) + if (on) + if (selected_glass == 1 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 0 && selected_uranium == 0 && selected_iron == 0 && selected_clown == 0) + if (ore_glass > 0) + ore_glass--; + generate_mineral(/obj/item/stack/sheet/glass) + else + on = 0 + continue + if (selected_glass == 1 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 0 && selected_uranium == 0 && selected_iron == 1 && selected_clown == 0) + if (ore_glass > 0 && ore_iron > 0) + ore_glass--; + ore_iron--; + generate_mineral(/obj/item/stack/sheet/rglass) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 1 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 0 && selected_uranium == 0 && selected_iron == 0 && selected_clown == 0) + if (ore_gold > 0) + ore_gold--; + generate_mineral(/obj/item/stack/sheet/mineral/gold) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 0 && selected_silver == 1 && selected_diamond == 0 && selected_plasma == 0 && selected_uranium == 0 && selected_iron == 0 && selected_clown == 0) + if (ore_silver > 0) + ore_silver--; + generate_mineral(/obj/item/stack/sheet/mineral/silver) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 1 && selected_plasma == 0 && selected_uranium == 0 && selected_iron == 0 && selected_clown == 0) + if (ore_diamond > 0) + ore_diamond--; + generate_mineral(/obj/item/stack/sheet/mineral/diamond) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 1 && selected_uranium == 0 && selected_iron == 0 && selected_clown == 0) + if (ore_plasma > 0) + ore_plasma--; + generate_mineral(/obj/item/stack/sheet/mineral/plasma) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 0 && selected_uranium == 1 && selected_iron == 0 && selected_clown == 0) + if (ore_uranium > 0) + ore_uranium--; + generate_mineral(/obj/item/stack/sheet/mineral/uranium) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 0 && selected_uranium == 0 && selected_iron == 1 && selected_clown == 0) + if (ore_iron > 0) + ore_iron--; + generate_mineral(/obj/item/stack/sheet/metal) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 1 && selected_uranium == 0 && selected_iron == 1 && selected_clown == 0) + if (ore_iron > 0 && ore_plasma > 0) + ore_iron--; + ore_plasma--; + generate_mineral(/obj/item/stack/sheet/plasteel) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 0 && selected_uranium == 0 && selected_iron == 0 && selected_clown == 1) + if (ore_clown > 0) + ore_clown--; + generate_mineral(/obj/item/stack/sheet/mineral/bananium) + else + on = 0 + continue + //THESE TWO ARE CODED FOR URIST TO USE WHEN HE GETS AROUND TO IT. + //They were coded on 18 Feb 2012. If you're reading this in 2015, then firstly congratulations on the world not ending on 21 Dec 2012 and secondly, Urist is apparently VERY lazy. ~Errorage + /*if (selected_glass == 0 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 1 && selected_plasma == 0 && selected_uranium == 1 && selected_iron == 0 && selected_clown == 0) + if (ore_uranium >= 2 && ore_diamond >= 1) + ore_uranium -= 2 + ore_diamond -= 1 + generate_mineral(/obj/item/stack/sheet/mineral/adamantine) + else + on = 0 + continue + if (selected_glass == 0 && selected_gold == 0 && selected_silver == 1 && selected_diamond == 0 && selected_plasma == 1 && selected_uranium == 0 && selected_iron == 0 && selected_clown == 0) + if (ore_silver >= 1 && ore_plasma >= 3) + ore_silver -= 1 + ore_plasma -= 3 + generate_mineral(/obj/item/stack/sheet/mineral/mythril) + else + on = 0 + continue*/ - if (!src.output || !src.input) return - var/list/tick_alloys = list() + //if a non valid combination is selected - //Grab some more ore to process this tick. - for(var/i = 0,i= 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 - 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,i10) + break + if (istype(O,/obj/item/weapon/ore/iron)) + ore_iron++; + O.loc = null + continue + if (istype(O,/obj/item/weapon/ore/glass)) + ore_glass++; + O.loc = null + continue + if (istype(O,/obj/item/weapon/ore/diamond)) + ore_diamond++; + O.loc = null + continue + if (istype(O,/obj/item/weapon/ore/plasma)) + ore_plasma++ + O.loc = null + continue + if (istype(O,/obj/item/weapon/ore/gold)) + ore_gold++ + O.loc = null + continue + if (istype(O,/obj/item/weapon/ore/silver)) + ore_silver++ + O.loc = null + continue + if (istype(O,/obj/item/weapon/ore/uranium)) + ore_uranium++ + O.loc = null + continue + if (istype(O,/obj/item/weapon/ore/bananium)) + ore_clown++ + O.loc = null + continue + unload_mineral(O) - console.updateUsrDialog() +/obj/machinery/mineral/processing_unit/proc/generate_mineral(var/P) + var/O = new P(src) + unload_mineral(O) \ No newline at end of file diff --git a/code/modules/mining/machine_stacking.dm b/code/modules/mining/machine_stacking.dm index b974a57aafc..5f315648c10 100644 --- a/code/modules/mining/machine_stacking.dm +++ b/code/modules/mining/machine_stacking.dm @@ -4,62 +4,53 @@ name = "stacking machine console" icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "console" - density = 1 + density = 0 anchored = 1 var/obj/machinery/mineral/stacking_machine/machine = null var/machinedir = SOUTHEAST /obj/machinery/mineral/stacking_unit_console/New() - ..() - spawn(7) src.machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir)) if (machine) - machine.console = src + machine.CONSOLE = src else - del(src) + qdel(src) -/obj/machinery/mineral/stacking_unit_console/attack_hand(mob/user) - add_fingerprint(user) - interact(user) - -/obj/machinery/mineral/stacking_unit_console/interact(mob/user) - user.set_machine(src) +/obj/machinery/mineral/stacking_unit_console/attack_hand(user as mob) + var/obj/item/stack/sheet/s var/dat - dat += text("

Stacking unit console


") + dat += text("Stacking unit console

") - 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\]

") + for(var/O in machine.stack_list) + s = machine.stack_list[O] + if(s.amount > 0) + dat += text("[capitalize(s.name)]: [s.amount] Release
") + + dat += text("
Stacking: [machine.stack_amt]

") user << browse("[dat]", "window=console_stacking_machine") - onclose(user, "console_stacking_machine") + + return /obj/machinery/mineral/stacking_unit_console/Topic(href, href_list) if(..()) 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 - + usr.set_machine(src) src.add_fingerprint(usr) - src.updateUsrDialog() + if(href_list["release"]) + if(!(text2path(href_list["release"]) in machine.stack_list)) return //someone tried to spawn materials by spoofing hrefs + var/obj/item/stack/sheet/inp = machine.stack_list[text2path(href_list["release"])] + var/obj/item/stack/sheet/out = new inp.type() + out.amount = inp.amount + inp.amount = 0 + machine.unload_mineral(out) + src.updateUsrDialog() return /**********************Mineral stacking unit**************************/ @@ -71,61 +62,31 @@ icon_state = "stacker" density = 1 anchored = 1.0 - var/obj/machinery/mineral/stacking_unit_console/console - var/obj/machinery/mineral/input = null - var/obj/machinery/mineral/output = null - var/list/stack_storage[0] - var/list/stack_paths[0] - var/stack_amt = 50; // Amount to stack before releassing + var/obj/machinery/mineral/stacking_unit_console/CONSOLE + var/stk_types = list() + var/stk_amt = list() + var/stack_list[0] //Key: Type. Value: Instance of type. + var/stack_amt = 50; //ammount to stack before releassing + input_dir = EAST + output_dir = WEST -/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)) - if(src.input) break - for (var/dir in cardinal) - src.output = locate(/obj/machinery/mineral/output, get_step(src, dir)) - if(src.output) break - return - return +/obj/machinery/mineral/stacking_machine/proc/process_sheet(obj/item/stack/sheet/inp) + if(!(inp.type in stack_list)) //It's the first of this sheet added + var/obj/item/stack/sheet/s = new inp.type(src,0) + s.amount = 0 + stack_list[inp.type] = s + var/obj/item/stack/sheet/storage = stack_list[inp.type] + storage.amount += inp.amount //Stack the sheets + inp.loc = null //Let the old sheet garbage collect + while(storage.amount > stack_amt) //Get rid of excessive stackage + var/obj/item/stack/sheet/out = new inp.type() + out.amount = stack_amt + unload_mineral(out) + storage.amount -= stack_amt /obj/machinery/mineral/stacking_machine/process() - if (src.output && src.input) - 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 - O.loc = output.loc - else - O.loc = output.loc - - //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 + var/turf/T = get_step(src, input_dir) + if(T) + for(var/obj/item/stack/sheet/S in T) + process_sheet(S) diff --git a/code/modules/mining/machine_unloading.dm b/code/modules/mining/machine_unloading.dm index 1bbf7706ec2..bdba6e0d57e 100644 --- a/code/modules/mining/machine_unloading.dm +++ b/code/modules/mining/machine_unloading.dm @@ -7,8 +7,8 @@ icon_state = "unloader" density = 1 anchored = 1.0 - var/obj/machinery/mineral/input = null - var/obj/machinery/mineral/output = null + input_dir = WEST + output_dir = EAST /obj/machinery/mineral/unloading_machine/New() diff --git a/code/modules/mining/mine_areas.dm b/code/modules/mining/mine_areas.dm index 11c5a327714..b89bdcd1b56 100644 --- a/code/modules/mining/mine_areas.dm +++ b/code/modules/mining/mine_areas.dm @@ -6,11 +6,25 @@ /area/mine/explored name = "Mine" icon_state = "explored" + music = null + always_unpowered = 1 + requires_power = 1 + poweralm = 0 + power_environ = 0 + power_equip = 0 + power_light = 0 ambientsounds = list('sound/ambience/ambimine.ogg') /area/mine/unexplored name = "Mine" icon_state = "unexplored" + music = null + always_unpowered = 1 + requires_power = 1 + poweralm = 0 + power_environ = 0 + power_equip = 0 + power_light = 0 ambientsounds = list('sound/ambience/ambimine.ogg') /area/mine/lobby diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index 61902d6deab..eaf2dfe384f 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -68,96 +68,76 @@ var/excavation_amount = 100 - proc/playDigSound() +/obj/item/weapon/pickaxe/proc/playDigSound() playsound(src, pick(digsound),20,1) - 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/diamond + name = "diamond-tipped pickaxe" + icon_state = "dpickaxe" + item_state = "dpickaxe" + digspeed = 20 //mines twice as fast as a normal pickaxe, bought from mining vendor + origin_tech = "materials=4;engineering=3" + desc = "A pickaxe with a diamond pick head. Extremely robust at cracking rock walls and digging up dirt." - 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/drill + name = "mining drill" + icon_state = "handdrill" + item_state = "jackhammer" + digspeed = 25 //available from roundstart, faster than a pickaxe. + digsound = list('sound/weapons/drill.ogg') + hitsound = 'sound/weapons/drill.ogg' + origin_tech = "materials=2;powerstorage=3;engineering=2" + desc = "An electric mining drill for the especially scrawny." - drill - name = "mining drill" // Can dig sand as well! - icon_state = "handdrill" - item_state = "jackhammer" - digspeed = 30 - hitsound = 'sound/weapons/drill.ogg' - digsound = list('sound/weapons/drill.ogg') - origin_tech = "materials=2;powerstorage=3;engineering=2" - desc = "Yours is the drill that will pierce through the rock walls." +/obj/item/weapon/pickaxe/drill/cyborg + name = "cyborg mining drill" + desc = "An integrated electric mining drill." + flags = NODROP - jackhammer - name = "sonic jackhammer" - icon_state = "jackhammer" - item_state = "jackhammer" - digspeed = 15 //faster than drill, but cannot dig - hitsound = 'sound/weapons/sonic_jackhammer.ogg' - digsound = list('sound/weapons/sonic_jackhammer.ogg') - origin_tech = "materials=3;powerstorage=2;engineering=2" - desc = "Cracks rocks with sonic blasts, perfect for killing cave lizards." +/obj/item/weapon/pickaxe/drill/diamonddrill + name = "diamond-tipped mining drill" + icon_state = "diamonddrill" + digspeed = 10 + origin_tech = "materials=6;powerstorage=4;engineering=5" + desc = "Yours is the drill that will pierce the heavens!" - 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/diamonddrill/traitor //Pocket-sized traitor diamond drill. + name = "supermatter drill" + icon_state = "smdrill" + origin_tech = "materials=6;powerstorage=4;engineering=5;syndicate=3" + desc = "Microscopic supermatter crystals cover the head of this tiny drill." + w_class = 2.0 - 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 - hitsound = 'sound/weapons/plasma_cutter.ogg' - digsound = list('sound/weapons/plasma_cutter.ogg') - 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." +/obj/item/weapon/pickaxe/drill/cyborg/diamond //This is the BORG version! + name = "diamond-tipped cyborg mining drill" //To inherit the NODROP flag, and easier to change borg specific drill mechanics. + icon_state = "diamonddrill" + digspeed = 10 - 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/drill/jackhammer + name = "sonic jackhammer" + icon_state = "jackhammer" + item_state = "jackhammer" + digspeed = 5 //the epitome of powertools. extremely fast mining, laughs at puny walls + origin_tech = "materials=3;powerstorage=2;engineering=2" + digsound = list('sound/weapons/sonic_jackhammer.ogg') + hitsound = 'sound/weapons/sonic_jackhammer.ogg' + desc = "Cracks rocks with sonic blasts, and doubles as a demolition power tool for smashing walls." - 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" - hitsound = 'sound/weapons/drill.ogg' - digsound = list('sound/weapons/drill.ogg') - desc = "Yours is the drill that will pierce the heavens!" - - traitor //Pocket-sized traitor diamond drill. - name = "supermatter drill" - icon_state = "smdrill" - origin_tech = "materials=6;powerstorage=4;engineering=5;syndicate=3" - desc = "Microscopic supermatter crystals cover the head of this tiny drill." - w_class = 2.0 - - borgdrill - name = "cyborg mining drill" - icon_state = "jackhammer" - item_state = "jackhammer" - digspeed = 15 - hitsound = 'sound/weapons/drill.ogg' - digsound = list('sound/weapons/drill.ogg') - desc = "" +/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." +/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." /*****************************Shovel********************************/ /obj/item/weapon/shovel diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 57bfce341df..fcc5dc7c89b 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -1,5 +1,11 @@ /**********************Mineral deposits**************************/ +var/global/list/rockTurfEdgeCache +#define NORTH_EDGING "north" +#define SOUTH_EDGING "south" +#define EAST_EDGING "east" +#define WEST_EDGING "west" + /turf/simulated/mineral //wall piece name = "Rock" icon = 'icons/turf/walls.dmi' @@ -10,418 +16,414 @@ density = 1 blocks_air = 1 temperature = TCMB - var/mineral/mineral - var/mined_ore = 0 + var/mineralType = null + var/mineralAmt = 3 + var/spread = 0 //will the seam spread? + var/spreadChance = 0 //the percentual chance of an ore spreading to the neighbouring tiles var/last_act = 0 + var/scan_state = null //Holder for the image we display when we're pinged by a mining scanner + var/hidden = 1 - var/datum/geosample/geologic_data - var/excavation_level = 0 - var/list/finds - var/next_rock = 0 - var/archaeo_overlay = "" - var/excav_overlay = "" - var/obj/item/weapon/last_find - var/datum/artifact_find/artifact_find - var/scan_state = null +/turf/simulated/mineral/ex_act(severity, target) + ..() + switch(severity) + if(3.0) + if (prob(75)) + src.gets_drilled(null, 1) + if(2.0) + if (prob(90)) + src.gets_drilled(null, 1) + if(1.0) + src.gets_drilled(null, 1) + return - has_resources = 1 +/turf/simulated/mineral/New() + if(!rockTurfEdgeCache || !rockTurfEdgeCache.len) + rockTurfEdgeCache = list() + rockTurfEdgeCache.len = 4 + rockTurfEdgeCache[NORTH_EDGING] = image('icons/turf/mining.dmi', "rock_side_n", layer = 6) + rockTurfEdgeCache[SOUTH_EDGING] = image('icons/turf/mining.dmi', "rock_side_s") + rockTurfEdgeCache[EAST_EDGING] = image('icons/turf/mining.dmi', "rock_side_e", layer = 6) + rockTurfEdgeCache[WEST_EDGING] = image('icons/turf/mining.dmi', "rock_side_w", layer = 6) - New() - . = ..() + spawn(1) + var/turf/T + if((istype(get_step(src, NORTH), /turf/simulated/floor)) || (istype(get_step(src, NORTH), /turf/space))) + T = get_step(src, NORTH) + if (T) + T.overlays += rockTurfEdgeCache[SOUTH_EDGING] + if((istype(get_step(src, SOUTH), /turf/simulated/floor)) || (istype(get_step(src, SOUTH), /turf/space))) + T = get_step(src, SOUTH) + if (T) + T.overlays += rockTurfEdgeCache[NORTH_EDGING] + if((istype(get_step(src, EAST), /turf/simulated/floor)) || (istype(get_step(src, EAST), /turf/space))) + T = get_step(src, EAST) + if (T) + T.overlays += rockTurfEdgeCache[WEST_EDGING] + if((istype(get_step(src, WEST), /turf/simulated/floor)) || (istype(get_step(src, WEST), /turf/space))) + T = get_step(src, WEST) + if (T) + T.overlays += rockTurfEdgeCache[EAST_EDGING] - MineralSpread() + if (mineralType && mineralAmt && spread && spreadChance) + for(var/dir in cardinal) + if(prob(spreadChance)) + var/turf/T = get_step(src, dir) + if(istype(T, /turf/simulated/mineral/random)) + Spread(T) - 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", layer=2) - 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=2) - 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=2) - 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=2) + HideRock() + return +/turf/simulated/mineral/proc/HideRock() + if(hidden) + icon_state = "rock" + return - 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() - - - 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) - - - 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() - - - proc/UpdateMineral() - if(!mineral) - name = "\improper Rock" - icon_state = "rock" - return - name = "\improper [mineral.display_name] deposit" - icon_state = "rock_[mineral.name][rand(1,3)]" - scan_state = "rock_[mineral.name][rand(1,3)]" - - //Not even going to touch this pile of spaghetti - attackby(obj/item/weapon/W as obj, mob/user as mob, params) - - 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 - - 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 - - if (istype(W, /obj/item/weapon/pickaxe)) - var/turf/T = user.loc - if (!( istype(T, /turf) )) - return - - var/obj/item/weapon/pickaxe/P = W - if(last_act + P.digspeed > world.time)//prevents message spam - return - last_act = world.time - - P.playDigSound() - - //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) - else - GetDrilled(1) - return - - excavation_level += P.excavation_amount - - //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 - - /* 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) - else - flick("flash",M.flash) - if(prob(50)) - M.Stun(5) - M.apply_effect(25, IRRADIATE) - - var/turf/simulated/floor/plating/airless/asteroid/N = ChangeTurf(/turf/simulated/floor/plating/airless/asteroid) - playsound(src, 'sound/effects/break_stone.ogg', 50, 1) //beautiful destruction - N.fullUpdateMineralOverlays() - - if(rand(1,750) == 1) - visible_message("An old dusty crate was buried within!") - new /obj/structure/closet/crate/secure/loot(src) - - - 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 - - //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 - - //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) - - finds.Remove(F) - - - proc/artifact_debris(var/severity = 0) - //cael's patented random limited drop componentized loot system! - //sky's patented not-fucking-retarded overhaul! - - //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) - - if(2) - var/obj/item/stack/tile/R = new(src) - R.amount = rand(1,5) - - if(3) - var/obj/item/stack/sheet/metal/R = new(src) - R.amount = rand(5,25) - - 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