UFFR 57f9bbf404
Tinkering + config
More tinkering, also tried to implement bounce sound effects, but they don't seem to work.
Added a config to disable casings.
Commented out smoke effect because it wasn't working out.
2022-12-21 21:47:02 -05:00

284 lines
8.0 KiB
Java

package com.hbm.handler.guncfg;
import java.util.ArrayList;
import java.util.Optional;
import com.hbm.config.BombConfig;
import com.hbm.entity.effect.EntityCloudTom;
import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.particle.SpentCasingConfig;
import com.hbm.particle.SpentCasingConfigBuilder;
import com.hbm.particle.SpentCasingConfig.CasingType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
public class GunGrenadeFactory {
static final SpentCasingConfig CASING_40 = new SpentCasingConfigBuilder("40", CasingType.BRASS_STRAIGHT_WALL, false)
.setSmokeChance(0).setScaleX(4).setScaleY(4).setScaleZ(3).setAfterReload(true).setPitchFactor(0.02f).setYawFactor(0.03f)
.build();
public static GunConfiguration getHK69Config() {
GunConfiguration config = new GunConfiguration();
config.rateOfFire = 30;
config.roundsPerCycle = 1;
config.gunMode = GunConfiguration.MODE_NORMAL;
config.firingMode = GunConfiguration.FIRE_MANUAL;
config.hasSights = true;
config.reloadDuration = 40;
config.firingDuration = 0;
config.ammoCap = 1;
config.reloadType = GunConfiguration.RELOAD_SINGLE;
config.allowsInfinity = true;
config.crosshair = Crosshair.L_CIRCUMFLEX;
config.firingSound = "hbm:weapon.hkShoot";
config.reloadSound = GunConfiguration.RSOUND_GRENADE;
config.reloadSoundEnd = false;
config.name = "gPistol";
config.manufacturer = EnumGunManufacturer.H_AND_K;
config.config = new ArrayList<Integer>();
config.config.addAll(HbmCollection.grenade);
config.durability = 300;
config.casingConfig = Optional.of(GunGrenadeFactory.CASING_40);
return config;
}
static byte i = 0;
public static BulletConfiguration getGrenadeConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.wear = 10;
bullet.trail = 0;
return bullet;
}
public static BulletConfiguration getGrenadeHEConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 20;
bullet.dmgMax = 15;
bullet.wear = 15;
bullet.explosive = 5.0F;
bullet.trail = 1;
return bullet;
}
public static BulletConfiguration getGrenadeIncendirayConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 15;
bullet.wear = 15;
bullet.trail = 0;
bullet.incendiary = 2;
return bullet;
}
public static BulletConfiguration getGrenadePhosphorusConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 15;
bullet.wear = 15;
bullet.trail = 0;
bullet.incendiary = 2;
bullet.bImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F);
return bullet;
}
public static BulletConfiguration getGrenadeSmokeConfig()
{
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.explosive = 0;
bullet.velocity = 2.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 15;
bullet.wear = 15;
bullet.trail = 0;
bullet.incendiary = 2;
bullet.bImpact = BulletConfigFactory.getPhosphorousEffect(20, 120 * 20, 400, 0.5, 1);
return bullet;
}
public static BulletConfiguration getGrenadeChlorineConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.wear = 10;
bullet.trail = 3;
bullet.explosive = 0;
bullet.chlorine = 50;
return bullet;
}
public static BulletConfiguration getGrenadeSleekConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.wear = 10;
bullet.trail = 4;
bullet.explosive = 7.5F;
bullet.jolt = 6.5D;
return bullet;
}
public static BulletConfiguration getGrenadeConcussionConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 20;
bullet.blockDamage = false;
bullet.explosive = 10.0F;
bullet.trail = 3;
return bullet;
}
public static BulletConfiguration getGrenadeFinnedConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.wear = 10;
bullet.gravity = 0.02;
bullet.explosive = 1.5F;
bullet.trail = 5;
return bullet;
}
public static BulletConfiguration getGrenadeNuclearConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.wear = 10;
bullet.trail = 0;
bullet.velocity = 4;
bullet.explosive = 0.0F;
bullet.bImpact = (projectile, x, y, z) -> BulletConfigFactory.nuclearExplosion(projectile, x, y, z, 1);
return bullet;
}
static final byte size = 25;
public static BulletConfiguration getGrenadeLunaticConfig()
{
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 4;
bullet.explosive = 0.0F;
bullet.wear = 20;
// TODO rework
bullet.bImpact = (projectile, x, y, z) ->
{
if (!projectile.worldObj.isRemote)
{
EntityNukeExplosionMK3 explosionEntity = new EntityNukeExplosionMK3(projectile.worldObj);
explosionEntity.posX = projectile.posX;
explosionEntity.posY = projectile.posY;
explosionEntity.posZ = projectile.posZ;
explosionEntity.destructionRange = size;
explosionEntity.speed = BombConfig.blastSpeed;
explosionEntity.coefficient = 15F;
explosionEntity.coefficient2 = 45F;
explosionEntity.waste = false;
explosionEntity.extType = 2;
projectile.worldObj.spawnEntityInWorld(explosionEntity);
// ExplosionNT explosion = new ExplosionNT(projectile.worldObj, projectile, x, y, z, size).addAllAttrib(ExAttrib.NOSOUND, ExAttrib.NOPARTICLE, ExAttrib.NOHURT);
EntityCloudTom cloud = new EntityCloudTom(projectile.worldObj, size);
cloud.posX = x;
cloud.posY = y;
cloud.posZ = z;
projectile.worldObj.spawnEntityInWorld(cloud);
}
};
return bullet;
}
public static BulletConfiguration getGrenadeTracerConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.wear = 10;
bullet.explosive = 0F;
bullet.trail = 5;
bullet.vPFX = "bluedust";
return bullet;
}
public static BulletConfiguration getGrenadeKampfConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.spread = 0.0F;
bullet.gravity = 0.0D;
bullet.wear = 15;
bullet.explosive = 3.5F;
bullet.style = BulletConfiguration.STYLE_GRENADE;
bullet.trail = 4;
bullet.vPFX = "smoke";
return bullet;
}
}