diff --git a/Farseer Physics Engine 3.5/Farseer Physics Engine.v12.suo b/Farseer Physics Engine 3.5/Farseer Physics Engine.v12.suo
new file mode 100644
index 000000000..7d0e3e068
Binary files /dev/null and b/Farseer Physics Engine 3.5/Farseer Physics Engine.v12.suo differ
diff --git a/Launcher/Form1.cs b/Launcher/Form1.cs
index d80ed81b5..9a92d6ccc 100644
--- a/Launcher/Form1.cs
+++ b/Launcher/Form1.cs
@@ -17,7 +17,6 @@ namespace Launcher
{
public partial class LauncherMain : Form
{
- public static string ContentPackageFolder = "Data/ContentPackages/";
private const string configPath = "config.xml";
private Subsurface.GameSettings settings;
@@ -42,7 +41,7 @@ namespace Launcher
{
InitializeComponent();
- ContentPackage.LoadAll(LauncherMain.ContentPackageFolder);
+ ContentPackage.LoadAll(ContentPackage.Folder);
contentPackageBox.DataSource = ContentPackage.list;
supportedModes = new List();
diff --git a/Launcher/PackageManager.Designer.cs b/Launcher/PackageManager.Designer.cs
index 9cfc78428..7584ed37e 100644
--- a/Launcher/PackageManager.Designer.cs
+++ b/Launcher/PackageManager.Designer.cs
@@ -102,6 +102,7 @@
this.itemList.Name = "itemList";
this.itemList.Size = new System.Drawing.Size(255, 134);
this.itemList.TabIndex = 8;
+ this.itemList.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.fileList_KeyPress);
//
// itemButton
//
@@ -161,6 +162,7 @@
this.structureList.Name = "structureList";
this.structureList.Size = new System.Drawing.Size(255, 121);
this.structureList.TabIndex = 8;
+ this.structureList.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.fileList_KeyPress);
//
// structureButton
//
@@ -189,6 +191,7 @@
this.jobList.Name = "jobList";
this.jobList.Size = new System.Drawing.Size(255, 134);
this.jobList.TabIndex = 11;
+ this.jobList.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.fileList_KeyPress);
//
// label4
//
diff --git a/Launcher/PackageManager.cs b/Launcher/PackageManager.cs
index 61e9b7e2e..420b1fdd6 100644
--- a/Launcher/PackageManager.cs
+++ b/Launcher/PackageManager.cs
@@ -96,28 +96,25 @@ namespace Launcher
fileButton.Enabled = (selectedPackage != null);
}
- if (selectedPackage == null)
+
+ foreach (ListBox fileBox in fileBoxes)
{
- foreach (ListBox fileBox in fileBoxes)
+ fileBox.Items.Clear();
+ }
+
+
+ foreach (ListBox fileBox in fileBoxes)
+ {
+ ContentType type = (fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None;
+
+ foreach (ContentFile file in selectedPackage.files)
{
- fileBox.Items.Clear();
- }
- }
- else
- {
-
- foreach (ListBox fileBox in fileBoxes)
- {
- ContentType type = (fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None;
-
- foreach (ContentFile file in selectedPackage.files)
- {
- if (file.type != type) continue;
-
- fileBox.Items.Add(file);
- }
+ if (file.type != type) continue;
+
+ fileBox.Items.Add(file);
}
}
+
}
private void newPackage_Click(object sender, EventArgs e)
@@ -145,7 +142,7 @@ namespace Launcher
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "XML files (*.xml)|*.xml;*.XML";
- //ofd.RestoreDirectory?
+ ofd.RestoreDirectory = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
@@ -256,7 +253,7 @@ namespace Launcher
private void okButton_Click(object sender, EventArgs e)
{
- if (selectedPackage!=null) selectedPackage.Save(LauncherMain.ContentPackageFolder);
+ if (selectedPackage!=null) selectedPackage.Save(ContentPackage.Folder);
this.Close();
}
diff --git a/Subsurface/Content/Items/Electricity/poweritems.xml b/Subsurface/Content/Items/Electricity/poweritems.xml
index a57442421..fb0260648 100644
--- a/Subsurface/Content/Items/Electricity/poweritems.xml
+++ b/Subsurface/Content/Items/Electricity/poweritems.xml
@@ -41,7 +41,27 @@
-
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Subsurface/Content/Items/Electricity/regex.png b/Subsurface/Content/Items/Electricity/regex.png
new file mode 100644
index 000000000..52a4c0295
Binary files /dev/null and b/Subsurface/Content/Items/Electricity/regex.png differ
diff --git a/Subsurface/Content/Items/Electricity/signalitems.xml b/Subsurface/Content/Items/Electricity/signalitems.xml
index 7bcb2e020..c42fd6b19 100644
--- a/Subsurface/Content/Items/Electricity/signalitems.xml
+++ b/Subsurface/Content/Items/Electricity/signalitems.xml
@@ -185,7 +185,7 @@
linkable="true"
price="10">
-
+
@@ -203,5 +203,30 @@
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Subsurface/Content/Items/Electricity/supercapacitor.png b/Subsurface/Content/Items/Electricity/supercapacitor.png
new file mode 100644
index 000000000..46eab4595
Binary files /dev/null and b/Subsurface/Content/Items/Electricity/supercapacitor.png differ
diff --git a/Subsurface/Content/Items/Electricity/wifi.png b/Subsurface/Content/Items/Electricity/wifi.png
new file mode 100644
index 000000000..bb63ff272
Binary files /dev/null and b/Subsurface/Content/Items/Electricity/wifi.png differ
diff --git a/Subsurface/Content/Items/Ladder/item.xml b/Subsurface/Content/Items/Ladder/ladder.xml
similarity index 100%
rename from Subsurface/Content/Items/Ladder/item.xml
rename to Subsurface/Content/Items/Ladder/ladder.xml
diff --git a/Subsurface/Content/Items/Reactor/reactor.xml b/Subsurface/Content/Items/Reactor/reactor.xml
index 758928870..306b9b1f0 100644
--- a/Subsurface/Content/Items/Reactor/reactor.xml
+++ b/Subsurface/Content/Items/Reactor/reactor.xml
@@ -34,6 +34,8 @@
+
+
diff --git a/Subsurface/Content/Items/blank.png b/Subsurface/Content/Items/blank.png
new file mode 100644
index 000000000..9a1af9801
Binary files /dev/null and b/Subsurface/Content/Items/blank.png differ
diff --git a/Subsurface/Content/Items/idcard.xml b/Subsurface/Content/Items/idcard.xml
index 045bd351d..8e75e69f1 100644
--- a/Subsurface/Content/Items/idcard.xml
+++ b/Subsurface/Content/Items/idcard.xml
@@ -5,9 +5,9 @@
Tags="smallitem"
pickdistance="150">
-
+
-
+
diff --git a/Subsurface/Content/Items/itemlabel.xml b/Subsurface/Content/Items/itemlabel.xml
new file mode 100644
index 000000000..56e4fcc9f
--- /dev/null
+++ b/Subsurface/Content/Items/itemlabel.xml
@@ -0,0 +1,14 @@
+
+
+-
+
+
+
+
+
+
+
+
diff --git a/Subsurface/Content/Jobs.xml b/Subsurface/Content/Jobs.xml
index a9fc829e4..8316e2e55 100644
--- a/Subsurface/Content/Jobs.xml
+++ b/Subsurface/Content/Jobs.xml
@@ -13,7 +13,7 @@
-
+
@@ -24,7 +24,7 @@
-
+
diff --git a/Subsurface/Content/UI/style.xml b/Subsurface/Content/UI/style.xml
index 73b0c7357..5fb091a28 100644
--- a/Subsurface/Content/UI/style.xml
+++ b/Subsurface/Content/UI/style.xml
@@ -54,6 +54,13 @@
+
+
+
+
0)
{
charElement.Add(new XAttribute("items", string.Join(",", pickedItems)));
diff --git a/Subsurface/Source/Characters/HumanoidAnimController.cs b/Subsurface/Source/Characters/HumanoidAnimController.cs
index a887f35e3..553a13752 100644
--- a/Subsurface/Source/Characters/HumanoidAnimController.cs
+++ b/Subsurface/Source/Characters/HumanoidAnimController.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Xml.Linq;
using FarseerPhysics;
using Microsoft.Xna.Framework;
+using Subsurface.Items.Components;
namespace Subsurface
{
@@ -542,7 +543,7 @@ namespace Subsurface
void UpdateClimbing()
{
- if (character.SelectedConstruction == null)
+ if (character.SelectedConstruction == null || character.SelectedConstruction.GetComponent()==null)
{
Anim = Animation.None;
return;
@@ -623,7 +624,12 @@ namespace Subsurface
torso.body.ApplyForce(climbForce * 40.0f * torso.Mass);
head.body.SmoothRotate(0.0f);
- Rectangle trigger = character.SelectedConstruction.Prefab.Triggers.First();
+ Rectangle trigger = character.SelectedConstruction.Prefab.Triggers.FirstOrDefault();
+ if (trigger == null)
+ {
+ character.SelectedConstruction = null;
+ return;
+ }
trigger = character.SelectedConstruction.TransformTrigger(trigger);
//stop climbing if:
@@ -673,10 +679,10 @@ namespace Subsurface
Limb rightHand = GetLimb(LimbType.RightHand);
Limb rightArm = GetLimb(LimbType.RightArm);
- Vector2 itemPos = character.SecondaryKeyDown.State ? aimPos : holdPos;
+ Vector2 itemPos = character.GetInputState(InputType.SecondaryHeld) ? aimPos : holdPos;
float itemAngle;
- if (character.SecondaryKeyDown.State && itemPos != Vector2.Zero)
+ if (character.GetInputState(InputType.SecondaryHeld) && itemPos != Vector2.Zero)
{
Vector2 mousePos = ConvertUnits.ToSimUnits(character.CursorPosition);
diff --git a/Subsurface/Source/Characters/Ragdoll.cs b/Subsurface/Source/Characters/Ragdoll.cs
index 0efc2b6b3..3187ed605 100644
--- a/Subsurface/Source/Characters/Ragdoll.cs
+++ b/Subsurface/Source/Characters/Ragdoll.cs
@@ -472,7 +472,7 @@ namespace Subsurface
inWater = false;
headInWater = false;
- if (currentHull.Volume>currentHull.FullVolume*0.95f || ConvertUnits.ToSimUnits(currentHull.Surface)-floorY> HeadPosition*0.95f)
+ if (currentHull.Volume > currentHull.FullVolume * 0.95f || ConvertUnits.ToSimUnits(currentHull.Surface) - floorY > HeadPosition * 0.95f)
inWater = true;
}
@@ -562,7 +562,7 @@ namespace Subsurface
private void UpdateNetplayerPosition()
{
Limb refLimb = GetLimb(LimbType.Torso);
- if (refLimb== null) refLimb = GetLimb(LimbType.Head);
+ if (refLimb == null) refLimb = GetLimb(LimbType.Head);
if (refLimb.body.TargetPosition == Vector2.Zero) return;
@@ -603,7 +603,7 @@ namespace Subsurface
if (resetAll)
{
- System.Diagnostics.Debug.WriteLine("resetall");
+ System.Diagnostics.Debug.WriteLine("reset ragdoll limb positions");
foreach (Limb limb in limbs)
{
diff --git a/Subsurface/Source/ContentPackage.cs b/Subsurface/Source/ContentPackage.cs
index 98501441d..2a263b4cc 100644
--- a/Subsurface/Source/ContentPackage.cs
+++ b/Subsurface/Source/ContentPackage.cs
@@ -15,6 +15,9 @@ namespace Subsurface
public class ContentPackage
{
+
+ public static string Folder = "Data/ContentPackages/";
+
public static List list = new List();
@@ -81,6 +84,7 @@ namespace Subsurface
{
ContentPackage newPackage = new ContentPackage("Content/Data/"+name);
newPackage.name = name;
+ newPackage.Path = Folder + name;
list.Add(newPackage);
return newPackage;
diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs
index 93b8f8047..edf99ab91 100644
--- a/Subsurface/Source/DebugConsole.cs
+++ b/Subsurface/Source/DebugConsole.cs
@@ -136,11 +136,13 @@ namespace Subsurface
public static void ExecuteCommand(string command, Game1 game)
{
+#if !DEBUG
if (Game1.Client!=null)
{
ThrowError("Console commands are disabled in multiplayer mode");
return;
}
+#endif
if (command == "") return;
string[] commands = command.Split(' ');
@@ -246,6 +248,9 @@ namespace Subsurface
hull.OxygenPercentage = 100.0f;
}
break;
+ case "tutorial":
+ TutorialMode.Start();
+ break;
case "lobbyscreen":
case "lobby":
Game1.LobbyScreen.Select();
diff --git a/Subsurface/Source/EventInput/KeyboardDispatcher.cs b/Subsurface/Source/EventInput/KeyboardDispatcher.cs
index 9427af6d5..3026824bc 100644
--- a/Subsurface/Source/EventInput/KeyboardDispatcher.cs
+++ b/Subsurface/Source/EventInput/KeyboardDispatcher.cs
@@ -1,6 +1,8 @@
using System;
using System.Threading;
+#if WINDOWS
using System.Windows;
+#endif
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
@@ -42,12 +44,14 @@ namespace EventInput
//ctrl-v
if (e.Character == 0x16)
{
+#if WINDOWS
//XNA runs in Multiple Thread Apartment state, which cannot recieve clipboard
Thread thread = new Thread(PasteThread);
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
_subscriber.ReceiveTextInput(_pasteResult);
+#endif
}
else
{
@@ -74,6 +78,7 @@ namespace EventInput
}
}
+#if WINDOWS
//Thread has to be in Single Thread Apartment state in order to receive clipboard
string _pasteResult = "";
[STAThread]
@@ -81,5 +86,7 @@ namespace EventInput
{
_pasteResult = Clipboard.ContainsText() ? Clipboard.GetText() : "";
}
+#endif
+
}
}
diff --git a/Subsurface/Source/GUI/GUI.cs b/Subsurface/Source/GUI/GUI.cs
index 51f20f963..70b667c2d 100644
--- a/Subsurface/Source/GUI/GUI.cs
+++ b/Subsurface/Source/GUI/GUI.cs
@@ -20,7 +20,7 @@ namespace Subsurface
public static GUIStyle style;
static Texture2D t;
- public static SpriteFont Font, SmallFont;
+ public static SpriteFont Font, SmallFont, LargeFont;
private static GraphicsDevice graphicsDevice;
@@ -274,7 +274,7 @@ namespace Subsurface
bool clicked = false;
- if (rect.Contains(PlayerInput.GetMouseState.Position))
+ if (rect.Contains(PlayerInput.MousePosition))
{
clicked = (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed);
@@ -301,8 +301,16 @@ namespace Subsurface
spriteBatch.DrawString(Font,
"Physics: " + Game1.World.UpdateTime
+ " - bodies: " + Game1.World.BodyList.Count
- + "Camera pos: " + Game1.GameScreen.Cam.Position,
+ + " Camera pos: " + Game1.GameScreen.Cam.Position,
new Vector2(10, 30), Color.White);
+
+ if (Submarine.Loaded!=null)
+ {
+ spriteBatch.DrawString(Font,
+ "Sub pos: " + Submarine.Loaded.Position,
+ new Vector2(10, 50), Color.White);
+ }
+
}
diff --git a/Subsurface/Source/GUI/GUIButton.cs b/Subsurface/Source/GUI/GUIButton.cs
index 0eacc727d..bb238ba04 100644
--- a/Subsurface/Source/GUI/GUIButton.cs
+++ b/Subsurface/Source/GUI/GUIButton.cs
@@ -60,7 +60,7 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
- if (rect.Contains(PlayerInput.GetMouseState.Position) && Enabled && (MouseOn == null || MouseOn == this || IsParentOf(MouseOn)))
+ if (rect.Contains(PlayerInput.MousePosition) && Enabled && (MouseOn == null || MouseOn == this || IsParentOf(MouseOn)))
{
state = ComponentState.Hover;
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
diff --git a/Subsurface/Source/GUI/GUIListBox.cs b/Subsurface/Source/GUI/GUIListBox.cs
index b8074a1c9..56e882201 100644
--- a/Subsurface/Source/GUI/GUIListBox.cs
+++ b/Subsurface/Source/GUI/GUIListBox.cs
@@ -27,6 +27,14 @@ namespace Subsurface
private bool enabled;
+ public GUIComponent Selected
+ {
+ get
+ {
+ return selected;
+ }
+ }
+
public object SelectedData
{
get
@@ -276,7 +284,7 @@ namespace Subsurface
if (CheckSelected() != selected.UserData) selected = null;
}
}
- else if (enabled && (MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.GetMouseState.Position))
+ else if (enabled && (MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.MousePosition))
{
child.State = ComponentState.Hover;
if (PlayerInput.LeftButtonClicked())
diff --git a/Subsurface/Source/GUI/GUIMessageBox.cs b/Subsurface/Source/GUI/GUIMessageBox.cs
index f5cfccb00..c56cda83f 100644
--- a/Subsurface/Source/GUI/GUIMessageBox.cs
+++ b/Subsurface/Source/GUI/GUIMessageBox.cs
@@ -15,6 +15,12 @@ namespace Subsurface
//GUIFrame frame;
public GUIButton[] Buttons;
+ public string Text
+ {
+ get { return (children[1] as GUITextBlock).Text; }
+ set { (children[1] as GUITextBlock).Text = value; }
+ }
+
public GUIMessageBox(string header, string text)
: this(header, text, new string[] {"OK"})
{
diff --git a/Subsurface/Source/GUI/GUIScrollBar.cs b/Subsurface/Source/GUI/GUIScrollBar.cs
index 0ab9663d7..b654948c5 100644
--- a/Subsurface/Source/GUI/GUIScrollBar.cs
+++ b/Subsurface/Source/GUI/GUIScrollBar.cs
@@ -155,14 +155,14 @@ namespace Subsurface
int moveAmount;
if (isHorizontal)
{
- moveAmount = PlayerInput.GetMouseState.Position.X - PlayerInput.GetOldMouseState.Position.X;
+ moveAmount = (int)PlayerInput.MouseSpeed.X;
newX = Math.Min(Math.Max(newX + moveAmount, 0), frame.Rect.Width - bar.Rect.Width);
barScroll = (float)newX / ((float)frame.Rect.Width - (float)bar.Rect.Width);
}
else
{
- moveAmount = PlayerInput.GetMouseState.Position.Y - PlayerInput.GetOldMouseState.Position.Y;
+ moveAmount = (int)PlayerInput.MouseSpeed.Y;
newY = Math.Min(Math.Max(newY+moveAmount, 0), frame.Rect.Height - bar.Rect.Height);
barScroll = (float)newY / ((float)frame.Rect.Height - (float)bar.Rect.Height);
diff --git a/Subsurface/Source/GUI/GUITextBlock.cs b/Subsurface/Source/GUI/GUITextBlock.cs
index f699cada0..8842689c3 100644
--- a/Subsurface/Source/GUI/GUITextBlock.cs
+++ b/Subsurface/Source/GUI/GUITextBlock.cs
@@ -76,9 +76,12 @@ namespace Subsurface
}
- public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false)
+ public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false, SpriteFont font =null)
: this (rect, text, null, null, alignment, textAlignment, style, parent, wrap)
{
+ this.Font = font == null ? GUI.Font : font;
+
+ SetTextPos();
}
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)
@@ -117,11 +120,7 @@ namespace Subsurface
if (parent != null)
parent.AddChild(this);
- //if (wrap)
- //{
- this.Wrap = wrap;
- // this.text = ToolBox.WrapText(this.text, rect.Width);
- //}
+ this.Wrap = wrap;
SetTextPos();
}
@@ -135,7 +134,7 @@ namespace Subsurface
if (Wrap && rect.Width>0)
{
//text = text.Replace("\n"," ");
- text = ToolBox.WrapText(text, rect.Width, Font);
+ text = ToolBox.WrapText(text, rect.Width - padding.X - padding.Z, Font);
Vector2 newSize = MeasureText(text);
diff --git a/Subsurface/Source/GUI/GUITextBox.cs b/Subsurface/Source/GUI/GUITextBox.cs
index fcebd9b22..4401d2cd0 100644
--- a/Subsurface/Source/GUI/GUITextBox.cs
+++ b/Subsurface/Source/GUI/GUITextBox.cs
@@ -146,6 +146,7 @@ namespace Subsurface
public void Deselect()
{
+ Selected = false;
if (keyboardDispatcher.Subscriber == this) keyboardDispatcher.Subscriber = null;
}
@@ -158,7 +159,7 @@ namespace Subsurface
caretTimer += deltaTime;
caretVisible = ((caretTimer*1000.0f) % 1000) < 500;
- if (rect.Contains(PlayerInput.GetMouseState.Position))
+ if (rect.Contains(PlayerInput.MousePosition))
{
state = ComponentState.Hover;
if (PlayerInput.LeftButtonClicked()) Select();
diff --git a/Subsurface/Source/GUI/GUITickBox.cs b/Subsurface/Source/GUI/GUITickBox.cs
index ffa74fb80..0564b2bb5 100644
--- a/Subsurface/Source/GUI/GUITickBox.cs
+++ b/Subsurface/Source/GUI/GUITickBox.cs
@@ -25,6 +25,12 @@ namespace Subsurface
}
}
+ public bool Enabled
+ {
+ get;
+ set;
+ }
+
public GUITickBox(Rectangle rect, string label, Alignment alignment, GUIComponent parent)
: base(null)
{
@@ -35,15 +41,26 @@ namespace Subsurface
box.HoverColor = Color.Gray;
box.SelectedColor = Color.DarkGray;
- text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, 30), label, Color.Transparent, Color.White, Alignment.TopLeft, null, this);
+ text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, rect.Height), label, Color.Transparent, Color.White, Alignment.TopLeft, null, this);
+
+ Enabled = true;
}
public override void Update(float deltaTime)
{
- base.Update(deltaTime);
+ if (rect.Width ==420)
+ {
+ int asd = 1;
+ }
+ //base.Update(deltaTime);
- if (box.Rect.Contains(PlayerInput.GetMouseState.Position))
+ if (!Enabled) return;
+
+ if (box.Rect.Contains(PlayerInput.MousePosition))
{
+
+
+
box.State = ComponentState.Hover;
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
@@ -67,12 +84,16 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
+ if (rect.Width == 420)
+ {
+ int asd = 1;
+ }
+
DrawChildren(spriteBatch);
- if (Selected)
- {
- GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 2, box.Rect.Y + 2, box.Rect.Width - 4, box.Rect.Height - 4), Color.Green * 0.8f, true);
- }
+ GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 2, box.Rect.Y + 2, box.Rect.Width - 4, box.Rect.Height - 4),
+ selected ? Color.Green * 0.8f : Color.Black, true);
+
}
}
}
diff --git a/Subsurface/Source/Game1.cs b/Subsurface/Source/Game1.cs
index 91d528f0d..e6562c43a 100644
--- a/Subsurface/Source/Game1.cs
+++ b/Subsurface/Source/Game1.cs
@@ -10,6 +10,7 @@ using Subsurface.Particles;
using System.Collections;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Input;
+using System.Xml;
namespace Subsurface
{
@@ -119,8 +120,8 @@ namespace Subsurface
//TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 55);
World = new World(new Vector2(0, -9.82f));
- Settings.VelocityIterations = 2;
- Settings.PositionIterations = 1;
+ FarseerPhysics.Settings.VelocityIterations = 2;
+ FarseerPhysics.Settings.PositionIterations = 1;
}
///
@@ -165,6 +166,7 @@ namespace Subsurface
{
GUI.Font = ToolBox.TryLoadFont("SpriteFont1", Content);
GUI.SmallFont = ToolBox.TryLoadFont("SmallFont", Content);
+ GUI.LargeFont = ToolBox.TryLoadFont("LargeFont", Content);
sw = new Stopwatch();
@@ -263,7 +265,7 @@ namespace Subsurface
DebugConsole.Update(this, (float)deltaTime);
- if ((!DebugConsole.IsOpen && !GUI.PauseMenuOpen) || NetworkMember != null) Screen.Selected.Update(deltaTime);
+ if ((!DebugConsole.IsOpen && !GUI.PauseMenuOpen) || (NetworkMember != null && NetworkMember.GameStarted)) Screen.Selected.Update(deltaTime);
GUI.Update((float)deltaTime);
@@ -323,4 +325,4 @@ namespace Subsurface
}
}
-}
+}
\ No newline at end of file
diff --git a/Subsurface/Source/GameSession/GameModes/TraitorMode.cs b/Subsurface/Source/GameSession/GameModes/TraitorMode.cs
index e81751bff..76d3bffb6 100644
--- a/Subsurface/Source/GameSession/GameModes/TraitorMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/TraitorMode.cs
@@ -30,16 +30,7 @@ namespace Subsurface
base.Update(deltaTime);
if (!isRunning) return;
-
- if (DateTime.Now >= endTime)
- {
- string endMessage = traitor.character.Info.Name + " was a traitor! ";
- endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
- endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was unsuccesful.";
- End(endMessage);
- return;
- }
-
+
if (traitor==null || target ==null)
{
@@ -68,6 +59,35 @@ namespace Subsurface
endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was succesful.";
End(endMessage);
}
+ else if (traitor.character.IsDead)
+ {
+ string endMessage = traitor.character.Info.Name + " was a traitor! ";
+ endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
+ endMessage += " task was to assassinate " + target.character.Info.Name + ", but ";
+ endMessage += (traitor.character.Info.Gender == Gender.Male) ? "he" : "she";
+ endMessage += " got " + ((traitor.character.Info.Gender == Gender.Male) ? "himself" : "herself");
+ endMessage += " killed before completing it.";
+ End(endMessage);
+ return;
+ }
+ else if (Level.Loaded.AtEndPosition)
+ {
+ string endMessage = traitor.character.Info.Name + " was a traitor! ";
+ endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
+ endMessage += " task was to assassinate " + target.character.Info.Name + ". ";
+ endMessage += "The task was unsuccessful - the has submarine reached its destination.";
+ End(endMessage);
+ return;
+ }
+ else if (DateTime.Now >= endTime)
+ {
+ string endMessage = traitor.character.Info.Name + " was a traitor! ";
+ endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
+ endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was unsuccesful.";
+ End(endMessage);
+ return;
+ }
+
}
}
}
diff --git a/Subsurface/Source/GameSession/GameModes/TutorialMode.cs b/Subsurface/Source/GameSession/GameModes/TutorialMode.cs
index 7a83faa6f..dd82ff8d9 100644
--- a/Subsurface/Source/GameSession/GameModes/TutorialMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/TutorialMode.cs
@@ -22,6 +22,8 @@ namespace Subsurface
Game1.GameSession.StartShift(TimeSpan.Zero, "tutorial");
+ Game1.GameSession.taskManager.Tasks.Clear();
+
Game1.GameScreen.Select();
}
@@ -184,7 +186,7 @@ namespace Subsurface
+ " going into the to the power connection - that's why the monitor isn't working."
+ " You should find a piece of wire to connect it. Try searching some of the cabinets scattered around the sub.");
- while (Character.Controlled.Inventory.items.FirstOrDefault(i => i!=null && i.GetComponent()!=null)==null)
+ while (!HasItem("Wire"))
{
yield return Status.Running;
}
@@ -280,32 +282,159 @@ namespace Subsurface
var moloch = new Character("Content/Characters/Moloch/moloch.xml", steering.Item.SimPosition + Vector2.UnitX * 15.0f);
moloch.PlaySound(AIController.AiState.Attack);
- //moloch.AIController.
-
infoBox = CreateInfoFrame("Uh-oh... Something enormous just appeared on the radar.");
- Structure window = null;
+ List windows = new List();
foreach (Structure s in Structure.wallList)
{
- if (s.CastShadow) continue;
+ if (s.CastShadow || !s.HasBody) continue;
- if (window == null || s.Rect.Right > window.Rect.Right) window = s;
+ if (s.Rect.Right > steering.Item.Position.X) windows.Add(s);
}
bool broken = false;
do
{
- moloch.AIController.SelectTarget(steering.Item);
- for (int i = 0; i < window.SectionCount; i++)
+ moloch.AIController.SelectTarget(steering.Item.CurrentHull.AiTarget);
+ Vector2 steeringDir = windows[0].Position - moloch.Position;
+ if (steeringDir != Vector2.Zero) steeringDir = Vector2.Normalize(steeringDir);
+
+ foreach (Limb limb in moloch.AnimController.limbs)
{
- if (!window.SectionHasHole(i)) continue;
- broken = true;
- break;
+ limb.body.LinearVelocity = new Vector2(limb.LinearVelocity.X, limb.LinearVelocity.Y + steeringDir.Y*0.01f);
}
+ moloch.AIController.Steering = steeringDir;
+
+ foreach (Structure window in windows)
+ {
+ for (int i = 0; i < window.SectionCount; i++)
+ {
+ if (!window.SectionHasHole(i)) continue;
+ broken = true;
+ break;
+ }
+ if (broken) break;
+ }
+
+
yield return new WaitForSeconds(1.0f);
} while (!broken);
+ yield return new WaitForSeconds(1.0f);
+
+
+ var capacitor1 = Item.itemList.Find(i => i.HasTag("capacitor1")).GetComponent();
+ var capacitor2 = Item.itemList.Find(i => i.HasTag("capacitor1")).GetComponent();
+ CoroutineManager.StartCoroutine(KeepEnemyAway(moloch, new PowerContainer[] { capacitor1, capacitor2 }));
+
+
+ infoBox = CreateInfoFrame("The hull has been breached! Close all the doors to the command room to stop the water from flooding the entire sub!");
+
+
+ Door commandDoor1 = Item.itemList.Find(i => i.HasTag("commanddoor1")).GetComponent();
+ Door commandDoor2 = Item.itemList.Find(i => i.HasTag("commanddoor2")).GetComponent();
+ Door commandDoor3 = Item.itemList.Find(i => i.HasTag("commanddoor3")).GetComponent();
+
+ while (commandDoor1.IsOpen && (commandDoor2.IsOpen || commandDoor3.IsOpen))
+ {
+ yield return Status.Running;
+ }
+
+ infoBox = CreateInfoFrame("Great! You should find yourself an diving mask or a diving suit, in case the creature causes more damage. "+
+ "There are some in the room next to the airlock.");
+
+ while (!HasItem("Diving Mask") && !HasItem("Diving Suit"))
+ {
+ yield return Status.Running;
+ }
+
+ if (HasItem("Diving Mask"))
+ {
+ infoBox = CreateInfoFrame("The diving mask will let you breathe underwater, but it won't protect from the water pressure outside the sub. "+
+ "It should be fine for the situation at hand, but you still need to find an oxygen tank and drag it into the same slot as the mask." +
+ "You should grab one or two.");
+ }
+ else if (HasItem("Diving Suit"))
+ {
+ infoBox = CreateInfoFrame("In addition to letting you breathe underwater, the suit will protect you from the water pressure outside the sub " +
+ "(unlike the diving mask). However, you still need to drag an oxygen tank into the same slot as the suit to supply oxygen. "+
+ "You should grab one or two.");
+ }
+
+ while (!HasItem("Oxygen Tank"))
+ {
+ yield return Status.Running;
+ }
+
+ yield return new WaitForSeconds(5.0f);
+
+ infoBox = CreateInfoFrame("Now it's time to stop the creature attacking the submarine. Head to the railgun room at the upper right corner of the sub.");
+
+ var railGun = Item.itemList.Find(i => i.GetComponent()!=null);
+
+ while (Vector2.Distance(Character.Controlled.Position, railGun.Position)>500)
+ {
+ yield return new WaitForSeconds(1.0f);
+ }
+
+ infoBox = CreateInfoFrame("The railgun requires a large power surge to fire. The reactor can't provide a surge large enough, so we need to use the "
+ +" supercapacitors in the railgun room. The capacitors need to be charged first; select them and crank up the recharge rate.");
+
+ while (capacitor1.RechargeSpeed<0.5f && capacitor2.RechargeSpeed<0.5f)
+ {
+ yield return new WaitForSeconds(1.0f);
+ }
+
+ infoBox = CreateInfoFrame("The capacitors consume large amounts of power when they're being charged at a high rate. "+
+ "Be cautious to overload the electrical grid or the reactor. They also take some time to recharge, so now is a good "+
+ "time to head to the room below to load some shells into the railgun.");
+
+
+ var loader = Item.itemList.Find(i => i.Name == "Railgun Loader").GetComponent();
+
+ while (Math.Abs(Character.Controlled.Position.Y - loader.Item.Position.Y)>50)
+ {
+ yield return Status.Running;
+ }
+
+ infoBox = CreateInfoFrame("Grab one of the shells. You can load it by selecting the railgun loader and dragging the shell to. "
+ +"one of the free slots.");
+
+ while (loader.Item.ContainedItems.FirstOrDefault(i => i != null) != null)
+ {
+ capacitor1.Charge += 1.0f;
+ capacitor2.Charge += 1.0f;
+ yield return Status.Running;
+ }
+
+
+ yield return Status.Success;
+ }
+
+ private bool HasItem(string itemName)
+ {
+ if (Character.Controlled == null) return false;
+ return Character.Controlled.Inventory.items.FirstOrDefault(i => i != null && i.Name == itemName)!=null;
+ }
+
+ ///
+ /// keeps the enemy away from the sub until the capacitors are loaded
+ ///
+ private IEnumerable