/** * Parse a turretlock tag for the given <code>Entity</code>. * * @param turretLockTag * @param entity */ private void parseTurretLock(Element turretLockTag, Entity entity){ String value = turretLockTag.getAttribute(DIRECTION); try { int turDir = Integer.parseInt(value); ((Tank) entity).setSecondaryFacing(turDir); ((Tank) entity).lockTurret(((Tank)entity).getLocTurret()); } catch (Exception e) { System.err.println(e); e.printStackTrace(); warning.append("Invalid turret lock direction value in " + "movement tag.\n"); } }
/** * Parse a turret2lock tag for the given <code>Entity</code>. * * @param turret2LockTag * @param entity */ private void parseTurret2Lock(Element turret2LockTag, Entity entity){ String value = turret2LockTag.getAttribute(DIRECTION); try { int turDir = Integer.parseInt(value); ((Tank) entity).setDualTurretOffset(turDir); ((Tank) entity).lockTurret(((Tank)entity).getLocTurret2()); } catch (Exception e) { System.err.println(e); e.printStackTrace(); warning.append("Invalid turret2 lock direction value in " + "movement tag.\n"); } }
/** * apply the effects of an "engine hit" crit */ public void engineHit() { engineHit = true; immobilize(); lockTurret(getLocTurret()); lockTurret(getLocTurret2()); for (Mounted m : getWeaponList()) { WeaponType wtype = (WeaponType) m.getType(); if (wtype.hasFlag(WeaponType.F_ENERGY) // Chemical lasers still work even after an engine hit. && !(wtype instanceof CLChemicalLaserWeapon) // And presumably vehicle flamers should, too; we can always // remove this again if ruled otherwise. && !(wtype instanceof VehicleFlamerWeapon)) { m.setBreached(true); // not destroyed, just unpowered } } }
tank.lockTurret(0); } else { tank.unlockTurret();