New pump & railguncont sprites, saving fixes (disappearing items fixed?), moving LightManager.ViewPos to railgun when aiming, generating waypoints outside sub, easier wire node editing, characters stand when using a controller, shiftsummary crew status scrolling, stuff
This commit is contained in:
@@ -81,7 +81,9 @@ namespace Barotrauma.Items.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (userPos != 0.0f && character.AnimController.Anim != AnimController.Animation.UsingConstruction)
|
||||
character.AnimController.Anim = AnimController.Animation.UsingConstruction;
|
||||
|
||||
if (userPos != 0.0f)
|
||||
{
|
||||
float torsoX = ConvertUnits.ToDisplayUnits(character.AnimController.RefLimb.SimPosition.X);
|
||||
|
||||
@@ -89,12 +91,16 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (diff!= Vector2.Zero && diff.Length() > 10.0f)
|
||||
{
|
||||
character.AnimController.Anim = AnimController.Animation.None;
|
||||
//character.AnimController.Anim = AnimController.Animation.None;
|
||||
|
||||
character.AnimController.TargetMovement = new Vector2(Math.Sign(diff.X), 0.0f);
|
||||
character.AnimController.TargetDir = (Math.Sign(diff.X) == 1) ? Direction.Right : Direction.Left;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
character.AnimController.TargetMovement = Vector2.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
ApplyStatusEffects(ActionType.OnActive, deltaTime, character);
|
||||
@@ -103,6 +109,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
character.AnimController.Anim = AnimController.Animation.UsingConstruction;
|
||||
character.AnimController.ResetPullJoints();
|
||||
|
||||
if (dir != 0) character.AnimController.TargetDir = dir;
|
||||
|
||||
foreach (LimbPos lb in limbPositions)
|
||||
@@ -110,6 +117,8 @@ namespace Barotrauma.Items.Components
|
||||
Limb limb = character.AnimController.GetLimb(lb.limbType);
|
||||
if (limb == null) continue;
|
||||
|
||||
limb.Disabled = true;
|
||||
|
||||
FixedMouseJoint fmj = limb.pullJoint;
|
||||
if (fmj == null) continue;
|
||||
|
||||
@@ -138,7 +147,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void SecondaryUse(float deltaTime, Character character = null)
|
||||
{
|
||||
if (this.character == null || this.character!=character || this.character.SelectedConstruction!=item)
|
||||
if (this.character == null || this.character != character || this.character.SelectedConstruction != item)
|
||||
{
|
||||
character = null;
|
||||
return;
|
||||
@@ -150,13 +159,13 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (Connection c2 in c.Recipients)
|
||||
{
|
||||
if (c2 == null || c2.Item==null || !c2.Item.Prefab.FocusOnSelected) continue;
|
||||
if (c2 == null || c2.Item == null || !c2.Item.Prefab.FocusOnSelected) continue;
|
||||
|
||||
Vector2 centerPos = c2.Item.WorldPosition;
|
||||
|
||||
if (character == Character.Controlled && cam != null)
|
||||
{
|
||||
Lights.LightManager.ViewPos = centerPos;
|
||||
Lights.LightManager.ViewTarget = c2.Item;
|
||||
cam.TargetPos = c2.Item.WorldPosition;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Barotrauma.Items.Components
|
||||
pingState = 0.0f;
|
||||
}
|
||||
|
||||
voltage = 0.0f;
|
||||
voltage -= deltaTime;
|
||||
}
|
||||
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private Vector2 newNodePos;
|
||||
|
||||
private static Wire draggingWire;
|
||||
private static int? selectedNodeIndex;
|
||||
|
||||
public Wire(Item item, XElement element)
|
||||
@@ -310,31 +311,34 @@ namespace Barotrauma.Items.Components
|
||||
//nodes.Add(newNodePos);
|
||||
}
|
||||
|
||||
if (!editing) return;
|
||||
if (!editing || !PlayerInput.MouseInsideWindow) return;
|
||||
|
||||
for (int i = 1; i < Nodes.Count; i++)
|
||||
for (int i = 0; i < Nodes.Count; i++)
|
||||
{
|
||||
Vector2 worldPos = Nodes[i];
|
||||
if (item.Submarine != null) worldPos += item.Submarine.Position;
|
||||
if (item.Submarine != null) worldPos += item.Submarine.Position + Submarine.HiddenSubPosition;
|
||||
worldPos.Y = -worldPos.Y;
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, worldPos+new Vector2(-3,-3), new Vector2(6, 6), Color.Red, true, 0.0f);
|
||||
GUI.DrawRectangle(spriteBatch, worldPos + new Vector2(-3, -3), new Vector2(6, 6), item.Color, true, 0.0f);
|
||||
|
||||
if (GUIComponent.MouseOn != null ||
|
||||
Vector2.Distance(GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) > 10.0f)
|
||||
Vector2.Distance(GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), new Vector2(worldPos.X, -worldPos.Y)) > 10.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
MapEntity.DisableSelect = true;
|
||||
GUI.DrawRectangle(spriteBatch, worldPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f);
|
||||
|
||||
if (selectedNodeIndex == null && !MapEntity.SelectedAny)
|
||||
if (selectedNodeIndex == null && draggingWire == null)// && !MapEntity.SelectedAny)
|
||||
{
|
||||
if (PlayerInput.LeftButtonDown() && PlayerInput.GetOldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
|
||||
{
|
||||
MapEntity.SelectEntity(item);
|
||||
draggingWire = this;
|
||||
selectedNodeIndex = i;
|
||||
MapEntity.DisableSelect = true;
|
||||
break;
|
||||
}
|
||||
else if (PlayerInput.RightButtonClicked())
|
||||
{
|
||||
@@ -346,22 +350,27 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (PlayerInput.LeftButtonDown())
|
||||
{
|
||||
if (selectedNodeIndex != null && item.IsSelected)
|
||||
if (selectedNodeIndex != null && draggingWire == this)
|
||||
{
|
||||
MapEntity.DisableSelect = true;
|
||||
Nodes[(int)selectedNodeIndex] = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||
//Nodes[(int)selectedNodeIndex] = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition)-Submarine.HiddenSubPosition+Submarine.Loaded.Position;
|
||||
|
||||
Vector2 nodeWorldPos = Nodes[(int)selectedNodeIndex];
|
||||
Vector2 nodeWorldPos = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition) - Submarine.HiddenSubPosition - Submarine.Loaded.Position;// Nodes[(int)selectedNodeIndex];
|
||||
|
||||
if (item.Submarine != null) nodeWorldPos += item.Submarine.Position;
|
||||
nodeWorldPos.X = MathUtils.Round(nodeWorldPos.X, Submarine.GridSize.X/2.0f);
|
||||
nodeWorldPos.Y = MathUtils.Round(nodeWorldPos.Y, Submarine.GridSize.Y/2.0f);
|
||||
|
||||
//if (item.Submarine != null) nodeWorldPos += item.Submarine.Position;
|
||||
|
||||
Nodes[(int)selectedNodeIndex] = nodeWorldPos;
|
||||
|
||||
Nodes[(int)selectedNodeIndex] = RoundNode(Nodes[(int)selectedNodeIndex], Hull.FindHull(nodeWorldPos));
|
||||
MapEntity.SelectEntity(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedNodeIndex = null;
|
||||
draggingWire = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Barotrauma.Items.Components
|
||||
var projectiles = GetLoadedProjectiles(true);
|
||||
if (projectiles.Count == 0) return false;
|
||||
|
||||
if (GetAvailablePower() < currPowerConsumption) return false;
|
||||
if (GetAvailablePower() < powerConsumption) return false;
|
||||
|
||||
var batteries = item.GetConnectedComponents<PowerContainer>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user