From 5533ef494693ee95b86178d42b5cf61a7f9a60d5 Mon Sep 17 00:00:00 2001 From: Cael_Aislinn Date: Fri, 8 Feb 2013 23:54:45 +1000 Subject: [PATCH] setup digsite creation + propogation on mining asteroid, setup most excavation and tool interaction with mining turfs + digsites, setup tweaked list operation, modified dme Signed-off-by: Cael_Aislinn --- baystation12.dme | 11 ++- code/__HELPERS/lists.dm | 5 +- code/modules/mining/mine_turfs.dm | 150 +++++++++++++++++++++++------- 3 files changed, 125 insertions(+), 41 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index 3ebe66586a2..ecc43c2a84d 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -774,10 +774,10 @@ #include "code\modules\customitems\item_defines.dm" #include "code\modules\customitems\item_spawning.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\events\alien_infestation.dm" #include "code\modules\events\blob.dm" #include "code\modules\events\brand_intelligence.dm" @@ -1127,7 +1127,6 @@ #include "code\modules\research\xenoarchaeology\analysis_isotope_ratio.dm" #include "code\modules\research\xenoarchaeology\analysis_scanner.dm" #include "code\modules\research\xenoarchaeology\archaeo_excavate.dm" -#include "code\modules\research\xenoarchaeology\archaeo_tools.dm" #include "code\modules\research\xenoarchaeology\artifact.dm" #include "code\modules\research\xenoarchaeology\artifact_analysis.dm" #include "code\modules\research\xenoarchaeology\artifact_db.dm" @@ -1141,7 +1140,9 @@ #include "code\modules\research\xenoarchaeology\finds.dm" #include "code\modules\research\xenoarchaeology\fossils.dm" #include "code\modules\research\xenoarchaeology\geosample.dm" +#include "code\modules\research\xenoarchaeology\misc_tools.dm" #include "code\modules\research\xenoarchaeology\readme.dm" +#include "code\modules\research\xenoarchaeology\suspension_generator.dm" #include "code\modules\research\xenoarchaeology\talking_item.dm" #include "code\modules\scripting\Errors.dm" #include "code\modules\scripting\IDE.dm" diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index 690025ab735..fd1bdb3465b 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -149,8 +149,9 @@ proc/listclearnulls(list/list) //Reverses the order of items in the list /proc/reverselist(list/L) var/list/output = list() - for(var/i = L.len; i >= 1; i--) - output += L[i] + if(L) + for(var/i = L.len; i >= 1; i--) + output += L[i] return output //Randomize: Return the list in a random order diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index cca0035846d..a7944ca8968 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -24,11 +24,10 @@ var/excavation_level = 0 var/list/finds = list() var/list/excavation_minerals = list() - var/list/excavation_minerals_ascending = list() - var/list/exca_first = list("A","B","C","D","E") - var/list/exca_second = list() var/next_rock = 0 - var/overlay_num = 0 + var/archaeo_overlay = "" + var/excav_overlay = "" + var/obj/item/weapon/last_find /turf/simulated/mineral/Del() return @@ -76,17 +75,16 @@ //keep any digsite data as constant as possible if(T.finds.len && !M.finds.len) M.finds = T.finds - M.overlays += "overlay_archaeo1" + if(T.archaeo_overlay) + M.overlays += archaeo_overlay + //---- Xenoarchaeology BEGIN if(mineralAmt > 0 && !excavation_minerals.len) for(var/i=0, i= F.excavation_required + F.destruct_range) - fail_message = ", [pick("there is a crunching noise","[W] hits something","part of the rock face crumbles away","something breaks under [W]")]" - if(prob(50)) - src.finds.Remove(F) - user << "\red You start [P.drill_verb][fail_message]." + 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) + if(prob(50)) + if(prob(25)) + excavate_find(5, src.finds[1]) + else if(prob(50)) + src.finds.Remove(src.finds[1]) 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(5, F) + if(src.excavation_level + P.excavation_amount >= 100) gets_drilled() + return else src.excavation_level += P.excavation_amount - //handle any archaeological finds we might uncover + //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 - //extract pesky minerals while we're excavating - while(excavation_minerals.len && src.excavation_level > excavation_minerals[excavation_minerals.len]) - drop_mineral() - //have a 50% chance to extract bonus minerals this way - //if(prob(50)) - pop(excavation_minerals) - mineralAmt-- + //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 - //drop some rocks - next_rock += P.excavation_amount * 10 - while(next_rock > 100) - next_rock -= 100 - var/obj/item/weapon/ore/O = new(src) - O.geological_data = src.geological_data + //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() + //have a 50% chance to extract bonus minerals this way + //if(prob(50)) + 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) + O.geological_data = src.geological_data else return attack_hand(user) @@ -399,6 +456,31 @@ commented out in r5061, I left it because of the shroom thingies usr << "\red You destroy some of the rocks!"*/ 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) + + //some find types delete the /obj/item/weapon/archaeological_find and replace it with something else, this handles when that happens + //yuck + if(!X) + X = last_find + if(!X) + X = "something" + + //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)) + src.visible_message("\red[pick("[X] crumbles away into dust","[X] breaks apart","[X] collapses onto itself")].") + del(X) + + src.finds.Remove(F) + /* /turf/simulated/mineral/proc/setRandomMinerals() var/s = pickweight(list("uranium" = 5, "iron" = 50, "gold" = 5, "silver" = 5, "plasma" = 50, "diamond" = 1))