This commit is contained in:
Regalis
2015-12-04 01:37:30 +02:00
parent c064c5eb50
commit 242af12f14
25 changed files with 200 additions and 109 deletions
@@ -54,15 +54,19 @@ namespace Barotrauma
(pathSteering.CurrentPath.NextNode == null || pathSteering.CurrentPath.Unreachable)))
{
//steer away from edges of the hull
if (character.Position.X < character.AnimController.CurrentHull.Rect.X + WallAvoidDistance)
if (character.AnimController.CurrentHull!=null)
{
pathSteering.SteeringManual(deltaTime, Vector2.UnitX);
}
else if (character.Position.X > character.AnimController.CurrentHull.Rect.Right - WallAvoidDistance)
{
pathSteering.SteeringManual(deltaTime, -Vector2.UnitX);
if (character.Position.X < character.AnimController.CurrentHull.Rect.X + WallAvoidDistance)
{
pathSteering.SteeringManual(deltaTime, Vector2.UnitX);
}
else if (character.Position.X > character.AnimController.CurrentHull.Rect.Right - WallAvoidDistance)
{
pathSteering.SteeringManual(deltaTime, -Vector2.UnitX);
}
}
character.AIController.SteeringManager.SteeringWander(1.0f);
return;
}
@@ -94,7 +94,6 @@ namespace Barotrauma
case NetworkEventType.KillCharacter:
return true;
case NetworkEventType.ImportantEntityUpdate:
int i = 0;
//foreach (Limb limb in AnimController.Limbs)
//{
//if (RefLimb.ignoreCollisions) continue;
@@ -152,7 +152,17 @@ namespace Barotrauma
public Hull CurrentHull
{
get { return currentHull;}
get { return currentHull; }
set
{
if (value == currentHull) return;
currentHull = value;
foreach (Limb limb in Limbs)
{
limb.body.Submarine = currentHull == null ? null : Submarine.Loaded;
}
}
}
public bool IgnorePlatforms
@@ -534,8 +544,9 @@ namespace Barotrauma
if (newHull == currentHull) return;
currentHull = newHull;
CurrentHull = newHull;
UpdateCollisionCategories();
}
+18 -12
View File
@@ -273,19 +273,19 @@ namespace Barotrauma
get { return AnimController.RefLimb.SimPosition; }
}
public Vector2 Position
public override Vector2 Position
{
get { return ConvertUnits.ToDisplayUnits(AnimController.RefLimb.SimPosition); }
get { return AnimController.RefLimb.Position; }
}
static Character()
{
DeathMsg[(int)CauseOfDeath.Damage] = "succumbed to your injuries";
DeathMsg[(int)CauseOfDeath.Bloodloss] = "bled out";
DeathMsg[(int)CauseOfDeath.Drowning] = "drowned";
DeathMsg[(int)CauseOfDeath.Damage] = "succumbed to your injuries";
DeathMsg[(int)CauseOfDeath.Bloodloss] = "bled out";
DeathMsg[(int)CauseOfDeath.Drowning] = "drowned";
DeathMsg[(int)CauseOfDeath.Suffocation] = "suffocated";
DeathMsg[(int)CauseOfDeath.Pressure] = "been crushed by water pressure";
DeathMsg[(int)CauseOfDeath.Burn] = "burnt to death";
DeathMsg[(int)CauseOfDeath.Pressure] = "been crushed by water pressure";
DeathMsg[(int)CauseOfDeath.Burn] = "burnt to death";
}
public static Character Create(string file, Vector2 position)
@@ -334,6 +334,7 @@ namespace Barotrauma
}
protected Character(string file, Vector2 position, CharacterInfo characterInfo = null, bool isNetworkPlayer = false)
: base(null)
{
keys = new Key[Enum.GetNames(typeof(InputType)).Length];
@@ -522,7 +523,7 @@ namespace Barotrauma
continue;
}
Item item = new Item(itemPrefab, Position);
Item item = new Item(itemPrefab, Position, null);
if (info.Job.EquipSpawnItem[i])
{
@@ -754,12 +755,15 @@ namespace Barotrauma
if (moveCam)
{
cam.TargetPos = ConvertUnits.ToDisplayUnits(AnimController.Limbs[0].SimPosition);
cam.TargetPos = WorldPosition;
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, 250.0f, 0.05f);
}
cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition);
cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition);
if (AnimController.CurrentHull != null) cursorPosition -= Submarine.Loaded.Position;
Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition);
if (Vector2.Distance(AnimController.Limbs[0].SimPosition, mouseSimPos)>1.0f)
{
Body body = Submarine.PickBody(AnimController.Limbs[0].SimPosition, mouseSimPos);
@@ -877,9 +881,11 @@ namespace Barotrauma
{
if (!Enabled) return;
Submarine = AnimController.CurrentHull == null ? null : Submarine.Loaded;
obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f);
AnimController.SimplePhysicsEnabled = (Character.controlled != this && Vector2.Distance(cam.WorldViewCenter, Position) > 5000.0f);
AnimController.SimplePhysicsEnabled = (Character.controlled != this && Vector2.Distance(cam.WorldViewCenter, WorldPosition) > 5000.0f);
if (isDead) return;