Add empty firing animation and case colours

This commit is contained in:
George Paton 2024-02-26 12:12:47 +11:00
parent e88d3aba19
commit b710c6d6f6
10 changed files with 28 additions and 17 deletions

View File

@ -55,6 +55,7 @@ public class GunConfiguration implements Cloneable {
public int firingDuration;
//sound path to the shooting sound
public String firingSound = "";
public String firingSoundEmpty = null;
public float firingVolume = 1.0F;
public float firingPitch = 1.0F;
//how long the reload animation will play

View File

@ -33,7 +33,7 @@ public class GunGrenadeFactory {
static {
EJECTOR_LAUNCHER = new CasingEjector().setAngleRange(0.02F, 0.03F).setAfterReload();
EJECTOR_CONGOLAKE = new CasingEjector().setMotion(0.3, 0.1, 0).setAngleRange(0.02F, 0.03F).setDelay(15);
CASING40MM = new SpentCasing(CasingType.STRAIGHT).setScale(4F, 4F, 3F).setBounceMotion(0.02F, 0.03F).setColor(0x777777).setupSmoke(1F, 0.5D, 60, 40);
CASING40MM = new SpentCasing(CasingType.STRAIGHT).setScale(4F, 4F, 3F).setBounceMotion(0.02F, 0.03F).setColor(SpentCasing.COLOR_CASE_40MM, 0x4B5443).setupSmoke(1F, 0.5D, 60, 40);
}
public static GunConfiguration getHK69Config() {
@ -82,6 +82,7 @@ public class GunGrenadeFactory {
config.allowsInfinity = true;
config.crosshair = Crosshair.L_CIRCUMFLEX;
config.firingSound = "hbm:weapon.glShoot";
config.firingSoundEmpty = "hbm:weapon.glShootEmpty";
config.reloadSound = GunConfiguration.RSOUND_GRENADE_NEW;
config.reloadSoundEnd = false;
@ -97,6 +98,7 @@ public class GunGrenadeFactory {
config.loadAnimations = i -> {
config.animations.put(AnimType.CYCLE, ResourceManager.congolake_anim.get("Fire"));
config.animations.put(AnimType.CYCLE_EMPTY, ResourceManager.congolake_anim.get("FireEmpty"));
config.animations.put(AnimType.RELOAD, ResourceManager.congolake_anim.get("ReloadStart"));
config.animations.put(AnimType.RELOAD_EMPTY, ResourceManager.congolake_anim.get("ReloadEmpty"));
config.animations.put(AnimType.RELOAD_CYCLE, ResourceManager.congolake_anim.get("Reload"));
@ -206,7 +208,7 @@ public class GunGrenadeFactory {
bullet.explosive = 7.5F;
bullet.jolt = 6.5D;
bullet.spentCasing = CASING40MM.clone().register("40MMIF");
bullet.spentCasing = CASING40MM.clone().register("40MMIF").setColor(SpentCasing.COLOR_CASE_40MM, 0x1C1C1C);
return bullet;
}
@ -223,7 +225,7 @@ public class GunGrenadeFactory {
bullet.explosive = 10.0F;
bullet.trail = 3;
bullet.spentCasing = CASING40MM.clone().register("40MMCon");
bullet.spentCasing = CASING40MM.clone().register("40MMCon").setColor(SpentCasing.COLOR_CASE_40MM, 0x3D5E1D);
return bullet;
}
@ -237,7 +239,7 @@ public class GunGrenadeFactory {
bullet.explosive = 1.5F;
bullet.trail = 5;
bullet.spentCasing = CASING40MM.clone().register("40MMFin");
bullet.spentCasing = CASING40MM.clone().register("40MMFin").setColor(SpentCasing.COLOR_CASE_40MM, 0x007FDB);
return bullet;
}
@ -254,7 +256,7 @@ public class GunGrenadeFactory {
BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
};
bullet.spentCasing = CASING40MM.clone().register("40MMNuke");
bullet.spentCasing = CASING40MM.clone().register("40MMNuke").setColor(SpentCasing.COLOR_CASE_40MM, 0xE2C000);
return bullet;
}
@ -270,7 +272,7 @@ public class GunGrenadeFactory {
bullet.trail = 5;
bullet.vPFX = "bluedust";
bullet.spentCasing = CASING40MM.clone().register("40MMTrac").setColor(0xEEEEEE);
bullet.spentCasing = CASING40MM.clone().register("40MMTrac").setColor(0xEEEEEE, 0x0075CA);
return bullet;
}

View File

@ -241,9 +241,6 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
for(int i = 0; i < bullets; i++) {
spawnProjectile(world, player, stack, BulletConfigSyncingUtil.getKey(config));
}
if(player instanceof EntityPlayerMP)
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.CYCLE.ordinal()), (EntityPlayerMP) player);
useUpAmmo(player, stack, true);
player.inventoryContainer.detectAndSendChanges();
@ -251,8 +248,15 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
int wear = (int) Math.ceil(config.wear / (1F + EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)));
setItemWear(stack, getItemWear(stack) + wear);
}
if(player instanceof EntityPlayerMP) {
AnimType animType = getMag(stack) == 0 ? AnimType.CYCLE_EMPTY : AnimType.CYCLE;
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(animType.ordinal()), (EntityPlayerMP) player);
}
world.playSoundAtEntity(player, mainConfig.firingSound, mainConfig.firingVolume, mainConfig.firingPitch);
String firingSound = mainConfig.firingSound;
if (getMag(stack) == 0 && mainConfig.firingSoundEmpty != null) firingSound = mainConfig.firingSoundEmpty;
world.playSoundAtEntity(player, firingSound, mainConfig.firingVolume, mainConfig.firingPitch);
if(mainConfig.ejector != null && !mainConfig.ejector.getAfterReload())
queueCasing(player, mainConfig.ejector, config, stack);

View File

@ -67,8 +67,8 @@ public class GunAnimationPacket implements IMessage {
animation = base.getAnimation(stack, AnimType.RELOAD);
}
// Fallback to regular CYCLE if no ALT_CYCLE exists
if(animation == null && type == AnimType.ALT_CYCLE) {
// Fallback to regular CYCLE if no ALT_CYCLE (or CYCLE_EMPTY) exists
if(animation == null && (type == AnimType.ALT_CYCLE || type == AnimType.CYCLE_EMPTY)) {
animation = base.getAnimation(stack, AnimType.CYCLE);
}

View File

@ -15,8 +15,9 @@ public class SpentCasing implements Cloneable {
public static final int COLOR_CASE_16INCH = 0xD89128;
public static final int COLOR_CASE_16INCH_PHOS = 0xC8C8C8;
public static final int COLOR_CASE_16INCH_NUKE = 0x495443;
public static final int COLOR_CASE_40MM = 0x515151;
public static final HashMap<String, SpentCasing> casingMap = new HashMap();
public static final HashMap<String, SpentCasing> casingMap = new HashMap<String, SpentCasing>();
public enum CasingType {
STRAIGHT("Straight"),

View File

@ -23,6 +23,7 @@ public class HbmAnimations {
RELOAD_CYCLE, //animation that plays for every individual round (for shotguns and similar single round loading weapons)
RELOAD_END, //animation for transitioning from our RELOAD_CYCLE to idle
CYCLE, //animation for every firing cycle
CYCLE_EMPTY, //animation for the final shot in the magazine
ALT_CYCLE, //animation for alt fire cycles
SPINUP, //animation for actionstart
SPINDOWN, //animation for actionend

View File

@ -8,6 +8,7 @@ import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
@ -105,13 +106,13 @@ public class ItemRenderWeaponCongo implements IItemRenderer {
ItemGunBase gun = (ItemGunBase)item.getItem();
BulletConfiguration bullet = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(ItemGunBase.getMagType(item)));
int[] colors = bullet.spentCasing != null ? bullet.spentCasing.getColors() : new int[] { 0x3E3E3E };
int[] colors = bullet.spentCasing != null ? bullet.spentCasing.getColors() : new int[] { SpentCasing.COLOR_CASE_40MM };
Color shellColor = new Color(colors.length >= 2 ? colors[1] : 0x3E3E3E);
Color shellColor = new Color(colors[0]);
GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F);
ResourceManager.congolake.renderPart("Shell");
Color shellForeColor = new Color(colors[0]);
Color shellForeColor = new Color(colors.length > 1 ? colors[1] : colors[0]);
GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F);
ResourceManager.congolake.renderPart("ShellFore");

File diff suppressed because one or more lines are too long

View File

@ -207,6 +207,7 @@
"weapon.coilgunShoot": {"category": "player", "sounds": [{"name": "weapon/coilgunShoot", "stream": false}]},
"weapon.glReload": {"category": "player", "sounds": [{"name": "weapon/glReload", "stream": false}]},
"weapon.glShoot": {"category": "player", "sounds": [{"name": "weapon/glShoot", "stream": false}]},
"weapon.glShootEmpty": {"category": "player", "sounds": [{"name": "weapon/glShootEmpty", "stream": false}]},
"weapon.44Shoot": {"category": "player", "sounds": [{"name": "weapon/44Shoot", "stream": false}]},
"weapon.trainImpact": {"category": "player", "sounds": [{"name": "weapon/trainImpact", "stream": false}]},