Merge branch 'master' into coolthings
This commit is contained in:
@@ -184,8 +184,8 @@ namespace Barotrauma.Items.Components
|
||||
item.SetTransform(rightHand.SimPosition, 0.0f);
|
||||
}
|
||||
|
||||
bool alreadySelected = character.HasSelectedItem(item);
|
||||
if (picker.TrySelectItem(item))
|
||||
bool alreadySelected = character.HasEquippedItem(item);
|
||||
if (picker.TrySelectItem(item) || picker.HasEquippedItem(item))
|
||||
{
|
||||
item.body.Enabled = true;
|
||||
IsActive = true;
|
||||
@@ -308,7 +308,7 @@ namespace Barotrauma.Items.Components
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
if (item.body == null || !item.body.Enabled) return;
|
||||
if (picker == null || !picker.HasSelectedItem(item))
|
||||
if (picker == null || !picker.HasEquippedItem(item))
|
||||
{
|
||||
IsActive = false;
|
||||
return;
|
||||
@@ -320,7 +320,37 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
item.Submarine = picker.Submarine;
|
||||
|
||||
picker.AnimController.HoldItem(deltaTime, item, handlePos, holdPos, aimPos, picker.IsKeyDown(InputType.Aim), holdAngle);
|
||||
if (picker.HasSelectedItem(item))
|
||||
{
|
||||
picker.AnimController.HoldItem(deltaTime, item, handlePos, holdPos, aimPos, picker.IsKeyDown(InputType.Aim), holdAngle);
|
||||
}
|
||||
else
|
||||
{
|
||||
Limb equipLimb = null;
|
||||
if (picker.Inventory.IsInLimbSlot(item, InvSlotType.Face) || picker.Inventory.IsInLimbSlot(item, InvSlotType.Head))
|
||||
{
|
||||
equipLimb = picker.AnimController.GetLimb(LimbType.Head);
|
||||
}
|
||||
else if (picker.Inventory.IsInLimbSlot(item, InvSlotType.Torso))
|
||||
{
|
||||
equipLimb = picker.AnimController.GetLimb(LimbType.Torso);
|
||||
}
|
||||
else if (picker.Inventory.IsInLimbSlot(item, InvSlotType.Legs))
|
||||
{
|
||||
equipLimb = picker.AnimController.GetLimb(LimbType.Waist);
|
||||
}
|
||||
|
||||
if (equipLimb != null)
|
||||
{
|
||||
float itemAngle = (equipLimb.Rotation + holdAngle * picker.AnimController.Dir);
|
||||
|
||||
Matrix itemTransfrom = Matrix.CreateRotationZ(equipLimb.Rotation);
|
||||
Vector2 transformedHandlePos = Vector2.Transform(handlePos[0], itemTransfrom);
|
||||
|
||||
item.body.ResetDynamics();
|
||||
item.SetTransform(equipLimb.SimPosition - transformedHandlePos, itemAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void Flip(Item item)
|
||||
|
||||
Reference in New Issue
Block a user