Skip to content

Commit 81682dc

Browse files
authored
Adds muzzle flashes for guns depending on the ammo (ParadiseSS13#13322)
* Muzzle flashes added for guns * Use an muzzle flash effect now. * Unused var * sillenced guns have a lower alpha muzzleflash effect
1 parent f110cef commit 81682dc

File tree

23 files changed

+205
-46
lines changed

23 files changed

+205
-46
lines changed

code/__DEFINES/muzzle_flash.dm

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#define MUZZLE_FLASH_STRENGTH_WEAK 1
2+
#define MUZZLE_FLASH_STRENGTH_NORMAL 2
3+
#define MUZZLE_FLASH_STRENGTH_STRONG 3
4+
5+
#define MUZZLE_FLASH_RANGE_WEAK 1
6+
#define MUZZLE_FLASH_RANGE_NORMAL 2
7+
#define MUZZLE_FLASH_RANGE_STRONG 3

code/game/gamemodes/changeling/powers/mutations.dm

+1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@
221221
projectile_type = /obj/item/projectile/tentacle
222222
caliber = "tentacle"
223223
icon_state = "tentacle_end"
224+
muzzle_flash_effect = null
224225
var/obj/item/gun/magic/tentacle/gun //the item that shot it
225226

226227
/obj/item/ammo_casing/magic/tentacle/New(obj/item/gun/magic/tentacle/tentacle_gun)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/obj/effect/temp_visual/target_angled/muzzle_flash
2+
icon = 'icons/effects/projectile.dmi'
3+
icon_state = "firing_effect"
4+
duration = 0.2
5+
6+
/obj/effect/temp_visual/target_angled/muzzle_flash/Initialize(mapload, atom/target, duration_override = null)
7+
if(duration_override)
8+
duration = duration_override
9+
. = ..()
10+
if(get_dir(src, target) & NORTH)
11+
layer = BELOW_MOB_LAYER
12+
13+
14+
/obj/effect/temp_visual/target_angled/muzzle_flash/energy
15+
icon_state = "firing_effect_energy"
16+
17+
/obj/effect/temp_visual/target_angled/muzzle_flash/magic
18+
icon = 'icons/effects/effects.dmi'
19+
icon_state = "shieldsparkles"

code/game/objects/effects/temporary_visuals/temporary_visual.dm

+10
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@
3535
if(set_dir)
3636
setDir(set_dir)
3737
. = ..()
38+
39+
/obj/effect/temp_visual/target_angled
40+
randomdir = FALSE
41+
42+
/obj/effect/temp_visual/target_angled/Initialize(mapload, atom/target)
43+
. = ..()
44+
if(target)
45+
var/matrix/M = new
46+
M.Turn(get_angle(src, target))
47+
transform = M

code/game/objects/items/weapons/chrono_eraser.dm

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@
141141
/obj/item/ammo_casing/energy/chrono_beam
142142
name = "eradication beam"
143143
projectile_type = /obj/item/projectile/energy/chrono_beam
144+
muzzle_flash_effect = /obj/effect/temp_visual/target_angled/muzzle_flash/energy
145+
muzzle_flash_color = null
144146
icon_state = "chronobolt"
145147
e_cost = 0
146148

code/modules/mining/lavaland/loot/tendril_loot.dm

+1
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@
358358
projectile_type = /obj/item/projectile/hook
359359
caliber = "hook"
360360
icon_state = "hook"
361+
muzzle_flash_effect = null
361362

362363
/obj/item/projectile/hook
363364
name = "hook"

code/modules/projectiles/ammunition.dm

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
var/click_cooldown_override = 0 //Override this to make your gun have a faster fire rate, in tenths of a second. 4 is the default gun cooldown.
2020
var/harmful = TRUE //pacifism check for boolet, set to FALSE if bullet is non-lethal
2121

22+
/// What type of muzzle flash effect will be shown. If null then no effect and flash of light will be shown
23+
var/muzzle_flash_effect = /obj/effect/temp_visual/target_angled/muzzle_flash
24+
/// What color the flash has. If null then the flash won't cause lighting
25+
var/muzzle_flash_color = LIGHT_COLOR_TUNGSTEN
26+
/// What range the muzzle flash has
27+
var/muzzle_flash_range = MUZZLE_FLASH_RANGE_WEAK
28+
/// How strong the flash is
29+
var/muzzle_flash_strength = MUZZLE_FLASH_STRENGTH_WEAK
30+
2231
/obj/item/ammo_casing/New()
2332
..()
2433
if(projectile_type)

0 commit comments

Comments
 (0)