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:
Regalis
2016-03-12 21:28:39 +02:00
parent d1580328ed
commit c99f94b1de
5 changed files with 23 additions and 8 deletions

View File

@@ -305,6 +305,7 @@
<requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="toggle"/>
<input name="set_state"/>
<input name="set_color"/>
</ConnectionPanel>
</Item>

View File

@@ -43,7 +43,7 @@
<StatusEffect type="OnFailure" target="Contained" targetnames="Welding Fuel Tank,Oxygen Tank" Condition="-3.0"/>
<LightComponent color="1.0,0.9,0.7,1.0" Flicker="0.5">
<LightComponent LightColor="1.0,0.9,0.7,1.0" Flicker="0.5">
<sprite texture="Content/Items/Electricity/lightsprite.png" origin="0.5,0.5"/>
</LightComponent>
</RepairTool>
@@ -88,7 +88,7 @@
<StatusEffect type="OnFailure" target="Contained" targetnames="Welding Fuel Tank,Oxygen Tank" Condition="-3.0"/>
<LightComponent color="0.1,0.8,1.0,1.0" Flicker="0.5">
<LightComponent LightColor="0.8,0.7,1.0,1.0" Flicker="0.5">
<sprite texture="Content/Items/Electricity/lightsprite.png" origin="0.5,0.5"/>
</LightComponent>
</RepairTool>

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;