diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj
index 477c5b791..f1ca179b7 100644
--- a/Subsurface/Barotrauma.csproj
+++ b/Subsurface/Barotrauma.csproj
@@ -747,7 +747,9 @@
PreserveNewest
-
+
+ PreserveNewest
+
PreserveNewest
@@ -884,6 +886,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Subsurface/Content/Characters/Moloch/moloch.xml b/Subsurface/Content/Characters/Moloch/moloch.xml
index 3f9a40f45..18d51ad96 100644
--- a/Subsurface/Content/Characters/Moloch/moloch.xml
+++ b/Subsurface/Content/Characters/Moloch/moloch.xml
@@ -46,15 +46,15 @@
-
+
-
+
-
+
diff --git a/Subsurface/Content/Items/Clothes/clothes.xml b/Subsurface/Content/Items/Clothes/clothes.xml
index a0d4c251e..9586f6b69 100644
--- a/Subsurface/Content/Items/Clothes/clothes.xml
+++ b/Subsurface/Content/Items/Clothes/clothes.xml
@@ -53,7 +53,7 @@
-
diff --git a/Subsurface/Content/Items/OxygenGenerator/oxygengenerator.xml b/Subsurface/Content/Items/OxygenGenerator/oxygengenerator.xml
index 32f56a0c5..96501ab14 100644
--- a/Subsurface/Content/Items/OxygenGenerator/oxygengenerator.xml
+++ b/Subsurface/Content/Items/OxygenGenerator/oxygengenerator.xml
@@ -27,7 +27,7 @@
name="Vent"
linkable="true">
-
+
diff --git a/Subsurface/Content/Items/Reactor/reactor.xml b/Subsurface/Content/Items/Reactor/reactor.xml
index 74546b500..c23c90635 100644
--- a/Subsurface/Content/Items/Reactor/reactor.xml
+++ b/Subsurface/Content/Items/Reactor/reactor.xml
@@ -50,7 +50,8 @@
-
+ pickdistance="150"
+ price="200">
diff --git a/Subsurface/Content/Items/Weapons/smack.ogg b/Subsurface/Content/Items/Weapons/smack.ogg
new file mode 100644
index 000000000..bd3ec4bf7
Binary files /dev/null and b/Subsurface/Content/Items/Weapons/smack.ogg differ
diff --git a/Subsurface/Content/Items/Weapons/weapons.xml b/Subsurface/Content/Items/Weapons/weapons.xml
index 052a9ed4f..486ba31d5 100644
--- a/Subsurface/Content/Items/Weapons/weapons.xml
+++ b/Subsurface/Content/Items/Weapons/weapons.xml
@@ -4,6 +4,7 @@
-
@@ -67,12 +68,12 @@
-
-
-
+ aimpos="50,0" handle1="-15,-6" holdangle="100" reload="1.0">
+
+
+
-
+
@@ -81,9 +82,10 @@
-
+ name="Battery Cell"
+ pickdistance="150"
+ tags="smallitem,loadable"
+ price="50">
diff --git a/Subsurface/Content/Jobs.xml b/Subsurface/Content/Jobs.xml
index 7e5e6b6d0..925e30fc2 100644
--- a/Subsurface/Content/Jobs.xml
+++ b/Subsurface/Content/Jobs.xml
@@ -5,14 +5,14 @@
-
+
-
+
@@ -41,9 +41,11 @@
+
-
-
+
+
+
diff --git a/Subsurface/Content/Map/StructurePrefabs.xml b/Subsurface/Content/Map/StructurePrefabs.xml
index 2dfff52c7..29096ffc1 100644
--- a/Subsurface/Content/Map/StructurePrefabs.xml
+++ b/Subsurface/Content/Map/StructurePrefabs.xml
@@ -48,9 +48,6 @@
-
-
@@ -81,4 +78,7 @@
+
+
\ No newline at end of file
diff --git a/Subsurface/Content/Map/testroom.png b/Subsurface/Content/Map/testroom.png
index cb88347e0..75870c026 100644
Binary files a/Subsurface/Content/Map/testroom.png and b/Subsurface/Content/Map/testroom.png differ
diff --git a/Subsurface/Content/Quests.xml b/Subsurface/Content/Quests.xml
index 0942687c4..1adbaed14 100644
--- a/Subsurface/Content/Quests.xml
+++ b/Subsurface/Content/Quests.xml
@@ -7,7 +7,7 @@
reward="1000"
radarlabel="Infrasonic signal"
failuremessage="Retrieving the artifact failed"
- successmessage="The artifact has been succesfully retrived"
+ successmessage="The artifact has been succesfully retrieved"
itemname="Skyholder Artifact">
diff --git a/Subsurface/Data/ContentPackages/Vanilla 0.1.3.xml b/Subsurface/Data/ContentPackages/Vanilla 0.2.xml
similarity index 100%
rename from Subsurface/Data/ContentPackages/Vanilla 0.1.3.xml
rename to Subsurface/Data/ContentPackages/Vanilla 0.2.xml
diff --git a/Subsurface/Properties/AssemblyInfo.cs b/Subsurface/Properties/AssemblyInfo.cs
index e2a117134..32dd7fc3b 100644
--- a/Subsurface/Properties/AssemblyInfo.cs
+++ b/Subsurface/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.3.2")]
-[assembly: AssemblyFileVersion("0.1.3.2")]
+[assembly: AssemblyVersion("0.2.0.0")]
+[assembly: AssemblyFileVersion("0.2.0.0")]
diff --git a/Subsurface/Source/Characters/AICharacter.cs b/Subsurface/Source/Characters/AICharacter.cs
index 10b5fd345..0642b529d 100644
--- a/Subsurface/Source/Characters/AICharacter.cs
+++ b/Subsurface/Source/Characters/AICharacter.cs
@@ -131,7 +131,9 @@ namespace Barotrauma
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
{
- if (type == NetworkEventType.KillCharacter)
+ Enabled = true;
+
+ if (type == NetworkEventType.KillCharacter)
{
Kill(true);
return;
diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs
index 1115ae2ad..2a557fe23 100644
--- a/Subsurface/Source/Characters/Character.cs
+++ b/Subsurface/Source/Characters/Character.cs
@@ -112,7 +112,7 @@ namespace Barotrauma
{
get
{
- return SpeciesName;
+ return (info != null && !string.IsNullOrWhiteSpace(info.Name)) ? info.Name : SpeciesName;
}
}
@@ -604,20 +604,30 @@ namespace Barotrauma
return closestCharacter;
}
- private void ToggleSelectedCharacter(Character selected)
+ private void SelectCharacter(Character character, bool createNetworkEvent = true)
{
- if (selectedCharacter != null)
- {
- foreach (Limb limb in selectedCharacter.AnimController.Limbs)
- {
- limb.pullJoint.Enabled = false;
- }
- selectedCharacter = null;
- }
- else
+ if (character == null) return;
+
+ selectedCharacter = character;
+
+ if (createNetworkEvent)
+ new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, selectedCharacter.ID);
+
+ }
+
+ private void DeselectCharacter(bool createNetworkEvent = true)
+ {
+ if (selectedCharacter == null) return;
+
+ foreach (Limb limb in selectedCharacter.AnimController.Limbs)
{
- selectedCharacter = selected;
+ limb.pullJoint.Enabled = false;
}
+
+ selectedCharacter = null;
+
+ if (createNetworkEvent)
+ new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, -1);
}
///
@@ -724,7 +734,7 @@ namespace Barotrauma
if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 2.0f ||
(!selectedCharacter.isDead && selectedCharacter.Stun <= 0.0f))
{
- ToggleSelectedCharacter(selectedCharacter);
+ DeselectCharacter();
}
}
@@ -732,12 +742,12 @@ namespace Barotrauma
{
if (selectedCharacter != null)
{
- ToggleSelectedCharacter(selectedCharacter);
+ DeselectCharacter();
}
else if (closestCharacter != null && closestCharacter.IsHumanoid &&
(closestCharacter.isDead || closestCharacter.AnimController.StunTimer > 0.0f))
{
- selectedCharacter = closestCharacter;
+ SelectCharacter(closestCharacter);
}
}
@@ -1081,6 +1091,11 @@ namespace Barotrauma
message.Write((int)data);
return;
}
+ else if (type== NetworkEventType.SelectCharacter)
+ {
+ message.Write((int)data);
+ return;
+ }
else if (type == NetworkEventType.KillCharacter)
{
return;
@@ -1177,6 +1192,20 @@ namespace Barotrauma
return;
}
+ else if (type == NetworkEventType.SelectCharacter)
+ {
+ int characterId = message.ReadInt32();
+ if (characterId==-1)
+ {
+ DeselectCharacter(false);
+ }
+ else
+ {
+ Character character = FindEntityByID(characterId) as Character;
+ if (character != null) SelectCharacter(character, false);
+ }
+ return;
+ }
else if (type == NetworkEventType.KillCharacter)
{
Kill(true);
diff --git a/Subsurface/Source/Characters/StatusEffect.cs b/Subsurface/Source/Characters/StatusEffect.cs
index 5efa952b9..384c431e9 100644
--- a/Subsurface/Source/Characters/StatusEffect.cs
+++ b/Subsurface/Source/Characters/StatusEffect.cs
@@ -18,6 +18,8 @@ namespace Barotrauma
private TargetType targetTypes;
private string[] targetNames;
+ private List requiredItems;
+
public string[] propertyNames;
private object[] propertyEffects;
@@ -62,10 +64,11 @@ namespace Barotrauma
protected StatusEffect(XElement element)
{
+ requiredItems = new List();
+
IEnumerable attributes = element.Attributes();
List propertyAttributes = new List();
-
-
+
foreach (XAttribute attribute in attributes)
{
switch (attribute.Name.ToString())
@@ -140,6 +143,14 @@ namespace Barotrauma
case "explosion":
explosion = new Explosion(subElement);
break;
+ case "requireditem":
+ case "requireditems":
+ RelatedItem newRequiredItem = RelatedItem.Load(subElement);
+
+ if (newRequiredItem == null) continue;
+
+ requiredItems.Add(newRequiredItem);
+ break;
}
}
@@ -156,19 +167,42 @@ namespace Barotrauma
// if (this.type == type) Apply(deltaTime, character, item);
//}
+ private bool HasRequiredItems(Entity entity)
+ {
+ if (requiredItems == null) return true;
+ foreach (RelatedItem requiredItem in requiredItems)
+ {
+ Item item = entity as Item;
+ if (item != null)
+ {
+ if (!requiredItem.CheckRequirements(null, item)) return false;
+ }
+ Character character = entity as Character;
+ if (character != null)
+ {
+ if (!requiredItem.CheckRequirements(character, null)) return false;
+ }
+ }
+ return true;
+ }
+
public virtual void Apply(ActionType type, float deltaTime, Entity entity, IPropertyObject target)
{
+ if (this.type != type || !HasRequiredItems(entity)) return;
+
if (targetNames != null && !targetNames.Contains(target.Name)) return;
List targets = new List();
targets.Add(target);
- if (this.type == type) Apply(deltaTime, entity, targets);
+ Apply(deltaTime, entity, targets);
}
public virtual void Apply(ActionType type, float deltaTime, Entity entity, List targets)
{
- if (this.type == type) Apply(deltaTime, entity, targets);
+ if (this.type != type || !HasRequiredItems(entity)) return;
+
+ Apply(deltaTime, entity, targets);
}
protected virtual void Apply(float deltaTime, Entity entity, List targets)
diff --git a/Subsurface/Source/CoroutineManager.cs b/Subsurface/Source/CoroutineManager.cs
index 95b7a933b..d536edad9 100644
--- a/Subsurface/Source/CoroutineManager.cs
+++ b/Subsurface/Source/CoroutineManager.cs
@@ -95,10 +95,7 @@ namespace Barotrauma
{
timer -= deltaTime;
return timer<=0.0f;
-
}
-
-
}
diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs
index 134c4d8d9..4ed836b2b 100644
--- a/Subsurface/Source/DebugConsole.cs
+++ b/Subsurface/Source/DebugConsole.cs
@@ -273,7 +273,7 @@ namespace Barotrauma
}
break;
case "tutorial":
- TutorialMode.Start();
+ TutorialMode.StartTutorial();
break;
case "lobbyscreen":
case "lobby":
@@ -281,6 +281,7 @@ namespace Barotrauma
break;
case "savemap":
case "savesub":
+ case "save":
if (commands.Length < 2) break;
string fileName = string.Join(" ", commands.Skip(1));
@@ -294,6 +295,7 @@ namespace Barotrauma
break;
case "loadmap":
case "loadsub":
+ case "load":
if (commands.Length < 2) break;
Submarine.Load(string.Join(" ", commands.Skip(1)));
break;
diff --git a/Subsurface/Source/Events/Quests/SalvageQuest.cs b/Subsurface/Source/Events/Quests/SalvageQuest.cs
index 440fcc643..82f01a3ed 100644
--- a/Subsurface/Source/Events/Quests/SalvageQuest.cs
+++ b/Subsurface/Source/Events/Quests/SalvageQuest.cs
@@ -37,7 +37,7 @@ namespace Barotrauma
public override void Start(Level level)
{
- Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count)];
+ Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
item = new Item(itemPrefab, position + level.Position);
item.MoveWithLevel = true;
diff --git a/Subsurface/Source/GameMain.cs b/Subsurface/Source/GameMain.cs
index f54ffe3a8..33943dfc7 100644
--- a/Subsurface/Source/GameMain.cs
+++ b/Subsurface/Source/GameMain.cs
@@ -268,6 +268,8 @@ namespace Barotrauma
if (hasLoaded && !titleScreenOpen)
{
+ AmbientSoundManager.Update();
+
if (PlayerInput.KeyHit(Keys.Escape)) GUI.TogglePauseMenu();
DebugConsole.Update(this, (float)deltaTime);
diff --git a/Subsurface/Source/GameSession/GameModes/GameMode.cs b/Subsurface/Source/GameSession/GameModes/GameMode.cs
index d9165b4a9..02e207d05 100644
--- a/Subsurface/Source/GameSession/GameModes/GameMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/GameMode.cs
@@ -10,14 +10,10 @@ namespace Barotrauma
{
public static List PresetList = new List();
- TimeSpan duration;
protected DateTime startTime;
- protected DateTime endTime;
//public readonly bool IsSinglePlayer;
- private GUIProgressBar timerBar;
-
protected bool isRunning;
//protected string name;
@@ -31,16 +27,6 @@ namespace Barotrauma
get { return null; }
}
- public DateTime StartTime
- {
- get { return startTime; }
- }
-
- public DateTime EndTime
- {
- get { return endTime; }
- }
-
public bool IsRunning
{
get { return isRunning; }
@@ -68,19 +54,19 @@ namespace Barotrauma
public virtual void Draw(SpriteBatch spriteBatch)
{
- if (timerBar != null) timerBar.Draw(spriteBatch);
+ //if (timerBar != null) timerBar.Draw(spriteBatch);
}
- public virtual void Start(TimeSpan duration)
+ public virtual void Start()
{
startTime = DateTime.Now;
- if (duration!=TimeSpan.Zero)
- {
- endTime = startTime + duration;
- this.duration = duration;
+ //if (duration!=TimeSpan.Zero)
+ //{
+ // endTime = startTime + duration;
+ // this.duration = duration;
- timerBar = new GUIProgressBar(new Rectangle(GameMain.GraphicsWidth - 120, 20, 100, 25), Color.Gold, 0.0f, null);
- }
+ // timerBar = new GUIProgressBar(new Rectangle(GameMain.GraphicsWidth - 120, 20, 100, 25), Color.Gold, 0.0f, null);
+ //}
endMessage = "The round has ended!";
@@ -89,13 +75,13 @@ namespace Barotrauma
public virtual void Update(float deltaTime)
{
- if (!isRunning) return;
+ //if (!isRunning) return;
- if (duration != TimeSpan.Zero)
- {
- double elapsedTime = (DateTime.Now - startTime).TotalSeconds;
- timerBar.BarSize = (float)(elapsedTime / duration.TotalSeconds);
- }
+ //if (duration != TimeSpan.Zero)
+ //{
+ // double elapsedTime = (DateTime.Now - startTime).TotalSeconds;
+ // timerBar.BarSize = (float)(elapsedTime / duration.TotalSeconds);
+ //}
//if (DateTime.Now >= endTime)
//{
// End(endMessage);
diff --git a/Subsurface/Source/GameSession/GameModes/QuestMode.cs b/Subsurface/Source/GameSession/GameModes/QuestMode.cs
index 0c0f3304d..b02038dbc 100644
--- a/Subsurface/Source/GameSession/GameModes/QuestMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/QuestMode.cs
@@ -32,9 +32,9 @@ namespace Barotrauma
quest = Quest.LoadRandom(locations, rand);
}
- public override void Start(TimeSpan duration)
+ public override void Start()
{
- base.Start(duration);
+ base.Start();
new GUIMessageBox(quest.Name, quest.Description, 400, 400);
diff --git a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs
index 1e925e4c6..217b7e7a1 100644
--- a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs
@@ -88,6 +88,8 @@ namespace Barotrauma
CrewManager = new CrewManager(subElement);
}
+
+ savedOnStart = true;
}
public void GenerateMap(string seed)
@@ -95,7 +97,7 @@ namespace Barotrauma
Map = new Map(seed, 500);
}
- public override void Start(TimeSpan duration)
+ public override void Start()
{
CargoManager.CreateItems();
@@ -181,11 +183,13 @@ namespace Barotrauma
isRunning = false;
+ GameMain.GameSession.EndShift("");
+
//if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage;
StringBuilder sb = new StringBuilder();
- List casualties = CrewManager.characters.FindAll(c => c.IsDead);
+ List casualties = CrewManager.characters.FindAll(c => c.IsDead);
if (casualties.Count == CrewManager.characters.Count)
{
@@ -226,8 +230,7 @@ namespace Barotrauma
Character.CharacterList[i].Remove();
}
- GameMain.GameSession.EndShift("");
-
+ Submarine.Unload();
}
private bool EndShift(GUIButton button, object obj)
diff --git a/Subsurface/Source/GameSession/GameModes/TraitorMode.cs b/Subsurface/Source/GameSession/GameModes/TraitorMode.cs
index b9264e960..34df3fe02 100644
--- a/Subsurface/Source/GameSession/GameModes/TraitorMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/TraitorMode.cs
@@ -15,9 +15,9 @@ namespace Barotrauma
}
- public override void Start(TimeSpan duration)
+ public override void Start()
{
- base.Start(duration);
+ base.Start();
traitor = null;
target = null;
@@ -56,7 +56,7 @@ namespace Barotrauma
{
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 succesful.";
+ endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was successful.";
End(endMessage);
}
else if (traitor.character.IsDead)
@@ -78,14 +78,6 @@ namespace Barotrauma
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 2b46b1c66..2c442d6f3 100644
--- a/Subsurface/Source/GameSession/GameModes/TutorialMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/TutorialMode.cs
@@ -15,13 +15,13 @@ namespace Barotrauma
private GUIComponent infoBox;
- public static void Start()
+ public static void StartTutorial()
{
Submarine.Load("Content/Map/TutorialSub.sub", "");
GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameModePreset.list.Find(gm => gm.Name.ToLower()=="tutorial"));
- GameMain.GameSession.StartShift(TimeSpan.Zero, "tutorial");
+ GameMain.GameSession.StartShift("tutorial");
GameMain.GameSession.taskManager.Tasks.Clear();
@@ -34,9 +34,9 @@ namespace Barotrauma
CrewManager = new CrewManager();
}
- public override void Start(TimeSpan duration)
+ public override void Start()
{
- base.Start(duration);
+ base.Start();
WayPoint wayPoint = WayPoint.GetRandom(SpawnType.Cargo, null);
if (wayPoint==null)
@@ -273,8 +273,15 @@ namespace Barotrauma
yield return new WaitForSeconds(2.0f);
infoBox = CreateInfoFrame("You can now move the other end of the wire around, and attach it on the wall by left clicking or "
- + "remove the previous attachment by right clicking. Or you can just run the wire straight to the junction box and attach it "
- + " the same way you did to the navigation terminal.");
+ + "remove the previous attachment by right clicking. Or if you don't care for neatly laid out wiring, you can just "
+ +"run it straight to the junction box.");
+
+ while (Character.Controlled.SelectedConstruction == null || Character.Controlled.SelectedConstruction.GetComponent()==null)
+ {
+ yield return CoroutineStatus.Running;
+ }
+
+ infoBox = CreateInfoFrame("Connect the wire to the junction box by pulling it to the power connection, the same way you did with the navigation terminal.");
while (radar.Voltage<0.1f)
{
@@ -346,10 +353,10 @@ namespace Barotrauma
Vector2 steeringDir = windows[0].Position - moloch.Position;
if (steeringDir != Vector2.Zero) steeringDir = Vector2.Normalize(steeringDir);
- foreach (Limb limb in moloch.AnimController.Limbs)
- {
- limb.body.LinearVelocity = new Vector2(limb.LinearVelocity.X*2.0f, limb.LinearVelocity.Y + steeringDir.Y*10.0f);
- }
+ //foreach (Limb limb in moloch.AnimController.Limbs)
+ //{
+ // limb.body.LinearVelocity = new Vector2(limb.LinearVelocity.X*2.0f, limb.LinearVelocity.Y + steeringDir.Y*10.0f);
+ //}
moloch.AIController.Steering = steeringDir;
@@ -365,11 +372,12 @@ namespace Barotrauma
}
- yield return new WaitForSeconds(1.0f);
+ yield return new WaitForSeconds(0.1f);
} while (!broken);
yield return new WaitForSeconds(0.5f);
-
+
+ Submarine.Loaded.GodMode = true;
var capacitor1 = Item.itemList.Find(i => i.HasTag("capacitor1")).GetComponent();
var capacitor2 = Item.itemList.Find(i => i.HasTag("capacitor1")).GetComponent();
@@ -470,6 +478,8 @@ namespace Barotrauma
yield return CoroutineStatus.Running;
}
+ Submarine.Loaded.GodMode = false;
+
infoBox = CreateInfoFrame("The creature has died. Now you should fix the damages in the control room: "+
"Grab a welding tool from the closet in the railgun room.");
@@ -584,7 +594,7 @@ namespace Barotrauma
private bool Restart(GUIButton button, object obj)
{
- TutorialMode.Start();
+ TutorialMode.StartTutorial();
return true;
}
diff --git a/Subsurface/Source/GameSession/GameSession.cs b/Subsurface/Source/GameSession/GameSession.cs
index 86fde58ea..a2ce69108 100644
--- a/Subsurface/Source/GameSession/GameSession.cs
+++ b/Subsurface/Source/GameSession/GameSession.cs
@@ -98,14 +98,14 @@ namespace Barotrauma
}
}
- public void StartShift(TimeSpan duration, string levelSeed)
+ public void StartShift(string levelSeed)
{
Level level = Level.CreateRandom(levelSeed);
- StartShift(duration, level);
+ StartShift(level);
}
- public void StartShift(TimeSpan duration, Level level, bool reloadSub = true)
+ public void StartShift(Level level, bool reloadSub = true)
{
GameMain.LightManager.LosEnabled = (GameMain.Server==null || GameMain.Server.CharacterInfo!=null);
@@ -129,7 +129,7 @@ namespace Barotrauma
if (Quest!=null) Quest.Start(Level.Loaded);
- if (gameMode!=null) gameMode.Start(duration);
+ if (gameMode!=null) gameMode.Start();
taskManager.StartShift(level);
}
@@ -145,7 +145,7 @@ namespace Barotrauma
}
else if (GameMain.Client==null)
{
- Submarine.Unload();
+ //Submarine.Unload();
GameMain.LobbyScreen.Select();
}
diff --git a/Subsurface/Source/GameSettings.cs b/Subsurface/Source/GameSettings.cs
index 97290cad9..bf3e37f4c 100644
--- a/Subsurface/Source/GameSettings.cs
+++ b/Subsurface/Source/GameSettings.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.Xna.Framework.Graphics;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -73,10 +74,16 @@ namespace Barotrauma
}
XElement graphicsMode = doc.Root.Element("graphicsmode");
- GraphicsWidth = int.Parse(graphicsMode.Attribute("width").Value);
- GraphicsHeight = int.Parse(graphicsMode.Attribute("height").Value);
-
- FullScreenEnabled = graphicsMode.Attribute("fullscreen").Value == "true";
+ GraphicsWidth = ToolBox.GetAttributeInt(graphicsMode, "width", 0);
+ GraphicsHeight = ToolBox.GetAttributeInt(graphicsMode, "height", 0);
+
+ if (GraphicsWidth==0 || GraphicsHeight==0)
+ {
+ GraphicsWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
+ GraphicsHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
+ }
+
+ FullScreenEnabled = ToolBox.GetAttributeBool(graphicsMode, "fullscreen", true);
MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", "");
diff --git a/Subsurface/Source/Items/CharacterInventory.cs b/Subsurface/Source/Items/CharacterInventory.cs
index 56fab4692..6a17ab096 100644
--- a/Subsurface/Source/Items/CharacterInventory.cs
+++ b/Subsurface/Source/Items/CharacterInventory.cs
@@ -155,7 +155,12 @@ namespace Barotrauma
if (items[i].Combine(item))
{
//PutItem(items[i], i, false, false);
- new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, items[i].ID, true);
+ Inventory otherInventory = items[i].inventory;
+ if (otherInventory!=null)
+ {
+ new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, otherInventory.ID, true);
+ }
+
combined = true;
}
diff --git a/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs b/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs
index 5dc68a12f..5c474d137 100644
--- a/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs
+++ b/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs
@@ -2,6 +2,7 @@
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
using Microsoft.Xna.Framework;
+using System;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
@@ -18,6 +19,10 @@ namespace Barotrauma.Items.Components
private Character user;
+ private float reload;
+
+ private float reloadTimer;
+
[HasDefaultValue(0.0f, false)]
public float Range
{
@@ -25,6 +30,13 @@ namespace Barotrauma.Items.Components
set { range = ConvertUnits.ToSimUnits(value); }
}
+ [HasDefaultValue(0.5f, false)]
+ public float Reload
+ {
+ get { return reload; }
+ set { reload = Math.Max(0.0f, value); }
+ }
+
public MeleeWeapon(Item item, XElement element)
: base(item, element)
{
@@ -35,22 +47,19 @@ namespace Barotrauma.Items.Components
if (subElement.Name.ToString().ToLower() != "attack") continue;
attack = new Attack(subElement);
}
-
- if (attack==null)
- {
- DebugConsole.ThrowError("Item ''"+item.Name+"'' doesn't have an attack configured");
- }
}
public override bool Use(float deltaTime, Character character = null)
{
- if (character == null) return false;
+ if (character == null || reloadTimer>0.0f) return false;
if (!character.GetInputState(InputType.SecondaryHeld) || hitting) return false;
user = character;
if (hitPos < MathHelper.Pi * 0.69f) return false;
+ reloadTimer = reload;
+
item.body.FarseerBody.CollisionCategories = Physics.CollisionProjectile;
item.body.FarseerBody.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall;
item.body.FarseerBody.OnCollision += OnCollision;
@@ -95,6 +104,8 @@ namespace Barotrauma.Items.Components
if (!item.body.Enabled) return;
if (!picker.HasSelectedItem(item)) IsActive = false;
+ reloadTimer -= deltaTime;
+
if (!picker.GetInputState(InputType.SecondaryHeld) && !hitting) hitPos = 0.0f;
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
@@ -117,8 +128,6 @@ namespace Barotrauma.Items.Components
{
ac.HoldItem(deltaTime, item, handlePos, new Vector2(hitPos, 0.0f), aimPos, false, 0.0f);
}
-
-
}
else
{
@@ -174,20 +183,24 @@ namespace Barotrauma.Items.Components
if (limb.character == picker) return false;
target = limb.character;
}
+ else
+ {
+ return false;
+ }
- if (target==null)
+ if (target == null)
{
target = f2.Body.UserData as IDamageable;
}
if (target == null) return false;
- attack.DoDamage(user, target, item.Position, 1.0f);
+ if (attack!=null) attack.DoDamage(user, target, item.Position, 1.0f);
RestoreCollision();
hitting = false;
- ApplyStatusEffects(ActionType.OnUse, 1.0f, picker);
+ ApplyStatusEffects(ActionType.OnUse, 1.0f, limb.character);
return true;
}
diff --git a/Subsurface/Source/Items/Components/Machines/Engine.cs b/Subsurface/Source/Items/Components/Machines/Engine.cs
index f26735544..d41bb4bc4 100644
--- a/Subsurface/Source/Items/Components/Machines/Engine.cs
+++ b/Subsurface/Source/Items/Components/Machines/Engine.cs
@@ -20,15 +20,15 @@ namespace Barotrauma.Items.Components
float powerPerForce;
- [Editable, HasDefaultValue(1.0f, true)]
- public float PowerPerForce
- {
- get { return powerPerForce; }
- set
- {
- powerPerForce = Math.Max(0.0f, value);
- }
- }
+ //[Editable, HasDefaultValue(1.0f, true)]
+ //public float PowerPerForce
+ //{
+ // get { return powerPerForce; }
+ // set
+ // {
+ // powerPerForce = Math.Max(0.0f, value);
+ // }
+ //}
[Editable, HasDefaultValue(2000.0f, true)]
public float MaxForce
@@ -61,7 +61,7 @@ namespace Barotrauma.Items.Components
{
base.Update(deltaTime, cam);
- currPowerConsumption = Math.Abs(targetForce) * powerPerForce;
+ currPowerConsumption = Math.Abs(targetForce)/100.0f * powerConsumption;
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
if (Force != 0.0f)
diff --git a/Subsurface/Source/Items/Components/Machines/MiniMap.cs b/Subsurface/Source/Items/Components/Machines/MiniMap.cs
index 7f03e33f3..32b31ddb2 100644
--- a/Subsurface/Source/Items/Components/Machines/MiniMap.cs
+++ b/Subsurface/Source/Items/Components/Machines/MiniMap.cs
@@ -14,10 +14,14 @@ namespace Barotrauma.Items.Components
IsActive = true;
}
+ bool hasPower;
+
public override void Update(float deltaTime, Camera cam)
{
currPowerConsumption = powerConsumption;
-
+
+ hasPower = voltage > minVoltage;
+
voltage = 0.0f;
}
@@ -38,6 +42,8 @@ namespace Barotrauma.Items.Components
GuiFrame.Draw(spriteBatch);
+ if (!hasPower) return;
+
//GUI.DrawRectangle(spriteBatch, new Rectangle(x,y,width,height), Color.Black, true);
Rectangle miniMap = new Rectangle(x + 20, y + 40, width - 40, height - 60);
diff --git a/Subsurface/Source/Items/Components/Machines/OxygenGenerator.cs b/Subsurface/Source/Items/Components/Machines/OxygenGenerator.cs
index f69703b60..791ad8373 100644
--- a/Subsurface/Source/Items/Components/Machines/OxygenGenerator.cs
+++ b/Subsurface/Source/Items/Components/Machines/OxygenGenerator.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.Xna.Framework;
+using System;
using System.Collections.Generic;
using System.Xml.Linq;
@@ -12,6 +13,8 @@ namespace Barotrauma.Items.Components
bool running;
+ private float generatedAmount;
+
List ventList;
public bool IsRunning()
@@ -25,6 +28,13 @@ namespace Barotrauma.Items.Components
private set;
}
+ [Editable, HasDefaultValue(100.0f, true)]
+ public float GeneratedAmount
+ {
+ get { return generatedAmount; }
+ set { generatedAmount = MathHelper.Clamp(value, -10000.0f, 10000.0f); }
+ }
+
public OxygenGenerator(Item item, XElement element)
: base(item, element)
{
@@ -64,7 +74,7 @@ namespace Barotrauma.Items.Components
running = true;
- CurrFlow = Math.Min(voltage, 1.0f) * 50000.0f;
+ CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount * 1000.0f;
item.CurrentHull.Oxygen += CurrFlow * deltaTime;
UpdateVents(CurrFlow);
diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs
index 88de703e5..e4004b4c4 100644
--- a/Subsurface/Source/Items/Item.cs
+++ b/Subsurface/Source/Items/Item.cs
@@ -816,8 +816,11 @@ namespace Barotrauma
if (item.prefab.PickDistance == 0.0f) continue;
if (Vector2.Distance(position, item.SimPosition) > item.prefab.PickDistance) continue;
- Body body = Submarine.CheckVisibility(position, item.SimPosition);
- if (body != null && body.UserData as Item != item) continue;
+ if (!item.prefab.PickThroughWalls)
+ {
+ Body body = Submarine.CheckVisibility(position, item.SimPosition);
+ if (body != null && body.UserData as Item != item) continue;
+ }
dist = Vector2.Distance(pickPosition, item.SimPosition);
if (dist < item.prefab.PickDistance && (closest == null || dist < closestDist))
diff --git a/Subsurface/Source/Items/ItemPrefab.cs b/Subsurface/Source/Items/ItemPrefab.cs
index 5ecdd28d1..f7f3f4b66 100644
--- a/Subsurface/Source/Items/ItemPrefab.cs
+++ b/Subsurface/Source/Items/ItemPrefab.cs
@@ -25,6 +25,8 @@ namespace Barotrauma
//how close the character has to be to the item to pick it up
private float pickDistance;
+ private bool pickThroughWalls;
+
//an area next to the construction
//the construction can be Activated() by a character inside the area
public List Triggers;
@@ -39,6 +41,11 @@ namespace Barotrauma
get { return pickDistance; }
}
+ public bool PickThroughWalls
+ {
+ get { return pickThroughWalls; }
+ }
+
public override bool IsLinkable
{
@@ -146,6 +153,7 @@ namespace Barotrauma
name = ToolBox.GetAttributeString(element, "name", "");
if (name == "") DebugConsole.ThrowError("Unnamed item in "+filePath+"!");
+ pickThroughWalls = ToolBox.GetAttributeBool(element, "pickthroughwalls", false);
pickDistance = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "pickdistance", 0.0f));
isLinkable = ToolBox.GetAttributeBool(element, "linkable", false);
diff --git a/Subsurface/Source/Items/RelatedItem.cs b/Subsurface/Source/Items/RelatedItem.cs
index dbc4ce005..2bccf83cc 100644
--- a/Subsurface/Source/Items/RelatedItem.cs
+++ b/Subsurface/Source/Items/RelatedItem.cs
@@ -71,6 +71,42 @@ namespace Barotrauma
statusEffects = new List();
}
+ public bool CheckRequirements(Character character, Item parentItem)
+ {
+ switch (type)
+ {
+ case RelationType.Contained:
+ if (parentItem == null) return false;
+ foreach (Item contained in parentItem.ContainedItems)
+ {
+ if (contained.Condition>0.0f && MatchesItem(contained)) return true;
+ }
+ break;
+ case RelationType.Equipped:
+ if (character == null) return false;
+ foreach (Item equippedItem in character.SelectedItems)
+ {
+ if (equippedItem == null) continue;
+
+ if (equippedItem.Condition>0.0f && MatchesItem(equippedItem)) return true;
+ }
+ break;
+ case RelationType.Picked:
+ if (character == null || character.Inventory==null) return false;
+ foreach (Item pickedItem in character.Inventory.items)
+ {
+ if (pickedItem == null) continue;
+
+ if (MatchesItem(pickedItem)) return true;
+ }
+ break;
+ default:
+ return true;
+ }
+
+ return false;
+ }
+
public void Save(XElement element)
{
element.Add(
diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs
index 5ca6f7971..0c01bc390 100644
--- a/Subsurface/Source/Map/Levels/Level.cs
+++ b/Subsurface/Source/Map/Levels/Level.cs
@@ -745,7 +745,7 @@ int currentTargetIndex = 1;
}
AtStartPosition = Vector2.Distance(startPosition, -Position) < ExitDistance;
- AtEndPosition = Vector2.Distance(endPosition, -Position) < ExitDistance;
+ AtEndPosition = Vector2.Distance(endPosition, -Position) < ExitDistance;
prevVelocity = simVelocity;
}
diff --git a/Subsurface/Source/Map/Structure.cs b/Subsurface/Source/Map/Structure.cs
index 601872dbf..a5d541f40 100644
--- a/Subsurface/Source/Map/Structure.cs
+++ b/Subsurface/Source/Map/Structure.cs
@@ -423,6 +423,7 @@ namespace Barotrauma
public AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, float deltaTime, bool playSound = false)
{
+ if (Submarine.Loaded != null && Submarine.Loaded.GodMode) return new AttackResult(0.0f, 0.0f);
if (!prefab.HasBody || prefab.IsPlatform) return new AttackResult(0.0f, 0.0f);
int i = FindSectionIndex(ConvertUnits.ToDisplayUnits(position));
@@ -445,13 +446,13 @@ namespace Barotrauma
private void SetDamage(int sectionIndex, float damage)
{
+ if (Submarine.Loaded != null && Submarine.Loaded.GodMode) return;
if (!prefab.HasBody) return;
if (damage != sections[sectionIndex].damage && Math.Abs(sections[sectionIndex].lastSentDamage - damage)>5.0f)
{
- new NetworkEvent(NetworkEventType.UpdateEntity, ID, false, sectionIndex);
+ new NetworkEvent(NetworkEventType.WallDamage, ID, false, sectionIndex);
sections[sectionIndex].lastSentDamage = damage;
-
}
if (damage < prefab.MaxHealth*0.5f)
diff --git a/Subsurface/Source/Map/Submarine.cs b/Subsurface/Source/Map/Submarine.cs
index 063f7014e..21ed6e856 100644
--- a/Subsurface/Source/Map/Submarine.cs
+++ b/Subsurface/Source/Map/Submarine.cs
@@ -61,6 +61,12 @@ namespace Barotrauma
get { return lastPickedFraction; }
}
+ public bool GodMode
+ {
+ get;
+ set;
+ }
+
public Md5Hash MD5Hash
{
get
diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs
index a048500e0..3b45763df 100644
--- a/Subsurface/Source/Networking/GameClient.cs
+++ b/Subsurface/Source/Networking/GameClient.cs
@@ -247,12 +247,15 @@ namespace Barotrauma.Networking
if (connectionStatus != NetConnectionStatus.Connected)
{
string denyMessage = inc.ReadString();
- DebugConsole.ThrowError(denyMessage);
+
+ new GUIMessageBox("Couldn't connect to server", denyMessage);
+ connectCanceled = true;
}
break;
default:
Console.WriteLine(inc.ReadString() + " Strange message");
+ connectCanceled = true;
break;
}
}
@@ -457,9 +460,6 @@ namespace Barotrauma.Networking
yield return CoroutineStatus.Running;
- double durationMinutes = inc.ReadDouble();
-
- TimeSpan duration = new TimeSpan(0, (int)durationMinutes, 0);
Rand.SetSyncedSeed(seed);
//int gameModeIndex = inc.ReadInt32();
@@ -467,7 +467,7 @@ namespace Barotrauma.Networking
yield return CoroutineStatus.Running;
- GameMain.GameSession.StartShift(duration, levelSeed);
+ GameMain.GameSession.StartShift(levelSeed);
yield return CoroutineStatus.Running;
@@ -501,9 +501,10 @@ namespace Barotrauma.Networking
public IEnumerable