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
@@ -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+"''!");
+20 -3
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;
+9 -4
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;
}
+1 -1
View File
@@ -602,7 +602,7 @@ namespace Barotrauma.Networking
gameStarted = true;
endRoundButton.Visible = Voting.AllowEndVoting;
endRoundButton.Visible = Voting.AllowEndVoting && myCharacter != null;
GameMain.GameScreen.Select();
@@ -85,7 +85,7 @@ namespace Barotrauma.Networking
get { return allowSpectating; }
}
public float EndVoteRequiredRatio;
public float EndVoteRequiredRatio = 0.5f;
private void CreateSettingsFrame()
{