Fuel rods can't be turned back to uranium/incendium if they've already been used, fixed level generation breaking with smaller subs

This commit is contained in:
Regalis
2016-02-13 13:09:27 +02:00
parent 1506738ff7
commit 08f1d05507
9 changed files with 52 additions and 15 deletions

View File

@@ -59,7 +59,7 @@
<Deconstruct time="10">
<Item name="Steel Bar"/>
<Item name="Uranium Bar"/>
<Item name="Uranium Bar" requirefullcondition="true"/>
</Deconstruct>
<Sprite texture ="fuelrod.png"/>
@@ -78,7 +78,7 @@
<Deconstruct time="10">
<Item name="Steel Bar"/>
<Item name="Incendium Bar"/>
<Item name="Incendium Bar" requirefullcondition="true"/>
</Deconstruct>
<Sprite texture ="fuelrod.png"/>

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.1.3")]
[assembly: AssemblyFileVersion("0.3.1.3")]
[assembly: AssemblyVersion("0.3.1.5")]
[assembly: AssemblyFileVersion("0.3.1.5")]

View File

@@ -58,9 +58,11 @@ namespace Barotrauma.Items.Components
return;
}
foreach (string deconstructProduct in targetItem.Prefab.DeconstructItems)
foreach (DeconstructItem deconstructProduct in targetItem.Prefab.DeconstructItems)
{
var itemPrefab = ItemPrefab.list.FirstOrDefault(ip => ip.Name.ToLower() == deconstructProduct.ToLower()) as ItemPrefab;
if (deconstructProduct.RequireFullCondition && targetItem.Condition < 100.0f) continue;
var itemPrefab = ItemPrefab.list.FirstOrDefault(ip => ip.Name.ToLower() == deconstructProduct.ItemPrefabName.ToLower()) as ItemPrefab;
if (itemPrefab==null)
{
DebugConsole.ThrowError("Tried to deconstruct item ''"+targetItem.Name+"'' but couldn't find item prefab ''"+deconstructProduct+"''!");

View File

@@ -9,6 +9,18 @@ using Microsoft.Xna.Framework.Input;
namespace Barotrauma
{
struct DeconstructItem
{
public readonly string ItemPrefabName;
public readonly bool RequireFullCondition;
public DeconstructItem(string itemPrefabName, bool requireFullCondition)
{
ItemPrefabName = itemPrefabName;
RequireFullCondition = requireFullCondition;
}
}
class ItemPrefab : MapEntityPrefab
{
//static string contentFolder = "Content/Items/";
@@ -38,7 +50,7 @@ namespace Barotrauma
get { return configFile; }
}
public List<string> DeconstructItems
public List<DeconstructItem> DeconstructItems
{
get;
private set;
@@ -216,7 +228,7 @@ namespace Barotrauma
Triggers = new List<Rectangle>();
DeconstructItems = new List<string>();
DeconstructItems = new List<DeconstructItem>();
DeconstructTime = 1.0f;
foreach (XElement subElement in element.Elements())
@@ -238,7 +250,12 @@ namespace Barotrauma
foreach (XElement deconstructItem in subElement.Elements())
{
DeconstructItems.Add(ToolBox.GetAttributeString(deconstructItem, "name", "not found"));
string deconstructItemName = ToolBox.GetAttributeString(deconstructItem, "name", "not found");
bool requireFullCondition = ToolBox.GetAttributeBool(deconstructItem, "requirefullcondition", false);
DeconstructItems.Add(new DeconstructItem(deconstructItemName, requireFullCondition));
}
break;

View File

@@ -148,13 +148,12 @@ namespace Barotrauma
Rand.SetSyncedSeed(ToolBox.StringToInt(seed));
float minWidth = Submarine.Loaded == null ? 3000.0f : Math.Max(Submarine.Borders.Width, Submarine.Borders.Height);
float minWidth = Submarine.Loaded == null ? 0.0f : Math.Max(Submarine.Borders.Width, Submarine.Borders.Height);
minWidth = Math.Max(minWidth, 3500.0f);
startPosition = new Vector2((int)minWidth * 2, Rand.Range((int)minWidth * 2, borders.Height - (int)minWidth * 2, false));
endPosition = new Vector2(borders.Width - (int)minWidth * 2, Rand.Range((int)minWidth * 2, borders.Height - (int)minWidth * 2, false));
List<Vector2> pathNodes = new List<Vector2>();
Rectangle pathBorders = borders;// new Rectangle((int)minWidth, (int)minWidth, borders.Width - (int)minWidth * 2, borders.Height - (int)minWidth);
pathBorders.Inflate(-minWidth*2, -minWidth*2);
@@ -871,7 +870,10 @@ namespace Barotrauma
#if DEBUG
DebugConsole.ThrowError("Invalid right normal");
#endif
GameMain.World.RemoveBody(cell.body);
cell.body = null;
leftNormal = Vector2.UnitX;
break;
}
@@ -891,7 +893,10 @@ namespace Barotrauma
#if DEBUG
DebugConsole.ThrowError("Invalid right normal");
#endif
GameMain.World.RemoveBody(cell.body);
cell.body = null;
rightNormal = Vector2.UnitX;
break;
}

View File

@@ -602,7 +602,7 @@ namespace Barotrauma.Networking
gameStarted = true;
endRoundButton.Visible = Voting.AllowEndVoting;
endRoundButton.Visible = Voting.AllowEndVoting && myCharacter != null;
GameMain.GameScreen.Select();

View File

@@ -85,7 +85,7 @@ namespace Barotrauma.Networking
get { return allowSpectating; }
}
public float EndVoteRequiredRatio;
public float EndVoteRequiredRatio = 0.5f;
private void CreateSettingsFrame()
{

View File

@@ -1,3 +1,16 @@
---------------------------------------------------------------------------------------------------------
v0.3.1.5
---------------------------------------------------------------------------------------------------------
- fixed projectiles/weapons not colliding with characters
---------------------------------------------------------------------------------------------------------
v0.3.1.4
---------------------------------------------------------------------------------------------------------
- fixed items ''floating'' in some of the custom subs
- fuel rods can't be turned back to uranium/incendium bars if they've been used
---------------------------------------------------------------------------------------------------------
v0.3.1.3
---------------------------------------------------------------------------------------------------------

Binary file not shown.