Improve gun animations to be more modular. (#7645)

* Improve gun animations to be more modular.
- This is a port of TGCM pull/4807. Credit to SplinterGP for helping me set things up.
- It essentially allows people to not need a '-pump' for their animation, but instead to just use whatever they please. They just need to write it down at the relevant intervals.

* Improve further.

* Update shotgun.dm
This commit is contained in:
Kates
2020-09-20 12:49:03 +02:00
committed by VirgoBot
parent e700936b20
commit 19aa0200db
3 changed files with 9 additions and 6 deletions

View File

@@ -14,6 +14,7 @@
ammo_type = /obj/item/ammo_casing/a762 ammo_type = /obj/item/ammo_casing/a762
load_method = SINGLE_CASING|SPEEDLOADER load_method = SINGLE_CASING|SPEEDLOADER
action_sound = 'sound/weapons/riflebolt.ogg' action_sound = 'sound/weapons/riflebolt.ogg'
pump_animation = null
/obj/item/weapon/gun/projectile/shotgun/pump/rifle/practice // For target practice /obj/item/weapon/gun/projectile/shotgun/pump/rifle/practice // For target practice
desc = "A bolt-action rifle with a lightweight synthetic wood stock, designed for competitive shooting. Comes shipped with practice rounds pre-loaded into the gun. Popular among professional marksmen. Uses 7.62mm rounds." desc = "A bolt-action rifle with a lightweight synthetic wood stock, designed for competitive shooting. Comes shipped with practice rounds pre-loaded into the gun. Popular among professional marksmen. Uses 7.62mm rounds."
@@ -66,4 +67,4 @@
desc = "An iconic manually operated lever action rifle, offering adequate stopping power due to it's still powerful cartridge while at the same time having a rather respectable firing rate due to it's mechanism. It is very probable this is a replica instead of a museum piece, but rifles of this pattern still see usage as colonist guns in some far off regions. Uses 7.62mm rounds." desc = "An iconic manually operated lever action rifle, offering adequate stopping power due to it's still powerful cartridge while at the same time having a rather respectable firing rate due to it's mechanism. It is very probable this is a replica instead of a museum piece, but rifles of this pattern still see usage as colonist guns in some far off regions. Uses 7.62mm rounds."
item_state = "levercarabine" // That isn't how carbine is spelled ya knob! :U item_state = "levercarabine" // That isn't how carbine is spelled ya knob! :U
icon_state = "levercarabine" icon_state = "levercarabine"
animated_pump = 1 pump_animation = "levercarabine-cycling"

View File

@@ -14,10 +14,10 @@
ammo_type = /obj/item/ammo_casing/a12g/beanbag ammo_type = /obj/item/ammo_casing/a12g/beanbag
projectile_type = /obj/item/projectile/bullet/shotgun projectile_type = /obj/item/projectile/bullet/shotgun
handle_casings = HOLD_CASINGS handle_casings = HOLD_CASINGS
var/recentpump = 0 // to prevent spammage var/recentpump = 0 //To prevent spammage
var/action_sound = 'sound/weapons/shotgunpump.ogg' var/action_sound = 'sound/weapons/shotgunpump.ogg'
var/animated_pump = 0 //This is for cyling animations.
var/empty_sprite = 0 //This is just a dirty var so it doesn't fudge up. var/empty_sprite = 0 //This is just a dirty var so it doesn't fudge up.
var/pump_animation = "shotgun-pump" //You put the reference to the animation in question here. Frees up namming. Ex: "shotgun_old_pump" or "sniper_cycle"
/obj/item/weapon/gun/projectile/shotgun/pump/consume_next_projectile() /obj/item/weapon/gun/projectile/shotgun/pump/consume_next_projectile()
if(chambered) if(chambered)
@@ -41,8 +41,8 @@
loaded -= AC //Remove casing from loaded list. loaded -= AC //Remove casing from loaded list.
chambered = AC chambered = AC
if(animated_pump)//This affects all bolt action and shotguns. if(pump_animation)//This affects all bolt action and shotguns.
flick("[icon_state]-cycling", src)//This plays any pumping flick("[pump_animation]", src)//This plays any pumping
update_icon() update_icon()
@@ -60,6 +60,7 @@
/obj/item/weapon/gun/projectile/shotgun/pump/slug /obj/item/weapon/gun/projectile/shotgun/pump/slug
ammo_type = /obj/item/ammo_casing/a12g ammo_type = /obj/item/ammo_casing/a12g
pump_animation = null
/obj/item/weapon/gun/projectile/shotgun/pump/combat /obj/item/weapon/gun/projectile/shotgun/pump/combat
name = "combat shotgun" name = "combat shotgun"
@@ -71,6 +72,7 @@
max_shells = 7 //match the ammo box capacity, also it can hold a round in the chamber anyways, for a total of 8. max_shells = 7 //match the ammo box capacity, also it can hold a round in the chamber anyways, for a total of 8.
ammo_type = /obj/item/ammo_casing/a12g ammo_type = /obj/item/ammo_casing/a12g
load_method = SINGLE_CASING|SPEEDLOADER load_method = SINGLE_CASING|SPEEDLOADER
pump_animation = "cshotgun-pump"
/obj/item/weapon/gun/projectile/shotgun/pump/combat/empty /obj/item/weapon/gun/projectile/shotgun/pump/combat/empty
ammo_type = null ammo_type = null

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 94 KiB