Renames "OnSecondaryUse" to "OnAim" for more sense

adds new "OnHudUse" to separate normal and self use
This commit is contained in:
Alex Noir
2017-12-10 13:39:00 +03:00
parent db7d5539e0
commit 00653c5aa4
12 changed files with 62 additions and 17 deletions
@@ -128,7 +128,7 @@ namespace Barotrauma
Character.AnimController.TargetDir = Direction.Left;
}
if (Character.SelectedConstruction != null) Character.SelectedConstruction.SecondaryUse(deltaTime, Character);
if (Character.SelectedConstruction != null) Character.SelectedConstruction.Aim(deltaTime, Character);
}
else if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater)
@@ -932,13 +932,13 @@ namespace Barotrauma
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.Aim) && selectedItems[i] != null) selectedItems[i].Aim(deltaTime, this);
}
if (selectedConstruction != null)
{
if (IsKeyDown(InputType.Use)) selectedConstruction.Use(deltaTime, this);
if (selectedConstruction != null && IsKeyDown(InputType.Aim)) selectedConstruction.SecondaryUse(deltaTime, this);
if (selectedConstruction != null && IsKeyDown(InputType.Aim)) selectedConstruction.Aim(deltaTime, this);
}
if (SelectedCharacter != null)
@@ -41,6 +41,7 @@ namespace Barotrauma
private readonly float duration;
private readonly bool useItem;
private readonly bool hudUseItem;
public readonly ActionType type;
@@ -166,9 +167,11 @@ namespace Barotrauma
FireSize = subElement.GetAttributeFloat("size",10.0f);
break;
case "use":
case "useitem":
useItem = true;
break;
case "huduse":
hudUseItem = true;
break;
case "requireditem":
case "requireditems":
RelatedItem newRequiredItem = RelatedItem.Load(subElement);
@@ -258,6 +261,13 @@ namespace Barotrauma
item.Use(deltaTime, targets.FirstOrDefault(t => t is Character) as Character);
}
}
if (hudUseItem)
{
foreach (Item item in targets.FindAll(t => t is Item).Cast<Item>())
{
item.HudUse(deltaTime, targets.FirstOrDefault(t => t is Character) as Character);
}
}
foreach (ISerializableEntity target in targets)
{