Navigation requires power, locationtypes and missions included in content packages

This commit is contained in:
Regalis
2016-02-18 22:04:47 +02:00
parent cd4e3a3d2a
commit 9e11134bd3
10 changed files with 50 additions and 29 deletions
+1 -1
View File
@@ -29,7 +29,7 @@
<Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="0,0,64,128"/> <Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="0,0,64,128"/>
<Steering minvoltage="0.5" canbeselected = "true"> <Steering minvoltage="0.5" canbeselected = "true" powerconsumption="10">
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" color="0.0,0.0,0.0,0.6"/> <GuiFrame rect="0,0,0.5,0.5" alignment="Center" color="0.0,0.0,0.0,0.6"/>
</Steering> </Steering>
@@ -36,6 +36,8 @@
<Character file="Content/Characters/Watcher/watcher.xml" /> <Character file="Content/Characters/Watcher/watcher.xml" />
<Structure file="Content/Map/StructurePrefabs.xml" /> <Structure file="Content/Map/StructurePrefabs.xml" />
<RandomEvents file="Content/randomevents.xml" /> <RandomEvents file="Content/randomevents.xml" />
<LocationTypes file="Content/Map/locationTypes.xml" />
<Missions file="Content/Missions.xml" />
<Jobs file="Content/Jobs.xml" /> <Jobs file="Content/Jobs.xml" />
<Executable file="Barotrauma.exe" /> <Executable file="Barotrauma.exe" />
</contentpackage> </contentpackage>
+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.2.5")] [assembly: AssemblyVersion("0.3.2.6")]
[assembly: AssemblyFileVersion("0.3.2.5")] [assembly: AssemblyFileVersion("0.3.2.6")]
+1 -1
View File
@@ -10,7 +10,7 @@ namespace Barotrauma
{ {
public enum ContentType public enum ContentType
{ {
None, Jobs, Item, Character, Structure, Executable, RandomEvents None, Jobs, Item, Character, Structure, Executable, LocationTypes, RandomEvents, Missions
} }
public class ContentPackage public class ContentPackage
+4 -3
View File
@@ -10,9 +10,7 @@ namespace Barotrauma
class Mission class Mission
{ {
private static List<Mission> list = new List<Mission>(); private static List<Mission> list = new List<Mission>();
private static string configFile = "Content/Missions.xml";
private string name; private string name;
private string description; private string description;
@@ -96,6 +94,9 @@ namespace Barotrauma
public static Mission LoadRandom(Location[] locations, Random rand) public static Mission LoadRandom(Location[] locations, Random rand)
{ {
var files = GameMain.SelectedPackage.GetFilesOfType(ContentType.Missions);
string configFile = files[rand.Next(files.Count)];
XDocument doc = ToolBox.TryLoadXml(configFile); XDocument doc = ToolBox.TryLoadXml(configFile);
if (doc == null) return null; if (doc == null) return null;
+1 -1
View File
@@ -253,7 +253,7 @@ namespace Barotrauma
ParticleManager = new ParticleManager("Content/Particles/ParticlePrefabs.xml", Cam); ParticleManager = new ParticleManager("Content/Particles/ParticlePrefabs.xml", Cam);
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
LocationType.Init("Content/Map/locationTypes.xml"); LocationType.Init();
MainMenuScreen.Select(); MainMenuScreen.Select();
TitleScreen.LoadState = 100.0f; TitleScreen.LoadState = 100.0f;
@@ -117,18 +117,10 @@ namespace Barotrauma.Items.Components
{ {
//base.Update(deltaTime, cam); //base.Update(deltaTime, cam);
//if (voltage < minVoltage) return; if (voltage < minVoltage) return;
if (autoPilot) if (autoPilot)
{ {
//if (steeringPath==null)
//{
// PathFinder pathFinder = new PathFinder(WayPoint.WayPointList, false);
// steeringPath = pathFinder.FindPath(
// ConvertUnits.ToSimUnits(Level.Loaded.StartPosition),
// ConvertUnits.ToSimUnits(Level.Loaded.EndPosition));
//}
UpdateAutoPilot(deltaTime); UpdateAutoPilot(deltaTime);
} }
else if (valueChanged) else if (valueChanged)
@@ -149,6 +141,9 @@ namespace Barotrauma.Items.Components
targetLevel += (neutralBallastLevel - 0.5f) * 100.0f; targetLevel += (neutralBallastLevel - 0.5f) * 100.0f;
item.SendSignal(targetLevel.ToString(CultureInfo.InvariantCulture), "velocity_y_out"); item.SendSignal(targetLevel.ToString(CultureInfo.InvariantCulture), "velocity_y_out");
voltage -= deltaTime;
} }
public override void DrawHUD(SpriteBatch spriteBatch, Character character) public override void DrawHUD(SpriteBatch spriteBatch, Character character)
@@ -162,13 +157,15 @@ namespace Barotrauma.Items.Components
GuiFrame.Update(1.0f / 60.0f); GuiFrame.Update(1.0f / 60.0f);
GuiFrame.Draw(spriteBatch); GuiFrame.Draw(spriteBatch);
if (voltage < minVoltage) return;
Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40); Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40);
//GUI.DrawRectangle(spriteBatch, velRect, Color.White, false); //GUI.DrawRectangle(spriteBatch, velRect, Color.White, false);
if (Submarine.Loaded != null && Level.Loaded != null) if (Submarine.Loaded != null && Level.Loaded != null)
{ {
Vector2 realWorldVelocity = ConvertUnits.ToDisplayUnits(Submarine.Loaded.Velocity * Physics.DisplayToRealWorldRatio) * 3.6f; Vector2 realWorldVelocity = ConvertUnits.ToDisplayUnits(Submarine.Loaded.Velocity * Physics.DisplayToRealWorldRatio) * 3.6f;
float realWorldDepth = (Submarine.Loaded.Position.Y - Level.Loaded.Size.Y) *Physics.DisplayToRealWorldRatio; float realWorldDepth = Math.Abs(Submarine.Loaded.Position.Y - Level.Loaded.Size.Y) * Physics.DisplayToRealWorldRatio;
GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 65), GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 65),
"Velocity: " + (int)realWorldVelocity.X + " km/h", Color.LightGreen, null, 0, GUI.SmallFont); "Velocity: " + (int)realWorldVelocity.X + " km/h", Color.LightGreen, null, 0, GUI.SmallFont);
GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 50), GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 50),
@@ -306,7 +303,11 @@ namespace Barotrauma.Items.Components
if (connection.Name == "velocity_in") if (connection.Name == "velocity_in")
{ {
currVelocity = ToolBox.ParseToVector2(signal, false); currVelocity = ToolBox.ParseToVector2(signal, false);
} }
else
{
base.ReceiveSignal(signal, connection, sender, power);
}
} }
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message) public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
+16 -10
View File
@@ -127,20 +127,26 @@ namespace Barotrauma
return null; return null;
} }
public static void Init(string file) public static void Init()
{ {
XDocument doc = ToolBox.TryLoadXml(file); var locationTypeFiles = GameMain.SelectedPackage.GetFilesOfType(ContentType.LocationTypes);
if (doc==null) foreach (string file in locationTypeFiles)
{ {
return; XDocument doc = ToolBox.TryLoadXml(file);
if (doc==null)
{
return;
}
foreach (XElement element in doc.Root.Elements())
{
LocationType locationType = new LocationType(element);
list.Add(locationType);
}
} }
foreach (XElement element in doc.Root.Elements())
{
LocationType locationType = new LocationType(element);
list.Add(locationType);
}
} }
} }
} }
+11
View File
@@ -1,3 +1,14 @@
---------------------------------------------------------------------------------------------------------
v0.3.2.6
---------------------------------------------------------------------------------------------------------
- fixed the broken password box
- location types and missions are included in content packages
- junction boxes and power sources can be connected with multiple parallel wires without multiplying
the power output
-
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.3.2.5 v0.3.2.5
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
Binary file not shown.