Skip to content

Commit

Permalink
fix that annoying af particle runtime (#3483)
Browse files Browse the repository at this point in the history
I know that borbop's current PR also fixes this, but I'm tired of seeing it in CI too
  • Loading branch information
Absolucy authored Sep 20, 2024
1 parent 4077af8 commit 271d602
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/living/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 11 additions & 10 deletions monkestation/code/modules/blood_for_the_blood_gods/particle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
. = ..()
Expand Down
3 changes: 2 additions & 1 deletion monkestation/code/modules/physics/physics_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 271d602

Please sign in to comment.