Skip to content

Commit

Permalink
Adding some null checking for runtimes in mob creation/destruction.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jan 7, 2024
1 parent 00775a8 commit c20028b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
28 changes: 24 additions & 4 deletions code/modules/mob/living/deity/deity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,34 @@
return STATUS_INTERACTIVE

/mob/living/deity/Destroy()

for(var/phenom in phenomenas)
remove_phenomena(phenom)

if(length(items_by_category))
for(var/cat in items_by_category)
var/list/L = items_by_category[cat]
L.Cut()
items_by_category.Cut()

if(length(items))
for(var/i in items)
qdel(items[i])
items.Cut()

death(0)
minions.Cut()
structures.Cut()
eyeobj.release()
if(length(minions))
minions.Cut()
if(length(structures))
structures.Cut()

if(eyeobj)
eyeobj.release()
QDEL_NULL(eyeobj)
QDEL_NULL(eyenet) //We do it here as some mobs have eyes that have access to the visualnet and we only want to destroy it when the deity is destroyed
QDEL_NULL(eyeobj)

QDEL_NULL(form)

return ..()

/mob/living/deity/verb/return_to_plane()
Expand Down
11 changes: 0 additions & 11 deletions code/modules/mob/living/deity/deity_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,3 @@
if(items[name])
var/datum/deity_item/di = items[name]
. = di.level


/mob/living/deity/Destroy()
for(var/cat in items_by_category)
var/list/L = items_by_category[cat]
L.Cut()
items_by_category.Cut()
for(var/i in items)
qdel(items[i])
items.Cut()
. = ..()
5 changes: 0 additions & 5 deletions code/modules/mob/living/deity/deity_phenomena.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
if(power_per_regen < 0 || power < power_min)
adjust_power(power_per_regen)

/mob/living/deity/Destroy()
for(var/phenom in phenomenas)
remove_phenomena(phenom)
return ..()

/mob/living/deity/proc/add_phenomena(var/type)
if(!phenomenas)
phenomenas = list()
Expand Down
13 changes: 7 additions & 6 deletions code/modules/mob/observer/eye/freelook/freelook.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,30 @@

/mob/observer/eye/freelook
var/list/visibleChunks = list()

var/datum/visualnet/visualnet

/mob/observer/eye/freelook/Initialize(var/mapload, var/datum/visualnet/net)
. = ..()
if(net) visualnet = net
if(net)
visualnet = net

/mob/observer/eye/freelook/Destroy()
. = ..()
visualnet = null

/mob/observer/eye/freelook/possess(var/mob/user)
. = ..()
visualnet.update_eye_chunks(src, TRUE)
if(visualnet)
visualnet.update_eye_chunks(src, TRUE)

/mob/observer/eye/freelook/release(var/mob/user)
if(user == owner)
if(visualnet && user == owner)
visualnet.remove_eye(src)
. = ..()

// Streams the chunk that the new loc is in.
/mob/observer/eye/freelook/setLoc(var/T)
. = ..()

if(.)
if(. && visualnet)
visualnet.update_eye_chunks(src)

0 comments on commit c20028b

Please sign in to comment.