Fixed letting go of dragged character when entering/exiting the sub, fixed spawnitems not being visible in the job info window

This commit is contained in:
Regalis
2016-08-22 16:49:43 +03:00
parent f279f5240d
commit d476ebdc8d
4 changed files with 9 additions and 24 deletions
@@ -87,11 +87,7 @@ namespace Barotrauma
currTargetPos = target.SimPosition; currTargetPos = target.SimPosition;
//if character is outside the sub and target isn't, transform the position //if character is outside the sub and target isn't, transform the position
if (character.Submarine == null && target.Submarine != null) if (character.Submarine != null && target.Submarine == null)
{
//currTargetPos += target.Submarine.SimPosition;
}
else if (target.Submarine == null)
{ {
currTargetPos -= character.Submarine.SimPosition; currTargetPos -= character.Submarine.SimPosition;
} }
@@ -931,7 +931,7 @@ namespace Barotrauma
LimbType type = i == 0 ? leftHandTarget: rightHandTarget; LimbType type = i == 0 ? leftHandTarget: rightHandTarget;
Limb targetLimb = target.AnimController.GetLimb(type); Limb targetLimb = target.AnimController.GetLimb(type);
Limb pullLimb = GetLimb(i == 0 ?LimbType.LeftHand: LimbType.RightHand); Limb pullLimb = GetLimb(i == 0 ? LimbType.LeftHand: LimbType.RightHand);
if (i==1 && inWater) if (i==1 && inWater)
{ {
@@ -939,15 +939,16 @@ namespace Barotrauma
} }
else else
{ {
Vector2 diff = ConvertUnits.ToSimUnits(targetLimb.WorldPosition - pullLimb.WorldPosition);
pullLimb.pullJoint.Enabled = true; pullLimb.pullJoint.Enabled = true;
pullLimb.pullJoint.WorldAnchorB = targetLimb.SimPosition; pullLimb.pullJoint.WorldAnchorB = pullLimb.SimPosition + diff;
pullLimb.pullJoint.MaxForce = 10000.0f; pullLimb.pullJoint.MaxForce = 10000.0f;
targetLimb.pullJoint.Enabled = true; targetLimb.pullJoint.Enabled = true;
targetLimb.pullJoint.WorldAnchorB = pullLimb.SimPosition; targetLimb.pullJoint.WorldAnchorB = targetLimb.SimPosition - diff;
targetLimb.pullJoint.MaxForce = 10000.0f; targetLimb.pullJoint.MaxForce = 10000.0f;
} }
} }
+1 -1
View File
@@ -715,7 +715,7 @@ namespace Barotrauma
if (selectedCharacter!=null) if (selectedCharacter!=null)
{ {
if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 3.0f || !selectedCharacter.CanBeSelected) if (Vector2.Distance(selectedCharacter.WorldPosition, WorldPosition) > 300.0f || !selectedCharacter.CanBeSelected)
{ {
DeselectCharacter(controlled == this); DeselectCharacter(controlled == this);
} }
+2 -14
View File
@@ -12,7 +12,6 @@ namespace Barotrauma
public readonly XElement Items; public readonly XElement Items;
public readonly List<string> ItemNames; public readonly List<string> ItemNames;
//public List<bool> EquipItem;
public List<SkillPrefab> Skills; public List<SkillPrefab> Skills;
@@ -71,7 +70,6 @@ namespace Barotrauma
AllowAlways = ToolBox.GetAttributeBool(element, "allowalways", false); AllowAlways = ToolBox.GetAttributeBool(element, "allowalways", false);
ItemNames = new List<string>(); ItemNames = new List<string>();
//EquipItem = new List<bool>();
Skills = new List<SkillPrefab>(); Skills = new List<SkillPrefab>();
@@ -83,16 +81,9 @@ namespace Barotrauma
Items = subElement; Items = subElement;
foreach (XElement itemElement in subElement.Elements()) foreach (XElement itemElement in subElement.Elements())
{ {
string itemName = ToolBox.GetAttributeString(subElement, "name", ""); string itemName = ToolBox.GetAttributeString(itemElement, "name", "");
ItemNames.Add(itemName); if (!string.IsNullOrWhiteSpace(itemName)) ItemNames.Add(itemName);
} }
//string itemName = ToolBox.GetAttributeString(subElement, "name", "");
//bool equipItem = ToolBox.GetAttributeBool(subElement, "equip", false);
//if (!string.IsNullOrEmpty(itemName))
//{
// ItemNames.Add(itemName);
// EquipItem.Add(equipItem);
//}
break; break;
case "skills": case "skills":
foreach (XElement skillElement in subElement.Elements()) foreach (XElement skillElement in subElement.Elements())
@@ -153,9 +144,6 @@ namespace Barotrauma
y += 20; y += 20;
} }
return backFrame; return backFrame;
} }