Railgun HUD (shows supercapacitor charge & how many shells there are left)

This commit is contained in:
Joonas Rikkonen
2017-11-27 19:34:57 +02:00
parent f4f58622e1
commit 51fe7df481
10 changed files with 189 additions and 32 deletions
@@ -18,7 +18,7 @@ namespace Barotrauma.Items.Components
}
}
class Controller : ItemComponent
partial class Controller : ItemComponent
{
//where the limbs of the user should be positioned when using the controller
private List<LimbPos> limbPositions;
@@ -167,26 +167,9 @@ namespace Barotrauma.Items.Components
character = null;
return;
}
if (character == null) return;
Entity focusTarget = null;
if (character == null) return;
foreach (Connection c in item.Connections)
{
if (c.Name != "position_out") continue;
foreach (Connection c2 in c.Recipients)
{
if (c2 == null || c2.Item == null || !c2.Item.Prefab.FocusOnSelected) continue;
focusTarget = c2.Item;
break;
}
}
Entity focusTarget = GetFocusTarget();
if (focusTarget == null)
{
item.SendSignal(0, XMLExtensions.Vector2ToString(character.CursorWorldPosition), "position_out", character);
@@ -210,6 +193,22 @@ namespace Barotrauma.Items.Components
}
}
private Item GetFocusTarget()
{
foreach (Connection c in item.Connections)
{
if (c.Name != "position_out") continue;
foreach (Connection c2 in c.Recipients)
{
if (c2 == null || c2.Item == null || !c2.Item.Prefab.FocusOnSelected) continue;
return c2.Item;
}
}
return null;
}
public override bool Pick(Character picker)
{
item.SendSignal(0, "1", "signal_out", picker);