Add empty reload sounds to Benelli

This commit is contained in:
George Paton 2024-02-20 13:41:09 +11:00
parent 8408a8e239
commit f5d1b7b787
5 changed files with 12 additions and 4 deletions

View File

@ -63,6 +63,7 @@ public class GunConfiguration implements Cloneable {
public int emptyReloadAdditionalDuration; public int emptyReloadAdditionalDuration;
//sound path to the reload sound //sound path to the reload sound
public String reloadSound = ""; public String reloadSound = "";
public String reloadSoundEmpty = null;
//whether the reload sound should be played at the beginning or at the end of the reload //whether the reload sound should be played at the beginning or at the end of the reload
public boolean reloadSoundEnd = true; public boolean reloadSoundEnd = true;
public String equipSound = ""; public String equipSound = "";
@ -114,6 +115,7 @@ public class GunConfiguration implements Cloneable {
public static final String RSOUND_REVOLVER = "hbm:weapon.revolverReload"; public static final String RSOUND_REVOLVER = "hbm:weapon.revolverReload";
public static final String RSOUND_RIFLE = ""; public static final String RSOUND_RIFLE = "";
public static final String RSOUND_MAG = "hbm:weapon.magReload"; public static final String RSOUND_MAG = "hbm:weapon.magReload";
public static final String RSOUND_MAG_BOLT = "hbm:weapon.magReloadBolt";
public static final String RSOUND_SHOTGUN = "hbm:weapon.shotgunReload"; public static final String RSOUND_SHOTGUN = "hbm:weapon.shotgunReload";
public static final String RSOUND_LAUNCHER = "hbm:weapon.rpgReload"; public static final String RSOUND_LAUNCHER = "hbm:weapon.rpgReload";
public static final String RSOUND_GRENADE = "hbm:weapon.hkReload"; public static final String RSOUND_GRENADE = "hbm:weapon.hkReload";

View File

@ -246,6 +246,7 @@ public class Gun12GaugeFactory {
config.reloadDuration = 21; config.reloadDuration = 21;
config.emptyReloadAdditionalDuration = 15; config.emptyReloadAdditionalDuration = 15;
config.reloadSound = GunConfiguration.RSOUND_MAG; config.reloadSound = GunConfiguration.RSOUND_MAG;
config.reloadSoundEmpty = GunConfiguration.RSOUND_MAG_BOLT;
config.reloadSoundEnd = false; config.reloadSoundEnd = false;
config.name += "Drum"; config.name += "Drum";

View File

@ -365,6 +365,8 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
return; return;
} }
String reloadSound = mainConfig.reloadSoundEmpty != null && getMag(stack) == 0 ? mainConfig.reloadSoundEmpty : mainConfig.reloadSound;
ammo.stacksize = toConsume; ammo.stacksize = toConsume;
setMag(stack, getMag(stack) + toAdd); setMag(stack, getMag(stack) + toAdd);
if (getMag(stack) >= mainConfig.ammoCap) { if (getMag(stack) >= mainConfig.ammoCap) {
@ -375,11 +377,11 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
AnimType animType = availableFills <= 1 ? AnimType.RELOAD_END : AnimType.RELOAD_CYCLE; AnimType animType = availableFills <= 1 ? AnimType.RELOAD_END : AnimType.RELOAD_CYCLE;
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(animType.ordinal()), (EntityPlayerMP) player); PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(animType.ordinal()), (EntityPlayerMP) player);
if (availableFills > 1 && !mainConfig.reloadSoundEnd) if (availableFills > 1 && !mainConfig.reloadSoundEnd)
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F); world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
} }
if(hasLoaded && mainConfig.reloadSoundEnd) if(hasLoaded && mainConfig.reloadSoundEnd)
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F); world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
if(mainConfig.ejector != null && mainConfig.ejector.getAfterReload()) if(mainConfig.ejector != null && mainConfig.ejector.getAfterReload())
queueCasing(player, mainConfig.ejector, prevCfg, stack); queueCasing(player, mainConfig.ejector, prevCfg, stack);
@ -418,8 +420,10 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
if(getIsReloading(stack)) if(getIsReloading(stack))
return; return;
if(!mainConfig.reloadSoundEnd) if(!mainConfig.reloadSoundEnd) {
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F); String reloadSound = mainConfig.reloadSoundEmpty != null && getMag(stack) == 0 ? mainConfig.reloadSoundEmpty : mainConfig.reloadSound;
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
}
if(!world.isRemote) { if(!world.isRemote) {
AnimType reloadType = getMag(stack) == 0 ? AnimType.RELOAD_EMPTY : AnimType.RELOAD; AnimType reloadType = getMag(stack) == 0 ? AnimType.RELOAD_EMPTY : AnimType.RELOAD;

View File

@ -171,6 +171,7 @@
"weapon.revolverReload": {"category": "player", "sounds": [{"name": "weapon/revolverReload", "stream": false}]}, "weapon.revolverReload": {"category": "player", "sounds": [{"name": "weapon/revolverReload", "stream": false}]},
"weapon.shotgunReload": {"category": "player", "sounds": ["weapon/shotgunReload1", "weapon/shotgunReload2", "weapon/shotgunReload3"]}, "weapon.shotgunReload": {"category": "player", "sounds": ["weapon/shotgunReload1", "weapon/shotgunReload2", "weapon/shotgunReload3"]},
"weapon.magReload": {"category": "player", "sounds": [{"name": "weapon/magReload", "stream": false}]}, "weapon.magReload": {"category": "player", "sounds": [{"name": "weapon/magReload", "stream": false}]},
"weapon.magReloadBolt": {"category": "player", "sounds": [{"name": "weapon/magReloadBolt", "stream": false}]},
"weapon.rpgReload": {"category": "player", "sounds": [{"name": "weapon/rpgReload", "stream": false}]}, "weapon.rpgReload": {"category": "player", "sounds": [{"name": "weapon/rpgReload", "stream": false}]},
"weapon.boat": {"category": "player", "sounds": [{"name": "weapon/boat", "stream": false}]}, "weapon.boat": {"category": "player", "sounds": [{"name": "weapon/boat", "stream": false}]},
"weapon.hkShoot": {"category": "player", "sounds": [{"name": "weapon/hkShoot", "stream": false}]}, "weapon.hkShoot": {"category": "player", "sounds": [{"name": "weapon/hkShoot", "stream": false}]},