diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 4c9635ef9742..4cccc6c6ba63 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -421,7 +421,7 @@ * Helper proc for throwing blood particles around, similar to the spray_blood proc. */ /mob/living/proc/blood_particles(amount = rand(1, 3), angle = rand(0,360), min_deviation = -30, max_deviation = 30, min_pixel_z = 0, max_pixel_z = 6) - if(!isturf(loc) || !blood_volume ||HAS_TRAIT(src, TRAIT_NOBLOOD)) + if(QDELETED(src) || QDELETED(loc) || !isturf(loc) || !blood_volume || HAS_TRAIT(src, TRAIT_NOBLOOD)) return for(var/i in 1 to amount) var/obj/effect/decal/cleanable/blood/particle/droplet = new(loc) diff --git a/monkestation/code/modules/blood_for_the_blood_gods/particle.dm b/monkestation/code/modules/blood_for_the_blood_gods/particle.dm index a74415bfeb8a..cd0966cfb06c 100644 --- a/monkestation/code/modules/blood_for_the_blood_gods/particle.dm +++ b/monkestation/code/modules/blood_for_the_blood_gods/particle.dm @@ -19,14 +19,13 @@ return FALSE /obj/effect/decal/cleanable/blood/particle/proc/start_movement(movement_angle) - var/datum/component/movable_physics/movable_physics = GetComponent(/datum/component/movable_physics) - if(!movable_physics) - movable_physics = initialize_physics() - if(!isnull(movement_angle)) - movable_physics.set_angle(movement_angle) + get_or_init_physics()?.set_angle(movement_angle) -/obj/effect/decal/cleanable/blood/particle/proc/initialize_physics() - return AddComponent(/datum/component/movable_physics, \ +/obj/effect/decal/cleanable/blood/particle/proc/get_or_init_physics() as /datum/component/movable_physics + RETURN_TYPE(/datum/component/movable_physics) + if(QDELETED(src)) + return + return LoadComponent(/datum/component/movable_physics, \ horizontal_velocity = rand(3 * 100, 5.5 * 100) * 0.01, \ vertical_velocity = rand(4 * 100, 4.5 * 100) * 0.01, \ horizontal_friction = rand(0.05 * 100, 0.1 * 100) * 0.01, \ @@ -38,7 +37,9 @@ ) /obj/effect/decal/cleanable/blood/particle/proc/on_bounce() - if(!isturf(loc) || !splatter_type_floor) + if(QDELETED(src)) + return + if(QDELETED(loc) || !isturf(loc) || !splatter_type_floor) qdel(src) return var/obj/effect/decal/cleanable/splatter @@ -73,7 +74,7 @@ qdel(src) /obj/effect/decal/cleanable/blood/particle/proc/on_bump(atom/bumped_atom) - if(!isturf(loc) || !splatter_type_wall) + if(QDELETED(src) || QDELETED(bumped_atom) || !isturf(loc) || !splatter_type_wall) return if(iswallturf(bumped_atom)) //Adjust pixel offset to make splatters appear on the wall @@ -119,8 +120,8 @@ update_appearance(UPDATE_ICON) /obj/effect/decal/cleanable/blood/splatter/stacking/Destroy() - . = ..() splat_overlays = null + return ..() /obj/effect/decal/cleanable/blood/splatter/stacking/update_overlays() . = ..() diff --git a/monkestation/code/modules/physics/physics_component.dm b/monkestation/code/modules/physics/physics_component.dm index 5c678839c235..e744387264c9 100644 --- a/monkestation/code/modules/physics/physics_component.dm +++ b/monkestation/code/modules/physics/physics_component.dm @@ -266,7 +266,8 @@ /// Helper to set angle, futureproofing in case new behavior like altering the transform of the movable based on angle is needed /datum/component/movable_physics/proc/set_angle(new_angle) - angle = SIMPLIFY_DEGREES(new_angle) + if(!isnull(new_angle)) + angle = SIMPLIFY_DEGREES(new_angle) /// We do not EVER want newtonian movement while handling movement ourselves, so block it! /datum/component/movable_physics/proc/on_newtonian_move(atom/movable/source, direction, start_delay)