- disabled FOW blurring (made it possible to see through corners) and re-enabled penumbra
- fixed structures being assigned the misc category by default - turrets don't require a barrel sprite - OnImpact statuseffect is applied when a projectile hits something - WIP depth charges
This commit is contained in:
@@ -172,6 +172,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
ApplyStatusEffects(ActionType.OnUse, 1.0f);
|
||||
ApplyStatusEffects(ActionType.OnImpact, 1.0f);
|
||||
|
||||
item.body.FarseerBody.OnCollision -= OnProjectileCollision;
|
||||
|
||||
|
||||
@@ -75,8 +75,19 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
IsActive = true;
|
||||
|
||||
barrelSprite = new Sprite(Path.GetDirectoryName(item.Prefab.ConfigFile) + "/" +element.Attribute("barrelsprite").Value,
|
||||
ToolBox.GetAttributeVector2(element, "origin", Vector2.Zero));
|
||||
string barrelSpritePath = ToolBox.GetAttributeString(element, "barrelsprite", "");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(barrelSpritePath))
|
||||
{
|
||||
if (!barrelSpritePath.Contains("/"))
|
||||
{
|
||||
barrelSpritePath = Path.Combine(Path.GetDirectoryName(item.Prefab.ConfigFile), barrelSpritePath);
|
||||
}
|
||||
|
||||
barrelSprite = new Sprite(
|
||||
barrelSpritePath,
|
||||
ToolBox.GetAttributeVector2(element, "origin", Vector2.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing = false)
|
||||
@@ -85,10 +96,13 @@ namespace Barotrauma.Items.Components
|
||||
if (item.Submarine != null) drawPos += item.Submarine.DrawPosition;
|
||||
drawPos.Y = -drawPos.Y;
|
||||
|
||||
barrelSprite.Draw(spriteBatch,
|
||||
drawPos + barrelPos, Color.White,
|
||||
rotation + MathHelper.PiOver2, 1.0f,
|
||||
SpriteEffects.None, item.Sprite.Depth+0.01f);
|
||||
if (barrelSprite!=null)
|
||||
{
|
||||
barrelSprite.Draw(spriteBatch,
|
||||
drawPos + barrelPos, Color.White,
|
||||
rotation + MathHelper.PiOver2, 1.0f,
|
||||
SpriteEffects.None, item.Sprite.Depth+0.01f);
|
||||
}
|
||||
|
||||
if (!editing) return;
|
||||
|
||||
@@ -169,6 +183,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
Item projectile = projectiles[0].Item;
|
||||
|
||||
projectile.Drop();
|
||||
|
||||
projectile.body.ResetDynamics();
|
||||
projectile.body.Enabled = true;
|
||||
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y)), -rotation);
|
||||
@@ -298,7 +314,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
base.RemoveComponentSpecific();
|
||||
|
||||
barrelSprite.Remove();
|
||||
if (barrelSprite != null) barrelSprite.Remove();
|
||||
}
|
||||
|
||||
private List<Projectile> GetLoadedProjectiles(bool returnFirst = false)
|
||||
|
||||
Reference in New Issue
Block a user