Fix several hard-dels, add harddel ref tracking (#16174)

This commit is contained in:
Wildkins
2023-04-10 16:42:20 -04:00
committed by GitHub
parent e9a9bb3323
commit 3f4786ab23
30 changed files with 418 additions and 905 deletions
@@ -266,7 +266,7 @@
else if(reference==node3)
qdel(network_node3)
node2 = null
node3 = null
update_underlays()
@@ -21,6 +21,7 @@
thing.parent = null
members = null
edges = null
return ..()
+71 -18
View File
@@ -5,23 +5,10 @@
remove_system(hardpoint, force = 1)
hardpoints.Cut()
if(arms)
frame.arms = arms
arms.forceMove(frame)
arms = null
if(legs)
frame.legs = legs
legs.forceMove(frame)
pass_flags &= PASSRAILING //if previously was hoverthrusters, need to update pass flag
legs = null
if(body)
frame.body = body
body.forceMove(frame)
body = null
if(head)
frame.head = head
head.forceMove(frame)
head = null
remove_arms(frame)
remove_legs(frame)
remove_body(frame)
remove_head(frame)
frame.is_wired = FRAME_WIRED_ADJUSTED
frame.is_reinforced = FRAME_REINFORCED_WELDED
@@ -31,6 +18,72 @@
qdel(src)
/mob/living/heavy_vehicle/proc/remove_body_part(obj/item/mech_component/part, atom/dest)
if(!part)
return
if(!dest)
dest = get_turf(src)
if(part == arms)
remove_arms(dest)
else if(part == legs)
remove_legs(dest)
else if(part == body)
remove_body(dest)
else if(part == head)
remove_head(dest)
/mob/living/heavy_vehicle/proc/remove_arms(atom/dest)
if(!arms)
return
var/obj/structure/heavy_vehicle_frame/frame = dest
if(istype(frame))
frame.arms = arms
arms.forceMove(dest)
arms = null
/mob/living/heavy_vehicle/proc/remove_legs(atom/dest)
if(!legs)
return
pass_flags &= PASSRAILING //if previously was hoverthrusters, need to update pass flag
var/obj/structure/heavy_vehicle_frame/frame = dest
if(istype(frame))
frame.legs = legs
legs.forceMove(dest)
legs = null
/mob/living/heavy_vehicle/proc/remove_body(atom/dest)
if(!body)
return
var/obj/structure/heavy_vehicle_frame/frame = dest
if(istype(frame))
frame.body = body
body.forceMove(dest)
body = null
/mob/living/heavy_vehicle/proc/remove_head(atom/dest)
if(!head)
return
var/obj/structure/heavy_vehicle_frame/frame = dest
if(istype(frame))
frame.head = head
head.forceMove(dest)
head = null
/mob/living/heavy_vehicle/proc/forget_module(var/module_to_forget)
//Realistically a module disappearing without being uninstalled is wrong and a bug or adminbus
var/target = null
@@ -150,4 +203,4 @@
to_chat(user, "<span class='notice'>You remove \the [system] in \the [src]'s [system_hardpoint].</span>")
playsound(user.loc, 'sound/items/screwdriver.ogg', 100, 1)
return 1
return system
+3 -3
View File
@@ -13,14 +13,14 @@
if(exosuit)
name = "wreckage of \the [exosuit.name]"
if(!gibbed)
for(var/obj/item/thing in list(exosuit.arms, exosuit.legs, exosuit.head, exosuit.body))
if(thing && prob(40))
thing.forceMove(src)
for(var/hardpoint in exosuit.hardpoints)
if(exosuit.hardpoints[hardpoint] && prob(40))
var/obj/item/thing = exosuit.hardpoints[hardpoint]
if(exosuit.remove_system(hardpoint))
thing.forceMove(src)
for(var/obj/item/mech_component/comp in list(exosuit.arms, exosuit.legs, exosuit.head, exosuit.body))
if(comp && prob(40))
exosuit.remove_body_part(comp, src)
/obj/structure/mech_wreckage/powerloader/Initialize(mapload)
var/mob/living/heavy_vehicle/premade/ripley/new_mech = new(loc)
+14 -2
View File
@@ -97,6 +97,12 @@
selected_system = null
for(var/hardpoint in hardpoints)
var/obj/item/S = remove_system(hardpoint, force = 1)
qdel(S)
hardpoints = null
for(var/thing in pilots)
var/mob/pilot = thing
if(pilot.client)
@@ -112,14 +118,20 @@
hardpoint_hud_elements = null
hardpoints = null
QDEL_NULL(access_card)
QDEL_NULL(arms)
QDEL_NULL(legs)
QDEL_NULL(head)
QDEL_NULL(body)
QDEL_NULL(hud_health)
QDEL_NULL(hud_open)
QDEL_NULL(hud_power)
QDEL_NULL(hud_power_control)
QDEL_NULL(camera)
QDEL_NULL(radio)
. = ..()
/mob/living/heavy_vehicle/IsAdvancedToolUser()
+6 -6
View File
@@ -913,6 +913,12 @@ default behaviour is:
QDEL_NULL(reagents)
clear_from_target_grid()
if(auras)
for(var/a in auras)
remove_aura(a)
QDEL_NULL(ability_master)
return ..()
/mob/living/proc/nervous_system_failure()
@@ -993,12 +999,6 @@ default behaviour is:
return FALSE
. = TRUE
/mob/living/Destroy()
if(auras)
for(var/a in auras)
remove_aura(a)
return ..()
/mob/living/proc/needs_wheelchair()
return FALSE
@@ -51,6 +51,7 @@
friends = null
target_mob = null
targets = null
QDEL_NULL_ASSOC(target_type_validator_map)
return ..()
/mob/living/simple_animal/hostile/can_name(var/mob/living/M)
+1
View File
@@ -4,6 +4,7 @@
living_mob_list -= src
unset_machine()
QDEL_NULL(hud_used)
lose_hearing_sensitivity()
if(client)
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
qdel(spell_master)
@@ -18,6 +18,12 @@
var/datum/weakref/sensor_ref
var/list/last_scan
/obj/machinery/computer/ship/sensors/Destroy()
QDEL_NULL(sound_token)
sensors = null
identification = null
return ..()
/obj/machinery/computer/ship/sensors/proc/get_sensors()
return sensors