Fix the ChangeTurf improvements PR, 3725

This commit is contained in:
Razgriz
2022-02-28 23:32:13 -07:00
parent d4e8d5c0d6
commit 15f43a90e1
12 changed files with 57 additions and 79 deletions

View File

@@ -21,7 +21,7 @@
/turf/unsimulated/wall/supermatter/Destroy()
STOP_PROCESSING(SSturfs, src)
..()
return ..()
/turf/unsimulated/wall/supermatter/process()
// Only check infrequently.
@@ -117,4 +117,4 @@
if(istype(user,/mob/observer))
return
qdel(user)
qdel(user)

View File

@@ -21,7 +21,6 @@
/obj/landed_holder/proc/land_on(var/turf/T)
//Gather destination information
var/obj/landed_holder/new_holder = new(null)
T.lighting_clear_overlay()
new_holder.turf_type = T.type
new_holder.dir = T.dir
new_holder.icon = T.icon
@@ -31,14 +30,12 @@
new_holder.decals = T.decals ? T.decals.Copy() : null
//Set the destination to be like us
T.Destroy()
var/turf/simulated/shuttle/new_dest = T.ChangeTurf(my_turf.type,,1)
my_turf.lighting_clear_overlay()
new_dest.set_dir(my_turf.dir)
new_dest.icon_state = my_turf.icon_state
new_dest.icon = my_turf.icon
new_dest.copy_overlays(my_turf, TRUE)
new_dest.underlays = my_turf.underlays.Copy()
new_dest.underlays = my_turf.underlays
new_dest.decals = my_turf.decals
//Shuttle specific stuff
new_dest.interior_corner = my_turf.interior_corner
@@ -46,7 +43,6 @@
new_dest.under_turf = my_turf.under_turf
new_dest.join_flags = my_turf.join_flags
new_dest.join_group = my_turf.join_group
new_dest.lighting_build_overlay()
// Associate the holder with the new turf.
new_holder.my_turf = new_dest
@@ -63,14 +59,12 @@
//Change our source to whatever it was before
if(turf_type)
new_source = my_turf.ChangeTurf(turf_type,,1)
new_source.lighting_clear_overlay()
new_source.set_dir(dir)
new_source.icon_state = icon_state
new_source.icon = icon
new_source.copy_overlays(src, TRUE)
new_source.underlays = underlays.Copy()
new_source.underlays = underlays
new_source.decals = decals
new_source.lighting_build_overlay()
else
new_source = my_turf.ChangeTurf(base_turf ? base_turf : get_base_turf_by_area(my_turf),,1)
@@ -102,7 +96,7 @@
/turf/simulated/shuttle/Destroy()
landed_holder = null
..()
return ..()
// For joined corners touching static lighting turfs, add an overlay to cancel out that part of our lighting overlay.
/turf/simulated/shuttle/proc/update_breaklights()
@@ -117,7 +111,7 @@
/turf/simulated/shuttle/proc/underlay_update()
if(!takes_underlays)
//Basically, if it's not forced, and we don't care, don't do it.
return //CHOMP Edit removed 0. Sarcastically quoting the above comment ^ "Basically, if it's not stupposed to store a fucking value, don't store a fucking value."
return 0
var/turf/under //May be a path or a turf
var/mutable_appearance/us = new(src) //We'll use this for changes later
@@ -294,4 +288,4 @@
/turf/simulated/shuttle/floor/voidcraft/external/dark
/turf/simulated/shuttle/floor/voidcraft/external/light
/turf/simulated/shuttle/floor/voidcraft/external/light

View File

@@ -45,8 +45,7 @@
/turf/simulated/wall/Destroy()
STOP_PROCESSING(SSturfs, src)
dismantle_wall(null,null,1)
..()
return ..()
/turf/simulated/wall/examine_icon()
return icon(icon=initial(icon), icon_state=initial(icon_state))
@@ -332,11 +331,4 @@
to_chat(user, span("notice", "You deconstruct \the [src]."))
ChangeTurf(/turf/simulated/floor/airless, preserve_outdoors = TRUE)
return TRUE
return FALSE
/turf/simulated/wall/AltClick(mob/user)
if(isliving(user))
var/mob/living/livingUser = user
if(try_graffiti(livingUser, livingUser.get_active_hand()))
return
. = ..()
return FALSE

View File

@@ -30,11 +30,11 @@
var/movement_cost = 0 // How much the turf slows down movement, if any.
var/list/footstep_sounds = null
var/list/vorefootstep_sounds = null //CHOMPstation edit
var/block_tele = FALSE // If true, most forms of teleporting to or from this turf tile will fail.
var/can_build_into_floor = FALSE // Used for things like RCDs (and maybe lattices/floor tiles in the future), to see if a floor should replace it.
var/list/dangerous_objects // List of 'dangerous' objs that the turf holds that can cause something bad to happen when stepped on, used for AI mobs.
var/tmp/changing_turf
/turf/Initialize(mapload)
. = ..()
@@ -59,9 +59,14 @@
Be.multiz_turf_new(src, UP)
/turf/Destroy()
. = QDEL_HINT_IWILLGC
if (!changing_turf)
crash_with("Improper turf qdel. Do not qdel turfs directly.")
changing_turf = FALSE
cleanbot_reserved_turfs -= src
if(connections)
connections.erase_all()
..()
return QDEL_HINT_IWILLGC
/turf/ex_act(severity)
return 0
@@ -311,7 +316,7 @@
/turf/proc/try_graffiti(var/mob/vandal, var/obj/item/tool)
if(!tool || !tool.sharp || !can_engrave())
if(!tool.sharp || !can_engrave())
return FALSE
if(jobban_isbanned(vandal, "Graffiti"))
@@ -408,4 +413,4 @@
return
// We were the the B-side in a turf translation
/turf/proc/post_translate_B(var/turf/A)
return
return

View File

@@ -61,49 +61,29 @@
cut_overlays(TRUE)
RemoveElement(/datum/element/turf_z_transparency)
changing_turf = TRUE
qdel(src)
var/turf/W = new N( locate(src.x, src.y, src.z) )
if(ispath(N, /turf/simulated/floor))
var/turf/simulated/W = new N( locate(src.x, src.y, src.z) )
if(old_fire)
fire = old_fire
W.fire = old_fire
W.RemoveLattice()
else if(old_fire)
old_fire.RemoveFire()
if (istype(W,/turf/simulated/floor))
W.RemoveLattice()
if(tell_universe)
universe.OnTurfChange(W)
if(tell_universe)
universe.OnTurfChange(W)
if(air_master)
air_master.mark_for_update(W)
if(air_master)
air_master.mark_for_update(src) //handle the addition of the new turf.
for(var/turf/space/S in range(W,1))
S.update_starlight()
W.levelupdate()
W.update_icon(1)
W.post_change()
. = W
else
var/turf/W = new N( locate(src.x, src.y, src.z) )
if(old_fire)
old_fire.RemoveFire()
if(tell_universe)
universe.OnTurfChange(W)
if(air_master)
air_master.mark_for_update(src)
for(var/turf/space/S in range(W,1))
S.update_starlight()
W.levelupdate()
W.update_icon(1)
W.post_change()
. = W
for(var/turf/space/S in range(W, 1))
S.update_starlight()
W.levelupdate()
W.update_icon(1)
W.post_change()
. = W
dangerous_objects = old_dangerous_objects
@@ -132,4 +112,4 @@
space_tile.update_starlight()
if(preserve_outdoors)
outdoors = old_outdoors
outdoors = old_outdoors

View File

@@ -24,7 +24,7 @@
/turf/unsimulated/wall/planetary/Destroy()
SSplanets.removeTurf(src)
..()
return ..()
/turf/unsimulated/wall/planetary/proc/set_temperature(var/new_temperature)
if(new_temperature == temperature)
@@ -67,4 +67,3 @@
oxygen = MOLES_O2STANDARD
nitrogen = MOLES_N2STANDARD
temperature = 310.92 // About 37.7C / 100F

View File

@@ -19,6 +19,13 @@
T.ScrapeAway()
else*/
vv_update_display(D, "deleted", VV_MSG_DELETED)
qdel(D)
// turfs are special snowflakes that'll explode if qdel'd outside ChangeTurf
if (isturf(D))
var/turf/T = D
T.ChangeTurf(world.turf)
else
qdel(D)
if(!QDELETED(D))
vv_update_display(D, "deleted", "")
vv_update_display(D, "deleted", "")

View File

@@ -172,7 +172,4 @@
corpse.adjustBruteLoss(H.getBruteLoss())
corpse.UpdateAppearance()
corpse.regenerate_icons()
for(var/obj/item/organ/internal/I in corpse.internal_organs)
var/obj/item/organ/internal/G = I
G.Destroy()
return
QDEL_NULL_LIST(corpse.internal_organs)

View File

@@ -15,6 +15,12 @@
/turf/simulated/Destroy()
updateVisibility(src)
if(zone)
if(can_safely_remove_from_zone())
c_copy_air()
zone.remove(src)
else
zone.rebuild()
return ..()
/turf/simulated/Initialize()

View File

@@ -223,4 +223,4 @@
#undef LIFT_MOVING
#undef LIFT_WAITING_A
#undef LIFT_WAITING_B
#undef LIFT_WAITING_B

View File

@@ -101,7 +101,6 @@ Also includes Life and New
stasis += hit.stasisforce
..()
/mob/living/simple_mob/xeno/Destroy()
traitdat.Destroy() //Let's clean up after ourselves.
traitdat = null
/mob/living/simple_animal/xeno/Destroy()
QDEL_NULL(traitdat)
..()

View File

@@ -12,7 +12,6 @@ Xenobiological product lives here as a basic type.
var/nameVar = "blah"
/obj/item/xenoproduct/Destroy()
traits.Destroy() //Let's not leave any traits hanging around.
traits = null
QDEL_NULL(traits)
..()