Fixed projectiles (e.g. railgun shells) not colliding with the sub when shot from outside, fixed lightcomponents not being positioned correctly on moving items
This commit is contained in:
@@ -149,6 +149,16 @@ namespace Barotrauma.Items.Components
|
||||
AttackResult attackResult = new AttackResult(0.0f, 0.0f);
|
||||
if (attack != null)
|
||||
{
|
||||
var submarine = f2.Body.UserData as Submarine;
|
||||
if (submarine != null)
|
||||
{
|
||||
item.Move(-submarine.Position);
|
||||
item.Submarine = submarine;
|
||||
item.body.Submarine = submarine;
|
||||
item.FindHull();
|
||||
return false;
|
||||
}
|
||||
|
||||
Limb limb;
|
||||
Structure structure;
|
||||
if ((limb = (f2.Body.UserData as Limb)) != null)
|
||||
|
||||
@@ -92,10 +92,8 @@ namespace Barotrauma.Items.Components
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
base.Update(deltaTime, cam);
|
||||
if (item.CurrentHull != null)
|
||||
{
|
||||
light.Submarine = item.CurrentHull.Submarine;
|
||||
}
|
||||
|
||||
light.Submarine = (item.CurrentHull == null) ? null : item.CurrentHull.Submarine;
|
||||
|
||||
if (item.Container != null)
|
||||
{
|
||||
@@ -105,7 +103,13 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (item.body != null)
|
||||
{
|
||||
light.Position = item.WorldPosition;
|
||||
light.Position = item.Position;
|
||||
|
||||
if (!item.body.Enabled)
|
||||
{
|
||||
light.Color = Color.Transparent;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (powerConsumption == 0.0f)
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Barotrauma
|
||||
|
||||
body.BodyType = BodyType.Dynamic;
|
||||
body.CollisionCategories = Physics.CollisionMisc | Physics.CollisionWall;
|
||||
body.CollidesWith = Physics.CollisionLevel | Physics.CollisionCharacter;
|
||||
body.CollidesWith = Physics.CollisionLevel | Physics.CollisionCharacter | Physics.CollisionProjectile;
|
||||
body.Restitution = Restitution;
|
||||
body.Friction = Friction;
|
||||
body.FixedRotation = true;
|
||||
|
||||
Reference in New Issue
Block a user