diff --git a/code/modules/projectiles/effects.dm b/code/modules/projectiles/effects.dm index faf140e9fa..40b573e837 100644 --- a/code/modules/projectiles/effects.dm +++ b/code/modules/projectiles/effects.dm @@ -4,6 +4,9 @@ layer = 5 var/angle = 0 var/call_time = 0 + var/life_time = 2 + var/alpha_modifier = 1 + var/update_time = 0.6 /obj/effect/projectile/New(var/turf/location) if (istype(location)) @@ -19,12 +22,12 @@ /obj/effect/projectile/proc/update() var/dt = world.time - call_time - if(dt > 2) + if(dt > life_time) loc = null qdel(src) return - alpha *= 0.9 - spawn(0.3) + alpha *= alpha_modifier + spawn(update_time) update() //---------------------------- @@ -51,24 +54,27 @@ /obj/effect/projectile/impact icon_state = "dust_cloud_generic" + life_time = 6 + alpha_modifier = 0.9 + update_time = 0.5 var/speed_modifier = 1 /obj/effect/projectile/impact/activate(var/direction) pixel_x = cos(direction) * 32 pixel_y = sin(direction) * 32 call_time = world.time - var/dispersion = rand(-30, 30) + var/dispersion = rand(-60, 60) angle = direction + dispersion - 180 - speed_modifier = sqrt(abs(dispersion)) + speed_modifier *= sqrt(abs(dispersion)) * 0.5 update() /obj/effect/projectile/impact/update() var/dt = world.time - call_time - if(dt > 5) + if(dt > life_time) loc = null qdel(src) return - alpha *= 0.85 + alpha *= alpha_modifier var/ds = 20 if(speed_modifier != 0) ds /= speed_modifier @@ -76,15 +82,25 @@ ds /= dt pixel_x += cos(angle) * sqrt(ds) pixel_y += sin(angle) * sqrt(ds) - spawn(0.4) + spawn(update_time) update() +/obj/effect/projectile/impact/heavy + icon_state = "dust_heavy_cloud_generic" + life_time = 10 + alpha_modifier = 0.9 + update_time = 0.6 + speed_modifier = 1.5 + //---------------------------- // Tracer //---------------------------- /obj/effect/projectile/tracer icon_state = "tracer_white" + life_time = 6 + alpha_modifier = 0.9 + update_time = 0.7 /obj/effect/projectile/tracer/activate(var/direction, var/pixel_dist, var/turf/starting) angle = direction @@ -92,21 +108,23 @@ pixel_y = (sin(angle) * pixel_dist) - ((y - starting.y) * world.icon_size) transform = turn(transform, -angle) call_time = world.time - spawn(0.5) + spawn() update() /obj/effect/projectile/tracer/update() var/dt = world.time - call_time - if(dt > 2) + if(dt > life_time) loc = null qdel(src) return - alpha *= 0.8 - spawn(0.6) + alpha *= alpha_modifier + spawn(update_time) update() /obj/effect/projectile/tracer/minor alpha = 64 + life_time = 3 + alpha_modifier = 0.7 /obj/effect/projectile/tracer/red icon_state = "tracer_red" @@ -115,4 +133,5 @@ icon_state = "tracer_green" /obj/effect/projectile/tracer/shell - icon_state = "shell_tracer_white" \ No newline at end of file + icon_state = "shell_tracer_white" + life_time = 10 \ No newline at end of file diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 825e4a9981..b30175a9cd 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -706,6 +706,7 @@ if (istype(src, /obj/item/projectile/shell)) if (loc == trajectory.target) var/obj/item/projectile/shell/S = src + on_impact(T) S.initiate(loc) return FALSE diff --git a/code/modules/projectiles/projectile/cannon.dm b/code/modules/projectiles/projectile/cannon.dm index c7ec32c361..8c26c568a7 100644 --- a/code/modules/projectiles/projectile/cannon.dm +++ b/code/modules/projectiles/projectile/cannon.dm @@ -16,10 +16,11 @@ atype = "HE" tracer_type = /obj/effect/projectile/tracer/shell muzzle_type = /obj/effect/projectile/bullet/muzzle + impact_type = /obj/effect/projectile/impact/heavy var/turf/targloc = null var/initiated = FALSE -/obj/item/projectile/shell/update_icon() +/obj/item/projectile/shell/New() ..() icon_state = "[atype]_shell" @@ -40,12 +41,11 @@ return ..() /obj/item/projectile/shell/on_impact(var/atom/A) - impact_effect(effect_transform) // generate impact effect playsound(src, "ric_sound", 50, TRUE, -2) if (istype(A, /turf)) var/turf/T = A if (atype == "cannonball") - if (!istype(T, /turf/floor/beach) && !istype(T, /turf/floor/broken_floor)) + if (!istype(T, /turf/floor/beach) && !istype(T, /turf/floor/broken_floor) && !istype(T, /turf/floor/trench)) T.ChangeTurf(/turf/floor/dirt/burned) explosion(T, 1, 1, 1, 2) else @@ -56,6 +56,17 @@ qdel(src) return TRUE +/obj/item/projectile/shell/impact_effect() + if (ispath(impact_type)) + var/turf/effect_loc = null + if(permutated.len > 0) + effect_loc = permutated[permutated.len] + else + effect_loc = starting + for(var/i = 0, i < 10, i++) + var/obj/effect/projectile/P = new impact_type(effect_loc) + if (istype(P)) + P.activate(get_angle()) /obj/item/projectile/shell/launch(atom/target, mob/user, obj/structure/cannon/modern/tank/launcher) targloc = get_turf(target) @@ -97,7 +108,8 @@ if(!T) return var/caliber_modifier = clamp(round(caliber / 50), 0, 4) - + if (!istype(T, /turf/floor/beach) && !istype(T, /turf/floor/broken_floor) && !istype(T, /turf/floor/trench)) + T.ChangeTurf(/turf/floor/dirt/burned) if (atype == "HE") var/he_range = caliber_modifier var/list/fragment_types = list(/obj/item/projectile/bullet/pellet/fragment/short_range = 1) @@ -183,8 +195,9 @@ icon = 'icons/obj/projectiles.dmi' icon_state = "bullet" -/obj/item/projectile/shell/autocannon/update_icon() - return +/obj/item/projectile/shell/autocannon/New() + ..() + icon_state = "bullet" /obj/item/projectile/shell/autocannon/a20_aphe atype = "AP" diff --git a/icons/effects/projectiles.dmi b/icons/effects/projectiles.dmi index 36b25cf129..c84c6b6ce8 100644 Binary files a/icons/effects/projectiles.dmi and b/icons/effects/projectiles.dmi differ