From f34bd3f5c027ed714d16d36632e5dcdd34aa6c08 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Sun, 24 Nov 2024 15:35:31 +0300 Subject: [PATCH] Guncode Agony 4.2: Firing Effect Intervallo (#88072) ## About The Pull Request Firing effects now attach themselves to the firer, meaning you don't run over or back from your own muzzle flash if you fire while running. ## Why It's Good For The Game Look better, both when moving into and away from the effect. ## Changelog :cl: image: Muzzle flash now is attached to your sprite, meaning you won't run over it if you fire while moving /:cl: --- .../game/objects/effects/temporary_visuals/miscellaneous.dm | 6 ++++++ code/modules/projectiles/ammunition/_firing.dm | 2 +- code/modules/vehicles/mecha/equipment/weapons/weapons.dm | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code/game/objects/effects/temporary_visuals/miscellaneous.dm b/code/game/objects/effects/temporary_visuals/miscellaneous.dm index ae2ce27b100..5dfdb74ce85 100644 --- a/code/game/objects/effects/temporary_visuals/miscellaneous.dm +++ b/code/game/objects/effects/temporary_visuals/miscellaneous.dm @@ -57,6 +57,12 @@ icon_state = "firing_effect" duration = 3 +/obj/effect/temp_visual/dir_setting/firing_effect/Initialize(mapload, set_dir) + . = ..() + if (ismovable(loc)) + var/atom/movable/spawned_inside = loc + spawned_inside.vis_contents += src + /obj/effect/temp_visual/dir_setting/firing_effect/setDir(newdir) switch(newdir) if(NORTH) diff --git a/code/modules/projectiles/ammunition/_firing.dm b/code/modules/projectiles/ammunition/_firing.dm index 5ea2da3513d..5a704354ed3 100644 --- a/code/modules/projectiles/ammunition/_firing.dm +++ b/code/modules/projectiles/ammunition/_firing.dm @@ -83,7 +83,7 @@ if(loaded_projectile.firer) firing_dir = get_dir(fired_from, target) if(!loaded_projectile.suppressed && firing_effect_type && !tk_firing(user, fired_from)) - new firing_effect_type(get_turf(src), firing_dir) + new firing_effect_type(user || get_turf(src), firing_dir) var/direct_target if(target && curloc.Adjacent(targloc, target=targloc, mover=src)) //if the target is right on our location or adjacent (including diagonally if reachable) we'll skip the travelling code in the proj's fire() diff --git a/code/modules/vehicles/mecha/equipment/weapons/weapons.dm b/code/modules/vehicles/mecha/equipment/weapons/weapons.dm index cf042033cba..c62b2a0d9ce 100644 --- a/code/modules/vehicles/mecha/equipment/weapons/weapons.dm +++ b/code/modules/vehicles/mecha/equipment/weapons/weapons.dm @@ -74,7 +74,7 @@ projectile_obj.hit_prone_targets = shooter.combat_mode projectile_obj.fire() if(!projectile_obj.suppressed && firing_effect_type) - new firing_effect_type(get_turf(src), chassis.dir) + new firing_effect_type(chassis || get_turf(src), chassis.dir) playsound(chassis, fire_sound, 50, TRUE) log_combat(source, target, "fired [projectile_obj] at", src, "from [chassis] at [get_area_name(src, TRUE)]")