diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java index 8ba4652bb..7e551326d 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java @@ -309,6 +309,14 @@ public class EntityBulletBase extends Entity implements IProjectile { if(overrideDamage != 0) damage = overrideDamage; + if(victim instanceof EntityLivingBase) { + EntityLivingBase living = (EntityLivingBase) victim; + double head = living.height - living.getEyeHeight(); + if(movement.hitVec != null && movement.hitVec.yCoord > living.height - head) { + damage *= this.config.headshotMult; + } + } + if(!victim.attackEntityFrom(damagesource, damage)) { try { diff --git a/src/main/java/com/hbm/handler/BulletConfiguration.java b/src/main/java/com/hbm/handler/BulletConfiguration.java index bf7a6f789..d8ba85af4 100644 --- a/src/main/java/com/hbm/handler/BulletConfiguration.java +++ b/src/main/java/com/hbm/handler/BulletConfiguration.java @@ -39,6 +39,7 @@ public class BulletConfiguration { //damage bounds public float dmgMin; public float dmgMax; + public float headshotMult = 1.0F; //acceleration torwards neg Y public double gravity; @@ -160,6 +161,11 @@ public class BulletConfiguration { return this; } + public BulletConfiguration setHeadshot(float mult) { + this.headshotMult = mult; + return this; + } + public BulletConfiguration setToGuided() { this.bUpdate = BulletConfigFactory.getLaserSteering(); diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java index 07cf53695..e4085d715 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java @@ -1,8 +1,8 @@ package com.hbm.tileentity.turret; -import java.util.ArrayList; import java.util.List; +import com.hbm.blocks.BlockDummyable; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.interfaces.IFluidAcceptor; @@ -13,11 +13,13 @@ import com.hbm.items.ModItems; import com.hbm.packet.AuxParticlePacketNT; import com.hbm.packet.PacketDispatcher; +import api.hbm.fluid.IFluidStandardReceiver; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Vec3; +import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFluidAcceptor { +public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFluidAcceptor, IFluidStandardReceiver { public FluidTank tank; @@ -115,6 +117,30 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl } } } + + @Override //TODO: clean this shit up + protected void updateConnections() { + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + + this.trySubscribe(worldObj, xCoord + dir.offsetX * -1 + rot.offsetX * 0, yCoord, zCoord + dir.offsetZ * -1 + rot.offsetZ * 0, ForgeDirection.UNKNOWN); + this.trySubscribe(worldObj, xCoord + dir.offsetX * -1 + rot.offsetX * -1, yCoord, zCoord + dir.offsetZ * -1 + rot.offsetZ * -1, ForgeDirection.UNKNOWN); + this.trySubscribe(worldObj, xCoord + dir.offsetX * 0 + rot.offsetX * -2, yCoord, zCoord + dir.offsetZ * 0 + rot.offsetZ * -2, ForgeDirection.UNKNOWN); + this.trySubscribe(worldObj, xCoord + dir.offsetX * 1 + rot.offsetX * -2, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ * -2, ForgeDirection.UNKNOWN); + this.trySubscribe(worldObj, xCoord + dir.offsetX * 0 + rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 0 + rot.offsetZ * 1, ForgeDirection.UNKNOWN); + this.trySubscribe(worldObj, xCoord + dir.offsetX * 1 + rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ * 1, ForgeDirection.UNKNOWN); + this.trySubscribe(worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * 0, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * 0, ForgeDirection.UNKNOWN); + this.trySubscribe(worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * -1, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * -1, ForgeDirection.UNKNOWN); + + this.trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX * -1 + rot.offsetX * 0, yCoord, zCoord + dir.offsetZ * -1 + rot.offsetZ * 0, ForgeDirection.UNKNOWN); + this.trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX * -1 + rot.offsetX * -1, yCoord, zCoord + dir.offsetZ * -1 + rot.offsetZ * -1, ForgeDirection.UNKNOWN); + this.trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX * 0 + rot.offsetX * -2, yCoord, zCoord + dir.offsetZ * 0 + rot.offsetZ * -2, ForgeDirection.UNKNOWN); + this.trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX * 1 + rot.offsetX * -2, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ * -2, ForgeDirection.UNKNOWN); + this.trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX * 0 + rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 0 + rot.offsetZ * 1, ForgeDirection.UNKNOWN); + this.trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX * 1 + rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ * 1, ForgeDirection.UNKNOWN); + this.trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * 0, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * 0, ForgeDirection.UNKNOWN); + this.trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * -1, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * -1, ForgeDirection.UNKNOWN); + } @Override public void readFromNBT(NBTTagCompound nbt) { @@ -158,4 +184,9 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl if(type.name().equals(tank.getTankType().name())) tank.setFill(i); } + + @Override + public FluidTank[] getReceivingTanks() { + return new FluidTank[] { tank }; + } }