Water dustparticle fixes, random variation in background color, submarine is automatically moved to origo when loading, configuring a fabricable item with no material requirements doesn't throw an error, AI characters can't open doors if in handcuffs, engines can be picked through doors

This commit is contained in:
Regalis
2016-02-20 18:24:38 +02:00
parent 8672a47a12
commit 619390ab72
21 changed files with 146 additions and 53 deletions
+3 -3
View File
@@ -610,6 +610,9 @@
<Content Include="Content\Lights\visioncircle.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Map\background2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Map\beaconbackground.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -824,9 +827,6 @@
<Content Include="Content\Map\background.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Map\background2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Map\testroom.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -5,6 +5,7 @@
name="Engine"
linkable="true"
category="Machine"
pickthroughwalls="true"
pickdistance="150">
<Sprite texture ="engine.png" depth="0.8"/>
+5 -4
View File
@@ -46,15 +46,16 @@
<Item name="ID Card"/>
<Item name="Stun Baton"/>
<Item name="Battery Cell"/>
<Item name="Handcuffs"/>
<Item name="Body Armor" equip="true"/>
<Item name="Ballistic Helmet" equip="true"/>
<Item name="Ballistic Helmet" equip="true"/>
</Job>
<Job name="Assistant" description="Assistants don't have any specific responsibilities or areas of expertise. This job is a good choice for newcomers who want to get a hang of working on board the submarine without taking up tasks that they aren't qualified for." allowalways="true">
<Skills>
<Skill name="Weapons" level="0,10"/>
<Skill name="Construction" level="0,10"/>
<Skill name="Electrical Engineering" level="0,10"/>
<Skill name="Weapons" level="20,30"/>
<Skill name="Construction" level="20,30"/>
<Skill name="Electrical Engineering" level="20,30"/>
</Skills>
<Item name="ID Card"/>
<Item name="Wrench"/>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 929 KiB

After

Width:  |  Height:  |  Size: 780 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 KiB

After

Width:  |  Height:  |  Size: 799 KiB

@@ -115,7 +115,7 @@ namespace Barotrauma
return currentTarget-pos2;
}
if (canOpenDoors) CheckDoorsInPath();
if (canOpenDoors && !character.LockHands) CheckDoorsInPath();
float allowedDistance = character.AnimController.InWater ? 1.0f : 0.6f;
if (currentPath.CurrentNode!=null && currentPath.CurrentNode.SimPosition.Y > character.SimPosition.Y+1.0f) allowedDistance*=0.5f;
@@ -199,7 +199,7 @@ namespace Barotrauma
if (nextNode.Waypoint.ConnectedGap.Open > 0.9f) return 0.0f;
if (nextNode.Waypoint.ConnectedGap.ConnectedDoor == null) return 100.0f;
if (!canOpenDoors) return null;
if (!canOpenDoors || character.LockHands) return null;
var doorButtons = nextNode.Waypoint.ConnectedGap.ConnectedDoor.Item.GetConnectedComponents<Controller>();
if (!doorButtons.Any()) return null;
+3 -5
View File
@@ -1063,7 +1063,7 @@ namespace Barotrauma
if (IsNetworkPlayer)
{
Vector2 namePos = new Vector2(pos.X, pos.Y - 80.0f) - GUI.Font.MeasureString(Info.Name) * 0.5f;
Vector2 namePos = new Vector2(pos.X, pos.Y - 120.0f) - GUI.Font.MeasureString(Info.Name) * 0.5f;
spriteBatch.DrawString(GUI.Font, Info.Name, namePos - new Vector2(1.0f, 1.0f), Color.Black);
spriteBatch.DrawString(GUI.Font, Info.Name, namePos, Color.White);
@@ -1081,10 +1081,8 @@ namespace Barotrauma
if (isDead) return;
Vector2 healthBarPos = new Vector2(pos.X - 50, DrawPosition.Y + 100.0f);
GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health/maxHealth, Color.Lerp(Color.Red, Color.Green, health/maxHealth)*0.8f);
GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f);
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
+2 -2
View File
@@ -152,7 +152,7 @@ namespace Barotrauma
return true;
}
public static void DrawLine(SpriteBatch sb, Vector2 start, Vector2 end, Color clr, float depth = 0.0f)
public static void DrawLine(SpriteBatch sb, Vector2 start, Vector2 end, Color clr, float depth = 0.0f, int width = 1)
{
Vector2 edge = end - start;
// calculate angle to rotate line
@@ -163,7 +163,7 @@ namespace Barotrauma
(int)start.X,
(int)start.Y,
(int)edge.Length(), //sb will strech the texture to fill this rectangle
1), //width of line, change this to make thicker line
width), //width of line, change this to make thicker line
null,
clr, //colour of line
angle, //angle of line (calulated above)
+1 -1
View File
@@ -286,7 +286,7 @@ namespace Barotrauma
Character character = Character.Create(characterInfos[i], waypoints[i].WorldPosition);
Character.Controlled = character;
if (!character.Info.StartItemsGiven)
if (character.Info!=null && !character.Info.StartItemsGiven)
{
character.GiveJobItems(waypoints[i]);
character.Info.StartItemsGiven = true;
+10 -4
View File
@@ -165,6 +165,12 @@ namespace Barotrauma.Items.Components
private void UpdateConvexHulls()
{
doorRect = new Rectangle(
item.Rect.Center.X - (int)(doorSprite.size.X / 2),
item.Rect.Y - item.Rect.Height / 2 + (int)(doorSprite.size.Y / 2.0f),
(int)doorSprite.size.X,
(int)doorSprite.size.Y);
Rectangle rect = doorRect;
if (isHorizontal)
{
@@ -221,10 +227,10 @@ namespace Barotrauma.Items.Components
private Vector2[] GetConvexHullCorners(Rectangle rect)
{
Vector2[] corners = new Vector2[4];
corners[0] = new Vector2(rect.X, rect.Y - rect.Height) + Submarine.HiddenSubPosition;
corners[1] = new Vector2(rect.X, rect.Y) + Submarine.HiddenSubPosition;
corners[2] = new Vector2(rect.Right, rect.Y) + Submarine.HiddenSubPosition;
corners[3] = new Vector2(rect.Right, rect.Y - rect.Height) + Submarine.HiddenSubPosition;
corners[0] = new Vector2(rect.X, rect.Y - rect.Height);
corners[1] = new Vector2(rect.X, rect.Y);
corners[2] = new Vector2(rect.Right, rect.Y);
corners[3] = new Vector2(rect.Right, rect.Y - rect.Height);
return corners;
}
@@ -29,11 +29,15 @@ namespace Barotrauma.Items.Components
return;
}
RequiredItems = new List<Tuple<ItemPrefab, int>>();
RequiredTime = ToolBox.GetAttributeFloat(element, "requiredtime", 1.0f);
RequiredItems = new List<Tuple<ItemPrefab, int>>();
string[] requiredItemNames = ToolBox.GetAttributeString(element, "requireditems", "").Split(',');
foreach (string requiredItemName in requiredItemNames)
{
if (string.IsNullOrWhiteSpace(requiredItemName)) continue;
ItemPrefab requiredItem = ItemPrefab.list.Find(ip => ip.Name.ToLower() == requiredItemName.Trim().ToLower()) as ItemPrefab;
if (requiredItem == null)
{
@@ -57,7 +61,6 @@ namespace Barotrauma.Items.Components
}
RequiredTime = ToolBox.GetAttributeFloat(element, "requiredtime", 1.0f);
}
}
+16 -1
View File
@@ -64,6 +64,8 @@ namespace Barotrauma
private List<InterestingPosition> positionsOfInterest;
private Color backgroundColor;
public Vector2 StartPosition
{
get { return startPosition; }
@@ -101,6 +103,11 @@ namespace Barotrauma
private set;
}
public Color BackgroundColor
{
get { return backgroundColor; }
}
public Level(string seed, float difficulty, int width, int height, int siteInterval)
{
this.seed = seed;
@@ -148,6 +155,12 @@ namespace Barotrauma
Rand.SetSyncedSeed(ToolBox.StringToInt(seed));
float brightness = Rand.Range(1.0f, 1.3f, false);
backgroundColor = Color.Lerp(new Color(11, 18, 26), new Color(11, 26, 18), Rand.Range(0.0f, 1.0f, false)) * brightness;
backgroundColor = new Color(backgroundColor, 1.0f);
float minWidth = Submarine.Loaded == null ? 0.0f : Math.Max(Submarine.Borders.Width, Submarine.Borders.Height);
minWidth = Math.Max(minWidth, 3500.0f);
@@ -1049,8 +1062,10 @@ namespace Barotrauma
}
}
public void DrawBack(SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null)
public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null)
{
graphics.Clear(backgroundColor);
if (renderer == null) return;
renderer.DrawBackground(spriteBatch, cam, backgroundSpriteManager);
}
+31 -19
View File
@@ -13,7 +13,7 @@ namespace Barotrauma
private static BasicEffect basicEffect;
private static Sprite background, backgroundTop;
private static Texture2D dustParticles;
private static Sprite dustParticles;
private static Texture2D shaftTexture;
private static BackgroundSpriteManager backgroundSpriteManager;
@@ -33,9 +33,9 @@ namespace Barotrauma
if (background==null)
{
background = new Sprite("Content/Map/background.png", Vector2.Zero);
backgroundTop = new Sprite("Content/Map/background2.png", Vector2.Zero);
dustParticles = Sprite.LoadTexture("Content/Map/dustparticles.png");
background = new Sprite("Content/Map/background2.png", Vector2.Zero);
backgroundTop = new Sprite("Content/Map/background.png", Vector2.Zero);
dustParticles = new Sprite("Content/Map/dustparticles.png", Vector2.Zero);
}
if (basicEffect == null)
@@ -94,17 +94,24 @@ namespace Barotrauma
background.DrawTiled(spriteBatch,
(backgroundPos.Y < 0) ? new Vector2(0.0f, -backgroundPos.Y) : Vector2.Zero,
new Vector2(GameMain.GraphicsWidth, 1024 - backgroundPos.Y),
Vector2.Zero, Color.White);
Vector2.Zero, level.BackgroundColor);
}
if (backgroundPos.Y < 0)
{
backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, 1024, (int)Math.Min(-backgroundPos.Y, 1024));
backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)),
Vector2.Zero, Color.White);
Vector2.Zero, level.BackgroundColor);
}
}
//backgroundPos = new Vector2(cam.WorldView.X, cam.WorldView.Y) + dustOffset;
////if (Level.Loaded != null) backgroundPos -= Level.Loaded.Position;
//Rectangle viewRect = cam.WorldView;
//viewRect.Y = -viewRect.Y;
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.BackToFront,
@@ -116,25 +123,29 @@ namespace Barotrauma
if (backgroundCreatureManager!=null) backgroundCreatureManager.Draw(spriteBatch);
//new Vector2((-offset.X*cam.Zoom) % 1024, (-offset.Y*cam.Zoom) % 1024)
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.BackToFront,
BlendState.AlphaBlend,
SamplerState.LinearWrap);
BlendState.Additive,
SamplerState.LinearWrap, DepthStencilState.Default, null, null,
cam.Transform);
backgroundPos = new Vector2(cam.WorldView.X, cam.WorldView.Y) + dustOffset;
//if (Level.Loaded != null) backgroundPos -= Level.Loaded.Position;
Rectangle viewRect = cam.WorldView;
viewRect.Y = -viewRect.Y;
float multiplier = 0.8f;
for (int i = 1; i < 4; i++)
//float multiplier = 0.9f;
for (int i = 1; i < 2; i++)
{
spriteBatch.Draw(dustParticles, new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsHeight),
new Rectangle((int)((backgroundPos.X * multiplier)), (int)((-backgroundPos.Y * multiplier)), cam.WorldView.Width*2, cam.WorldView.Height*2),
Color.White * multiplier, 0.0f, Vector2.Zero, SpriteEffects.None, 1.0f - multiplier);
multiplier -= 0.1f;
Vector2 offset = new Vector2(cam.WorldView.X, cam.WorldView.Y);// *multiplier;
dustParticles.SourceRect = new Rectangle((int)(offset.X), (int)(-offset.Y), (int)(1024), (int)(1024));
dustParticles.DrawTiled(spriteBatch, new Vector2(cam.WorldView.X, -cam.WorldView.Y),
new Vector2(cam.WorldView.Width, cam.WorldView.Height),
Vector2.Zero, Color.White);
}
spriteBatch.End();
@@ -169,6 +180,7 @@ namespace Barotrauma
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
graphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
graphicsDevice.BlendState = BlendState.AlphaBlend;
graphicsDevice.SetVertexBuffer(bodyVertices);
basicEffect.VertexColorEnabled = true;
+31
View File
@@ -699,6 +699,37 @@ namespace Barotrauma
}
}
Vector2 topLeft = new Vector2(Hull.hullList[0].Rect.X, Hull.hullList[0].Rect.Y);
Vector2 bottomRight = new Vector2(Hull.hullList[0].Rect.X, Hull.hullList[0].Rect.Y);
foreach (Hull hull in Hull.hullList)
{
if (hull.Rect.X < topLeft.X) topLeft.X = hull.Rect.X;
if (hull.Rect.Y > topLeft.Y) topLeft.Y = hull.Rect.Y;
if (hull.Rect.Right > bottomRight.X) bottomRight.X = hull.Rect.Right;
if (hull.Rect.Y - hull.Rect.Height < bottomRight.Y) bottomRight.Y = hull.Rect.Y - hull.Rect.Height;
}
Vector2 center = (topLeft + bottomRight) / 2.0f;
foreach (Item item in Item.ItemList)
{
var wire = item.GetComponent<Items.Components.Wire>();
if (wire == null) continue;
for (int i = 0; i < wire.Nodes.Count; i++)
{
wire.Nodes[i] -= center;
}
}
for (int i = 0; i < MapEntity.mapEntityList.Count; i++)
{
if (MapEntity.mapEntityList[i].Submarine == null) continue;
MapEntity.mapEntityList[i].Move(-center);
}
subBody = new SubmarineBody(this);
subBody.SetPosition(HiddenSubPosition);
+2 -2
View File
@@ -1305,7 +1305,7 @@ namespace Barotrauma.Networking
List<Client> recipients = new List<Client>();
Client targetClient = null;
if (type==ChatMessageType.Server)
if (type == ChatMessageType.Server)
{
string command = GetChatMessageCommand(message).ToLower();
@@ -1363,7 +1363,7 @@ namespace Barotrauma.Networking
{
foreach (Client c in ConnectedClients)
{
if (type != ChatMessageType.Dead || (c.Character != null && c.Character.IsDead)) recipients.Add(c);
if (type != ChatMessageType.Dead || (c.Character == null || c.Character.IsDead)) recipients.Add(c);
}
}
+8 -2
View File
@@ -578,7 +578,12 @@ namespace Barotrauma
cam.Transform);
graphics.Clear(new Color(0.051f, 0.149f, 0.271f, 1.0f));
if (GameMain.DebugDraw)
{
GUI.DrawLine(spriteBatch, new Vector2(0.0f, -cam.WorldView.Y), new Vector2(0.0f, -(cam.WorldView.Y - cam.WorldView.Height)), Color.White*0.5f, 1.0f, (int)(2.0f/cam.Zoom));
GUI.DrawLine(spriteBatch, new Vector2(cam.WorldView.X, -Submarine.HiddenSubPosition.Y), new Vector2(cam.WorldView.Right, -Submarine.HiddenSubPosition.Y), Color.White * 0.5f, 1.0f, (int)(2.0f / cam.Zoom));
}
Submarine.Draw(spriteBatch, true);
if (!characterMode)
@@ -587,7 +592,8 @@ namespace Barotrauma
MapEntity.DrawSelecting(spriteBatch, cam);
}
spriteBatch.End();
//-------------------- HUD -----------------------------
+9 -2
View File
@@ -226,9 +226,16 @@ namespace Barotrauma
//----------------------------------------------------------------------------------------
graphics.SetRenderTarget(renderTarget);
graphics.Clear(new Color(11, 18, 26, 255));
if (Level.Loaded == null)
{
graphics.Clear(new Color(11, 18, 26, 255));
if (Level.Loaded != null) Level.Loaded.DrawBack(spriteBatch, cam, BackgroundCreatureManager);
}
else
{
Level.Loaded.DrawBack(graphics, spriteBatch, cam, BackgroundCreatureManager);
}
spriteBatch.Begin(SpriteSortMode.BackToFront,
+2 -4
View File
@@ -31,8 +31,6 @@ namespace Barotrauma
{
menuTabs = new GUIFrame[Enum.GetValues(typeof(Tab)).Length+1];
buttonsTab = new GUIFrame(new Rectangle(0,0,0,0), Color.Transparent, Alignment.Left | Alignment.CenterY);
buttonsTab.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
//menuTabs[(int)Tabs.Main].Padding = GUI.style.smallPadding;
@@ -105,14 +103,14 @@ namespace Barotrauma
}
if (Submarine.SavedSubmarines.Count > 0) mapList.Select(Submarine.SavedSubmarines[0]);
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 20), 0, 100, 20),
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 30), 0, 100, 20),
"Save name: ", GUI.Style, Alignment.Left, Alignment.Left, menuTabs[(int)Tab.NewGame]);
saveNameBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 20), 30, 180, 20),
Alignment.TopLeft, GUI.Style, menuTabs[(int)Tab.NewGame]);
saveNameBox.Text = SaveUtil.CreateSavePath();
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 20), 60, 100, 20),
new GUITextBlock(new Rectangle((int)(mapList.Rect.Width + 30), 60, 100, 20),
"Map Seed: ", GUI.Style, Alignment.Left, Alignment.Left, menuTabs[(int)Tab.NewGame]);
seedBox = new GUITextBox(new Rectangle((int)(mapList.Rect.Width + 20), 90, 180, 20),
+15
View File
@@ -1,3 +1,18 @@
---------------------------------------------------------------------------------------------------------
v0.3.3.0
---------------------------------------------------------------------------------------------------------
- more visible indicators when taking damage, running out of oxygen or being crushed by pressure
- handcuffs
- changes in the welding/cutting targeting logic: it's now possible to target "corners" of the hull
even if the section of the wall is obstructed by adjacent walls
- fixed submarines spawning in a wrong position (e.g. inside walls) if the submarine has been built
far away from the coordinates (0,0)
- fixed a memory leak caused by item sprites
- character/inventory syncing bugfixes
- fixed spectators not seeing their own chat messages
- scrollable list of clients in the network statistics view
---------------------------------------------------------------------------------------------------------
v0.3.2.6
---------------------------------------------------------------------------------------------------------
Binary file not shown.