Players can't use other items when a railgun controller is selected. Prevents accidentally firing weapons or hitting people with something while using the railguns.

Closes #94
This commit is contained in:
Joonas Rikkonen
2017-12-15 00:25:46 +02:00
parent e17b5a195c
commit 8a7af2affd
3 changed files with 17 additions and 6 deletions
@@ -926,13 +926,16 @@ namespace Barotrauma
}
}
for (int i = 0; i < selectedItems.Length; i++ )
if (SelectedConstruction == null || !SelectedConstruction.Prefab.DisableItemUsageWhenSelected)
{
if (selectedItems[i] == null) continue;
if (i == 1 && selectedItems[0] == selectedItems[1]) continue;
for (int i = 0; i < selectedItems.Length; i++ )
{
if (selectedItems[i] == null) continue;
if (i == 1 && selectedItems[0] == selectedItems[1]) continue;
if (IsKeyDown(InputType.Use)) selectedItems[i].Use(deltaTime, this);
if (IsKeyDown(InputType.Aim) && selectedItems[i] != null) selectedItems[i].SecondaryUse(deltaTime, this);
if (IsKeyDown(InputType.Use)) selectedItems[i].Use(deltaTime, this);
if (IsKeyDown(InputType.Aim) && selectedItems[i] != null) selectedItems[i].SecondaryUse(deltaTime, this);
}
}
if (selectedConstruction != null)
@@ -134,6 +134,13 @@ namespace Barotrauma
private set;
}
[Serialize(false, false)]
public bool DisableItemUsageWhenSelected
{
get;
private set;
}
public bool CanSpriteFlipX
{
get { return canSpriteFlipX; }