mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #4849 from VOREStation/upstream-merge-5978
[MIRROR] Unpicks some mining spaghetti
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
sharp = 1
|
||||
|
||||
var/excavation_amount = 200
|
||||
var/destroy_artefacts = FALSE // some mining tools will destroy artefacts completely while avoiding side-effects.
|
||||
|
||||
/obj/item/weapon/pickaxe/silver
|
||||
name = "silver pickaxe"
|
||||
|
||||
@@ -24,7 +24,6 @@ var/list/mining_overlay_cache = list()
|
||||
var/sand_dug
|
||||
var/mined_ore = 0
|
||||
var/last_act = 0
|
||||
var/emitter_blasts_taken = 0 // EMITTER MINING! Muhehe.
|
||||
var/overlay_detail
|
||||
|
||||
var/datum/geosample/geologic_data
|
||||
@@ -208,14 +207,22 @@ var/list/mining_overlay_cache = list()
|
||||
new oretype(src)
|
||||
resources[ore] = 0
|
||||
|
||||
/turf/simulated/mineral/bullet_act(var/obj/item/projectile/Proj)
|
||||
/turf/simulated/mineral/bullet_act(var/obj/item/projectile/Proj) // only emitters for now
|
||||
if(Proj.excavation_amount)
|
||||
var/newDepth = excavation_level + Proj.excavation_amount // Used commonly below
|
||||
if(newDepth >= 200) // first, if the turf is completely drilled then don't bother checking for finds and just drill it
|
||||
GetDrilled(0)
|
||||
|
||||
// Emitter blasts
|
||||
if(istype(Proj, /obj/item/projectile/beam/emitter) || istype(Proj, /obj/item/projectile/beam/heavylaser/fakeemitter))
|
||||
emitter_blasts_taken++
|
||||
if(emitter_blasts_taken > 2) // 3 blasts per tile
|
||||
mined_ore = 1
|
||||
GetDrilled()
|
||||
//destroy any archaeological finds
|
||||
if(finds && finds.len)
|
||||
var/datum/find/F = finds[1]
|
||||
if(newDepth > F.excavation_required) // Digging too deep with something as clumsy or random as a blaster will destroy artefacts
|
||||
finds.Remove(finds[1])
|
||||
if(prob(50))
|
||||
artifact_debris()
|
||||
|
||||
excavation_level += Proj.excavation_amount
|
||||
update_archeo_overlays(Proj.excavation_amount)
|
||||
|
||||
/turf/simulated/mineral/Bumped(AM)
|
||||
|
||||
@@ -383,17 +390,9 @@ var/list/mining_overlay_cache = list()
|
||||
var/datum/find/F = finds[1]
|
||||
if(newDepth > F.excavation_required) // Digging too deep can break the item. At least you won't summon a Balrog (probably)
|
||||
fail_message = ". <b>[pick("There is a crunching noise","[W] collides with some different rock","Part of the rock face crumbles away","Something breaks under [W]")]</b>"
|
||||
|
||||
wreckfinds(P.destroy_artefacts)
|
||||
to_chat(user, "<span class='notice'>You start [P.drill_verb][fail_message].</span>")
|
||||
|
||||
if(fail_message && prob(90))
|
||||
if(prob(25))
|
||||
excavate_find(prob(5), finds[1])
|
||||
else if(prob(50))
|
||||
finds.Remove(finds[1])
|
||||
if(prob(50))
|
||||
artifact_debris()
|
||||
|
||||
if(do_after(user,P.digspeed))
|
||||
|
||||
if(finds && finds.len)
|
||||
@@ -406,63 +405,14 @@ var/list/mining_overlay_cache = list()
|
||||
to_chat(user, "<span class='notice'>You finish [P.drill_verb] \the [src].</span>")
|
||||
|
||||
if(newDepth >= 200) // This means the rock is mined out fully
|
||||
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(5))
|
||||
//empty boulder
|
||||
B = new(src)
|
||||
|
||||
if(B)
|
||||
if(P.destroy_artefacts)
|
||||
GetDrilled(0)
|
||||
else
|
||||
GetDrilled(1)
|
||||
excavate_turf()
|
||||
return
|
||||
|
||||
excavation_level += P.excavation_amount
|
||||
var/updateIcon = 0
|
||||
|
||||
//archaeo overlays
|
||||
if(!archaeo_overlay && finds && finds.len)
|
||||
var/datum/find/F = finds[1]
|
||||
if(F.excavation_required <= excavation_level + F.view_range)
|
||||
cut_overlay(archaeo_overlay)
|
||||
archaeo_overlay = "overlay_archaeo[rand(1,3)]"
|
||||
add_overlay(archaeo_overlay)
|
||||
|
||||
else if(archaeo_overlay && (!finds || !finds.len))
|
||||
cut_overlay(archaeo_overlay)
|
||||
archaeo_overlay = null
|
||||
|
||||
//there's got to be a better way to do this
|
||||
var/update_excav_overlay = 0
|
||||
if(excavation_level >= 150)
|
||||
if(excavation_level - P.excavation_amount < 150)
|
||||
update_excav_overlay = 1
|
||||
else if(excavation_level >= 100)
|
||||
if(excavation_level - P.excavation_amount < 100)
|
||||
update_excav_overlay = 1
|
||||
else if(excavation_level >= 50)
|
||||
if(excavation_level - P.excavation_amount < 50)
|
||||
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
|
||||
if(excav_quadrant > 5)
|
||||
excav_quadrant = 5
|
||||
cut_overlay(excav_overlay)
|
||||
excav_overlay = "overlay_excv[excav_quadrant]_[rand(1,3)]"
|
||||
add_overlay(excav_overlay)
|
||||
|
||||
if(updateIcon)
|
||||
update_icon()
|
||||
update_archeo_overlays(P.excavation_amount)
|
||||
|
||||
//drop some rocks
|
||||
next_rock += P.excavation_amount
|
||||
@@ -475,6 +425,54 @@ var/list/mining_overlay_cache = list()
|
||||
|
||||
return attack_hand(user)
|
||||
|
||||
/turf/simulated/mineral/proc/wreckfinds(var/destroy = FALSE)
|
||||
if(!destroy && prob(90)) //nondestructive methods have a chance of letting you step away to not trash things
|
||||
if(prob(25))
|
||||
excavate_find(prob(5), finds[1])
|
||||
else if(prob(50) || destroy) //destructive methods will always destroy finds, no bowls menacing with spikes for you
|
||||
finds.Remove(finds[1])
|
||||
if(prob(50))
|
||||
artifact_debris()
|
||||
|
||||
/turf/simulated/mineral/proc/update_archeo_overlays(var/excavation_amount = 0)
|
||||
var/updateIcon = 0
|
||||
|
||||
//archaeo overlays
|
||||
if(!archaeo_overlay && finds && finds.len)
|
||||
var/datum/find/F = finds[1]
|
||||
if(F.excavation_required <= excavation_level + F.view_range)
|
||||
cut_overlay(archaeo_overlay)
|
||||
archaeo_overlay = "overlay_archaeo[rand(1,3)]"
|
||||
add_overlay(archaeo_overlay)
|
||||
|
||||
else if(archaeo_overlay && (!finds || !finds.len))
|
||||
cut_overlay(archaeo_overlay)
|
||||
archaeo_overlay = null
|
||||
|
||||
//there's got to be a better way to do this
|
||||
var/update_excav_overlay = 0
|
||||
if(excavation_level >= 150)
|
||||
if(excavation_level - excavation_amount < 150)
|
||||
update_excav_overlay = 1
|
||||
else if(excavation_level >= 100)
|
||||
if(excavation_level - excavation_amount < 100)
|
||||
update_excav_overlay = 1
|
||||
else if(excavation_level >= 50)
|
||||
if(excavation_level - excavation_amount < 50)
|
||||
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
|
||||
if(excav_quadrant > 5)
|
||||
excav_quadrant = 5
|
||||
cut_overlay(excav_overlay)
|
||||
excav_overlay = "overlay_excv[excav_quadrant]_[rand(1,3)]"
|
||||
add_overlay(excav_overlay)
|
||||
|
||||
if(updateIcon)
|
||||
update_icon()
|
||||
|
||||
/turf/simulated/mineral/proc/clear_ore_effects()
|
||||
for(var/obj/effect/mineral/M in contents)
|
||||
qdel(M)
|
||||
@@ -489,6 +487,26 @@ var/list/mining_overlay_cache = list()
|
||||
O.geologic_data = geologic_data
|
||||
return O
|
||||
|
||||
/turf/simulated/mineral/proc/excavate_turf()
|
||||
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(5))
|
||||
//empty boulder
|
||||
B = new(src)
|
||||
|
||||
if(B)
|
||||
GetDrilled(0)
|
||||
else
|
||||
GetDrilled(1)
|
||||
return
|
||||
|
||||
/turf/simulated/mineral/proc/GetDrilled(var/artifact_fail = 0)
|
||||
|
||||
if(!density)
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
icon_state = "emitter"
|
||||
fire_sound = 'sound/weapons/emitter.ogg'
|
||||
light_color = "#00CC33"
|
||||
excavation_amount = 70 // 3 shots to mine a turf
|
||||
|
||||
muzzle_type = /obj/effect/projectile/muzzle/emitter
|
||||
tracer_type = /obj/effect/projectile/tracer/emitter
|
||||
@@ -118,6 +119,7 @@
|
||||
fire_sound = 'sound/weapons/emitter.ogg'
|
||||
damage = 0 // The actual damage is computed in /code/modules/power/singularity/emitter.dm
|
||||
light_color = "#00CC33"
|
||||
excavation_amount = 70 // 3 shots to mine a turf
|
||||
|
||||
muzzle_type = /obj/effect/projectile/muzzle/emitter
|
||||
tracer_type = /obj/effect/projectile/tracer/emitter
|
||||
|
||||
Reference in New Issue
Block a user