diff --git a/aurorastation.dme b/aurorastation.dme index 75c08e72c71..254e2ebcd02 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -77,6 +77,7 @@ #include "code\__defines\spatial_gridmap.dm" #include "code\__defines\species.dm" #include "code\__defines\species_languages.dm" +#include "code\__defines\stack_trace.dm" #include "code\__defines\subsystem-defines.dm" #include "code\__defines\subsystem-priority.dm" #include "code\__defines\targeting.dm" @@ -118,6 +119,7 @@ #include "code\_helpers\sanitize_values.dm" #include "code\_helpers\spatial_info.dm" #include "code\_helpers\spawn_sync.dm" +#include "code\_helpers\stack_trace.dm" #include "code\_helpers\text.dm" #include "code\_helpers\time.dm" #include "code\_helpers\turfs.dm" diff --git a/code/__defines/stack_trace.dm b/code/__defines/stack_trace.dm new file mode 100644 index 00000000000..969eaecc707 --- /dev/null +++ b/code/__defines/stack_trace.dm @@ -0,0 +1,2 @@ +/// gives us the stack trace from CRASH() without ending the current proc. +#define stack_trace(message) _stack_trace(message, __FILE__, __LINE__) diff --git a/code/_helpers/stack_trace.dm b/code/_helpers/stack_trace.dm new file mode 100644 index 00000000000..5c220d7a74a --- /dev/null +++ b/code/_helpers/stack_trace.dm @@ -0,0 +1,4 @@ +/// gives us the stack trace from CRASH() without ending the current proc. +/// Do not call directly, use the [stack_trace] macro instead. +/proc/_stack_trace(message, file, line) + CRASH("[message] ([file]:[line])") diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm index 7ba50068832..395da6b8f43 100644 --- a/code/game/objects/structures/lattice.dm +++ b/code/game/objects/structures/lattice.dm @@ -26,12 +26,16 @@ /obj/structure/lattice/Initialize() . = ..() + // TG does not have this, and it seems to trigger on the horizon, I do not know what this is supposed to do, perhaps we could get rid of it? if (restrict_placement) if(!(istype(loc, /turf/space) || isopenturf(loc) || istype(loc, /turf/unsimulated/floor/asteroid))) return INITIALIZE_HINT_QDEL for(var/obj/structure/lattice/LAT in loc) - if(LAT != src) - qdel(LAT) + if(LAT == src) + continue + stack_trace("multiple lattices found in ([loc.x], [loc.y], [loc.z])") + return INITIALIZE_HINT_QDEL + if(isturf(loc)) var/turf/turf = loc turf.is_hole = FALSE @@ -136,7 +140,7 @@ damaged = TRUE /obj/structure/lattice/catwalk/indoor/grate/damaged/Initialize() - .=..() + . = ..() icon_state = "[base_icon_state]_dam[rand(0,3)]" /obj/structure/lattice/catwalk/indoor/grate/light @@ -152,7 +156,7 @@ damaged = TRUE /obj/structure/lattice/catwalk/indoor/grate/light/damaged/Initialize() - .=..() + . = ..() icon_state = "[base_icon_state]_dam[rand(0,3)]" /obj/structure/lattice/catwalk/indoor/grate/attackby(obj/item/C, mob/user) diff --git a/html/changelogs/fluffyghost-fixlatticeinit.yml b/html/changelogs/fluffyghost-fixlatticeinit.yml new file mode 100644 index 00000000000..a3cbdb24347 --- /dev/null +++ b/html/changelogs/fluffyghost-fixlatticeinit.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: Fluffyghost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fix lattice Initialize, as it was QDELing directly instead of returning a QDEL HINT." + - backend: "Implemented stack_trace(), a version of CRASH() that does not end the current proc, from /tg/."