diff --git a/changelog b/changelog index d3dc84d3d..786bd11d7 100644 --- a/changelog +++ b/changelog @@ -34,6 +34,7 @@ * Due to repeated complaints, power armor sounds are now generally more quiet, with 25% volume for steps and 50% volume for jumping and landing * Reduced mask man's projectile resistance from 75% to 50% * Reduced maskman's resistance to damage above 50 from 75% to 50% +* Remnants power armor can now use the melee controller, allowing Sergeant Arch Dornan to beat the snot out of people # Fixed * Fixed proxy tiles that do not use electricity at all visually connecting to cables diff --git a/src/main/java/com/hbm/items/armor/ArmorRPA.java b/src/main/java/com/hbm/items/armor/ArmorRPA.java index 718f62f2d..0a5c4eeab 100644 --- a/src/main/java/com/hbm/items/armor/ArmorRPA.java +++ b/src/main/java/com/hbm/items/armor/ArmorRPA.java @@ -11,11 +11,12 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; -public class ArmorRPA extends ArmorFSBPowered implements IItemRendererProvider { +public class ArmorRPA extends ArmorFSBPowered implements IItemRendererProvider, IPAWeaponsProvider { public ArmorRPA(ArmorMaterial material, int slot, String texture, long maxPower, long chargeRate, long consumption, long drain) { super(material, slot, texture, maxPower, chargeRate, consumption, drain); @@ -52,4 +53,12 @@ public class ArmorRPA extends ArmorFSBPowered implements IItemRendererProvider { "Head", "Body,Fan,Glow", "LeftArm", "RightArm", "LeftLeg", "RightLeg", "LeftBoot", "RightBoot"); }}; } + + public static final ArmorRPAMelee meleeComponent = new ArmorRPAMelee(); + + @Override + public IPAMelee getMeleeComponent(EntityPlayer entity) { + if(this.hasFSBArmorIgnoreCharge(entity)) return meleeComponent; + return null; + } } diff --git a/src/main/java/com/hbm/items/armor/ArmorRPAMelee.java b/src/main/java/com/hbm/items/armor/ArmorRPAMelee.java new file mode 100644 index 000000000..c047cdf43 --- /dev/null +++ b/src/main/java/com/hbm/items/armor/ArmorRPAMelee.java @@ -0,0 +1,128 @@ +package com.hbm.items.armor; + +import org.lwjgl.opengl.GL11; + +import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; +import com.hbm.items.weapon.sedna.factory.ConfettiUtil; +import com.hbm.items.weapon.sedna.factory.XFactoryPA; +import com.hbm.main.ResourceManager; +import com.hbm.render.anim.BusAnimation; +import com.hbm.render.anim.BusAnimationSequence; +import com.hbm.render.anim.HbmAnimations; +import com.hbm.render.anim.AnimationEnums.GunAnimation; +import com.hbm.render.anim.BusAnimationKeyframe.IType; +import com.hbm.util.EntityDamageUtil; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; + +public class ArmorRPAMelee implements IPAMelee { + + @Override public void clickPrimary(ItemStack stack, LambdaContext ctx) { XFactoryPA.doSwing(stack, ctx, GunAnimation.CYCLE, 14); } + @Override public void clickSecondary(ItemStack stack, LambdaContext ctx) { XFactoryPA.doSwing(stack, ctx, GunAnimation.ALT_CYCLE, 20); } + + @Override + public void orchestra(ItemStack stack, LambdaContext ctx) { + EntityLivingBase entity = ctx.entity; + if(entity.worldObj.isRemote) return; + GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); + int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); + + boolean swings = type == GunAnimation.CYCLE && (timer == 3 || timer == 9); + boolean slap = type == GunAnimation.ALT_CYCLE && timer == 3; + + if((swings || slap) && ctx.getPlayer() != null) { + MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), 3.0D); + + if(mop != null) { + if(mop.typeOfHit == mop.typeOfHit.ENTITY) { + float damage = swings ? 15F : 35F; + float knockback = swings ? 0F : 1.5F; + float dt = swings ? 5F : 15F; + float pierce = swings ? 0.1F : 0.25F; + + if(mop.entityHit instanceof EntityLivingBase) { + EntityLivingBase living = (EntityLivingBase) mop.entityHit; + if(living.getMaxHealth() >= 100) damage *= 2.5; + EntityDamageUtil.attackEntityFromNT((EntityLivingBase) mop.entityHit, DamageSource.causePlayerDamage(ctx.getPlayer()), damage, true, false, knockback, dt, pierce); + if(living.getRNG().nextInt(slap ? 3 : 10) == 0 && !living.isEntityAlive()) ConfettiUtil.gib(living); + } else { + mop.entityHit.attackEntityFrom(DamageSource.causePlayerDamage(ctx.getPlayer()), damage); + } + + entity.worldObj.playSoundAtEntity(mop.entityHit, "hbm:weapon.fire.smack", 1F, 0.9F + entity.getRNG().nextFloat() * 0.2F); + } + if(mop.typeOfHit == mop.typeOfHit.BLOCK) { + Block b = entity.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); + entity.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, b.stepSound.getStepResourcePath(), 2F, 0.9F + entity.getRNG().nextFloat() * 0.2F); + } + } + } + } + + @Override + public BusAnimation playAnim(ItemStack stack, GunAnimation type) { + if(type == GunAnimation.EQUIP) return new BusAnimation() + .addBus("EQUIP", new BusAnimationSequence().setPos(-1, 0, 0).addPos(0, 0, 0, 250, IType.SIN_DOWN)); + if(type == GunAnimation.CYCLE) return new BusAnimation() + .addBus("SWINGRIGHT", new BusAnimationSequence().addPos(1, 0, 0, 150, IType.SIN_DOWN).addPos(0, 0, 0, 250, IType.SIN_FULL)) + .addBus("SWINGLEFT", new BusAnimationSequence().addPos(0, 0, 0, 300).addPos(1, 0, 0, 150, IType.SIN_DOWN).addPos(0, 0, 0, 250, IType.SIN_FULL)); + if(type == GunAnimation.ALT_CYCLE) return new BusAnimation() + .addBus("SLAPTURN", new BusAnimationSequence().addPos(1, 0, 0, 250, IType.LINEAR).hold(150).addPos(0, 0, 0, 350, IType.LINEAR)) + .addBus("SLAP", new BusAnimationSequence().hold(250).addPos(1, 0, 0, 150, IType.SIN_DOWN).addPos(0, 0, 0, 350, IType.SIN_FULL)); + + return null; + } + + @Override public void setupFirstPerson(ItemStack stack) { } + + @Override + public void renderFirstPerson(ItemStack stack) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.rpa_arm); + + GL11.glTranslated(0, -1.5, 0.5); + double scale = 0.125D; + GL11.glScaled(scale, scale, scale); + + double[] equip = HbmAnimations.getRelevantTransformation("EQUIP"); + double swingRight = HbmAnimations.getRelevantTransformation("SWINGRIGHT")[0]; + double swingLeft = HbmAnimations.getRelevantTransformation("SWINGLEFT")[0]; + double slapTurn = HbmAnimations.getRelevantTransformation("SLAPTURN")[0]; + double slap = HbmAnimations.getRelevantTransformation("SLAP")[0]; + + double forwardTilt = 60 - 60 * equip[0]; + double offsetOutward = 3; + double roll = 60; + + GL11.glPushMatrix(); + + GL11.glTranslated(-12 * swingLeft + 2 * slapTurn - 5 * slap, 6 * slap, 5 * swingLeft + 8 * slap); + GL11.glRotated(forwardTilt - swingRight * 20, 1, 0, 0); + + GL11.glTranslated(offsetOutward, 0, 0); + GL11.glTranslated(6, 8, 0); + GL11.glRotated(60 * swingLeft + 45 * slap, 0, 0, 1); + GL11.glRotated(roll + 15 * swingLeft + 45 * slapTurn, 0, 1, 0); + GL11.glTranslated(-6, -8, 0); + ResourceManager.armor_remnant.renderPart("LeftArm"); + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + + GL11.glTranslated(12 * swingRight - 2 * slapTurn + 5 * slap, 6 * slap, 5 * swingRight + 8 * slap); + GL11.glRotated(forwardTilt - swingLeft * 20, 1, 0, 0); + + GL11.glTranslated(-offsetOutward, 0, 0); + GL11.glTranslated(-6, 8, 0); + GL11.glRotated(-60 * swingRight - 45 * slap, 0, 0, 1); + GL11.glRotated(-roll - 15 * swingRight - 45 * slapTurn, 0, 1, 0); + GL11.glTranslated(6, -8, 0); + ResourceManager.armor_remnant.renderPart("RightArm"); + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java index f9fa32b7a..77f09a111 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java @@ -191,7 +191,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG BlockPos portPos = pos.offset(dir); if(tanks[1].getFill() > 0) this.tryProvide(tanks[1], worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir); - if(worldObj.getTotalWorldTime() % 20 == 0) this.trySubscribe(tanks[0].getTankType(), worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir); + this.trySubscribe(tanks[0].getTankType(), worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir); } } diff --git a/src/main/resources/assets/hbm/textures/armor/gold_layer_1.png b/src/main/resources/assets/hbm/textures/armor/gold_layer_1.png deleted file mode 100644 index 6802e06f2..000000000 Binary files a/src/main/resources/assets/hbm/textures/armor/gold_layer_1.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/armor/gold_layer_2.png b/src/main/resources/assets/hbm/textures/armor/gold_layer_2.png deleted file mode 100644 index a7cf83515..000000000 Binary files a/src/main/resources/assets/hbm/textures/armor/gold_layer_2.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/armor/iron_layer_1.png b/src/main/resources/assets/hbm/textures/armor/iron_layer_1.png deleted file mode 100644 index 6da6e8408..000000000 Binary files a/src/main/resources/assets/hbm/textures/armor/iron_layer_1.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/armor/iron_layer_2.png b/src/main/resources/assets/hbm/textures/armor/iron_layer_2.png deleted file mode 100644 index fab422ae6..000000000 Binary files a/src/main/resources/assets/hbm/textures/armor/iron_layer_2.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/armor/rpa_arm.png b/src/main/resources/assets/hbm/textures/armor/rpa_arm.png index cbaa90560..95ab0ffea 100644 Binary files a/src/main/resources/assets/hbm/textures/armor/rpa_arm.png and b/src/main/resources/assets/hbm/textures/armor/rpa_arm.png differ