Endworm & moloch immune to bleeding, showing right sub name in save file info, disable charactermode before saving, option to end round when the end of the level is reached, maintain position option in steering

This commit is contained in:
Regalis
2016-02-01 22:21:26 +02:00
parent 91a0033025
commit 14ee39e59a
20 changed files with 257 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<Character name ="endworm" humanoid="false" health="10000.0">
<Character name ="endworm" humanoid="false" health="10000.0" doesbleed="false">
<sound file="Content/Characters/Endworm/endwormidle.ogg" state="None" range="8000" />
<sound file="Content/Characters/Endworm/endwormattack1.ogg" state="Attack" range="8000" />

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<Character name ="moloch" humanoid="false" health ="1000">
<Character name="moloch" humanoid="false" health="1000" doesbleed="false">
<sound file="Content/Characters/Moloch/attack1.ogg" state="Attack" range="3000"/>
<sound file="Content/Characters/Moloch/attack2.ogg" state="Attack" range="3000"/>

View File

@@ -8,6 +8,11 @@
<Sprite texture ="button.png" depth="0.8"/>
<Deconstruct time="10">
<Item name="Polycarbonate Bar"/>
<Item name="FPGA Circuit"/>
</Deconstruct>
<Body width="32" height="32"/>
<Controller userpos="0" direction ="None" canbepicked = "true" msg="Open [E]">

View File

@@ -7,6 +7,10 @@
pickdistance="150"
price="50">
<Deconstruct time="10">
<Item name="Steel Bar"/>
</Deconstruct>
<Sprite texture ="oxygentank.png" depth="0.5"/>
<Body radius="6" height="22" density="5"/>
@@ -26,6 +30,10 @@
price="50"
description="Small enough to carry around in case of need, but won't protect you from the water pressure in the event of a full-blown hull breach.">
<Deconstruct time="10">
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture ="DivingMask.png" depth="0.5"/>
<Body radius="18" density="5"/>
@@ -101,6 +109,12 @@
price="50"
description="A battery-powered underwater propulsion device.">
<Deconstruct time="20">
<Item name="Steel Bar"/>
<Item name="Copper Bar"/>
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture ="DivingSuit.png" depth="0.5" sourcerect="22,98,59,32" origin="0.6,0.66"/>
<Body width="55" height="30" density="5"/>

View File

@@ -10,6 +10,11 @@
<Sprite texture ="tools.png" sourcerect="0,17,41,17" depth="0.5"/>
<Deconstruct time="10">
<Item name="Polycarbonate Bar"/>
<Item name="Steel Bar"/>
</Deconstruct>
<!-- physics body -->
<Body width="41" height="17" density="5"/>
@@ -56,6 +61,11 @@
price="100"
description="Cuts through various materials using a jet of ionized oxygen.">
<Deconstruct time="10">
<Item name="Polycarbonate Bar"/>
<Item name="Steel Bar"/>
</Deconstruct>
<Sprite texture ="tools.png" sourcerect="0,0,41,16" depth="0.5"/>
<Body width="41" height="16" density="5"/>
@@ -94,6 +104,10 @@
pickdistance="150"
price="50">
<Deconstruct time="10">
<Item name="Steel Bar"/>
</Deconstruct>
<Sprite texture ="fueltank.png" depth="0.5"/>
<Body radius="6" height="22" density="5"/>
@@ -113,6 +127,11 @@
price="100"
description="A handheld carbon dioxide extinguisher.">
<Deconstruct time="10">
<Item name="Polycarbonate Bar"/>
<Item name="Steel Bar"/>
</Deconstruct>
<Sprite texture ="extinguisher.png" depth="0.5" sourcerect="0,0,34,64" origin="0.4,0.5"/>
<Body radius="10" height="45" density="5"/>
@@ -135,7 +154,7 @@
Tags="smallitem"
pickdistance="200"
price="10">
<Sprite texture ="tools.png" sourcerect="0,58,31,6" depth="0.5"/>
<Body width="31" height="6" density="20"/>

View File

@@ -315,7 +315,7 @@ namespace Barotrauma
//the collision is ignored if the lowest limb is under the platform
if (lowestLimb==null || lowestLimb.Position.Y < structure.Rect.Y) return false;
}
else if (structure.StairDirection!=Direction.None && lowestLimb != null)
else if (structure.StairDirection != Direction.None && lowestLimb != null)
{
float stairPosY = structure.StairDirection == Direction.Right ?
lowestLimb.Position.X - structure.Rect.X : structure.Rect.Width - (lowestLimb.Position.X - structure.Rect.X);

View File

@@ -253,6 +253,12 @@ namespace Barotrauma
}
}
public bool DoesBleed
{
get;
private set;
}
public float PressureTimer
{
@@ -402,6 +408,8 @@ namespace Barotrauma
maxHealth = ToolBox.GetAttributeFloat(doc.Root, "health", 100.0f);
health = maxHealth;
DoesBleed = ToolBox.GetAttributeBool(doc.Root, "doesbleed", true);
needsAir = ToolBox.GetAttributeBool(doc.Root, "needsair", false);
drowningTime = ToolBox.GetAttributeFloat(doc.Root, "drowningtime", 10.0f);
@@ -958,7 +966,7 @@ namespace Barotrauma
PressureProtection -= deltaTime*100.0f;
}
Health -= bleeding;
Health -= bleeding*deltaTime;
if (health <= 0.0f) Kill(CauseOfDeath.Bloodloss, false);
}
@@ -1093,9 +1101,11 @@ namespace Barotrauma
//health -= attackResult.Damage;
//if (health <= 0.0f && damageType == DamageType.Burn) Kill(CauseOfDeath.Burn);
Bleeding += attackResult.Bleeding;
if (DoesBleed)
{
Bleeding += attackResult.Bleeding;
}
return attackResult;
}

View File

@@ -359,6 +359,11 @@ namespace Barotrauma
case "save":
if (commands.Length < 2) break;
if (GameMain.EditMapScreen.CharacterMode)
{
GameMain.EditMapScreen.ToggleCharacterMode();
}
string fileName = string.Join(" ", commands.Skip(1));
if (fileName.Contains("../"))
{
@@ -369,7 +374,7 @@ namespace Barotrauma
if (WayPoint.WayPointList.Find(wp => !wp.MoveWithLevel && wp.SpawnType == SpawnType.Path)==null)
{
DebugConsole.ThrowError("No waypoints found in the submarine. Did you forget to generate the waypoints?");
DebugConsole.ThrowError("No waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints.");
}
if (WayPoint.WayPointList.Find(wp => wp.SpawnType == SpawnType.Cargo) == null)

View File

@@ -10,10 +10,10 @@ namespace Barotrauma
{
private static string configFile = "Content/randomevents.xml";
const int MaxPreviousEvents = 6;
const float PreviouslyUsedWeight = 10.0f;
//const int MaxPreviousEvents = 6;
//const float PreviouslyUsedWeight = 10.0f;
static List<int> previousEvents = new List<int>();
//static List<int> previousEvents = new List<int>();
protected string name;
protected string description;
@@ -109,16 +109,16 @@ namespace Barotrauma
eventProbability[i] = ToolBox.GetAttributeInt(element, "commonness", 1);
//if the event has been previously selected, it's less likely to be selected now
int previousEventIndex = previousEvents.FindIndex(x => x == i);
if (previousEventIndex >= 0)
{
//how many shifts ago was the event last selected
int eventDist = eventCount - previousEventIndex;
//int previousEventIndex = previousEvents.FindIndex(x => x == i);
//if (previousEventIndex >= 0)
//{
// //how many shifts ago was the event last selected
// int eventDist = eventCount - previousEventIndex;
float weighting = (1.0f / eventDist) * PreviouslyUsedWeight;
// float weighting = (1.0f / eventDist) * PreviouslyUsedWeight;
eventProbability[i] *= weighting;
}
// eventProbability[i] *= weighting;
//}
probabilitySum += eventProbability[i];
@@ -153,7 +153,7 @@ namespace Barotrauma
ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement) });
object instance = constructor.Invoke(new object[] { element });
previousEvents.Add(i);
//previousEvents.Add(i);
return (ScriptedEvent)instance;
}

View File

@@ -78,15 +78,14 @@ namespace Barotrauma
this.submarine = submarine;
}
public GameSession(Submarine selectedSub, string saveFile, string filePath)
public GameSession(Submarine selectedSub, string saveFile, XDocument doc)
: this(selectedSub, saveFile)
{
GameMain.GameSession = this;
CrewManager = new CrewManager();
XDocument doc = ToolBox.TryLoadXml(filePath);
if (doc == null) return;
selectedSub.Name = ToolBox.GetAttributeString(doc.Root, "submarine", selectedSub.Name);
foreach (XElement subElement in doc.Root.Elements())
{

View File

@@ -17,8 +17,12 @@ namespace Barotrauma.Items.Components
private Vector2 currVelocity;
private Vector2 targetVelocity;
private GUITickBox maintainPosTickBox;
private bool autoPilot;
private Vector2? posToMaintain;
private SteeringPath steeringPath;
private PathFinder pathFinder;
@@ -39,6 +43,9 @@ namespace Barotrauma.Items.Components
autoPilot = value;
maintainPosTickBox.Enabled = autoPilot;
if (autoPilot)
{
if (pathFinder==null) pathFinder = new PathFinder(WayPoint.WayPointList, false);
@@ -46,6 +53,11 @@ namespace Barotrauma.Items.Components
ConvertUnits.ToSimUnits(item.WorldPosition),
ConvertUnits.ToSimUnits(Level.Loaded.EndPosition));
}
else
{
maintainPosTickBox.Selected = false;
posToMaintain = null;
}
}
}
@@ -87,7 +99,6 @@ namespace Barotrauma.Items.Components
IsActive = true;
var tickBox = new GUITickBox(new Rectangle(0,25,20,20), "Autopilot", Alignment.TopLeft, GuiFrame);
tickBox.OnSelected = (GUITickBox box) =>
{
AutoPilot = box.Selected;
@@ -95,6 +106,10 @@ namespace Barotrauma.Items.Components
return true;
};
maintainPosTickBox = new GUITickBox(new Rectangle(0, 50, 20, 20), "Maintain position", Alignment.TopLeft, GuiFrame);
maintainPosTickBox.Enabled = false;
maintainPosTickBox.OnSelected = ToggleMaintainPosition;
}
public override void Update(float deltaTime, Camera cam)
@@ -179,47 +194,95 @@ namespace Barotrauma.Items.Components
private void UpdateAutoPilot(float deltaTime)
{
autopilotRayCastTimer -= deltaTime;
steeringPath.CheckProgress(ConvertUnits.ToSimUnits(item.WorldPosition), 10.0f);
if (autopilotRayCastTimer<=0.0f && steeringPath.NextNode != null)
if (posToMaintain==null)
{
Vector2 diff = ConvertUnits.ToSimUnits(steeringPath.NextNode.Position - item.WorldPosition);
bool nextVisible = true;
for (int x = -1; x < 2; x += 2)
autopilotRayCastTimer -= deltaTime;
steeringPath.CheckProgress(ConvertUnits.ToSimUnits(item.WorldPosition), 10.0f);
if (autopilotRayCastTimer<=0.0f && steeringPath.NextNode != null)
{
for (int y = -1; y < 2; y += 2)
Vector2 diff = Vector2.Normalize(ConvertUnits.ToSimUnits(steeringPath.NextNode.Position - Submarine.Loaded.WorldPosition));
bool nextVisible = true;
for (int x = -1; x < 2; x += 2)
{
Vector2 cornerPos =
new Vector2(Submarine.Borders.Width * x, Submarine.Borders.Height * y) / 2.0f;
for (int y = -1; y < 2; y += 2)
{
Vector2 cornerPos =
new Vector2(Submarine.Borders.Width * x, Submarine.Borders.Height * y) / 2.0f;
cornerPos = ConvertUnits.ToSimUnits(cornerPos * 1.2f + Submarine.Loaded.Position);
cornerPos = ConvertUnits.ToSimUnits(cornerPos * 1.2f + Submarine.Loaded.WorldPosition);
if (Submarine.PickBody(cornerPos, cornerPos + diff, null, Physics.CollisionLevel) == null) continue;
float dist = Vector2.Distance(cornerPos, steeringPath.NextNode.SimPosition);
nextVisible = false;
x = 2;
y = 2;
if (Submarine.PickBody(cornerPos, cornerPos + diff*dist, null, Physics.CollisionLevel) == null) continue;
nextVisible = false;
x = 2;
y = 2;
}
}
if (nextVisible) steeringPath.SkipToNextNode();
autopilotRayCastTimer = AutopilotRayCastInterval;
}
if (nextVisible) steeringPath.SkipToNextNode();
autopilotRayCastTimer = AutopilotRayCastInterval;
if (steeringPath.CurrentNode != null)
{
SteerTowardsPosition(steeringPath.CurrentNode.WorldPosition);
}
}
else
{
SteerTowardsPosition((Vector2)posToMaintain);
}
if (steeringPath.CurrentNode != null)
}
private void SteerTowardsPosition(Vector2 worldPosition)
{
float prediction = 10.0f;
Vector2 futurePosition = ConvertUnits.ToDisplayUnits(item.Submarine.Velocity) * prediction;
Vector2 targetSpeed = ((worldPosition - item.WorldPosition) - futurePosition);
if (targetSpeed.Length()>500.0f)
{
float prediction = 5.0f;
Vector2 futurePosition = ConvertUnits.ToDisplayUnits(item.Submarine.Velocity) * prediction;
Vector2 targetSpeed = ((steeringPath.CurrentNode.WorldPosition - item.WorldPosition) - futurePosition);
targetSpeed = Vector2.Normalize(targetSpeed);
TargetVelocity = targetSpeed * 100.0f;
}
else
{
targetVelocity = targetSpeed/5.0f;
}
}
private bool ToggleMaintainPosition(GUITickBox tickBox)
{
item.NewComponentEvent(this, true, true);
if (tickBox.Selected)
{
if (Submarine.Loaded == null)
{
posToMaintain = null;
}
else
{
posToMaintain = item.WorldPosition;
}
}
else
{
posToMaintain = null;
}
return true;
}
public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f)
@@ -236,6 +299,15 @@ namespace Barotrauma.Items.Components
message.Write(targetVelocity.Y);
message.Write(autoPilot);
if (autoPilot)
{
message.Write(posToMaintain != null);
if (posToMaintain != null)
{
message.Write(((Vector2)posToMaintain).X);
message.Write(((Vector2)posToMaintain).Y);
}
}
return true;
}
@@ -245,10 +317,22 @@ namespace Barotrauma.Items.Components
Vector2 newTargetVelocity = Vector2.Zero;
bool newAutoPilot = false;
Vector2? newPosToMaintain = null;
try
{
newTargetVelocity = new Vector2(message.ReadFloat(), message.ReadFloat());
newAutoPilot = message.ReadBoolean();
if (newAutoPilot)
{
bool maintainPos = message.ReadBoolean();
if (maintainPos)
{
newPosToMaintain = new Vector2(
message.ReadFloat(),
message.ReadFloat());
}
}
}
catch
@@ -258,6 +342,9 @@ namespace Barotrauma.Items.Components
TargetVelocity = newTargetVelocity;
AutoPilot = newAutoPilot;
maintainPosTickBox.Selected = newPosToMaintain != null;
posToMaintain = newPosToMaintain;
}
}
}

View File

@@ -55,7 +55,7 @@ namespace Barotrauma
public string Name
{
get { return name; }
//set { name = value; }
set { name = value; }
}
public static Vector2 LastPickedPosition

View File

@@ -468,7 +468,7 @@ namespace Barotrauma
Vector2 limbForce = direction * impact * 0.5f;
float length = limbForce.Length();
if (length > 10.0f) limbForce = (limbForce / length) * 10.0f;
if (length > 5.0f) limbForce = (limbForce / length) * 5.0f;
foreach (Character c in Character.CharacterList)
{

View File

@@ -181,14 +181,16 @@ namespace Barotrauma.Networking
if (DateTime.Now > timeOut)
{
restRequestHandle.Abort();
DebugConsole.ThrowError("Couldn't connect to master server (request timed out)");
registeredToMaster = false;
DebugConsole.NewMessage("Couldn't connect to master server (request timed out)", Color.Red);
break;
//registeredToMaster = false;
}
System.Diagnostics.Debug.WriteLine("took "+sw.ElapsedMilliseconds+" ms");
yield return CoroutineStatus.Running;
}
System.Diagnostics.Debug.WriteLine("took "+sw.ElapsedMilliseconds+" ms");
yield return CoroutineStatus.Success;
}
@@ -198,15 +200,13 @@ namespace Barotrauma.Networking
if (response.ErrorException != null)
{
DebugConsole.ThrowError("Error while registering to master server", response.ErrorException);
registeredToMaster = false;
DebugConsole.NewMessage("Error while registering to master server (" + response.ErrorException + ")", Color.Red);
return;
}
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
DebugConsole.NewMessage("Error while reporting to master server (" + response.StatusCode + ": " + response.StatusDescription + ")", Color.Red);
//registeredToMaster = false;
return;
}
}
@@ -224,10 +224,14 @@ namespace Barotrauma.Networking
{
inGameHUD.Update((float)Physics.step);
//if all characters dead
if (AutoRestart &&
bool isCrewDead =
ConnectedClients.Find(c => c.Character != null && !c.Character.IsDead)==null &&
(myCharacter == null || myCharacter.IsDead))
(myCharacter == null || myCharacter.IsDead);
//restart if all characters are dead or submarine is at the end of the level
if ((AutoRestart && isCrewDead)
||
(endRoundAtLevelEnd && Submarine.Loaded!=null && Submarine.Loaded.AtEndPosition))
{
EndButtonHit(null, null);
UpdateNetLobby(null,null);
@@ -284,7 +288,7 @@ namespace Barotrauma.Networking
{
if (gameStarted)
{
if (myCharacter != null) new NetworkEvent(NetworkEventType.EntityUpdate, myCharacter.ID, false);
if (myCharacter != null && !myCharacter.IsDead) new NetworkEvent(NetworkEventType.EntityUpdate, myCharacter.ID, false);
foreach (Character c in Character.CharacterList)
{

View File

@@ -20,7 +20,7 @@ namespace Barotrauma.Networking
{
public bool ShowNetStats;
private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 40);
private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 30);
private TimeSpan sparseUpdateInterval = new TimeSpan(0, 0, 0, 3);
private SelectionMode subSelectionMode, modeSelectionMode;
@@ -41,6 +41,8 @@ namespace Barotrauma.Networking
private bool allowSpectating = true;
private bool endRoundAtLevelEnd = true;
public bool AutoRestart
{
get { return (ConnectedClients.Count == 0) ? false : autoRestart; }
@@ -85,16 +87,22 @@ namespace Barotrauma.Networking
private void CreateSettingsFrame()
{
settingsFrame = new GUIFrame(new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsHeight), Color.Black*0.5f);
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
GUIFrame innerFrame = new GUIFrame(new Rectangle(0,0,400,400), null, Alignment.Center, GUI.Style, settingsFrame);
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 400), null, Alignment.Center, GUI.Style, settingsFrame);
var randomizeLevelBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Randomize level seed", Alignment.Left, innerFrame);
new GUITextBlock(new Rectangle(0, -15, 0, 20), "Server settings", GUI.Style, innerFrame, GUI.LargeFont);
var randomizeLevelBox = new GUITickBox(new Rectangle(0, 30, 20, 20), "Randomize level seed", Alignment.Left, innerFrame);
randomizeLevelBox.Selected = randomizeSeed;
randomizeLevelBox.OnSelected = ToggleRandomizeSeed;
var endBox = new GUITickBox(new Rectangle(0, 60, 20, 20), "End round when destination reached", Alignment.Left, innerFrame);
endBox.Selected = endRoundAtLevelEnd;
endBox.OnSelected = (GUITickBox) => { endRoundAtLevelEnd = GUITickBox.Selected; return true; };
new GUITextBlock(new Rectangle(0, 35, 100, 20), "Submarine selection:", GUI.Style, innerFrame);
var selectionFrame = new GUIFrame(new Rectangle(0, 60, 300, 20), null, innerFrame);
new GUITextBlock(new Rectangle(0, 95, 100, 20), "Submarine selection:", GUI.Style, innerFrame);
var selectionFrame = new GUIFrame(new Rectangle(0, 120, 300, 20), null, innerFrame);
for (int i = 0; i<3; i++)
{
var selectionTick = new GUITickBox(new Rectangle(i * 100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
@@ -103,8 +111,8 @@ namespace Barotrauma.Networking
selectionTick.UserData = (SelectionMode)i;
}
new GUITextBlock(new Rectangle(0, 85, 100, 20), "Mode selection:", GUI.Style, innerFrame);
selectionFrame = new GUIFrame(new Rectangle(0, 110, 300, 20), null, innerFrame);
new GUITextBlock(new Rectangle(0, 145, 100, 20), "Mode selection:", GUI.Style, innerFrame);
selectionFrame = new GUIFrame(new Rectangle(0, 170, 300, 20), null, innerFrame);
for (int i = 0; i<3; i++)
{
var selectionTick = new GUITickBox(new Rectangle(i*100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
@@ -113,7 +121,7 @@ namespace Barotrauma.Networking
selectionTick.UserData = (SelectionMode)i;
}
var allowSpecBox = new GUITickBox(new Rectangle(0, 150, 20, 20), "Allow spectating", Alignment.Left, innerFrame);
var allowSpecBox = new GUITickBox(new Rectangle(0, 210, 20, 20), "Allow spectating", Alignment.Left, innerFrame);
allowSpecBox.Selected = true;
allowSpecBox.OnSelected = ToggleAllowSpectating;

View File

@@ -292,7 +292,13 @@ namespace Barotrauma
selectedTab = (int)obj;
return true;
}
public void ToggleCharacterMode()
{
ToggleCharacterMode(null,null);
}
private bool ToggleCharacterMode(GUIButton button, object obj)
{
selectedTab = -1;
@@ -397,28 +403,30 @@ namespace Barotrauma
if (characterMode)
{
if (Entity.FindEntityByID(dummyCharacter.ID)!=dummyCharacter)
if (dummyCharacter == null || Entity.FindEntityByID(dummyCharacter.ID)!=dummyCharacter)
{
ToggleCharacterMode(null, null);
}
foreach (MapEntity me in MapEntity.mapEntityList)
else
{
me.IsHighlighted = false;
}
if (dummyCharacter.SelectedConstruction==null)
{
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(dummyCharacter.CursorPosition);
foreach (Limb limb in dummyCharacter.AnimController.Limbs)
foreach (MapEntity me in MapEntity.mapEntityList)
{
limb.body.SetTransform(mouseSimPos, 0.0f);
me.IsHighlighted = false;
}
}
dummyCharacter.ControlLocalPlayer((float)deltaTime, cam, false);
dummyCharacter.Control((float)deltaTime, cam);
cam.TargetPos = Vector2.Zero;
if (dummyCharacter.SelectedConstruction==null)
{
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(dummyCharacter.CursorPosition);
foreach (Limb limb in dummyCharacter.AnimController.Limbs)
{
limb.body.SetTransform(mouseSimPos, 0.0f);
}
}
dummyCharacter.ControlLocalPlayer((float)deltaTime, cam, false);
dummyCharacter.Control((float)deltaTime, cam);
cam.TargetPos = Vector2.Zero;
}
}
else
{

View File

@@ -480,9 +480,9 @@ namespace Barotrauma
Directory.CreateDirectory(SaveUtil.TempPath);
}
File.Copy(selectedSub.FilePath, Path.Combine(SaveUtil.TempPath, "map.sub"), true);
File.Copy(selectedSub.FilePath, Path.Combine(SaveUtil.TempPath, selectedSub.Name+".sub"), true);
selectedSub = new Submarine(Path.Combine(SaveUtil.TempPath, "map.sub"), "");
selectedSub = new Submarine(Path.Combine(SaveUtil.TempPath, selectedSub.Name + ".sub"), "");
GameMain.GameSession = new GameSession(selectedSub, saveNameBox.Text, GameModePreset.list.Find(gm => gm.Name == "Single Player"));
(GameMain.GameSession.gameMode as SinglePlayerMode).GenerateMap(seedBox.Text);
@@ -515,7 +515,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Loading map ''"+saveFile+"'' failed", e);
DebugConsole.ThrowError("Loading save ''"+saveFile+"'' failed", e);
return false;
}

View File

@@ -25,30 +25,16 @@ namespace Barotrauma
string tempPath = Path.Combine(SaveFolder, "temp");
//if (Directory.Exists(tempPath))
//{
// Directory.Delete(tempPath, true);
//}
if (!Directory.Exists(tempPath))
{
// DecompressToDirectory(fileName, tempPath, null);
//}
//else
//{
Directory.CreateDirectory(tempPath);
}
//
//Directory.CreateDirectory(Path.GetDirectoryName(filePath) + "\\temp");
try
{
if (Submarine.Loaded!=null)
if (Submarine.Loaded != null)
{
Submarine.Loaded.SaveAs(Path.Combine(tempPath, "map.sub"));
Submarine.Loaded.SaveAs(Path.Combine(tempPath, Submarine.Loaded.Name+".sub"));
}
}
catch (Exception e)
@@ -83,8 +69,11 @@ namespace Barotrauma
DecompressToDirectory(filePath, TempPath, null);
Submarine selectedMap = new Submarine(Path.Combine(TempPath, "map.sub"), "");// Submarine.Load();
GameMain.GameSession = new GameSession(selectedMap, fileName, Path.Combine(TempPath, "gamesession.xml"));
XDocument doc = ToolBox.TryLoadXml(Path.Combine(TempPath, "gamesession.xml"));
string subPath = Path.Combine(TempPath, ToolBox.GetAttributeString(doc.Root, "submarine", ""));
Submarine selectedMap = new Submarine(subPath, "");// Submarine.Load();
GameMain.GameSession = new GameSession(selectedMap, fileName, doc);
//Directory.Delete(tempPath, true);
}

View File

@@ -174,7 +174,7 @@ namespace Barotrauma
string relativePath = GetRelativePath(file, currentDir);
string dirRoot = relativePath.Split(Path.DirectorySeparatorChar).First();
if (dirRoot == "Data") continue;
if (dirRoot != "Content" && dirRoot != "") continue;
if (filesToKeep.Contains(relativePath)) continue;

Binary file not shown.