diff --git a/baystation12.dme b/baystation12.dme index 9ae87c452f8..8797340a758 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -826,10 +826,10 @@ #include "code\modules\customitems\item_spawning.dm" #include "code\modules\customitems\definitions\base.dm" #include "code\modules\destilery\main.dm" -#include "code\modules\DetectiveWork\detective_work.dm" -#include "code\modules\DetectiveWork\evidence.dm" -#include "code\modules\DetectiveWork\footprints_and_rag.dm" -#include "code\modules\DetectiveWork\scanner.dm" +#include "code\modules\detectivework\detective_work.dm" +#include "code\modules\detectivework\evidence.dm" +#include "code\modules\detectivework\footprints_and_rag.dm" +#include "code\modules\detectivework\scanner.dm" #include "code\modules\economy\Accounts.dm" #include "code\modules\economy\Accounts_DB.dm" #include "code\modules\economy\ATM.dm" @@ -910,11 +910,11 @@ #include "code\modules\mining\mine_areas.dm" #include "code\modules\mining\mine_items.dm" #include "code\modules\mining\mine_turfs.dm" +#include "code\modules\mining\minerals.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\satchel_ore_boxdm.dm" -#include "code\modules\mining\unsim_mine_turfs.dm" #include "code\modules\mining\laborcamp\laborminerals.dm" #include "code\modules\mining\laborcamp\laborshuttle.dm" #include "code\modules\mining\laborcamp\laborstacker.dm" diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 65f7dbd5c8f..7d07097ef5c 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -68,6 +68,7 @@ datum/controller/game_controller/proc/setup() setupgenetics() setupfactions() setup_economy() + SetupXenoarch() for(var/i=0, i[target] is too durable to drill through.") - else if(istype(target, /turf/unsimulated/mineral)) - for(var/turf/unsimulated/mineral/M in range(chassis,1)) + else if(istype(target, /turf/simulated/mineral)) + for(var/turf/simulated/mineral/M in range(chassis,1)) if(get_dir(chassis,M)&chassis.dir) - M.gets_drilled() + M.GetDrilled() log_message("Drilled through [target]") if(locate(/obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp) in chassis.equipment) var/obj/structure/ore_box/ore_box = locate(/obj/structure/ore_box) in chassis:cargo @@ -102,8 +102,8 @@ for(var/obj/item/weapon/ore/ore in range(chassis,1)) if(get_dir(chassis,ore)&chassis.dir) ore.Move(ore_box) - else if(istype(target, /turf/unsimulated/floor/plating/airless/asteroid)) - for(var/turf/unsimulated/floor/plating/airless/asteroid/M in range(chassis,1)) + else if(istype(target, /turf/simulated/floor/plating/airless/asteroid)) + for(var/turf/simulated/floor/plating/airless/asteroid/M in range(chassis,1)) if(get_dir(chassis,M)&chassis.dir) M.gets_dug() log_message("Drilled through [target]") @@ -159,10 +159,10 @@ if(do_after_cooldown(target))//To slow down how fast mechs can drill through the station log_message("Drilled through [target]") target.ex_act(3) - else if(istype(target, /turf/unsimulated/mineral)) - for(var/turf/unsimulated/mineral/M in range(chassis,1)) + else if(istype(target, /turf/simulated/mineral)) + for(var/turf/simulated/mineral/M in range(chassis,1)) if(get_dir(chassis,M)&chassis.dir) - M.gets_drilled() + M.GetDrilled() log_message("Drilled through [target]") if(locate(/obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp) in chassis.equipment) var/obj/structure/ore_box/ore_box = locate(/obj/structure/ore_box) in chassis:cargo @@ -170,8 +170,8 @@ for(var/obj/item/weapon/ore/ore in range(chassis,1)) if(get_dir(chassis,ore)&chassis.dir) ore.Move(ore_box) - else if(istype(target,/turf/unsimulated/floor/plating/airless/asteroid)) - for(var/turf/unsimulated/floor/plating/airless/asteroid/M in range(target,1)) + else if(istype(target,/turf/simulated/floor/plating/airless/asteroid)) + for(var/turf/simulated/floor/plating/airless/asteroid/M in range(target,1)) M.gets_dug() log_message("Drilled through [target]") if(locate(/obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp) in chassis.equipment) diff --git a/code/game/objects/effects/glowshroom.dm b/code/game/objects/effects/glowshroom.dm index 06d189a64fa..f7f4cd8b482 100644 --- a/code/game/objects/effects/glowshroom.dm +++ b/code/game/objects/effects/glowshroom.dm @@ -69,7 +69,7 @@ if(prob(spreadIntoAdjacentChance)) spreadsIntoAdjacent = 1 - for(var/turf/unsimulated/floor/plating/airless/asteroid/earth in view(3,src)) + for(var/turf/simulated/floor/plating/airless/asteroid/earth in view(3,src)) if(spreadsIntoAdjacent || !locate(/obj/effect/glowshroom) in view(1,earth)) possibleLocs += earth diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index f55c48297dc..e47f8a13068 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -276,7 +276,7 @@ turf/simulated/floor/proc/update_icon() /turf/simulated/floor/proc/burn_tile() if(istype(src,/turf/simulated/floor/engine)) return - if(istype(src,/turf/unsimulated/floor/plating/airless/asteroid)) return//Asteroid tiles don't burn + if(istype(src,/turf/simulated/floor/plating/airless/asteroid)) return//Asteroid tiles don't burn if(broken || burnt) return if(is_plasteel_floor()) src.icon_state = "damaged[pick(1,2,3,4,5)]" diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 8455b559df9..0d65e7178ce 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -1,10 +1,8 @@ /**********************Mineral deposits**************************/ -#define XENOARCH_SPAWN_CHANCE 0.5 -#define XENOARCH_SPREAD_CHANCE 15 -#define ARTIFACT_SPAWN_CHANCE 20 -/datum/controller/game_controller/var/list/artifact_spawning_turfs = list() +datum/controller/game_controller/var/list/artifact_spawning_turfs = list() +var/list/artifact_spawn = list() // Runtime fix for geometry loading before controller is instantiated. /turf/simulated/mineral //wall piece name = "Rock" @@ -16,608 +14,384 @@ density = 1 blocks_air = 1 temperature = TCMB - var/mineralName = "" - var/mineralAmt = 0 - var/spread = 0 //will the seam spread? - var/spreadChance = 0 //the percentual chance of an ore spreading to the neighbouring tiles + var/mineral/mineral + var/mined_ore = 0 var/last_act = 0 - var/datum/geosample/geological_data + var/datum/geosample/geologic_data var/excavation_level = 0 - var/list/finds = list() - var/list/excavation_minerals = list() + 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 -/turf/simulated/mineral/Del() - return -/turf/simulated/mineral/ex_act(severity) - switch(severity) - if(3.0) + New() + . = ..() + + 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) + + + 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 - if(2.0) - if (prob(70)) - src.mineralAmt -= 1 //some of the stuff gets blown up - src.gets_drilled() - if(1.0) - src.mineralAmt -= 2 //some of the stuff gets blown up - src.gets_drilled() - return - -/turf/simulated/mineral/New() - - 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) - - if (mineralName && mineralAmt && spread && spreadChance) - for(var/trydir in list(1,2,4,8)) - if(prob(spreadChance)) - if(istype(get_step(src, trydir), /turf/simulated/mineral/random)) - var/turf/simulated/mineral/T = get_step(src, trydir) - var/turf/simulated/mineral/M = new src.type(T) - //keep any digsite data as constant as possible - if(T.finds.len && !M.finds.len) - M.finds = T.finds - if(T.archaeo_overlay) - M.overlays += archaeo_overlay - - - //---- Xenoarchaeology BEGIN - - //put into spawn so that digsite data can be preserved over the turf replacements via spreading mineral veins - spawn(0) - if(mineralAmt > 0 && !excavation_minerals.len) - for(var/i=0, i 0) - if(excavation_level < 25) - src.overlays += image('icons/obj/xenoarchaeology.dmi', "overlay_excv1_[rand(1,3)]") - else if(excavation_level < 50) - src.overlays += image('icons/obj/xenoarchaeology.dmi', "overlay_excv2_[rand(1,3)]") - else if(excavation_level < 75) - src.overlays += image('icons/obj/xenoarchaeology.dmi', "overlay_excv3_[rand(1,3)]") + name = "\improper [mineral.display_name] deposit" + switch(mineral.display_name) + if("Iron") + icon_state = "rock_Iron[rand(1,3)]" + if("Plasma") + icon_state = "rock_Plasma[rand(1,3)]" else - src.overlays += image('icons/obj/xenoarchaeology.dmi', "overlay_excv4_[rand(1,3)]") - desc = "It appears to be partially excavated."*/ + 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!" + 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 + + playsound(user, P.drill_sound, 20, 1) + + //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.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 + else + excavation_level += P.excavation_amount + + //archaeo overlays + if(!archaeo_overlay && 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) + N.fullUpdateMineralOverlays() + + if(rand(1,500) == 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 world.time)//prevents message spam - return - last_act = world.time - - playsound(user, P.drill_sound, 20, 1) - - //handle any archaeological finds we might uncover - var/fail_message - if(src.finds.len) - var/datum/find/F = src.finds[1] - if(src.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, src.finds[1]) - else if(prob(50)) - src.finds.Remove(src.finds[1]) - if(prob(50)) - artifact_debris() - - if(do_after(user,P.digspeed)) - user << "\blue You finish [P.drill_verb] the rock." - - if(finds.len) - var/datum/find/F = src.finds[1] - if(round(src.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(src.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(src.excavation_level + P.excavation_amount > F.excavation_required - F.clearance_range) - //just pull the surrounding rock out - excavate_find(0, F) - - if( src.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( src.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) - gets_drilled(0) - else - gets_drilled(1) - return - else - src.excavation_level += P.excavation_amount - - //archaeo overlays - if(!archaeo_overlay && finds.len) - var/datum/find/F = src.finds[1] - if(F.excavation_required <= src.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(src.excavation_level >= 75) - if(src.excavation_level - P.excavation_amount < 75) - update_excav_overlay = 1 - else if(src.excavation_level >= 50) - if(src.excavation_level - P.excavation_amount < 50) - update_excav_overlay = 1 - else if(src.excavation_level >= 25) - if(src.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 - - //extract pesky minerals while we're excavating - while(excavation_minerals.len && src.excavation_level > excavation_minerals[excavation_minerals.len]) - drop_mineral() - pop(excavation_minerals) - mineralAmt-- - score_oremined++ - - //drop some rocks - next_rock += P.excavation_amount * 10 - while(next_rock > 100) - next_rock -= 100 - var/obj/item/weapon/ore/O = new(src) - src.geological_data.UpdateNearbyArtifactInfo(src) - O.geological_data = src.geological_data - - else - return attack_hand(user) - return - -/turf/simulated/mineral/proc/drop_mineral() - var/obj/item/weapon/ore/O - if (src.mineralName == "Uranium") - O = new /obj/item/weapon/ore/uranium(src) - if (src.mineralName == "Iron") - O = new /obj/item/weapon/ore/iron(src) - if (src.mineralName == "Gold") - O = new /obj/item/weapon/ore/gold(src) - if (src.mineralName == "Silver") - O = new /obj/item/weapon/ore/silver(src) - if (src.mineralName == "Plasma") - O = new /obj/item/weapon/ore/plasma(src) - if (src.mineralName == "Diamond") - O = new /obj/item/weapon/ore/diamond(src) - if (src.mineralName == "Clown") - O = new /obj/item/weapon/ore/clown(src) - if(O) - src.geological_data.UpdateNearbyArtifactInfo(src) - O.geological_data = src.geological_data - return O - -/turf/simulated/mineral/proc/gets_drilled(var/artifact_fail = 0) - //var/destroyed = 0 //used for breaking strange rocks - if ((src.mineralName != "") && (src.mineralAmt > 0) && (src.mineralAmt < 11)) - - //if the turf has already been excavated, some of it's ore has been removed - for (var/i=0;i[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) - N.fullUpdateMineralOverlays() - var/crate = rand(1,500) - switch(crate) - if(1) - visible_message("After digging, you find an old dusty crate buried within!") - new/obj/structure/closet/crate/secure/loot(src) - return - -/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) - src.geological_data.UpdateNearbyArtifactInfo(src) - X:geological_data = src.geological_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) - src.visible_message("\red[pick("[display_name] crumbles away into dust","[display_name] breaks apart")].") - del(X) - - src.finds.Remove(F) - -/turf/simulated/mineral/proc/artifact_debris(var/severity = 0) - //cael's patented random limited drop componentized loot system! - severity = max(min(severity,1),0) - var/materials = 0 - var/list/viable_materials = list(1,2,4,8,16,32,64,128,256) - - var/num_materials = rand(1,3 + severity*2) - for(var/i=0, i 0 && !excavation_minerals.len) - for(var/i=0, i 0) - if(excavation_level < 25) - src.overlays += image('icons/obj/xenoarchaeology.dmi', "overlay_excv1_[rand(1,3)]") - else if(excavation_level < 50) - src.overlays += image('icons/obj/xenoarchaeology.dmi', "overlay_excv2_[rand(1,3)]") - else if(excavation_level < 75) - src.overlays += image('icons/obj/xenoarchaeology.dmi', "overlay_excv3_[rand(1,3)]") - else - src.overlays += image('icons/obj/xenoarchaeology.dmi', "overlay_excv4_[rand(1,3)]") - desc = "It appears to be partially excavated."*/ - - return - -/turf/unsimulated/mineral/random - name = "Mineral deposit" - var/mineralAmtList = list("Uranium" = 5, "Iron" = 5, "Diamond" = 5, "Gold" = 5, "Silver" = 5, "Plasma" = 5/*, "Adamantine" = 5*/) - var/mineralSpawnChanceList = list("Uranium" = 5, "Iron" = 50, "Diamond" = 1, "Gold" = 5, "Silver" = 5, "Plasma" = 25/*, "Adamantine" =5*/)//Currently, Adamantine won't spawn as it has no uses. -Durandan - var/mineralChance = 10 //means 10% chance of this plot changing to a mineral deposit - -/turf/unsimulated/mineral/random/New() - if (prob(mineralChance)) - var/mName = pickweight(mineralSpawnChanceList) //temp mineral name - - if (mName) - var/turf/unsimulated/mineral/M - switch(mName) - if("Uranium") - M = new/turf/unsimulated/mineral/uranium(src) - if("Iron") - M = new/turf/unsimulated/mineral/iron(src) - M.icon_state = "rock_Iron[rand(1,3)]" - if("Diamond") - M = new/turf/unsimulated/mineral/diamond(src) - if("Gold") - M = new/turf/unsimulated/mineral/gold(src) - if("Silver") - M = new/turf/unsimulated/mineral/silver(src) - if("Plasma") - M = new/turf/unsimulated/mineral/plasma(src) - M.icon_state = "rock_Plasma[rand(1,3)]" - if("Clown") - M = new/turf/unsimulated/mineral/clown(src) - if(M) - ..() - src = M - M.levelupdate() - - //preserve archaeo data - M.geological_data = src.geological_data - M.excavation_minerals = src.excavation_minerals - M.overlays = src.overlays - M.artifact_find = src.artifact_find - M.archaeo_overlay = src.archaeo_overlay - M.excav_overlay = src.excav_overlay - - /*else if (prob(artifactChance)) - new/obj/machinery/artifact(src)*/ - return - -/turf/unsimulated/mineral/random/high_chance - mineralChance = 25 - mineralSpawnChanceList = list("Uranium" = 10, "Iron" = 30, "Diamond" = 2, "Gold" = 10, "Silver" = 10, "Plasma" = 25, "Archaeo" = 2) - - -/turf/unsimulated/mineral/random/high_chance_clown - mineralChance = 40 - mineralSpawnChanceList = list("Uranium" = 10, "Iron" = 30, "Diamond" = 2, "Gold" = 5, "Silver" = 5, "Plasma" = 25, "Archaeo" = 2, "Clown" = 15) - -/turf/unsimulated/mineral/random/Del() - return - -/turf/unsimulated/mineral/uranium - name = "Uranium deposit" - icon_state = "rock_Uranium" - mineralName = "Uranium" - mineralAmt = 5 - spreadChance = 10 - spread = 1 - - - -/turf/unsimulated/mineral/iron - name = "Iron deposit" - icon_state = "rock_Iron1" - mineralName = "Iron" - mineralAmt = 5 - spreadChance = 25 - spread = 1 - - -/turf/unsimulated/mineral/diamond - name = "Diamond deposit" - icon_state = "rock_Diamond" - mineralName = "Diamond" - mineralAmt = 5 - spreadChance = 10 - spread = 1 - - -/turf/unsimulated/mineral/gold - name = "Gold deposit" - icon_state = "rock_Gold" - mineralName = "Gold" - mineralAmt = 5 - spreadChance = 10 - spread = 1 - - -/turf/unsimulated/mineral/silver - name = "Silver deposit" - icon_state = "rock_Silver" - mineralName = "Silver" - mineralAmt = 5 - spreadChance = 10 - spread = 1 - - -/turf/unsimulated/mineral/plasma - name = "Plasma deposit" - icon_state = "rock_Plasma1" - mineralName = "Plasma" - mineralAmt = 5 - spreadChance = 25 - spread = 1 - - -/turf/unsimulated/mineral/clown - name = "Bananium deposit" - icon_state = "rock_Clown" - mineralName = "Clown" - mineralAmt = 3 - spreadChance = 10 - spread = 1 - -/* -commented out in r5061, I left it because of the shroom thingies - -/turf/unsimulated/mineral/ReplaceWithFloor() - if(!icon_old) icon_old = icon_state - var/turf/unsimulated/floor/plating/airless/asteroid/W - var/old_dir = dir - - for(var/direction in cardinal) - for(var/obj/effect/glowshroom/shroom in get_step(src,direction)) - if(!shroom.floor) //shrooms drop to the floor - shroom.floor = 1 - shroom.icon_state = "glowshroomf" - shroom.pixel_x = 0 - shroom.pixel_y = 0 - - var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) - W = new /turf/unsimulated/floor/plating/airless/asteroid(src) - W.lighting_lumcount += old_lumcount - if(old_lumcount != W.lighting_lumcount) - W.lighting_changed = 1 - lighting_controller.changed_turfs += W - - W.dir = old_dir - - W.fullUpdateMineralOverlays() - W.levelupdate() - return W -*/ - -/turf/unsimulated/mineral/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!" - return - - if (istype(W, /obj/item/device/core_sampler)) - src.geological_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*src.excavation_level]cm." - return - - if (istype(W, /obj/item/weapon/pickaxe)) - var/turf/T = user.loc - if (!( istype(T, /turf) )) - return -/* - if (istype(W, /obj/item/weapon/pickaxe/radius)) - var/turf/T = user.loc - if (!( istype(T, /turf) )) - return -*/ -//Watch your tabbing, microwave. --NEO - - var/obj/item/weapon/pickaxe/P = W - if(last_act+P.digspeed > world.time)//prevents message spam - return - last_act = world.time - - playsound(user, P.drill_sound, 20, 1) - - //handle any archaeological finds we might uncover - var/fail_message - if(src.finds.len) - var/datum/find/F = src.finds[1] - if(src.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, src.finds[1]) - else if(prob(50)) - src.finds.Remove(src.finds[1]) - if(prob(50)) - artifact_debris() - - if(do_after(user,P.digspeed)) - user << "\blue You finish [P.drill_verb] the rock." - - if(finds.len) - var/datum/find/F = src.finds[1] - if(round(src.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(src.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(src.excavation_level + P.excavation_amount > F.excavation_required - F.clearance_range) - //just pull the surrounding rock out - excavate_find(0, F) - - if( src.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( src.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) - gets_drilled(0) - else - gets_drilled(1) - return - else - src.excavation_level += P.excavation_amount - - //archaeo overlays - if(!archaeo_overlay && finds.len) - var/datum/find/F = src.finds[1] - if(F.excavation_required <= src.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(src.excavation_level >= 75) - if(src.excavation_level - P.excavation_amount < 75) - update_excav_overlay = 1 - else if(src.excavation_level >= 50) - if(src.excavation_level - P.excavation_amount < 50) - update_excav_overlay = 1 - else if(src.excavation_level >= 25) - if(src.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 - - //extract pesky minerals while we're excavating - while(excavation_minerals.len && src.excavation_level > excavation_minerals[excavation_minerals.len]) - drop_mineral() - pop(excavation_minerals) - mineralAmt-- - score_oremined++ - - //drop some rocks - next_rock += P.excavation_amount * 10 - while(next_rock > 100) - next_rock -= 100 - var/obj/item/weapon/ore/O = new(src) - src.geological_data.UpdateNearbyArtifactInfo(src) - O.geological_data = src.geological_data - - else - return attack_hand(user) - return - -/turf/unsimulated/mineral/proc/drop_mineral() - var/obj/item/weapon/ore/O - if (src.mineralName == "Uranium") - O = new /obj/item/weapon/ore/uranium(src) - if (src.mineralName == "Iron") - O = new /obj/item/weapon/ore/iron(src) - if (src.mineralName == "Gold") - O = new /obj/item/weapon/ore/gold(src) - if (src.mineralName == "Silver") - O = new /obj/item/weapon/ore/silver(src) - if (src.mineralName == "Plasma") - O = new /obj/item/weapon/ore/plasma(src) - if (src.mineralName == "Diamond") - O = new /obj/item/weapon/ore/diamond(src) - if (src.mineralName == "Clown") - O = new /obj/item/weapon/ore/clown(src) - if(O) - src.geological_data.UpdateNearbyArtifactInfo(src) - O.geological_data = src.geological_data - return O - -/turf/unsimulated/mineral/proc/gets_drilled(var/artifact_fail = 0) - //var/destroyed = 0 //used for breaking strange rocks - if ((src.mineralName != "") && (src.mineralAmt > 0) && (src.mineralAmt < 11)) - - //if the turf has already been excavated, some of it's ore has been removed - for (var/i=0;i[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/unsimulated/floor/plating/airless/asteroid/N = ChangeTurf(/turf/unsimulated/floor/plating/airless/asteroid) - N.fullUpdateMineralOverlays() - var/crate = rand(1,500) - switch(crate) - if(1) - visible_message("After digging, you find an old dusty crate buried within!") - new/obj/structure/closet/crate/secure/loot(src) - return - -/turf/unsimulated/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) - src.geological_data.UpdateNearbyArtifactInfo(src) - X:geological_data = src.geological_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) - src.visible_message("\red[pick("[display_name] crumbles away into dust","[display_name] breaks apart")].") - del(X) - - src.finds.Remove(F) - -/turf/unsimulated/mineral/proc/artifact_debris(var/severity = 0) - //cael's patented random limited drop componentized loot system! - severity = max(min(severity,1),0) - var/materials = 0 - var/list/viable_materials = list(1,2,4,8,16,32,64,128,256) - - var/num_materials = rand(1,3 + severity*2) - for(var/i=0, i