[MIRROR] Some more Init and Destroy issues (#10317)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-03-06 04:36:25 -07:00
committed by GitHub
parent 5e90dd067f
commit 5aad34f339
35 changed files with 165 additions and 109 deletions

View File

@@ -164,7 +164,7 @@
var/turf/simulated/harvesting = pick(resource_field)
while(resource_field.len && !harvesting.resources)
harvesting.has_resources = 0
harvesting.turf_resource_types &= ~(TURF_HAS_MINERALS)
harvesting.resources = null
resource_field -= harvesting
if(resource_field.len) // runtime protection
@@ -209,7 +209,7 @@
current_capacity++ // Adds the ore to the drill's capacity.
if(!found_resource) // If a drill can't see an advanced material, it will destroy it while going through.
harvesting.has_resources = 0
harvesting.turf_resource_types &= ~(TURF_HAS_MINERALS)
harvesting.resources = null
resource_field -= harvesting
else
@@ -381,7 +381,7 @@
for(var/ix = 0, ix < drill_range, ix++)
mine_turf = locate(tx + ix, ty + iy, T.z)
if(!istype(mine_turf, /turf/space/))
if(mine_turf && mine_turf.has_resources)
if(mine_turf && mine_turf.turf_resource_types & TURF_HAS_MINERALS)
resource_field += mine_turf
if(!resource_field.len)

View File

@@ -34,7 +34,7 @@
for(var/turf/simulated/T in range(range, Turf))
if(!T.has_resources)
if(!(T.turf_resource_types & TURF_HAS_MINERALS))
continue
for(var/metal in T.resources)

View File

@@ -76,7 +76,7 @@ var/list/mining_overlay_cache = list()
ORE_RUTILE = /obj/item/ore/rutile
)
has_resources = 1
turf_resource_types = TURF_HAS_MINERALS
/turf/simulated/mineral/ChangeTurf(turf/N, tell_universe, force_lighting_update, preserve_outdoors)
clear_ore_effects()
@@ -206,6 +206,10 @@ var/list/mining_overlay_cache = list()
/turf/simulated/mineral/Initialize()
. = ..()
if(turf_resource_types & TURF_HAS_RARE_ORE)
make_ore(1)
else if (turf_resource_types & TURF_HAS_ORE)
make_ore()
if(prob(20))
overlay_detail = "asteroid[rand(0,9)]"
update_icon(1)
@@ -353,7 +357,7 @@ var/list/mining_overlay_cache = list()
/turf/simulated/mineral/proc/UpdateMineral()
clear_ore_effects()
if(mineral)
new /obj/effect/mineral(src, mineral)
new /obj/effect/mineral(src)
update_icon()
//Not even going to touch this pile of spaghetti
@@ -597,6 +601,7 @@ var/list/mining_overlay_cache = list()
update_icon()
/turf/simulated/mineral/proc/clear_ore_effects()
turf_resource_types &= ~(TURF_HAS_ORE | TURF_HAS_RARE_ORE)
for(var/obj/effect/mineral/M in contents)
qdel(M)

View File

@@ -9,15 +9,18 @@
var/image/scanner_image
var/ore_reagent // Reagent from pumping water near this ore.
/obj/effect/mineral/New(var/newloc, var/ore/M)
..(newloc)
/obj/effect/mineral/Initialize(mapload)
. = ..()
var/turf/simulated/mineral/min_turf = loc
if(!istype(min_turf))
return INITIALIZE_HINT_QDEL
var/ore/M = min_turf.mineral
name = "[M.display_name] deposit"
ore_key = M.name
if(M.reagent)
ore_reagent = M.reagent
icon_state = "rock_[ore_key]"
var/turf/T = get_turf(src)
layer = T.layer+0.1
layer = min_turf.layer+0.1
/obj/effect/mineral/proc/get_scan_overlay()
if(!scanner_image)
@@ -26,4 +29,4 @@
scanner_image = image(icon, loc = get_turf(src), icon_state = (O.scan_icon ? O.scan_icon : icon_state))
else
to_world("No ore data for [src]!")
return scanner_image
return scanner_image