This commit is contained in:
juanjp600
2017-12-21 20:31:24 -03:00
23 changed files with 347 additions and 190 deletions
@@ -13,7 +13,6 @@ namespace Barotrauma.Items.Components
private float pickTimer;
public List<InvSlotType> AllowedSlots
{
get { return allowedSlots; }
@@ -55,13 +54,15 @@ namespace Barotrauma.Items.Components
public override bool Pick(Character picker)
{
//return if someone is already trying to pick the item
if (pickTimer>0.0f) return false;
if (pickTimer > 0.0f) return false;
if (picker == null || picker.Inventory == null) return false;
if (PickingTime>0.0f)
if (PickingTime > 0.0f)
{
CoroutineManager.StartCoroutine(WaitForPick(picker, PickingTime));
if (picker.PickingItem == null)
{
CoroutineManager.StartCoroutine(WaitForPick(picker, PickingTime));
}
return false;
}
else
@@ -104,6 +105,8 @@ namespace Barotrauma.Items.Components
private IEnumerable<object> WaitForPick(Character picker, float requiredTime)
{
picker.PickingItem = item;
var leftHand = picker.AnimController.GetLimb(LimbType.LeftHand);
var rightHand = picker.AnimController.GetLimb(LimbType.RightHand);
@@ -151,7 +154,8 @@ namespace Barotrauma.Items.Components
private void StopPicking(Character picker)
{
picker.AnimController.Anim = AnimController.Animation.None;
pickTimer = 0.0f;
picker.PickingItem = null;
pickTimer = 0.0f;
}
protected void DropConnectedWires(Character character)
@@ -103,11 +103,7 @@ namespace Barotrauma.Items.Components
{
if (character == null) return false;
if (!character.IsKeyDown(InputType.Aim)) return false;
//if (DoesUseFail(Character)) return false;
//targetPosition = targetPosition.X, -targetPosition.Y);
float degreeOfSuccess = DegreeOfSuccess(character)/100.0f;
if (Rand.Range(0.0f, 0.5f) > degreeOfSuccess)
@@ -241,7 +237,7 @@ namespace Barotrauma.Items.Components
{
Gap leak = objective.OperateTarget as Gap;
if (leak == null) return true;
float dist = Vector2.Distance(leak.WorldPosition, item.WorldPosition);
//too far away -> consider this done and hope the AI is smart enough to move closer
@@ -258,9 +258,9 @@ namespace Barotrauma.Items.Components
if (batteryToLoad == null) return true;
if (batteryToLoad.RechargeSpeed < batteryToLoad.MaxRechargeSpeed*0.4f)
if (batteryToLoad.RechargeSpeed < batteryToLoad.MaxRechargeSpeed * 0.4f)
{
objective.AddSubObjective(new AIObjectiveOperateItem(batteryToLoad, character, ""));
objective.AddSubObjective(new AIObjectiveOperateItem(batteryToLoad, character, "", false));
return false;
}
}