dmgn
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Barotrauma
|
||||
{
|
||||
public enum ContentType
|
||||
{
|
||||
None, Jobs, Item, Character, Structure, Executable
|
||||
None, Jobs, Item, Character, Structure, Executable, RandomEvents
|
||||
}
|
||||
|
||||
public class ContentPackage
|
||||
|
||||
@@ -452,17 +452,23 @@ namespace Barotrauma
|
||||
DebugConsole.NewMessage("Deleted filelist", Color.Green);
|
||||
}
|
||||
|
||||
if (System.IO.File.Exists("Data/SavedSubs/TutorialSub.sub"))
|
||||
if (System.IO.File.Exists("Submarines/TutorialSub.sub"))
|
||||
{
|
||||
System.IO.File.Delete("Data/SavedSubs/TutorialSub.sub");
|
||||
System.IO.File.Delete("Submarines/TutorialSub.sub");
|
||||
|
||||
DebugConsole.NewMessage("Deleted TutorialSub from SavedSubs", Color.Green);
|
||||
DebugConsole.NewMessage("Deleted TutorialSub from the submarine folder", Color.Green);
|
||||
}
|
||||
|
||||
if (System.IO.File.Exists("crashreport.txt"))
|
||||
{
|
||||
DebugConsole.NewMessage("Deleted crashreport.txt", Color.Green);
|
||||
}
|
||||
|
||||
if (!System.IO.File.Exists("Content/Map/TutorialSub.sub"))
|
||||
{
|
||||
DebugConsole.ThrowError("TutorialSub.sub not found!");
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
NewMessage("Command not found", Color.Red);
|
||||
|
||||
@@ -8,8 +8,6 @@ namespace Barotrauma
|
||||
{
|
||||
class ScriptedEvent
|
||||
{
|
||||
private static string configFile = "Content/randomevents.xml";
|
||||
|
||||
//const int MaxPreviousEvents = 6;
|
||||
//const float PreviouslyUsedWeight = 10.0f;
|
||||
|
||||
@@ -94,6 +92,16 @@ namespace Barotrauma
|
||||
|
||||
public static ScriptedEvent LoadRandom(Random rand)
|
||||
{
|
||||
var configFiles = GameMain.Config.SelectedContentPackage.GetFilesOfType(ContentType.RandomEvents);
|
||||
|
||||
if (!configFiles.Any())
|
||||
{
|
||||
DebugConsole.ThrowError("No config files for random events found in the selected content package");
|
||||
return null;
|
||||
}
|
||||
|
||||
string configFile = configFiles[0];
|
||||
|
||||
XDocument doc = ToolBox.TryLoadXml(configFile);
|
||||
if (doc == null) return null;
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace Barotrauma.Items.Components
|
||||
if (particle != null) particle.Size *= Rand.Range(0.5f, 1.0f);
|
||||
}
|
||||
|
||||
new FireSource(item.Position);
|
||||
new FireSource(item.WorldPosition);
|
||||
}
|
||||
|
||||
if (temperature > meltDownTemp)
|
||||
|
||||
@@ -99,8 +99,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
IsActive = true;
|
||||
|
||||
var tickBox = new GUITickBox(new Rectangle(0,25,20,20), "Autopilot", Alignment.TopLeft, GuiFrame);
|
||||
tickBox.OnSelected = (GUITickBox box) =>
|
||||
autopilotTickBox = new GUITickBox(new Rectangle(0,25,20,20), "Autopilot", Alignment.TopLeft, GuiFrame);
|
||||
autopilotTickBox.OnSelected = (GUITickBox box) =>
|
||||
{
|
||||
AutoPilot = box.Selected;
|
||||
item.NewComponentEvent(this, true, true);
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
class Connection
|
||||
{
|
||||
private static Texture2D panelTexture;
|
||||
private static Sprite connector;
|
||||
private static Sprite wireCorner, wireVertical, wireHorizontal;
|
||||
|
||||
@@ -61,10 +62,14 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (connector == null)
|
||||
{
|
||||
connector = new Sprite("Content/Items/connector.png", new Vector2(0.5f, 0.5f));
|
||||
wireCorner = new Sprite("Content/Items/wireCorner.png", new Vector2(0.5f, 0.1f));
|
||||
wireVertical = new Sprite("Content/Items/wireVertical.png", new Vector2(0.5f, 0.5f));
|
||||
wireHorizontal = new Sprite("Content/Items/wireHorizontal.png", new Vector2(0.5f, 0.5f));
|
||||
panelTexture = Sprite.LoadTexture("Content/Items/connectionpanel.png");
|
||||
|
||||
connector = new Sprite(panelTexture, new Rectangle(448, 80, 64, 64), Vector2.Zero, 0.0f);
|
||||
connector.Origin = new Vector2(32.0f, 32.0f);
|
||||
wireCorner = new Sprite(panelTexture, new Rectangle(448, 0, 64, 64), Vector2.Zero, 0.0f);
|
||||
wireCorner.Origin = new Vector2(32.0f, 32.0f);
|
||||
wireVertical = new Sprite(panelTexture, new Rectangle(480, 64, 16, 16), new Vector2(-8.0f, -8.0f), 0.0f);
|
||||
wireHorizontal = new Sprite(panelTexture, new Rectangle(496, 64, 16, 16), new Vector2(-8.0f, -8.0f), 0.0f);
|
||||
}
|
||||
|
||||
this.item = item;
|
||||
@@ -186,13 +191,15 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public static void DrawConnections(SpriteBatch spriteBatch, ConnectionPanel panel, Character character)
|
||||
{
|
||||
|
||||
|
||||
int width = 400, height = 200;
|
||||
int x = GameMain.GraphicsWidth/2 - width/2, y = GameMain.GraphicsHeight - height;
|
||||
int x = GameMain.GraphicsWidth / 2 - width / 2, y = GameMain.GraphicsHeight - height;
|
||||
|
||||
Rectangle panelRect = new Rectangle(x, y, width, height);
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, panelRect, Color.Black, true);
|
||||
spriteBatch.Draw(panelTexture, panelRect, new Rectangle(0, 512 - height, width, height), Color.White);
|
||||
|
||||
//GUI.DrawRectangle(spriteBatch, panelRect, Color.Black, true);
|
||||
|
||||
bool mouseInRect = panelRect.Contains(PlayerInput.MousePosition);
|
||||
|
||||
@@ -209,8 +216,8 @@ namespace Barotrauma.Items.Components
|
||||
if (wireComponent != null) equippedWire = wireComponent;
|
||||
}
|
||||
|
||||
Vector2 rightPos = new Vector2(x + width - 110, y + 20);
|
||||
Vector2 leftPos = new Vector2(x + 110, y + 20);
|
||||
Vector2 rightPos = new Vector2(x + width - 110, y + 50);
|
||||
Vector2 leftPos = new Vector2(x + 110, y + 50);
|
||||
|
||||
float wireInterval = 10.0f;
|
||||
|
||||
@@ -291,6 +298,9 @@ namespace Barotrauma.Items.Components
|
||||
draggingConnected = null;
|
||||
}
|
||||
}
|
||||
|
||||
spriteBatch.Draw(panelTexture, panelRect, new Rectangle(0, 0, width, height), Color.White);
|
||||
|
||||
}
|
||||
|
||||
private void Draw(SpriteBatch spriteBatch, Item item, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, bool wireEquipped)
|
||||
@@ -299,7 +309,7 @@ namespace Barotrauma.Items.Components
|
||||
spriteBatch.DrawString(GUI.Font, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White);
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)position.X-10, (int)position.Y-10, 20, 20), Color.White);
|
||||
|
||||
spriteBatch.Draw(panelTexture, position - new Vector2(16.0f, 16.0f), new Rectangle(64, 256, 32, 32), Color.White);
|
||||
|
||||
for (int i = 0; i<MaxLinked; i++)
|
||||
{
|
||||
@@ -346,8 +356,13 @@ namespace Barotrauma.Items.Components
|
||||
// Wires[index] = null;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Wires.Any(w => w != null && w.Item != draggingConnected))
|
||||
{
|
||||
spriteBatch.Draw(panelTexture, position - new Vector2(16.0f, 16.0f), new Rectangle(32, 256, 32, 32), Color.White);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void DrawWire(SpriteBatch spriteBatch, Item wireItem, Item item, Vector2 end, Vector2 start, bool mouseIn, bool wireEquipped)
|
||||
@@ -373,7 +388,9 @@ namespace Barotrauma.Items.Components
|
||||
new Vector2(end.X - wireVertical.size.X / 2, end.Y + connLength),
|
||||
new Vector2(wireVertical.size.X, (float)Math.Abs(end.Y - start.Y)), wireItem.Color * alpha);
|
||||
textX = (int)end.X;
|
||||
connector.Draw(spriteBatch, end, Color.White*alpha);
|
||||
connector.Draw(spriteBatch, end, Color.White*alpha);
|
||||
|
||||
//spriteBatch.Draw(panelTexture, end, new Rectangle(32, 256, 32, 32), Color.White);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -387,7 +404,7 @@ namespace Barotrauma.Items.Components
|
||||
float dir = (end.X > start.X) ? -1.0f : 1.0f;
|
||||
|
||||
wireCorner.Draw(spriteBatch,
|
||||
new Vector2(start.X, end.Y-1), wireItem.Color * alpha, 0.0f, 1.0f,
|
||||
new Vector2(start.X, end.Y+24), wireItem.Color * alpha, 0.0f, 1.0f,
|
||||
(end.X > start.X) ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
|
||||
float wireStartX = start.X - wireCorner.size.X / 2 * dir;
|
||||
@@ -400,7 +417,7 @@ namespace Barotrauma.Items.Components
|
||||
rect = new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y);
|
||||
if (!wireEquipped && rect.Contains(PlayerInput.MousePosition)) mouseOn = true;
|
||||
|
||||
connector.Draw(spriteBatch, end, Color.White*alpha, -MathHelper.PiOver2 * dir);
|
||||
connector.Draw(spriteBatch, end, Color.White*alpha, -MathHelper.PiOver2*dir);
|
||||
}
|
||||
|
||||
if (draggingConnected == null && !wireEquipped)
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace Barotrauma
|
||||
this.limits = limits;
|
||||
this.cellSize = cellSize;
|
||||
|
||||
entities = new List<MapEntity>[(int)Math.Ceiling(limits.Width / cellSize),(int)Math.Ceiling(limits.Height / cellSize)];
|
||||
for (int x = 0; x<entities.GetLength(0); x++)
|
||||
entities = new List<MapEntity>[(int)Math.Ceiling(limits.Width / cellSize), (int)Math.Ceiling(limits.Height / cellSize)];
|
||||
for (int x = 0; x < entities.GetLength(0); x++)
|
||||
{
|
||||
for (int y=0; y<entities.GetLength(1); y++)
|
||||
for (int y = 0; y < entities.GetLength(1); y++)
|
||||
{
|
||||
entities[x, y] = new List<MapEntity>();
|
||||
}
|
||||
@@ -32,29 +32,29 @@ namespace Barotrauma
|
||||
Rectangle rect = entity.Rect;
|
||||
//if (Submarine.Loaded != null) rect.Offset(-Submarine.HiddenSubPosition);
|
||||
Rectangle indices = GetIndices(rect);
|
||||
if (indices.X<0 || indices.Width>=entities.GetLength(0) ||
|
||||
indices.Y<0 || indices.Height>=entities.GetLength(1))
|
||||
if (indices.X < 0 || indices.Width >= entities.GetLength(0) ||
|
||||
indices.Y < 0 || indices.Height >= entities.GetLength(1))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in EntityGrid.InsertEntity: "+entity+" is outside the grid");
|
||||
DebugConsole.ThrowError("Error in EntityGrid.InsertEntity: " + entity + " is outside the grid");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int x=indices.X; x<=indices.Width; x++)
|
||||
for (int x = indices.X; x <= indices.Width; x++)
|
||||
{
|
||||
for (int y = indices.Y; y<=indices.Height; y++)
|
||||
for (int y = indices.Y; y <= indices.Height; y++)
|
||||
{
|
||||
entities[x, y].Add(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void RemoveEntity(MapEntity entity)
|
||||
{
|
||||
for (int x = 0; x < entities.GetLength(0); x++)
|
||||
{
|
||||
for (int y = 0; y < entities.GetLength(1); y++)
|
||||
{
|
||||
if (entities[x,y].Contains(entity)) entities[x, y].Remove(entity);
|
||||
if (entities[x, y].Contains(entity)) entities[x, y].Remove(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,14 +76,13 @@ namespace Barotrauma
|
||||
|
||||
if (Submarine.Loaded != null) position -= Submarine.HiddenSubPosition;
|
||||
|
||||
if (position.X < limits.X || position.Y > limits.Y ||
|
||||
position.X > limits.Right || position.Y < limits.Y - limits.Height)
|
||||
Point indices = GetIndices(position);
|
||||
|
||||
if (indices.X < 0 || indices.Y < 0 || indices.X >= entities.GetLength(0) || indices.Y >= entities.GetLength(1))
|
||||
{
|
||||
return new List<MapEntity>();
|
||||
}
|
||||
|
||||
Point indices = GetIndices(position);
|
||||
|
||||
return entities[indices.X, indices.Y];
|
||||
}
|
||||
|
||||
@@ -91,10 +90,10 @@ namespace Barotrauma
|
||||
{
|
||||
Rectangle indices = Rectangle.Empty;
|
||||
indices.X = (int)Math.Floor((rect.X - limits.X) / cellSize);
|
||||
indices.Y = (int)Math.Floor((limits.Y - rect.Y)/cellSize);
|
||||
indices.Y = (int)Math.Floor((limits.Y - rect.Y) / cellSize);
|
||||
|
||||
indices.Width = (int)Math.Floor((rect.Right - limits.X) / cellSize);
|
||||
indices.Height = (int)Math.Floor((limits.Y - (rect.Y-rect.Height)) / cellSize);
|
||||
indices.Height = (int)Math.Floor((limits.Y - (rect.Y - rect.Height)) / cellSize);
|
||||
|
||||
return indices;
|
||||
}
|
||||
@@ -103,7 +102,7 @@ namespace Barotrauma
|
||||
{
|
||||
return new Point(
|
||||
(int)Math.Floor((position.X - limits.X) / cellSize),
|
||||
(int)Math.Floor((limits.Y - position.Y) / cellSize));
|
||||
(int)Math.Floor((limits.Y - position.Y) / cellSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Barotrauma
|
||||
|
||||
class Submarine : Entity
|
||||
{
|
||||
public static string SavePath = "Data" + System.IO.Path.DirectorySeparatorChar + "SavedSubs";
|
||||
public static string SavePath = "Submarines";
|
||||
|
||||
//position of the "actual submarine" which is rendered wherever the SubmarineBody is
|
||||
//should be in an unreachable place
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Barotrauma
|
||||
//menuTabs[(int)Tabs.Main].Padding = GUI.style.smallPadding;
|
||||
|
||||
|
||||
int y = 170;
|
||||
int y = (int)(GameMain.GraphicsHeight * 0.3f);
|
||||
|
||||
Rectangle panelRect = new Rectangle(
|
||||
290, y,
|
||||
@@ -81,6 +81,8 @@ namespace Barotrauma
|
||||
button.Color = button.Color * 0.8f;
|
||||
button.OnClicked = QuitClicked;
|
||||
|
||||
panelRect.Y += 10;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
menuTabs[(int)Tab.NewGame] = new GUIFrame(panelRect, GUI.Style);
|
||||
|
||||
@@ -464,8 +464,9 @@ namespace Barotrauma
|
||||
GameMain.Server.CharacterInfo = null;
|
||||
GameMain.Server.Character = null;
|
||||
|
||||
var playYourself = new GUITickBox(new Rectangle(0, -20, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Barotrauma
|
||||
{
|
||||
public static class UpdaterUtil
|
||||
{
|
||||
public const string Version = "1.0";
|
||||
public const string Version = "1.1";
|
||||
|
||||
public static void SaveFileList(string filePath)
|
||||
{
|
||||
@@ -174,7 +174,7 @@ namespace Barotrauma
|
||||
string relativePath = GetRelativePath(file, currentDir);
|
||||
|
||||
string dirRoot = relativePath.Split(Path.DirectorySeparatorChar).First();
|
||||
if (dirRoot != "Content" && dirRoot != "") continue;
|
||||
if (dirRoot != "Content") continue;
|
||||
|
||||
if (filesToKeep.Contains(relativePath)) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user