diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 51e89cbfc37b..e41ead876a45 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -215,6 +215,9 @@ /proc/get_hearers_in_view(R, atom/source) // Returns a list of hearers in view(R) from source (ignoring luminosity). Used in saycode. + if(!isnum(R)) + stack_trace("invalid get_hearers_in_view call on [source] with an range [R]") + return list() var/turf/T = get_turf(source) . = list() if(!T) diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index 17e9adf93f1f..9965861b39b0 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -318,7 +318,10 @@ DEFINE_BITFIELD(smoothing_junction, list( var/new_junction = NONE for(var/direction in GLOB.cardinals) //Cardinal case first. - SET_ADJ_IN_DIR(src, new_junction, direction, direction) + try + SET_ADJ_IN_DIR(src, new_junction, direction, direction) + catch(var/exception/except) + CRASH("[src] tried smoothing but failed; [except]") if(!(new_junction & (NORTH|SOUTH)) || !(new_junction & (EAST|WEST))) set_smoothed_icon_state(new_junction) diff --git a/code/_onclick/hud/alien.dm b/code/_onclick/hud/alien.dm index d0db2a3c0d94..623497e71ca7 100644 --- a/code/_onclick/hud/alien.dm +++ b/code/_onclick/hud/alien.dm @@ -122,6 +122,8 @@ if(!mymob) return var/mob/living/carbon/alien/humanoid/H = mymob + if(!H.client) + return if(hud_version != HUD_STYLE_NOHUD) for(var/obj/item/I in H.held_items) I.screen_loc = ui_hand_position(H.get_held_index_of_item(I)) diff --git a/code/_onclick/hud/generic_dextrous.dm b/code/_onclick/hud/generic_dextrous.dm index beeacbbccb4a..8ca1e6f1128a 100644 --- a/code/_onclick/hud/generic_dextrous.dm +++ b/code/_onclick/hud/generic_dextrous.dm @@ -67,6 +67,8 @@ if(!mymob) return var/mob/living/D = mymob + if(!D.client) + return if(hud_version != HUD_STYLE_NOHUD) for(var/obj/item/I in D.held_items) I.screen_loc = ui_hand_position(D.get_held_index_of_item(I)) diff --git a/code/_onclick/hud/guardian.dm b/code/_onclick/hud/guardian.dm index 1c5bcd4362c5..6a548eba9c89 100644 --- a/code/_onclick/hud/guardian.dm +++ b/code/_onclick/hud/guardian.dm @@ -100,7 +100,7 @@ static_inventory += using /datum/hud/dextrous/guardian/persistent_inventory_update() - if(!mymob) + if(!mymob || !mymob.client) return if(istype(mymob, /mob/living/simple_animal/hostile/guardian/dextrous)) var/mob/living/simple_animal/hostile/guardian/dextrous/D = mymob diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 0d00724a4329..9fdf71a69c8e 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -240,6 +240,8 @@ GLOBAL_LIST_INIT(available_ui_styles, list( return TRUE /datum/hud/proc/plane_masters_update() + if(!mymob.client) + return // Plane masters are always shown to OUR mob, never to observers for(var/thing in plane_masters) var/atom/movable/screen/plane_master/PM = plane_masters[thing] diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index b7dc8c2a3c05..d4d7989a58c3 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -216,6 +216,9 @@ * * sig_typeor_types Signal string key or list of signal keys to stop listening to specifically */ /datum/proc/UnregisterSignal(datum/target, sig_type_or_types) + if(!target) + stack_trace("Unregister Signal called without a target by [src].") + return var/list/lookup = target.comp_lookup if(!signal_procs || !signal_procs[target] || !lookup) return diff --git a/code/datums/quirks/negative.dm b/code/datums/quirks/negative.dm index bda4756d3292..872c9ade4407 100644 --- a/code/datums/quirks/negative.dm +++ b/code/datums/quirks/negative.dm @@ -443,6 +443,8 @@ RegisterSignal(quirk_holder, COMSIG_MOB_EXAMINATE, PROC_REF(looks_at_floor)) /datum/quirk/social_anxiety/remove() + if(!quirk_holder) + return UnregisterSignal(quirk_holder, list(COMSIG_MOB_EYECONTACT, COMSIG_MOB_EXAMINATE)) /datum/quirk/social_anxiety/on_process(delta_time) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index e88693546fff..ed593fcbbe5a 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -376,15 +376,20 @@ var/area/newarea = get_area(newloc) loc = newloc . = TRUE - oldloc.Exited(src, newloc) - if(oldarea != newarea) - oldarea.Exited(src, newloc) + if(!oldloc) + stack_trace("[src] moved out of nullspace/null loc") + else + oldloc.Exited(src, newloc) - for(var/i in oldloc) - if(i == src) // Multi tile objects - continue - var/atom/movable/thing = i - thing.Uncrossed(src) + for(var/i in oldloc) + if(i == src) // Multi tile objects + continue + var/atom/movable/thing = i + thing.Uncrossed(src) + + if(oldarea) + if(oldarea != newarea) + oldarea.Exited(src, newloc) newloc.Entered(src, oldloc) if(oldarea != newarea) @@ -560,7 +565,7 @@ if(destination) . = doMove(destination) else - CRASH("No valid destination passed into forceMove") + CRASH("No valid destination passed into forceMove on [src]") /atom/movable/proc/moveToNullspace() return doMove(null) diff --git a/code/game/objects/items/ego_weapons/waw.dm b/code/game/objects/items/ego_weapons/waw.dm index 772a8988a4d6..a4afcfe6f4c3 100644 --- a/code/game/objects/items/ego_weapons/waw.dm +++ b/code/game/objects/items/ego_weapons/waw.dm @@ -1913,7 +1913,7 @@ speed_slowdown = 1 throwforce = 100//TIME TO DIE! to_chat(user,span_warning("You put your strength behind this attack.")) - power_timer = addtimer(CALLBACK(src, PROC_REF(PowerReset)), 3 SECONDS,user, TIMER_STOPPABLE)//prevents storing 3 powered up anchors and unloading all of them at once + power_timer = addtimer(CALLBACK(src, PROC_REF(PowerReset)), 3 SECONDS, TIMER_STOPPABLE)//prevents storing 3 powered up anchors and unloading all of them at once /obj/item/ego_weapon/blind_obsession/proc/PowerReset(mob/user) to_chat(user, span_warning("You lose your balance while holding [src].")) diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm index 0251eb361734..04da68c9cc82 100644 --- a/code/game/turfs/change_turf.dm +++ b/code/game/turfs/change_turf.dm @@ -320,8 +320,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( var/energy = 0 var/heat_cap = 0 - for(var/t in turf_list) - var/turf/open/T = t + for(var/turf/open/T in turf_list) //Cache? var/datum/gas_mixture/turf/mix = T.air //"borrowing" this code from merge(), I need to play with the temp portion. Lets expand it out @@ -339,8 +338,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( for(var/id in total_gases) total_gases[id][MOLES] /= turflen - for(var/t in turf_list) - var/turf/open/T = t + for(var/turf/open/T in turf_list) T.air.copy_from(total) T.update_visuals() SSair.add_to_active(T) diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index c54765eb867a..2d668a9a3348 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -134,7 +134,10 @@ temperature_archived = temperature /turf/open/archive() - air.archive() + if(!air) + stack_trace("[src] tried to archive null air at [x]x-[y]y-[z]z") + else + air.archive() archived_cycle = SSair.times_fired temperature_archived = temperature @@ -257,8 +260,7 @@ max_share = 0 //Gotta reset our tracker #endif - for(var/t in adjacent_turfs) - var/turf/open/enemy_tile = t + for(var/turf/open/enemy_tile in adjacent_turfs) if(fire_count <= enemy_tile.current_cycle) continue @@ -472,8 +474,7 @@ var/energy = 0 var/heat_cap = 0 - for(var/t in turf_list) - var/turf/open/T = t + for(var/turf/open/T in turf_list) //Cache? var/datum/gas_mixture/turf/mix = T.air if (roundstart && istype(T.air, /datum/gas_mixture/immutable)) @@ -498,8 +499,7 @@ A_gases[id][MOLES] /= turflen A.garbage_collect() - for(var/t in turf_list) - var/turf/open/T = t + for(var/turf/open/T in turf_list) if(T.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs T.air.copy_from(SSair.planetary[T.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it else diff --git a/code/modules/mob/living/simple_animal/abnormality/waw/judgement_bird.dm b/code/modules/mob/living/simple_animal/abnormality/waw/judgement_bird.dm index 08572681433d..670c81be5251 100644 --- a/code/modules/mob/living/simple_animal/abnormality/waw/judgement_bird.dm +++ b/code/modules/mob/living/simple_animal/abnormality/waw/judgement_bird.dm @@ -191,7 +191,8 @@ if(get_dist(src, J) < 6) // Unnecessary for this distance continue target_turfs += get_turf(J) - + if(!LAZYLEN(target_turfs)) + return ..() var/turf/target_turf = pick(target_turfs) if(istype(target_turf)) patrol_path = get_path_to(src, target_turf, TYPE_PROC_REF(/turf, Distance_cardinal), 0, 200) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 25afd86cabd8..1816284fb354 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -486,8 +486,11 @@ //Returns true if the target atom is on our current turf and above the right layer //If direct target is true it's the originally clicked target. /obj/projectile/proc/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE) - if(QDELETED(target) || impacted[target]) + if(QDELETED(target)) return FALSE + if(target in impacted) + if(impacted[target]) + return FALSE if(!ignore_loc && (loc != target.loc)) return FALSE // if pass_flags match, pass through entirely - unless direct target is set. diff --git a/code/modules/shuttle/arrivals.dm b/code/modules/shuttle/arrivals.dm index 3579ede1d189..89f5becfb772 100644 --- a/code/modules/shuttle/arrivals.dm +++ b/code/modules/shuttle/arrivals.dm @@ -107,6 +107,9 @@ /obj/docking_port/mobile/arrivals/proc/CheckTurfsPressure() for(var/I in SSjob.latejoin_trackers) var/turf/open/T = get_turf(I) + if(!istype(T)) + stack_trace("Closed Turf in SSjob.latejoin_trackers was checked for air pressure.") + continue var/pressure = T.air.return_pressure() if(pressure < HAZARD_LOW_PRESSURE || pressure > HAZARD_HIGH_PRESSURE) //simple safety check return TRUE