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

Shrapnel smooth movement [WIP] #6821

Merged
merged 3 commits into from
Aug 7, 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
36 changes: 28 additions & 8 deletions code/datums/ammo/shrapnel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,36 @@
name = "glass shrapnel"
icon_state = "shrapnel_glass"

/datum/ammo/bullet/shrapnel/light/effect/ // no damage, but looks bright and neat
name = "sparks"

damage = 1 // Tickle tickle
/particles/shrapnel
icon = 'icons/obj/items/weapons/projectiles.dmi'
icon_state = "shrapnel_bright2"
width = 1000
height = 1000
count = 100
spawning = 0
lifespan = 0.6 SECONDS
fadein = 0.2 SECONDS
velocity = generator("square", 32 * 0.85, 32 * 1.15)
rotation = generator("num", 0, 359)

/obj/shrapnel_effect
anchored = TRUE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
unacidable = TRUE
blocks_emissive = EMISSIVE_BLOCK_GENERIC

/obj/shrapnel_effect/New()
. = ..()
particles = new /particles/shrapnel
particles.spawning = rand(5,9) + rand(5,9)
addtimer(CALLBACK(src, PROC_REF(stop)), 0.1 SECONDS)
QDEL_IN(src, 0.9 SECONDS)

/datum/ammo/bullet/shrapnel/light/effect/ver1
icon_state = "shrapnel_bright1"
/obj/shrapnel_effect/proc/stop()
particles.spawning = 0

/datum/ammo/bullet/shrapnel/light/effect/ver2
icon_state = "shrapnel_bright2"
/obj/shrapnel_effect/get_applying_acid_time()
return -1

/datum/ammo/bullet/shrapnel/jagged
shrapnel_chance = SHRAPNEL_CHANCE_TIER_2
Expand Down
3 changes: 1 addition & 2 deletions code/datums/autocells/explosion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ as having entered the turf.

if(power >= 100) // powerful explosions send out some special effects
epicenter = get_turf(epicenter) // the ex_acts might have changed the epicenter
create_shrapnel(epicenter, rand(5,9), , ,/datum/ammo/bullet/shrapnel/light/effect/ver1, explosion_cause_data)
create_shrapnel(epicenter, rand(5,9), , ,/datum/ammo/bullet/shrapnel/light/effect/ver2, explosion_cause_data)
new /obj/shrapnel_effect(epicenter)

/proc/log_explosion(atom/A, datum/automata_cell/explosion/E)
if(isliving(A))
Expand Down
4 changes: 1 addition & 3 deletions code/game/objects/explosion_recursive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ explosion resistance exactly as much as their health

if(power >= 100) // powerful explosions send out some special effects
epicenter = get_turf(epicenter) // the ex_acts might have changed the epicenter
create_shrapnel(epicenter, rand(5,9), , ,/datum/ammo/bullet/shrapnel/light/effect/ver1, explosion_cause_data)
sleep(1)
create_shrapnel(epicenter, rand(5,9), , ,/datum/ammo/bullet/shrapnel/light/effect/ver2, explosion_cause_data)
new /obj/shrapnel_effect(epicenter)

spawn(2) //just in case something goes wrong
if(explosion_in_progress)
Expand Down
6 changes: 0 additions & 6 deletions code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@

//Animate the visuals from starting position to new position

if(projectile_flags & PROJECTILE_SHRAPNEL) //there can be a LOT of shrapnel especially from a cluster OB, not important enough for the expense of an animate()
alpha = alpha_new
pixel_x = pixel_x_rel_new
pixel_y = pixel_y_rel_new
return

var/anim_time = delta_time * 0.1
animate(src, pixel_x = pixel_x_rel_new, pixel_y = pixel_y_rel_new, alpha = alpha_new, time = anim_time, flags = ANIMATION_END_NOW)

Expand Down
Loading