Changes to submarine<->outside teleporting logic:

- contacts between limbs and the sub are temporarily disabled before teleporting to prevent the character from "exploding"
- impact damage is disabled for 0.25 seconds after teleporting in case the character still explodes
- characters with disabled impact damage won't damage the walls when hitting
- the collider of SubmarineBody is generated based on walls instead of hulls
- fixed Submarine.CheckVisibilit ignoring fixtures with (CollisionWall | CollisionLevel) collisioncategory
This commit is contained in:
Regalis
2016-05-18 11:43:22 +03:00
parent be72fee824
commit 63e5f02057
7 changed files with 184 additions and 94 deletions
+8 -2
View File
@@ -431,13 +431,19 @@ namespace Barotrauma
if (limb.character.AnimController.IgnorePlatforms) return false;
}
}
if (f2.Body.UserData is Limb)
{
var character = ((Limb)f2.Body.UserData).character;
if (character.DisableImpactDamageTimer > 0.0f || ((Limb)f2.Body.UserData).Mass < 100.0f) return true;
}
if (!prefab.IsPlatform && prefab.StairDirection == Direction.None)
{
Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position);
int section = FindSectionIndex(pos);
if (section>0)
if (section > 0)
{
Vector2 normal = contact.Manifold.LocalNormal;
@@ -529,7 +535,7 @@ namespace Barotrauma
public AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, float deltaTime, bool playSound = false)
{
if (Submarine.Loaded != null && Submarine.Loaded.GodMode) return new AttackResult(0.0f, 0.0f);
if (Submarine.Loaded != null && Submarine.Loaded.GodMode && Submarine == Submarine.Loaded) return new AttackResult(0.0f, 0.0f);
if (!prefab.HasBody || prefab.IsPlatform) return new AttackResult(0.0f, 0.0f);
Vector2 transformedPos = position;