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;
//sound path to the reload sound
public String reloadSound = "";
public String reloadSoundEmpty = null;
//whether the reload sound should be played at the beginning or at the end of the reload
public boolean reloadSoundEnd = true;
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_RIFLE = "";
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_LAUNCHER = "hbm:weapon.rpgReload";
public static final String RSOUND_GRENADE = "hbm:weapon.hkReload";

View File

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

View File

@ -364,6 +364,8 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
setIsReloading(stack, false);
return;
}
String reloadSound = mainConfig.reloadSoundEmpty != null && getMag(stack) == 0 ? mainConfig.reloadSoundEmpty : mainConfig.reloadSound;
ammo.stacksize = toConsume;
setMag(stack, getMag(stack) + toAdd);
@ -375,11 +377,11 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
AnimType animType = availableFills <= 1 ? AnimType.RELOAD_END : AnimType.RELOAD_CYCLE;
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(animType.ordinal()), (EntityPlayerMP) player);
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)
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
if(mainConfig.ejector != null && mainConfig.ejector.getAfterReload())
queueCasing(player, mainConfig.ejector, prevCfg, stack);
@ -418,8 +420,10 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
if(getIsReloading(stack))
return;
if(!mainConfig.reloadSoundEnd)
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
if(!mainConfig.reloadSoundEnd) {
String reloadSound = mainConfig.reloadSoundEmpty != null && getMag(stack) == 0 ? mainConfig.reloadSoundEmpty : mainConfig.reloadSound;
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
}
if(!world.isRemote) {
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.shotgunReload": {"category": "player", "sounds": ["weapon/shotgunReload1", "weapon/shotgunReload2", "weapon/shotgunReload3"]},
"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.boat": {"category": "player", "sounds": [{"name": "weapon/boat", "stream": false}]},
"weapon.hkShoot": {"category": "player", "sounds": [{"name": "weapon/hkShoot", "stream": false}]},