- CrewCommander key can be changed
- Improved logic for teleporting character in/out the sub - changed Turret.AIOperate to use the new coordinate system - neutralballastlevel option in steering - crewmanager UI works properly with different numbers of crew members - fixed obstructvision "twitching" when moving in/out the sub - resetting steering velocity when AI is waiting - GetItem AIObjective ignores items outside the sub - crew has the "dismissed" order by default -
This commit is contained in:
@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
|
||||
if (powerConsumption == 0.0f) voltage = 1.0f;
|
||||
|
||||
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
|
||||
if (Force > 1.0f)
|
||||
if (Math.Abs(Force) > 1.0f)
|
||||
{
|
||||
Vector2 currForce = new Vector2((force / 100.0f) * maxForce * (voltage / minVoltage), 0.0f);
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
var mission = GameMain.GameSession.Mission;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(mission.RadarLabel))
|
||||
if (!string.IsNullOrWhiteSpace(mission.RadarLabel) && mission.RadarPosition != Vector2.Zero)
|
||||
{
|
||||
DrawMarker(spriteBatch,
|
||||
mission.RadarLabel,
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace Barotrauma.Items.Components
|
||||
private bool valueChanged;
|
||||
|
||||
private float autopilotRayCastTimer;
|
||||
|
||||
private float neutralBallastLevel;
|
||||
|
||||
bool AutoPilot
|
||||
{
|
||||
@@ -47,6 +49,17 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Editable, HasDefaultValue(0.5f, true)]
|
||||
public float NeutralBallastLevel
|
||||
{
|
||||
get { return neutralBallastLevel; }
|
||||
set
|
||||
{
|
||||
neutralBallastLevel = MathHelper.Clamp(value, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 TargetVelocity
|
||||
{
|
||||
get { return targetVelocity;}
|
||||
@@ -115,7 +128,11 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
item.SendSignal(targetVelocity.X.ToString(CultureInfo.InvariantCulture), "velocity_x_out");
|
||||
|
||||
item.SendSignal((-targetVelocity.Y).ToString(CultureInfo.InvariantCulture), "velocity_y_out");
|
||||
float targetLevel = -targetVelocity.Y;
|
||||
|
||||
targetLevel += (neutralBallastLevel - 0.5f) * 100.0f;
|
||||
|
||||
item.SendSignal(targetLevel.ToString(CultureInfo.InvariantCulture), "velocity_y_out");
|
||||
}
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
|
||||
@@ -174,6 +174,8 @@ namespace Barotrauma.Items.Components
|
||||
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y)), -rotation);
|
||||
|
||||
projectiles[0].Use(deltaTime);
|
||||
projectiles[0].User = character;
|
||||
|
||||
if (projectile.Container != null) projectile.Container.RemoveContained(projectile);
|
||||
|
||||
return true;
|
||||
@@ -236,7 +238,7 @@ namespace Barotrauma.Items.Components
|
||||
//ignore humans and characters that are inside the sub
|
||||
if (enemy.IsDead || enemy.SpeciesName == "human" || enemy.AnimController.CurrentHull != null) continue;
|
||||
|
||||
float dist = Vector2.Distance(enemy.Position, item.Position);
|
||||
float dist = Vector2.Distance(enemy.WorldPosition, item.WorldPosition);
|
||||
if (dist < closestDist)
|
||||
{
|
||||
closestEnemy = enemy;
|
||||
@@ -246,18 +248,29 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (closestEnemy == null) return false;
|
||||
|
||||
character.CursorPosition = closestEnemy.Position;
|
||||
SecondaryUse(deltaTime, character);
|
||||
character.CursorPosition = closestEnemy.WorldPosition;
|
||||
if (item.Submarine!=null) character.CursorPosition -= item.Submarine.Position;
|
||||
character.SetInput(InputType.Aim, false, true);
|
||||
//Vector2 receive
|
||||
|
||||
float enemyAngle = MathUtils.VectorToAngle(closestEnemy.Position-item.Position);
|
||||
float turretAngle = -(rotation - MathHelper.TwoPi);
|
||||
//Vector2 centerPos = new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y);
|
||||
|
||||
if (Math.Abs(enemyAngle - turretAngle) > 0.01f) return false;
|
||||
//Vector2 offset = receivedPos - centerPos;
|
||||
//offset.Y = -offset.Y;
|
||||
|
||||
var pickedBody = Submarine.PickBody(item.SimPosition, closestEnemy.SimPosition, null);
|
||||
//targetRotation = MathUtils.WrapAngleTwoPi(MathUtils.VectorToAngle(offset));
|
||||
|
||||
float enemyAngle = MathUtils.VectorToAngle(closestEnemy.WorldPosition-item.WorldPosition);
|
||||
float turretAngle = -rotation;
|
||||
|
||||
|
||||
|
||||
if (Math.Abs(MathUtils.GetShortestAngle(enemyAngle, turretAngle)) > 0.01f) return false;
|
||||
|
||||
var pickedBody = Submarine.PickBody(ConvertUnits.ToSimUnits(item.WorldPosition), closestEnemy.SimPosition, null);
|
||||
if (pickedBody != null && pickedBody.UserData as Limb == null) return false;
|
||||
|
||||
Use(deltaTime, character);
|
||||
if (objective.Option.ToLower()=="fire at will") Use(deltaTime, character);
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user