Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit d3ab7c5

Browse files
authored
Merge pull request #8 from She-Is-Trying-To-Form-Her-First-Thought/item_animations
Makes items randomly rotate when dropped and thrown, and also makes guns recoil in sprite when shot
2 parents 00ca411 + 625e268 commit d3ab7c5

File tree

30 files changed

+445
-19
lines changed

30 files changed

+445
-19
lines changed

code/modules/projectiles/gun.dm

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,8 @@
7272
/// Cooldown for the visible message sent from gun flipping.
7373
COOLDOWN_DECLARE(flip_cooldown)
7474

75-
light_system = OVERLAY_LIGHT // DOPPLETHAL ADDITION
76-
light_range = 0 // DOPPLETHAL ADDITION
77-
light_color = COLOR_WHITE // DOPPLETHAL ADDITION
78-
7975
var/obj/effect/muzzle_flash/muzzle_flash // DOPPLETHAL ADDITION
80-
var/muzzle_flash_lum = 2 // DOPPLETHAL ADDITION
8176
var/muzzleflash_iconstate // DOPPLETHAL ADDITION
82-
var/muzzle_flash_color = COLOR_VERY_SOFT_YELLOW // DOPPLETHAL ADDITION
8377
var/muzzle_effects = TRUE // DOPPLETHAL ADDITION
8478

8579
/obj/item/gun/Initialize(mapload)
@@ -453,6 +447,7 @@
453447
return FALSE
454448
process_chamber()
455449
update_appearance()
450+
firing_animation(user, TRUE) // DOPPLETHAL EDIT
456451
return TRUE
457452

458453
///returns true if the gun successfully fires
@@ -506,6 +501,7 @@
506501
return
507502
process_chamber()
508503
update_appearance()
504+
firing_animation(user, FALSE)
509505
semicd = TRUE
510506
addtimer(CALLBACK(src, PROC_REF(reset_semicd)), modified_delay)
511507

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/obj/item
2+
/// Used for unturning when picked up by a mob
3+
var/our_angle = 0
4+
5+
/// Randomly rotates and pixel shifts stuff when dropped or thrown or whatever
6+
/obj/item/proc/do_messy(pixel_variation = 8, angle_variation = 360, duration = 0)
7+
if(item_flags & NO_PIXEL_RANDOM_DROP)
8+
return
9+
animate(src, pixel_x = (base_pixel_x+rand(-pixel_variation,pixel_variation)), duration)
10+
animate(src, pixel_y = (base_pixel_y+rand(-pixel_variation,pixel_variation)), duration)
11+
if(our_angle)
12+
animate(src, transform = transform.Turn(-our_angle), duration)
13+
our_angle = 0
14+
our_angle = rand(0,angle_variation)
15+
transform = transform.Turn(our_angle)
16+
17+
/// Unrotates and pixel shifts things
18+
/obj/item/proc/undo_messy(duration = 0)
19+
animate(src, pixel_x = base_pixel_x, duration)
20+
animate(src, pixel_y = base_pixel_y, duration)
21+
if(our_angle)
22+
animate(src, transform = transform.Turn(-our_angle), duration)
23+
our_angle = 0
24+
25+
/// Messes things up when thrown
26+
/obj/item/on_thrown(mob/living/carbon/user, atom/target)
27+
if((item_flags & ABSTRACT) || HAS_TRAIT(src, TRAIT_NODROP))
28+
return
29+
user.dropItemToGround(src, silent = TRUE)
30+
if(throwforce && (HAS_TRAIT(user, TRAIT_PACIFISM)) || HAS_TRAIT(user, TRAIT_NO_THROWING))
31+
to_chat(user, span_notice("You set [src] down gently on the ground."))
32+
return
33+
undo_messy()
34+
do_messy(duration = 4)
35+
return src
36+
37+
/// Extra messes things up when thrown
38+
/obj/item/after_throw(datum/callback/callback)
39+
. = ..()
40+
undo_messy()
41+
do_messy(duration = 2)
42+
43+
/// Messes things up when they fall zlevels
44+
/obj/item/onZImpact(turf/turf_fallen, levels)
45+
. = ..()
46+
undo_messy()
47+
do_messy(duration = 4)
48+
49+
/// Fixes how things look when you pick them up
50+
/mob/put_in_hand(obj/item/item_picked, hand_index, forced = FALSE, ignore_anim = TRUE, visuals_only = FALSE)
51+
. = ..()
52+
if(. && item_picked)
53+
item_picked.undo_messy(duration = 0)
54+
55+
/// Messes up items when you drop them to the floor
56+
/mob/dropItemToGround(obj/item/item_dropped, force, silent, invdrop)
57+
. = ..()
58+
if(. && item_dropped)
59+
if(!(item_dropped.item_flags & NO_PIXEL_RANDOM_DROP))
60+
item_dropped.do_messy(duration = 2)

modular_lethal_doppler/paxilweapons_real/code/guns/bobr_kurwa.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414
recoil = 0.5
1515
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_lightgun.wav'
1616
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_lightgun.wav'
17+
gunshot_animation_information = list(
18+
"pixel_x" = 15, \
19+
"pixel_y" = 3, \
20+
"inactive_wben_suppressed" = TRUE, \
21+
)
22+
recoil_animation_information = list(
23+
"recoil_angle_upper" = -15, \
24+
"recoil_angle_lower" = -30, \
25+
"recoil_burst_speed" = 0.5, \
26+
"return_burst_speed" = 0.5, \
27+
)
1728

1829
/obj/item/gun/ballistic/revolver/shotgun_revolver/give_manufacturer_examine()
1930
AddElement(/datum/element/manufacturer_examine, COMPANY_SZOT)

modular_lethal_doppler/paxilweapons_real/code/guns/bogseo.dm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@
2828
recoil = 1.5
2929
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_mediumgun.wav'
3030
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_mediumgun.wav'
31+
gunshot_animation_information = list(
32+
"pixel_x" = 18, \
33+
"pixel_y" = 1, \
34+
"inactive_wben_suppressed" = TRUE, \
35+
)
36+
recoil_animation_information = list(
37+
"recoil_angle_upper" = -10, \
38+
"recoil_angle_lower" = -20, \
39+
"recoil_burst_speed" = 0.5, \
40+
"return_burst_speed" = 0.5, \
41+
"recoil_speed" = 0.5, \
42+
"return_speed" = 0.5, \
43+
)
3144

3245
/obj/item/gun/ballistic/automatic/xhihao_smg/Initialize(mapload)
3346
. = ..()

modular_lethal_doppler/paxilweapons_real/code/guns/cawil.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
recoil = 0.5
3131
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_heavygun.wav'
3232
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_heavygun.wav'
33+
gunshot_animation_information = list(
34+
"pixel_x" = 35, \
35+
"pixel_y" = 0, \
36+
"inactive_wben_suppressed" = TRUE, \
37+
)
38+
recoil_animation_information = list(
39+
"recoil_angle_upper" = -10, \
40+
"recoil_angle_lower" = -20, \
41+
"recoil_burst_speed" = 0.5, \
42+
"return_burst_speed" = 0.5, \
43+
)
3344

3445
/obj/item/gun/ballistic/automatic/sol_rifle/Initialize(mapload)
3546
. = ..()

modular_lethal_doppler/paxilweapons_real/code/guns/eland.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212
recoil = 0.25
1313
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_lightgun.wav'
1414
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_lightgun.wav'
15+
gunshot_animation_information = list(
16+
"pixel_x" = 13, \
17+
"pixel_y" = 2, \
18+
"inactive_wben_suppressed" = TRUE, \
19+
)
20+
recoil_animation_information = list(
21+
"recoil_angle_upper" = -15, \
22+
"recoil_angle_lower" = -30, \
23+
"recoil_burst_speed" = 0.5, \
24+
"return_burst_speed" = 0.5, \
25+
)
1526

1627
/obj/item/gun/ballistic/revolver/sol/give_manufacturer_examine()
1728
AddElement(/datum/element/manufacturer_examine, COMPANY_TRAPPISTE)

modular_lethal_doppler/paxilweapons_real/code/guns/fukiya.dm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,18 @@
3131
weapon_weight = WEAPON_HEAVY
3232
pb_knockback = 2
3333
recoil = 2
34-
muzzle_flash_lum = 3
3534
muzzleflash_iconstate = "muzzle_flash_medium"
35+
gunshot_animation_information = list(
36+
"pixel_x" = 35, \
37+
"pixel_y" = 1, \
38+
"inactive_wben_suppressed" = TRUE, \
39+
)
40+
recoil_animation_information = list(
41+
"recoil_angle_upper" = -10, \
42+
"recoil_angle_lower" = -30, \
43+
"recoil_burst_speed" = 0.5, \
44+
"return_burst_speed" = 0.5, \
45+
)
3646

3747
/obj/item/gun/ballistic/marsian_super_rifle/add_bayonet_point()
3848
return

modular_lethal_doppler/paxilweapons_real/code/guns/gwiazda.dm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
projectile_wound_bonus = 10 // +55 of the base projectile, burn baby burn
2525
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_lightgun.wav'
2626
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_lightgun.wav'
27+
gunshot_animation_information = list(
28+
"pixel_x" = 15, \
29+
"pixel_y" = 3, \
30+
"inactive_wben_suppressed" = TRUE, \
31+
"icon_state" = "plasmashot" \
32+
)
33+
recoil_animation_information = list(
34+
"recoil_angle_upper" = -15, \
35+
"recoil_angle_lower" = -30, \
36+
"recoil_burst_speed" = 0.5, \
37+
"return_burst_speed" = 0.5, \
38+
)
2739

2840
/obj/item/gun/ballistic/automatic/pistol/plasma_marksman/give_manufacturer_examine()
2941
AddElement(/datum/element/manufacturer_examine, COMPANY_SZOT)

modular_lethal_doppler/paxilweapons_real/code/guns/karim.dm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@
3333
'sound/items/weapons/gun/smartgun/smartgun_shoot_2.ogg',
3434
'sound/items/weapons/gun/smartgun/smartgun_shoot_3.ogg',
3535
)
36+
gunshot_animation_information = list(
37+
"pixel_x" = 18, \
38+
"pixel_y" = 0, \
39+
"inactive_wben_suppressed" = TRUE, \
40+
"icon_state" = "pulseshot" \
41+
)
42+
recoil_animation_information = list(
43+
"recoil_angle_upper" = -10, \
44+
"recoil_angle_lower" = -20, \
45+
"recoil_burst_speed" = 0.5, \
46+
"return_burst_speed" = 0.5, \
47+
"recoil_speed" = 0.5, \
48+
"return_speed" = 0.5, \
49+
)
3650

3751
/obj/item/gun/ballistic/automatic/karim/Initialize(mapload)
3852
. = ..()

modular_lethal_doppler/paxilweapons_real/code/guns/kiboko.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@
2626
actions_types = list()
2727
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_heavygun.wav'
2828
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_heavygun.wav'
29+
gunshot_animation_information = list(
30+
"pixel_x" = 35, \
31+
"pixel_y" = 1, \
32+
"inactive_wben_suppressed" = TRUE, \
33+
)
34+
recoil_animation_information = list(
35+
"recoil_angle_upper" = -10, \
36+
"recoil_angle_lower" = -20, \
37+
"recoil_burst_speed" = 0.5, \
38+
"return_burst_speed" = 0.5, \
39+
)
2940
/// The currently stored range to detonate shells at
3041
var/target_range = 14
3142
/// The maximum range we can set grenades to detonate at, just to be safe

modular_lethal_doppler/paxilweapons_real/code/guns/lanca.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@
3131
projectile_wound_bonus = -20
3232
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_mediumgun.wav'
3333
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_mediumgun.wav'
34+
gunshot_animation_information = list(
35+
"pixel_x" = 34, \
36+
"pixel_y" = 0, \
37+
"inactive_wben_suppressed" = TRUE, \
38+
)
39+
recoil_animation_information = list(
40+
"recoil_angle_upper" = -10, \
41+
"recoil_angle_lower" = -30, \
42+
"recoil_burst_speed" = 0.5, \
43+
"return_burst_speed" = 0.5, \
44+
)
3445

3546
/obj/item/gun/ballistic/automatic/lanca/Initialize(mapload)
3647
. = ..()

modular_lethal_doppler/paxilweapons_real/code/guns/mavu.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
recoil = 0.25
1616
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_lightgun.wav'
1717
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_lightgun.wav'
18+
gunshot_animation_information = list(
19+
"pixel_x" = 15, \
20+
"pixel_y" = 3, \
21+
"inactive_wben_suppressed" = TRUE, \
22+
)
23+
recoil_animation_information = list(
24+
"recoil_angle_upper" = -15, \
25+
"recoil_angle_lower" = -30, \
26+
"recoil_burst_speed" = 0.5, \
27+
"return_burst_speed" = 0.5, \
28+
)
1829

1930
/obj/item/gun/ballistic/automatic/pistol/sol/give_manufacturer_examine()
2031
AddElement(/datum/element/manufacturer_examine, COMPANY_TRAPPISTE)

modular_lethal_doppler/paxilweapons_real/code/guns/miecz.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
recoil = 0.25
3131
pickup_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_mediumgun.wav'
3232
drop_sound = 'modular_lethal_doppler/paxilweapons_real/sound/pickup_sounds/drop_mediumgun.wav'
33+
gunshot_animation_information = list(
34+
"pixel_x" = 28, \
35+
"pixel_y" = 0, \
36+
"inactive_wben_suppressed" = TRUE, \
37+
)
38+
recoil_animation_information = list(
39+
"recoil_angle_upper" = -10, \
40+
"recoil_angle_lower" = -20, \
41+
"recoil_burst_speed" = 0.5, \
42+
"return_burst_speed" = 0.5, \
43+
)
3344

3445
/obj/item/gun/ballistic/automatic/miecz/Initialize(mapload)
3546
. = ..()

modular_lethal_doppler/paxilweapons_real/code/guns/nomi.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@
2626
projectile_wound_bonus = -20
2727
projectile_damage_multiplier = 0.75
2828
recoil = 0.5
29+
gunshot_animation_information = list(
30+
"pixel_x" = 34, \
31+
"pixel_y" = 3, \
32+
"inactive_wben_suppressed" = TRUE, \
33+
)
34+
recoil_animation_information = list(
35+
"recoil_angle_upper" = -10, \
36+
"recoil_angle_lower" = -20, \
37+
"recoil_burst_speed" = 0.5, \
38+
"return_burst_speed" = 0.5, \
39+
)
2940

3041
/obj/item/gun/ballistic/automatic/nomi_shotgun/add_bayonet_point()
3142
return

modular_lethal_doppler/paxilweapons_real/code/guns/osako.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
slot_flags = ITEM_SLOT_BACK
2424
can_suppress = FALSE
2525
can_unsuppress = FALSE
26+
gunshot_animation_information = list(
27+
"pixel_x" = 35, \
28+
"pixel_y" = 2, \
29+
"inactive_wben_suppressed" = TRUE, \
30+
)
31+
recoil_animation_information = list(
32+
"recoil_angle_upper" = -10, \
33+
"recoil_angle_lower" = -20, \
34+
"recoil_burst_speed" = 0.5, \
35+
"return_burst_speed" = 0.5, \
36+
)
2637

2738
/obj/item/gun/ballistic/rifle/osako/add_bayonet_point()
2839
return

modular_lethal_doppler/paxilweapons_real/code/guns/qarad.dm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212
spread = 10
1313
projectile_wound_bonus = -10
1414
suppressor_x_offset = 9
15+
gunshot_animation_information = list(
16+
"pixel_x" = 35, \
17+
"pixel_y" = 0, \
18+
"inactive_wben_suppressed" = TRUE, \
19+
)
20+
recoil_animation_information = list(
21+
"recoil_angle_upper" = -10, \
22+
"recoil_angle_lower" = -20, \
23+
"recoil_burst_speed" = 0.5, \
24+
"return_burst_speed" = 0.5, \
25+
"recoil_speed" = 0.5, \
26+
"return_speed" = 0.5, \
27+
)
1528

1629
/obj/item/gun/ballistic/automatic/sol_rifle/machinegun/give_autofire()
1730
AddComponent(/datum/component/automatic_fire, fire_delay)

modular_lethal_doppler/paxilweapons_real/code/guns/ramu.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@
2727
slot_flags = ITEM_SLOT_BACK
2828
recoil = 2
2929
accepted_magazine_type = /obj/item/ammo_box/magazine/internal/s6gauge
30+
gunshot_animation_information = list(
31+
"pixel_x" = 35, \
32+
"pixel_y" = 3, \
33+
"inactive_wben_suppressed" = TRUE, \
34+
)
35+
recoil_animation_information = list(
36+
"recoil_angle_upper" = -10, \
37+
"recoil_angle_lower" = -30, \
38+
"recoil_burst_speed" = 0.5, \
39+
"return_burst_speed" = 0.5, \
40+
)
3041

3142
/obj/item/gun/ballistic/shotgun/ramu/add_bayonet_point()
3243
return

modular_lethal_doppler/paxilweapons_real/code/guns/ransu.dm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
spread = 0
2121
projectile_damage_multiplier = 1
2222
recoil = 0.5
23+
recoil_animation_information = list(
24+
"recoil_angle_upper" = -10, \
25+
"recoil_angle_lower" = -20, \
26+
"recoil_burst_speed" = 0.5, \
27+
"return_burst_speed" = 0.5, \
28+
)
2329

2430
/obj/item/gun/ballistic/automatic/suppressed_rifle/marksman/Initialize(mapload)
2531
. = ..()

0 commit comments

Comments
 (0)