- Larger icon for gap/ladder waypoints

- Creature-sub collision damage improvements (takes velocity of the limb into account)
- In-sub particles move with the sub
- Fixed artifacts spawning to non-pickable positions
- Fixed ItemInventories not being drawn if the item is in a subslot
- CauseOfDeath = Drowning if the character is in water while running out of oxy
- Some more deconstructable items
This commit is contained in:
Regalis
2016-01-20 23:31:37 +02:00
parent 75b8e44d3c
commit 97b3d8451c
19 changed files with 104 additions and 39 deletions
+4 -4
View File
@@ -253,7 +253,7 @@ namespace Barotrauma
if (particle != null)
{
particle.Size = particle.Size * Math.Abs(flowForce.X / 1000.0f);
particle.Size = particle.Size * Math.Min(Math.Abs(flowForce.X / 1000.0f),5.0f);
}
pos.Y = Rand.Range(lowerSurface, rect.Y - rect.Height);
@@ -279,14 +279,14 @@ namespace Barotrauma
var splash = GameMain.ParticleManager.CreateParticle(
"watersplash",
Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
-velocity);
-velocity, 0, FlowTargetHull);
if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
GameMain.ParticleManager.CreateParticle(
"bubbles",
Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
flowForce / 2.0f);
Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
flowForce / 2.0f, 0, FlowTargetHull);
}
}
+3 -1
View File
@@ -349,7 +349,7 @@ namespace Barotrauma
/// check visibility between two points (in sim units)
/// </summary>
/// <returns>a physics body that was between the points (or null)</returns>
public static Body CheckVisibility(Vector2 rayStart, Vector2 rayEnd)
public static Body CheckVisibility(Vector2 rayStart, Vector2 rayEnd, bool ignoreLevel = false)
{
Body closestBody = null;
float closestFraction = 1.0f;
@@ -365,6 +365,8 @@ namespace Barotrauma
if (fixture == null ||
(fixture.CollisionCategories != Physics.CollisionWall && fixture.CollisionCategories != Physics.CollisionLevel)) return -1;
if (ignoreLevel && fixture.CollisionCategories == Physics.CollisionLevel) return -1;
Structure structure = fixture.Body.UserData as Structure;
if (structure != null)
{
+22 -12
View File
@@ -353,9 +353,13 @@ namespace Barotrauma
{
Vector2 normal = Vector2.Normalize(body.Position - limb.SimPosition);
normal *= Math.Min(limb.Mass,100)/100.0f;
//normal *= Math.Min(limb.Mass,100)/100.0f;
ApplyImpact(normal, contact);
float impact = Math.Min(Vector2.Dot(Velocity - limb.LinearVelocity, -normal),5.0f);
ApplyImpact(impact * Math.Min(limb.Mass/200.0f, 1), -normal, contact);
//ApplyImpact((-limb.LinearVelocity * Math.Min(limb.Mass, 100)) / 50.0f, contact);
}
return collision;
@@ -365,7 +369,18 @@ namespace Barotrauma
}
var collisionNormal = Vector2.Normalize(ConvertUnits.ToDisplayUnits(body.Position) - cell.Center);
ApplyImpact(collisionNormal, contact);
Vector2 tempNormal;
FarseerPhysics.Common.FixedArray2<Vector2> worldPoints;
contact.GetWorldManifold(out tempNormal, out worldPoints);
Vector2 lastContactPoint = worldPoints[0];
float wallImpact = Vector2.Dot(Velocity, -collisionNormal);
ApplyImpact(wallImpact, -collisionNormal, contact);
//Vector2 u = Vector2.Dot(Velocity, -normal) * normal;
@@ -436,26 +451,21 @@ namespace Barotrauma
return false;
}
private void ApplyImpact(Vector2 normal,Contact contact)
private void ApplyImpact(float impact, Vector2 direction, Contact contact)
{
if (impact < 3.0f) return;
Vector2 tempNormal;
FarseerPhysics.Common.FixedArray2<Vector2> worldPoints;
contact.GetWorldManifold(out tempNormal, out worldPoints);
Vector2 lastContactPoint = worldPoints[0];
float impact = Vector2.Dot(Velocity, -normal);
if (impact < 3.0f) return;
SoundPlayer.PlayDamageSound(DamageSoundType.StructureBlunt, impact * 10.0f, ConvertUnits.ToDisplayUnits(lastContactPoint));
GameMain.GameScreen.Cam.Shake = impact * 2.0f;
Vector2 limbForce = -normal * impact * 0.5f;
Vector2 limbForce = direction * impact * 0.5f;
float length = limbForce.Length();
if (length > 10.0f) limbForce = (limbForce / length) * 10.0f;
+3 -1
View File
@@ -139,8 +139,10 @@ namespace Barotrauma
int iconX = iconIndices[(int)spawnType]*IconSize % iconTexture.Width;
int iconY = (int)(Math.Floor(iconIndices[(int)spawnType]*IconSize / (float)iconTexture.Width))*IconSize;
int iconSize = ConnectedGap == null && Ladders == null ? IconSize : (int)(IconSize * 1.5f);
spriteBatch.Draw(iconTexture,
new Rectangle((int)(drawPos.X - IconSize/2), (int)(drawPos.Y - IconSize/2), IconSize, IconSize),
new Rectangle((int)(drawPos.X - iconSize/2), (int)(drawPos.Y - iconSize/2), iconSize, iconSize),
new Rectangle(iconX, iconY, IconSize,IconSize), clr);
//GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), clr, true);