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 EndGame(string endMessage) { + var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300); + + if (!gameStarted) yield return CoroutineStatus.Success; gameStarted = false; - - var messageBox = new GUIMessageBox("The round has ended", endMessage); Character.Controlled = null; GameMain.LightManager.LosEnabled = false; @@ -529,7 +530,7 @@ namespace Barotrauma.Networking yield return CoroutineStatus.Running; } while (secondsLeft > 0.0f); - messageBox.Text = endMessage; + messageBox.Close(null,null); Submarine.Unload(); diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index 3f9ba9755..a6c261be4 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -601,7 +601,7 @@ namespace Barotrauma.Networking int seed = DateTime.Now.Millisecond; Rand.SetSyncedSeed(seed); GameMain.GameSession = new GameSession(selectedSub, "", GameMain.NetLobbyScreen.SelectedMode); - GameMain.GameSession.StartShift(GameMain.NetLobbyScreen.GameDuration, GameMain.NetLobbyScreen.LevelSeed); + GameMain.GameSession.StartShift(GameMain.NetLobbyScreen.LevelSeed); yield return CoroutineStatus.Running; @@ -662,7 +662,7 @@ namespace Barotrauma.Networking msg.Write(GameMain.NetLobbyScreen.SelectedMode.Name); - msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes); + //msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes); msg.Write((myCharacter == null) ? connectedClients.Count : connectedClients.Count + 1); foreach (Client client in connectedClients) @@ -703,8 +703,7 @@ namespace Barotrauma.Networking public IEnumerable EndGame(string endMessage) { - - var messageBox = new GUIMessageBox("The round has ended", endMessage); + var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300); Character.Controlled = null; GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; @@ -754,6 +753,8 @@ namespace Barotrauma.Networking Submarine.Unload(); + messageBox.Close(null, null); + GameMain.NetLobbyScreen.Select(); yield return CoroutineStatus.Success; @@ -1003,17 +1004,18 @@ namespace Barotrauma.Networking } //share the rest of the jobs according to the ''commonness'' of the job - float totalCommonness = 0.0f; - for (int i = 0; i < JobPrefab.List.Count; i++) - { - if (JobPrefab.List[i].AllowAlways || JobPrefab.List[i].MaxNumber == 0) continue; + //float totalCommonness = 0.0f; + //for (int i = 0; i < JobPrefab.List.Count; i++) + //{ + // if (JobPrefab.List[i].AllowAlways || JobPrefab.List[i].MaxNumber == 0) continue; - totalCommonness += JobPrefab.List[i].Commonness; - } + // totalCommonness += JobPrefab.List[i].Commonness; + //} - for (int preferenceIndex = 0; preferenceIndex < 3; preferenceIndex++) + //find a suitable job for the rest of the players + for (int i = unassigned.Count - 1; i >= 0; i--) { - for (int i = unassigned.Count - 1; i >= 0; i--) + for (int preferenceIndex = 0; preferenceIndex < 3; preferenceIndex++) { int jobIndex = JobPrefab.List.FindIndex(jp => jp == unassigned[i].jobPreferences[preferenceIndex]); @@ -1024,6 +1026,7 @@ namespace Barotrauma.Networking assignedClientCount[jobIndex]++; unassigned.RemoveAt(i); + break; } } @@ -1038,6 +1041,7 @@ namespace Barotrauma.Networking foreach (Client c in clients) { int index = c.jobPreferences.FindIndex(jp => jp == job); + if (index == -1) index = 1000; if (preferredClient == null || index < bestPreference) { bestPreference = index; diff --git a/Subsurface/Source/Networking/NetworkEvent.cs b/Subsurface/Source/Networking/NetworkEvent.cs index 8e1595605..b08501f96 100644 --- a/Subsurface/Source/Networking/NetworkEvent.cs +++ b/Subsurface/Source/Networking/NetworkEvent.cs @@ -11,14 +11,17 @@ namespace Barotrauma.Networking DropItem = 3, InventoryUpdate = 4, PickItem = 5, - UpdateProperty = 6 + UpdateProperty = 6, + WallDamage = 7, + SelectCharacter = 8 } class NetworkEvent { public static List events = new List(); - private static bool[] isImportant = { false, true, false, true, true, true, true }; + private static bool[] isImportant = { false, true, false, true, true, true, true, true, true }; + private static bool[] overridePrevious = { true, false, true, false, false, false, true, true, true }; private int id; @@ -68,7 +71,7 @@ namespace Barotrauma.Networking eventType = type; - if (!isImportant[(int)type]) + if (overridePrevious[(int)type]) { if (events.Find(e => e.id == id && e.eventType == type) != null) return; } diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index 04da3ef86..4704358f3 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -65,8 +65,6 @@ namespace Barotrauma //http://gafferongames.com/game-physics/fix-your-timestep/ Physics.accumulator += deltaTime; - AmbientSoundManager.Update(); - #if DEBUG if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null) { diff --git a/Subsurface/Source/Screens/LobbyScreen.cs b/Subsurface/Source/Screens/LobbyScreen.cs index 4241a7ee2..947cf2b75 100644 --- a/Subsurface/Source/Screens/LobbyScreen.cs +++ b/Subsurface/Source/Screens/LobbyScreen.cs @@ -447,7 +447,7 @@ namespace Barotrauma private bool StartShift(GUIButton button, object selection) { //GameMain.ShowLoading(ShiftLoading()); - GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false); + GameMain.GameSession.StartShift(selectedLevel, false); GameMain.GameScreen.Select(); return true; @@ -455,7 +455,7 @@ namespace Barotrauma private IEnumerable ShiftLoading() { - GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false); + GameMain.GameSession.StartShift(selectedLevel, false); GameMain.GameScreen.Select(); yield return CoroutineStatus.Success; diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs index 09ce8d636..bf973a0a3 100644 --- a/Subsurface/Source/Screens/MainMenuScreen.cs +++ b/Subsurface/Source/Screens/MainMenuScreen.cs @@ -196,7 +196,7 @@ namespace Barotrauma private bool TutorialButtonClicked(GUIButton button, object obj) { - TutorialMode.Start(); + TutorialMode.StartTutorial(); return true; } diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs index fc4e7a22e..669459947 100644 --- a/Subsurface/Source/Screens/NetLobbyScreen.cs +++ b/Subsurface/Source/Screens/NetLobbyScreen.cs @@ -23,7 +23,7 @@ namespace Barotrauma private GUITextBox textBox, seedBox; - private GUIScrollBar durationBar; + //private GUIScrollBar durationBar; private GUIFrame playerFrame; @@ -60,16 +60,7 @@ namespace Barotrauma { return ServerMessage; } - - public TimeSpan GameDuration - { - get - { - int minutes = (int)(durationBar.BarScroll* 60.0f); - return new TimeSpan(0, minutes, 0); - } - } - + public List JobPreferences { get @@ -100,10 +91,10 @@ namespace Barotrauma } } - public string DurationText() - { - return "Duration: " + GameDuration.TotalMinutes + " min"; - } + //public string DurationText() + //{ + // return "Duration: " + GameDuration.TotalMinutes + " min"; + //} public NetLobbyScreen() { @@ -214,20 +205,20 @@ namespace Barotrauma //duration ------------------------------------------------------------------ - GUITextBlock durationText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20), - "Duration: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame); - durationText.TextGetter = DurationText; + //GUITextBlock durationText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20), + // "Duration: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame); + //durationText.TextGetter = DurationText; - durationBar = new GUIScrollBar(new Rectangle(columnX, 150, columnWidth, 20), - GUI.Style, 0.1f, infoFrame); - durationBar.BarSize = 0.1f; + //durationBar = new GUIScrollBar(new Rectangle(columnX, 150, columnWidth, 20), + // GUI.Style, 0.1f, infoFrame); + //durationBar.BarSize = 0.1f; //seed ------------------------------------------------------------------ - new GUITextBlock(new Rectangle(columnX, 190, columnWidth, 20), + new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20), "Level Seed: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame); - seedBox = new GUITextBox(new Rectangle(columnX, 220, columnWidth, 20), + seedBox = new GUITextBox(new Rectangle(columnX, 150, columnWidth, 20), Alignment.TopLeft, GUI.Style, infoFrame); seedBox.OnTextChanged = SelectSeed; LevelSeed = ToolBox.RandomSeed(8); @@ -262,8 +253,7 @@ namespace Barotrauma GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; subList.Enabled = GameMain.Server != null; - modeList.Enabled = GameMain.Server != null; - durationBar.Enabled = GameMain.Server != null; + modeList.Enabled = GameMain.Server != null; seedBox.Enabled = GameMain.Server != null; serverMessage.Enabled = GameMain.Server != null; ServerName = (GameMain.Server==null) ? "Server" : GameMain.Server.Name; @@ -279,8 +269,7 @@ namespace Barotrauma startButton.UserData = "startButton"; //mapList.OnSelected = new GUIListBox.OnSelectedHandler(Game1.server.UpdateNetLobby); - modeList.OnSelected += GameMain.Server.UpdateNetLobby; - durationBar.OnMoved = GameMain.Server.UpdateNetLobby; + modeList.OnSelected += GameMain.Server.UpdateNetLobby; if (subList.CountChildren > 0 && subList.Selected == null) subList.Select(-1); if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(-1); @@ -702,10 +691,10 @@ namespace Barotrauma msg.Write(ServerMessage); msg.Write(modeList.SelectedIndex-1); - msg.Write(durationBar.BarScroll); + //msg.Write(durationBar.BarScroll); msg.Write(LevelSeed); - msg.Write((byte)(playerList.CountChildren - 1)); + msg.Write((byte)(playerList.CountChildren)); for (int i = 0; i < playerList.CountChildren; i++) { string clientName = playerList.children[i].UserData as string; @@ -721,7 +710,7 @@ namespace Barotrauma string mapName="", md5Hash=""; int modeIndex = 0; - float durationScroll = 0.0f; + //float durationScroll = 0.0f; string levelSeed = ""; try @@ -734,7 +723,7 @@ namespace Barotrauma modeIndex = msg.ReadInt32(); - durationScroll = msg.ReadFloat(); + //durationScroll = msg.ReadFloat(); levelSeed = msg.ReadString(); @@ -756,7 +745,7 @@ namespace Barotrauma modeList.Select(modeIndex); - durationBar.BarScroll = durationScroll; + //durationBar.BarScroll = durationScroll; LevelSeed = levelSeed; } diff --git a/Subsurface/Source/Screens/ServerListScreen.cs b/Subsurface/Source/Screens/ServerListScreen.cs index 92a30889d..362938184 100644 --- a/Subsurface/Source/Screens/ServerListScreen.cs +++ b/Subsurface/Source/Screens/ServerListScreen.cs @@ -42,6 +42,7 @@ namespace Barotrauma Rectangle panelRect = new Rectangle(0, 0, width, height); menu = new GUIFrame(panelRect, null, Alignment.Center, GUI.Style); + menu.Padding = new Vector4(40.0f, 40.0f, 40.0f, 20.0f); new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", GUI.Style, Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont); @@ -53,7 +54,7 @@ namespace Barotrauma int middleX = (int)(width * 0.4f); - serverList = new GUIListBox(new Rectangle(middleX,60,0,(int)(height*0.7f)), GUI.Style, menu); + serverList = new GUIListBox(new Rectangle(middleX,60,0,height-160), GUI.Style, menu); serverList.OnSelected = SelectServer; float[] columnRelativeX = new float[] { 0.15f, 0.55f, 0.15f, 0.15f }; diff --git a/Subsurface/Source/Sounds/AmbientSoundManager.cs b/Subsurface/Source/Sounds/AmbientSoundManager.cs index f633735ea..c78161f04 100644 --- a/Subsurface/Source/Sounds/AmbientSoundManager.cs +++ b/Subsurface/Source/Sounds/AmbientSoundManager.cs @@ -161,6 +161,22 @@ namespace Barotrauma startDrone = null; } + if (Submarine.Loaded==null) + { + + + if (waterAmbienceIndexes[0] > 0) + { + SoundManager.Stop(waterAmbienceIndexes[0]); + SoundManager.Stop(waterAmbienceIndexes[1]); + + waterAmbienceIndexes[0] = 0; + waterAmbienceIndexes[1] = 0; + } + + return; + } + float ambienceVolume = 0.8f; float lowpassHFGain = 1.0f; if (Character.Controlled != null) diff --git a/Subsurface/Source/Sounds/OggStream.cs b/Subsurface/Source/Sounds/OggStream.cs index efcdd56a6..a7451a524 100644 --- a/Subsurface/Source/Sounds/OggStream.cs +++ b/Subsurface/Source/Sounds/OggStream.cs @@ -529,7 +529,14 @@ namespace Barotrauma.Sounds for (int i = 0; i < tempBuffers.Length; i++) { - finished |= FillBuffer(stream, tempBuffers[i]); + try + { + finished |= FillBuffer(stream, tempBuffers[i]); + } + catch + { + continue; + } if (finished) { diff --git a/Subsurface/Source/Utils/SaveUtil.cs b/Subsurface/Source/Utils/SaveUtil.cs index d1a0a7e92..327d8919b 100644 --- a/Subsurface/Source/Utils/SaveUtil.cs +++ b/Subsurface/Source/Utils/SaveUtil.cs @@ -130,7 +130,7 @@ namespace Barotrauma return files; } - public static string CreateSavePath(string fileName="save") + public static string CreateSavePath(string fileName="Save") { if (!Directory.Exists(SaveFolder)) { @@ -142,12 +142,12 @@ namespace Barotrauma string pathWithoutExtension = Path.Combine(SaveFolder, fileName); int i = 0; - while (File.Exists(pathWithoutExtension + i + extension)) + while (File.Exists(pathWithoutExtension + " " + i + extension)) { i++; } - return fileName + i; + return fileName + " " + i; } public static void CompressStringToFile(string fileName, string value) diff --git a/Subsurface/changelog.txt b/Subsurface/changelog.txt index 28d44748c..6c9b3ca7e 100644 --- a/Subsurface/changelog.txt +++ b/Subsurface/changelog.txt @@ -1,4 +1,67 @@ +--------------------------------------------------------------------------------------------------------- +v0.2 +--------------------------------------------------------------------------------------------------------- + +Multiplayer: + - major optimization and much better lag compensation + - tons of bugfixes that should fix most of the syncing issues + - admins can play on their own server without launching another instance of the game + - setting the job preferences actually does something now + - reconnecting to a server if the connection is temporarily lost works much better now + - proper error messages if UPnP port forwarding fails + +Items: + - security guard gear: ballistic vest, helmet & stun baton + - wifi components that can be used for transmitting signals between devices + - wall labels with a configurable text + - a bunch of new sprites and sounds + - wearing a diving suit slows the characters down + - supercapacitors + - attempting to fire the railgun when there are no shells loaded doesn't consume power anymore + +Submarine: + - improved version of Aegir + - a new submarine, "Vellamo" + - nuclear reactors overheat much more slowly and there are warning signals for overheating and a remote + shutdown button in both of the default subs + - ambient sounds change according to the speed of the sub + - fixed parts of the submarine getting stuck in the level on collision + - the autopilot is a much better driver now (although it may still crash at very tight spots) + +Crew: + - aiming underwater is much easier + - improved humanoid animations + - stunned/dead characters can be dragged + - all characters can now use plasma cutters and welders regardless of their skills, but insufficient + skill level will make them flicker and work much less efficiently + - same for the harpoon gun, anyone can shoot but lower levels will make the gun less accurate + - rewiring devices may cause electric shocks if the electrical engineering level is too low + +Creatures: + - some random "prop fish" swimming in the background + - a new hostile creature + +Misc: + - a tutorial going through all the basic tasks and game mechanics (more in-depth tutorials will be + added in future versions, including one for making custom subs) + - an auto-updater in the launcher + - the game generates a detailed report if it crashes + - physics optimization (i.e. using simplified physics & animation for off-screen characters and + disabling them entirely if they're far enough) + - lighting optimization (caching the lights/shadows if a light source hasn't moved instead of + recalculating them every frame) + - two new background music tracks + - better looking explosions + - better looking water particle effects + - minor UI improvements + - better UI scaling on different resolutions + - health/oxygen bar improvements and status icons for bleeding and water pressure + - gap-hull connections are visible in the sub editor + - pumps don't have to be manually connected to a hull in the editor anymore, they automatically + empty/fill the hull they're inside + + --------------------------------------------------------------------------------------------------------- v0.1.3.2 --------------------------------------------------------------------------------------------------------- diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index a716f1b7d..416391887 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ