Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix that annoying af particle runtime #3483

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading