Fixed a bunch of hard dels (#32186)

This commit is contained in:
DamianX
2022-03-12 02:14:04 +01:00
committed by GitHub
parent 37549a0084
commit 30b5a2ac1d
8 changed files with 31 additions and 17 deletions

View File

@@ -72,7 +72,8 @@
/ray/proc/getReboundOnAtom(var/rayCastHit/hit)
//calc where we hit the atom
var/vector/hit_point = hit.point_raw
var/vector/hit_atom_loc = atom2vector(hit.hit_atom) + new /vector(0.5, 0.5)
var/atom/movable/resolved_hit_atom = hit.hit_atom?.get()
var/vector/hit_atom_loc = atom2vector(resolved_hit_atom) + new /vector(0.5, 0.5)
var/vector/hit_vector = hit_point - hit_atom_loc
@@ -136,7 +137,7 @@
var/turf/T = vector2turf(new_position, z)
//trying hit at turf
var/rayCastHitInfo/info = new /rayCastHitInfo(src, T, new_position, new_position_unfloored, distance)
var/rayCastHitInfo/info = new /rayCastHitInfo(src, makeweakref(T), new_position, new_position_unfloored, distance)
var/rayCastHit/hit = raycast_hit_check(info)
switch(hit.hit_code())
if(RAY_CAST_NO_HIT_EXIT)
@@ -154,7 +155,7 @@
//trying hit on every atom inside the turf
for(var/atom/movable/A in T)
info = new /rayCastHitInfo(src, A, new_position, new_position_unfloored, distance)
info = new /rayCastHitInfo(src, makeweakref(A), new_position, new_position_unfloored, distance)
hit = raycast_hit_check(info)
switch(hit.hit_code())
if(RAY_CAST_NO_HIT_EXIT)

View File

@@ -1,6 +1,6 @@
/rayCastHit
var/ray/used_ray
var/atom/movable/hit_atom
var/datum/weakref/hit_atom
var/vector/point
var/vector/point_raw
var/distance

View File

@@ -1,11 +1,11 @@
/rayCastHitInfo
var/ray/used_ray
var/atom/movable/hit_atom
var/datum/weakref/hit_atom
var/vector/point
var/vector/point_raw
var/distance
/rayCastHitInfo/New(var/ray/used_ray, var/atom/movable/hit_atom, var/vector/point, var/vector/point_raw, var/distance)
/rayCastHitInfo/New(var/ray/used_ray, var/datum/weakref/hit_atom, var/vector/point, var/vector/point_raw, var/distance)
src.used_ray = used_ray
src.hit_atom = hit_atom
src.point = point

View File

@@ -7,9 +7,11 @@
var/list/res = our_ray.cast(dist)
for(var/rayCastHit/rCH in res)
var/image/I = image('icons/Testing/Zone.dmi',"fullblock",10)
rCH.hit_atom.overlays += I
var/ref = "\ref[rCH.hit_atom]"
var/datum/weakref/ref = rCH.hit_atom
var/atom/movable/R = ref.get()
R.overlays += I
R = null
spawn(30)
var/atom/movable/R = locate(ref)
R = ref.get()
R.overlays -= I
return res

View File

@@ -264,9 +264,10 @@ List of hard deletions:"}
tag = null
for(var/timer in active_timers)
qdel(timer)
for(var/component in datum_components)
qdel(component)
active_timers = null
for(var/component_type in datum_components)
qdel(datum_components[component_type])
datum_components = null
/datum/var/gcDestroyed

View File

@@ -6,13 +6,20 @@
var/area/territory = null
/datum/component/ai/area_territorial/proc/SetArea(var/area/new_area)
if(territory)
territory.unregister_event(/event/area_entered, src, .proc/area_enter)
territory.unregister_event(/event/area_exited, src, .proc/area_exit)
unset_area()
territory = new_area
territory.register_event(/event/area_entered, src, .proc/area_enter)
territory.register_event(/event/area_exited, src, .proc/area_exit)
/datum/component/ai/area_territorial/proc/unset_area()
if(territory)
territory.unregister_event(/event/area_entered, src, .proc/area_enter)
territory.unregister_event(/event/area_exited, src, .proc/area_exit)
/datum/component/ai/area_territorial/Destroy()
unset_area()
..()
/datum/component/ai/area_territorial/proc/area_enter(atom/movable/enterer)
if(isliving(enterer)) // No ghosts
INVOKE_EVENT(parent, enter_signal, enter_args)

View File

@@ -44,6 +44,9 @@
qdel(immune_system)
immune_system = null
if(addicted_chems)
qdel(addicted_chems)
addicted_chems = null
. = ..()
/mob/living/examine(var/mob/user, var/size = "", var/show_name = TRUE, var/show_icon = TRUE) //Show the mob's size and whether it's been butchered

View File

@@ -41,12 +41,12 @@ var/list/beam_master = list()
hit_cache = .
/ray/beam_ray/raycast_hit_check(var/rayCastHitInfo/info)
var/atom/movable/A = info.hit_atom
var/turf/T = vector2turf(info.point, z)
var/atom/movable/A = info.hit_atom.get()
if(isnull(A))
return new /rayCastHit(info, RAY_CAST_NO_HIT_CONTINUE)
var/turf/T = vector2turf(info.point, z)
T.last_beam_damage = fired_beam.damage
if(!A.Cross(fired_beam, T) || (!isturf(fired_beam.original) && A == fired_beam.original))