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
+2 -2
View File
@@ -59,7 +59,7 @@
<Deconstruct time="10"> <Deconstruct time="10">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
<Item name="Uranium Bar"/> <Item name="Uranium Bar" requirefullcondition="true"/>
</Deconstruct> </Deconstruct>
<Sprite texture ="fuelrod.png"/> <Sprite texture ="fuelrod.png"/>
@@ -78,7 +78,7 @@
<Deconstruct time="10"> <Deconstruct time="10">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
<Item name="Incendium Bar"/> <Item name="Incendium Bar" requirefullcondition="true"/>
</Deconstruct> </Deconstruct>
<Sprite texture ="fuelrod.png"/> <Sprite texture ="fuelrod.png"/>
+2 -2
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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.1.3")] [assembly: AssemblyVersion("0.3.1.5")]
[assembly: AssemblyFileVersion("0.3.1.3")] [assembly: AssemblyFileVersion("0.3.1.5")]
@@ -58,9 +58,11 @@ namespace Barotrauma.Items.Components
return; 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) if (itemPrefab==null)
{ {
DebugConsole.ThrowError("Tried to deconstruct item ''"+targetItem.Name+"'' but couldn't find item prefab ''"+deconstructProduct+"''!"); 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 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 class ItemPrefab : MapEntityPrefab
{ {
//static string contentFolder = "Content/Items/"; //static string contentFolder = "Content/Items/";
@@ -38,7 +50,7 @@ namespace Barotrauma
get { return configFile; } get { return configFile; }
} }
public List<string> DeconstructItems public List<DeconstructItem> DeconstructItems
{ {
get; get;
private set; private set;
@@ -216,7 +228,7 @@ namespace Barotrauma
Triggers = new List<Rectangle>(); Triggers = new List<Rectangle>();
DeconstructItems = new List<string>(); DeconstructItems = new List<DeconstructItem>();
DeconstructTime = 1.0f; DeconstructTime = 1.0f;
foreach (XElement subElement in element.Elements()) foreach (XElement subElement in element.Elements())
@@ -238,7 +250,12 @@ namespace Barotrauma
foreach (XElement deconstructItem in subElement.Elements()) 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; break;
+9 -4
View File
@@ -148,13 +148,12 @@ namespace Barotrauma
Rand.SetSyncedSeed(ToolBox.StringToInt(seed)); 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)); 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)); 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>(); List<Vector2> pathNodes = new List<Vector2>();
Rectangle pathBorders = borders;// new Rectangle((int)minWidth, (int)minWidth, borders.Width - (int)minWidth * 2, borders.Height - (int)minWidth); Rectangle pathBorders = borders;// new Rectangle((int)minWidth, (int)minWidth, borders.Width - (int)minWidth * 2, borders.Height - (int)minWidth);
pathBorders.Inflate(-minWidth*2, -minWidth*2); pathBorders.Inflate(-minWidth*2, -minWidth*2);
@@ -871,7 +870,10 @@ namespace Barotrauma
#if DEBUG #if DEBUG
DebugConsole.ThrowError("Invalid right normal"); DebugConsole.ThrowError("Invalid right normal");
#endif #endif
GameMain.World.RemoveBody(cell.body);
cell.body = null;
leftNormal = Vector2.UnitX; leftNormal = Vector2.UnitX;
break;
} }
@@ -891,7 +893,10 @@ namespace Barotrauma
#if DEBUG #if DEBUG
DebugConsole.ThrowError("Invalid right normal"); DebugConsole.ThrowError("Invalid right normal");
#endif #endif
GameMain.World.RemoveBody(cell.body);
cell.body = null;
rightNormal = Vector2.UnitX; rightNormal = Vector2.UnitX;
break;
} }
+1 -1
View File
@@ -602,7 +602,7 @@ namespace Barotrauma.Networking
gameStarted = true; gameStarted = true;
endRoundButton.Visible = Voting.AllowEndVoting; endRoundButton.Visible = Voting.AllowEndVoting && myCharacter != null;
GameMain.GameScreen.Select(); GameMain.GameScreen.Select();
@@ -85,7 +85,7 @@ namespace Barotrauma.Networking
get { return allowSpectating; } get { return allowSpectating; }
} }
public float EndVoteRequiredRatio; public float EndVoteRequiredRatio = 0.5f;
private void CreateSettingsFrame() private void CreateSettingsFrame()
{ {
+13
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 v0.3.1.3
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
Binary file not shown.