diff --git a/Subsurface/Content/Characters/Endworm/endworm.xml b/Subsurface/Content/Characters/Endworm/endworm.xml
index 5e66c463a..560794eb7 100644
--- a/Subsurface/Content/Characters/Endworm/endworm.xml
+++ b/Subsurface/Content/Characters/Endworm/endworm.xml
@@ -42,14 +42,14 @@
-
+
-
+
-
+
-
+
diff --git a/Subsurface/Content/Items/Button/button.png b/Subsurface/Content/Items/Button/button.png
index fc4799021..e73ef0aed 100644
Binary files a/Subsurface/Content/Items/Button/button.png and b/Subsurface/Content/Items/Button/button.png differ
diff --git a/Subsurface/Content/Items/Diving/divinggear.xml b/Subsurface/Content/Items/Diving/divinggear.xml
index 07fc10dab..aaea39e6c 100644
--- a/Subsurface/Content/Items/Diving/divinggear.xml
+++ b/Subsurface/Content/Items/Diving/divinggear.xml
@@ -2,6 +2,7 @@
-
diff --git a/Subsurface/Content/Items/Engine/engine.png b/Subsurface/Content/Items/Engine/engine.png
index d8bf526cd..ff3ed0c09 100644
Binary files a/Subsurface/Content/Items/Engine/engine.png and b/Subsurface/Content/Items/Engine/engine.png differ
diff --git a/Subsurface/Content/Items/Engine/engine.xml b/Subsurface/Content/Items/Engine/engine.xml
index 4083ed7cd..56ce5cb6d 100644
--- a/Subsurface/Content/Items/Engine/engine.xml
+++ b/Subsurface/Content/Items/Engine/engine.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/Subsurface/Content/Items/Fabricators/fabricators.xml b/Subsurface/Content/Items/Fabricators/fabricators.xml
index ef0f0a55e..8d3a04b02 100644
--- a/Subsurface/Content/Items/Fabricators/fabricators.xml
+++ b/Subsurface/Content/Items/Fabricators/fabricators.xml
@@ -9,7 +9,7 @@
-
+
@@ -58,7 +58,7 @@
-
+
diff --git a/Subsurface/Content/Items/Reactor/reactor.xml b/Subsurface/Content/Items/Reactor/reactor.xml
index bd28a2b82..3ef81e616 100644
--- a/Subsurface/Content/Items/Reactor/reactor.xml
+++ b/Subsurface/Content/Items/Reactor/reactor.xml
@@ -69,8 +69,7 @@
name="Incendium Fuel Rod"
Tags="smallitem"
pickdistance="150"
- spritecolor="0.5,0.0,0.0,1.0"
- price="200">
+ spritecolor="0.5,0.0,0.0,1.0">
diff --git a/Subsurface/Content/Items/Weapons/railgun.xml b/Subsurface/Content/Items/Weapons/railgun.xml
index ef3dfc35a..0053db091 100644
--- a/Subsurface/Content/Items/Weapons/railgun.xml
+++ b/Subsurface/Content/Items/Weapons/railgun.xml
@@ -64,7 +64,7 @@
-
diff --git a/Subsurface/Content/Items/Weapons/weapons.xml b/Subsurface/Content/Items/Weapons/weapons.xml
index 2af647f1b..8383f4073 100644
--- a/Subsurface/Content/Items/Weapons/weapons.xml
+++ b/Subsurface/Content/Items/Weapons/weapons.xml
@@ -83,7 +83,7 @@
-
@@ -104,7 +104,7 @@
-
diff --git a/Subsurface/Content/Map/waypointIcons.png b/Subsurface/Content/Map/waypointIcons.png
index b6ceff9a2..4f502b176 100644
Binary files a/Subsurface/Content/Map/waypointIcons.png and b/Subsurface/Content/Map/waypointIcons.png differ
diff --git a/Subsurface/Content/Orders.xml b/Subsurface/Content/Orders.xml
index c28b1b516..43dbcdab4 100644
--- a/Subsurface/Content/Orders.xml
+++ b/Subsurface/Content/Orders.xml
@@ -17,7 +17,7 @@
-
+
\ No newline at end of file
diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs
index 607e6a612..ff548770d 100644
--- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs
+++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs
@@ -35,7 +35,7 @@ namespace Barotrauma
public override bool IsCompleted()
{
- return isCompleted;
+ return isCompleted || container.Inventory.FindItem(itemName)!=null;
}
protected override void Act(float deltaTime)
diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs
index 09f668857..9bc4de679 100644
--- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs
+++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs
@@ -59,6 +59,8 @@ namespace Barotrauma
protected override void Act(float deltaTime)
{
+ if (target == character) return;
+
waitUntilPathUnreachable -= deltaTime;
if (character.SelectedConstruction!=null && character.SelectedConstruction.GetComponent()==null)
diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs
index 13d3190a4..e71474c25 100644
--- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs
+++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs
@@ -85,12 +85,12 @@ namespace Barotrauma
currentObjective = new AIObjectiveGoTo(Character.Controlled, character, true);
break;
case "wait":
- currentObjective = new AIObjectiveGoTo(character.SimPosition, character, true);
+ currentObjective = new AIObjectiveGoTo(character, character, true);
break;
default:
if (order.TargetItem == null) return;
- currentObjective = new AIObjectiveOperateItem(order.TargetItem, character, option);
+ currentObjective = new AIObjectiveOperateItem(order.TargetItem, character, option, null, order.UseController);
break;
}
diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs
index 01937ede8..a820b237f 100644
--- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs
+++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs
@@ -30,15 +30,19 @@ namespace Barotrauma
get { return operateTarget; }
}
- public AIObjectiveOperateItem(ItemComponent item, Character character, string option, Entity operateTarget = null)
+ public AIObjectiveOperateItem(ItemComponent item, Character character, string option, Entity operateTarget = null, bool useController = false)
:base (character, option)
{
component = item;
this.operateTarget = operateTarget;
- var controllers = item.Item.GetConnectedComponents();
- if (controllers.Any()) component = controllers[0];
+ if (useController)
+ {
+ var controllers = item.Item.GetConnectedComponents();
+ if (controllers.Any()) component = controllers[0];
+ }
+
canBeCompleted = true;
}
diff --git a/Subsurface/Source/Characters/AI/Order.cs b/Subsurface/Source/Characters/AI/Order.cs
index 3a386bf5d..552284b43 100644
--- a/Subsurface/Source/Characters/AI/Order.cs
+++ b/Subsurface/Source/Characters/AI/Order.cs
@@ -24,6 +24,8 @@ namespace Barotrauma
public readonly Color Color;
+ public readonly bool UseController;
+
public ItemComponent TargetItem;
public readonly string[] Options;
@@ -76,6 +78,8 @@ namespace Barotrauma
Color = new Color(ToolBox.GetAttributeVector4(orderElement, "color", new Vector4(1.0f, 1.0f, 1.0f, 1.0f)));
+ UseController = ToolBox.GetAttributeBool(orderElement, "usecontroller", false);
+
string optionStr = ToolBox.GetAttributeString(orderElement, "options", "");
if (string.IsNullOrWhiteSpace(optionStr))
@@ -112,12 +116,13 @@ namespace Barotrauma
public Order(Order prefab, ItemComponent targetItem)
{
- Name = prefab.Name;
- DoingText = prefab.DoingText;
- ItemComponentType = prefab.ItemComponentType;
- Options = prefab.Options;
- SymbolSprite = prefab.SymbolSprite;
- Color = prefab.Color;
+ Name = prefab.Name;
+ DoingText = prefab.DoingText;
+ ItemComponentType = prefab.ItemComponentType;
+ Options = prefab.Options;
+ SymbolSprite = prefab.SymbolSprite;
+ Color = prefab.Color;
+ UseController = prefab.UseController;
TargetItem = targetItem;
}
diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs
index 116581fc8..fb2b199e7 100644
--- a/Subsurface/Source/Characters/Character.cs
+++ b/Subsurface/Source/Characters/Character.cs
@@ -89,6 +89,7 @@ namespace Barotrauma
private Character closestCharacter, selectedCharacter;
protected bool isDead;
+ private CauseOfDeath causeOfDeath;
public readonly bool IsHumanoid;
@@ -291,6 +292,11 @@ namespace Barotrauma
get { return isDead; }
}
+ public CauseOfDeath CauseOfDeath
+ {
+ get { return causeOfDeath; }
+ }
+
public override Vector2 SimPosition
{
get { return AnimController.RefLimb.SimPosition; }
@@ -915,7 +921,6 @@ namespace Barotrauma
if (!protectedFromPressure &&
(AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f))
{
-
PressureTimer += ((AnimController.CurrentHull == null) ?
100.0f : AnimController.CurrentHull.LethalPressure) * deltaTime;
@@ -1222,6 +1227,7 @@ namespace Barotrauma
health = 0.0f;
isDead = true;
+ this.causeOfDeath = causeOfDeath;
AnimController.movement = Vector2.Zero;
AnimController.TargetMovement = Vector2.Zero;
diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs
index 75c3d48d1..6ea859b83 100644
--- a/Subsurface/Source/DebugConsole.cs
+++ b/Subsurface/Source/DebugConsole.cs
@@ -150,11 +150,11 @@ namespace Barotrauma
NewMessage("menu: go to main menu", Color.Cyan);
NewMessage("game: enter the ''game screen''", Color.Cyan);
NewMessage("edit: switch to submarine editor", Color.Cyan);
- NewMessage("load [submarine name]: load a submarine!", Color.Cyan);
+ NewMessage("edit [submarine name]: load a submarine and switch to submarine editor", Color.Cyan);
+ NewMessage("load [submarine name]: load a submarine", Color.Cyan);
NewMessage("save [submarine name]: save the current submarine using the specified name", Color.Cyan);
- NewMessage(" ", Color.Cyan);
-
+ NewMessage(" ", Color.Cyan);
NewMessage("spawn: spawn a creature at a random spawnpoint", Color.Cyan);
NewMessage("spawn: spawn a creature at a random spawnpoint", Color.Cyan);
@@ -186,7 +186,6 @@ namespace Barotrauma
NewMessage("debugdraw: toggles the ''debug draw mode''", Color.Cyan);
NewMessage("netstats: toggles the visibility of the network statistics panel", Color.Cyan);
-
break;
case "createfilelist":
@@ -241,7 +240,11 @@ namespace Barotrauma
break;
case "editmapscreen":
case "editmap":
- case "edit":
+ case "edit":
+ if (commands.Length>1)
+ {
+ Submarine.Load(string.Join(" ", commands.Skip(1)));
+ }
GameMain.EditMapScreen.Select();
break;
case "test":
diff --git a/Subsurface/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs b/Subsurface/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs
index c852f1416..ecf39f758 100644
--- a/Subsurface/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs
+++ b/Subsurface/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs
@@ -254,7 +254,7 @@ namespace Barotrauma.Tutorials
infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern.");
- while (Submarine.Loaded.Position.Y > 31000.0f)
+ while (Submarine.Loaded.Position.Y > 10000.0f)
{
yield return CoroutineStatus.Running;
}
diff --git a/Subsurface/Source/GameSession/ShiftSummary.cs b/Subsurface/Source/GameSession/ShiftSummary.cs
index ede00077f..dc01341f9 100644
--- a/Subsurface/Source/GameSession/ShiftSummary.cs
+++ b/Subsurface/Source/GameSession/ShiftSummary.cs
@@ -10,27 +10,25 @@ namespace Barotrauma
{
class ShiftSummary
{
- class Casualty
- {
- public readonly CharacterInfo character;
- public readonly CauseOfDeath causeOfDeath;
+ //class Casualty
+ //{
+ // public readonly CharacterInfo character;
+ // public readonly CauseOfDeath causeOfDeath;
- public readonly string description;
+ // public readonly string description;
- public Casualty(CharacterInfo characterInfo, CauseOfDeath causeOfDeath, string description)
- {
- this.character = characterInfo;
- this.causeOfDeath = causeOfDeath;
- this.description = description;
- }
- }
+ // public Casualty(CharacterInfo characterInfo, CauseOfDeath causeOfDeath, string description)
+ // {
+ // this.character = characterInfo;
+ // this.causeOfDeath = causeOfDeath;
+ // this.description = description;
+ // }
+ //}
private Location startLocation, endLocation;
private GameSession gameSession;
- private List casualties;
-
private Mission selectedMission;
public ShiftSummary(GameSession gameSession)
@@ -39,22 +37,15 @@ namespace Barotrauma
startLocation = gameSession.Map==null ? null : gameSession.Map.CurrentLocation;
endLocation = gameSession.Map==null ? null : gameSession.Map.SelectedLocation;
-
- casualties = new List();
-
- foreach (Character character in gameSession.CrewManager.characters)
- {
- character.OnDeath = AddCasualty;
- }
-
+
selectedMission = gameSession.Mission;
}
- public void AddCasualty(Character character, CauseOfDeath causeOfDeath)
- {
- casualties.Add(new Casualty(character.Info, causeOfDeath, ""));
- }
+ //public void AddCasualty(Character character, CauseOfDeath causeOfDeath)
+ //{
+ // casualties.Add(new Casualty(character.Info, causeOfDeath, ""));
+ //}
public GUIFrame CreateSummaryFrame(string endMessage)
{
@@ -106,12 +97,10 @@ namespace Barotrauma
string statusText;
Color statusColor;
-
- var casualty = casualties.Find(c => c.character == character.Info);
-
- if (casualty != null)
+
+ if (character.IsDead)
{
- statusText = InfoTextManager.GetInfoText("CauseOfDeath." + casualty.causeOfDeath.ToString());
+ statusText = InfoTextManager.GetInfoText("CauseOfDeath." + character.CauseOfDeath.ToString());
statusColor = Color.DarkRed;
}
else
diff --git a/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs b/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs
index 5d1bef900..d1ce2039e 100644
--- a/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs
+++ b/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs
@@ -54,6 +54,17 @@ namespace Barotrauma.Items.Components
if (character == null || reloadTimer>0.0f) return false;
if (!character.IsKeyDown(InputType.Aim) || hitting) return false;
+ //don't allow hitting if the character is already hitting with another weapon
+ for (int i = 0; i < 2; i++ )
+ {
+ if (character.SelectedItems[i] == null || character.SelectedItems[i] == Item) continue;
+
+ var otherWeapon = character.SelectedItems[i].GetComponent();
+ if (otherWeapon == null) continue;
+
+ if (otherWeapon.hitting) return false;
+ }
+
SetUser(character);
if (hitPos < MathHelper.Pi * 0.69f) return false;
diff --git a/Subsurface/Source/Items/Components/ItemLabel.cs b/Subsurface/Source/Items/Components/ItemLabel.cs
index 133b5e3ec..62f7cb682 100644
--- a/Subsurface/Source/Items/Components/ItemLabel.cs
+++ b/Subsurface/Source/Items/Components/ItemLabel.cs
@@ -10,7 +10,7 @@ namespace Barotrauma.Items.Components
[HasDefaultValue("", true), Editable(100)]
public string Text
{
- get { return textBlock.Text; }
+ get { return textBlock.Text.Replace("\n", ""); }
set
{
if (value == TextBlock.Text || item.Rect.Width < 5) return;
diff --git a/Subsurface/Source/Items/Components/Machines/Deconstructor.cs b/Subsurface/Source/Items/Components/Machines/Deconstructor.cs
index c501a069d..49feba547 100644
--- a/Subsurface/Source/Items/Components/Machines/Deconstructor.cs
+++ b/Subsurface/Source/Items/Components/Machines/Deconstructor.cs
@@ -8,7 +8,7 @@ using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
- class Deconstructor : ItemComponent
+ class Deconstructor : Powered
{
GUIProgressBar progressBar;
GUIButton activateButton;
@@ -39,7 +39,12 @@ namespace Barotrauma.Items.Components
return;
}
- progressTimer += deltaTime;
+ if (voltage < minVoltage) return;
+
+ if (powerConsumption == 0.0f) voltage = 1.0f;
+
+ progressTimer += deltaTime*voltage;
+ Voltage -= deltaTime * 10.0f;
var targetItem = container.Inventory.Items.FirstOrDefault(i => i != null);
progressBar.BarSize = Math.Min(progressTimer / targetItem.Prefab.DeconstructTime, 1.0f);
@@ -83,6 +88,8 @@ namespace Barotrauma.Items.Components
{
SetActive(!IsActive);
+ currPowerConsumption = IsActive ? powerConsumption : 0.0f;
+
item.NewComponentEvent(this, true, true);
return true;
diff --git a/Subsurface/Source/Items/Components/Machines/Engine.cs b/Subsurface/Source/Items/Components/Machines/Engine.cs
index fd8cced69..3da90f043 100644
--- a/Subsurface/Source/Items/Components/Machines/Engine.cs
+++ b/Subsurface/Source/Items/Components/Machines/Engine.cs
@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
if (powerConsumption == 0.0f) voltage = 1.0f;
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
- if (Force != 0.0f)
+ if (Force > 1.0f)
{
Vector2 currForce = new Vector2((force / 100.0f) * maxForce * (voltage / minVoltage), 0.0f);
@@ -72,7 +72,7 @@ namespace Barotrauma.Items.Components
for (int i = 0; i < 5; i++)
{
- GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition,
+ var bubbles = GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition - (Vector2.UnitX * item.Rect.Width/2),
-currForce / 5.0f + new Vector2(Rand.Range(-100.0f, 100.0f), Rand.Range(-50f, 50f)),
0.0f, item.CurrentHull);
}
diff --git a/Subsurface/Source/Items/Components/Machines/Fabricator.cs b/Subsurface/Source/Items/Components/Machines/Fabricator.cs
index c12b51a2b..3525b1c68 100644
--- a/Subsurface/Source/Items/Components/Machines/Fabricator.cs
+++ b/Subsurface/Source/Items/Components/Machines/Fabricator.cs
@@ -56,7 +56,7 @@ namespace Barotrauma.Items.Components
}
}
- class Fabricator : ItemComponent
+ class Fabricator : Powered
{
private List fabricableItems;
@@ -64,8 +64,8 @@ namespace Barotrauma.Items.Components
private GUIFrame selectedItemFrame;
- GUIProgressBar progressBar;
- GUIButton activateButton;
+ private GUIProgressBar progressBar;
+ private GUIButton activateButton;
private FabricableItem fabricatedItem;
private float timeUntilReady;
@@ -208,6 +208,8 @@ namespace Barotrauma.Items.Components
var containers = item.GetComponents();
containers[0].Inventory.Locked = true;
containers[1].Inventory.Locked = true;
+
+ currPowerConsumption = powerConsumption;
}
private void CancelFabricating()
@@ -216,6 +218,8 @@ namespace Barotrauma.Items.Components
IsActive = false;
fabricatedItem = null;
+ currPowerConsumption = 0.0f;
+
if (activateButton != null)
{
activateButton.Text = "Create";
@@ -231,13 +235,19 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam)
{
- timeUntilReady -= deltaTime;
-
if (progressBar!=null)
{
progressBar.BarSize = fabricatedItem == null ? 0.0f : (fabricatedItem.RequiredTime - timeUntilReady) / fabricatedItem.RequiredTime;
}
+ if (voltage < minVoltage) return;
+
+ if (powerConsumption == 0) voltage = 1.0f;
+
+ timeUntilReady -= deltaTime*voltage;
+
+ voltage -= deltaTime * 10.0f;
+
if (timeUntilReady > 0.0f) return;
var containers = item.GetComponents();
diff --git a/Subsurface/Source/Items/Components/Machines/Reactor.cs b/Subsurface/Source/Items/Components/Machines/Reactor.cs
index 8ea54a446..520ff24f2 100644
--- a/Subsurface/Source/Items/Components/Machines/Reactor.cs
+++ b/Subsurface/Source/Items/Components/Machines/Reactor.cs
@@ -406,14 +406,14 @@ namespace Barotrauma.Items.Components
//temperature too high/low
if (Math.Abs(tempDiff)>500.0f)
{
- autoTemp = false;
+ AutoTemp = false;
FissionRate += deltaTime * 100.0f * Math.Sign(tempDiff);
CoolingRate -= deltaTime * 100.0f * Math.Sign(tempDiff);
}
//temperature OK
else
{
- autoTemp = true;
+ AutoTemp = true;
}
break;
@@ -566,7 +566,7 @@ namespace Barotrauma.Items.Components
return;
}
- autoTemp = newAutoTemp;
+ AutoTemp = newAutoTemp;
Temperature = newTemperature;
ShutDownTemp = newShutDownTemp;
diff --git a/Subsurface/Source/Items/Components/Power/PowerTransfer.cs b/Subsurface/Source/Items/Components/Power/PowerTransfer.cs
index 6e9db3461..151bd8aae 100644
--- a/Subsurface/Source/Items/Components/Power/PowerTransfer.cs
+++ b/Subsurface/Source/Items/Components/Power/PowerTransfer.cs
@@ -63,7 +63,8 @@ namespace Barotrauma.Items.Components
pt.Item.SendSignal("", "power", fullPower / Math.Max(fullLoad, 1.0f));
//damage the item if voltage is too high
- if (-pt.currPowerConsumption < Math.Max(pt.powerLoad * 2.0f, 200.0f)) continue;
+ if (-pt.currPowerConsumption < Math.Max(pt.powerLoad * Rand.Range(1.95f,2.05f), 200.0f)) continue;
+
float prevCondition = pt.item.Condition;
pt.item.Condition -= deltaTime * 10.0f;
diff --git a/Subsurface/Source/Items/Components/Signal/Wire.cs b/Subsurface/Source/Items/Components/Signal/Wire.cs
index ed3bfb30f..ec748568e 100644
--- a/Subsurface/Source/Items/Components/Signal/Wire.cs
+++ b/Subsurface/Source/Items/Components/Signal/Wire.cs
@@ -328,8 +328,8 @@ namespace Barotrauma.Items.Components
//nodes.Add(newNodePos);
}
- if (!editing || !PlayerInput.MouseInsideWindow) return;
-
+ if (!editing || !PlayerInput.MouseInsideWindow || GameMain.EditMapScreen.CharacterMode) return;
+
for (int i = 0; i < Nodes.Count; i++)
{
Vector2 worldPos = Nodes[i];
@@ -347,13 +347,13 @@ namespace Barotrauma.Items.Components
}
- MapEntity.DisableSelect = true;
GUI.DrawRectangle(spriteBatch, worldPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f);
if (selectedNodeIndex == null && draggingWire == null)// && !MapEntity.SelectedAny)
{
if (PlayerInput.LeftButtonDown() && PlayerInput.GetOldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
{
+ MapEntity.DisableSelect = true;
MapEntity.SelectEntity(item);
draggingWire = this;
selectedNodeIndex = i;
@@ -371,6 +371,7 @@ namespace Barotrauma.Items.Components
{
if (selectedNodeIndex != null && draggingWire == this)
{
+
MapEntity.DisableSelect = true;
//Nodes[(int)selectedNodeIndex] = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition)-Submarine.HiddenSubPosition+Submarine.Loaded.Position;
diff --git a/Subsurface/Source/Items/FixRequirement.cs b/Subsurface/Source/Items/FixRequirement.cs
index 91dbbf812..37396ac48 100644
--- a/Subsurface/Source/Items/FixRequirement.cs
+++ b/Subsurface/Source/Items/FixRequirement.cs
@@ -118,7 +118,7 @@ namespace Barotrauma
y2 = 20;
foreach (Skill skill in requirement.requiredSkills)
{
- var skillBlock = new GUITextBlock(new Rectangle(150, y2, 200, 15), skill.Name + " - " + skill.Level, GUI.Style, Alignment.Right, Alignment.TopLeft, reqFrame);
+ var skillBlock = new GUITextBlock(new Rectangle(0, y2, 200, 15), skill.Name + " - " + skill.Level, GUI.Style, Alignment.Right, Alignment.TopLeft, reqFrame);
skillBlock.Font = GUI.SmallFont;
skillBlock.UserData = skill;
diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs
index 24e97da19..5f20852f4 100644
--- a/Subsurface/Source/Items/Item.cs
+++ b/Subsurface/Source/Items/Item.cs
@@ -740,7 +740,7 @@ namespace Barotrauma
private GUIComponent CreateEditingHUD(bool inGame=false)
{
- int width = 400;
+ int width = 450;
int x = GameMain.GraphicsWidth/2-width/2, y = 10;
List editableProperties = inGame ? GetProperties() : GetProperties();
@@ -768,7 +768,7 @@ namespace Barotrauma
if (prefab.IsLinkable)
{
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to another item",
- GUI.Style, Alignment.TopLeft, Alignment.TopRight, editingHUD);
+ GUI.Style, Alignment.TopRight, Alignment.TopRight, editingHUD).Font = GUI.SmallFont;
y += 25;
}
foreach (ItemComponent ic in components)
@@ -776,7 +776,7 @@ namespace Barotrauma
foreach (RelatedItem relatedItem in ic.requiredItems)
{
new GUITextBlock(new Rectangle(0, y, 100, 20), ic.Name + ": " + relatedItem.Type.ToString() + " required", GUI.Style, editingHUD);
- GUITextBox namesBox = new GUITextBox(new Rectangle(0, y, 200, 20), Alignment.Right, GUI.Style, editingHUD);
+ GUITextBox namesBox = new GUITextBox(new Rectangle(-10, y, 160, 20), Alignment.Right, GUI.Style, editingHUD);
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (relatedItem);
PropertyDescriptor property = properties.Find("JoinedNames", false);
@@ -800,7 +800,7 @@ namespace Barotrauma
var editable = objectProperty.Attributes.OfType().FirstOrDefault();
if (editable != null) height = (int)(Math.Ceiling(editable.MaxLength / 20.0f) * 20.0f);
- GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, height), GUI.Style, editingHUD);
+ GUITextBox propertyBox = new GUITextBox(new Rectangle(180, y, 250, height), GUI.Style, editingHUD);
if (height>20) propertyBox.Wrap = true;
object value = objectProperty.GetValue();
diff --git a/Subsurface/Source/Items/ItemPrefab.cs b/Subsurface/Source/Items/ItemPrefab.cs
index bd32f8fbc..6e1492955 100644
--- a/Subsurface/Source/Items/ItemPrefab.cs
+++ b/Subsurface/Source/Items/ItemPrefab.cs
@@ -196,10 +196,20 @@ namespace Barotrauma
FireProof = ToolBox.GetAttributeBool(element, "fireproof", false);
- MapEntityCategory category;
- Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Misc"), out category);
- Category = category;
+ string categoriesStr = ToolBox.GetAttributeString(element, "category", "Misc");
+ string[] categories = categoriesStr.Split(',');
+
+ for (int i = 0; i h.Rect.X && rect.X + rect.Width < h.Rect.X+h.Rect.Width &&
- rect.Y < h.Rect.Y && rect.Y - rect.Height > h.Rect.Y - h.Rect.Height) continue;
-
- for (int i = 0; i < 2; i++ )
- {
- if (hulls[i] != null) continue;
- hulls[i] = h;
- break;
- }
-
- if (hulls[1] != null) break;
+ searchPos[0] = new Vector2(rect.X, rect.Y - rect.Height / 2);
+ searchPos[1] = new Vector2(rect.Right, rect.Y - rect.Height / 2);
}
+ else
+ {
+ searchPos[0] = new Vector2(rect.Center.X, rect.Y);
+ searchPos[1] = new Vector2(rect.Center.X, rect.Y - rect.Height);
+ }
+
+ hulls[0] = Hull.FindHullOld(searchPos[0], null, false);
+ hulls[1] = Hull.FindHullOld(searchPos[1], null, false);
if (hulls[0] == null && hulls[1] == null) return;
- if (hulls[0] != null && hulls[1] != null)
+ if (hulls[0]==null && hulls[1]!=null)
{
- if ((isHorizontal && hulls[0].Rect.X > hulls[1].Rect.X) || (!isHorizontal && hulls[0].Rect.Y < hulls[1].Rect.Y))
- {
- //make sure that hull1 is the lefthand room if the gap is horizontal,
- //or that hull1 is the upper hull if the gap is vertical
-
- Hull temp = hulls[0];
- hulls[0] = hulls[1];
- hulls[1] = temp;
-
- }
+ Hull temp = hulls[0];
+ hulls[0] = hulls[1];
+ hulls[1] = temp;
}
linkedTo.Add(hulls[0]);
if (hulls[1] != null) linkedTo.Add(hulls[1]);
-
}
public override void Draw(SpriteBatch sb, bool editing, bool back = true)
{
if (GameMain.DebugDraw)
{
- Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Width / 2.0f));
+ Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Height/ 2.0f));
GUI.DrawLine(sb, center, center + flowForce/10.0f, Color.Red);
GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + lerpedFlowForce / 10.0f + Vector2.One * 5.0f, Color.Orange);
@@ -241,7 +230,7 @@ namespace Barotrauma
UpdateRoomToRoom(deltaTime);
}
- lerpedFlowForce = Vector2.Lerp(lerpedFlowForce, flowForce, deltaTime*2.0f);
+ lerpedFlowForce = Vector2.Lerp(lerpedFlowForce, flowForce, deltaTime);
if (LerpedFlowForce.Length() > 100.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume)
{
@@ -276,19 +265,21 @@ namespace Barotrauma
}
else
{
+ if (Math.Sign(flowTargetHull.Rect.Y - rect.Y) != Math.Sign(lerpedFlowForce.Y)) return;
+
pos.Y += Math.Sign(flowForce.Y) * rect.Height / 2.0f;
for (int i = 0; i < rect.Width; i += (int)Rand.Range(80, 100))
{
pos.X = Rand.Range(rect.X, rect.X + rect.Width);
Vector2 velocity = new Vector2(
- flowForce.X * Rand.Range(0.5f, 0.7f),
- Math.Max(flowForce.Y,-100.0f) * Rand.Range(0.5f, 0.7f));
+ lerpedFlowForce.X * Rand.Range(0.5f, 0.7f),
+ Math.Max(lerpedFlowForce.Y, -100.0f) * Rand.Range(0.5f, 0.7f));
var splash = GameMain.ParticleManager.CreateParticle(
"watersplash",
Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
- velocity);
+ -velocity);
if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
@@ -411,20 +402,10 @@ namespace Barotrauma
flowTargetHull = hull1;
- //delta = (water2.Pressure - water1.Pressure) * 0.1f;
- //if (delta > 0.1f)
- //{
- // int posX = (int)((rect.X + size / 2.0f - water1.Rect.X) / Hull.WaveWidth);
- // //water1.WaveY[posX] = delta;
- // water1.WaveVel[posX] = delta * 0.01f;
- //}
-
if (hull1.Volume > hull1.FullVolume)
{
hull1.Pressure = Math.Max(hull1.Pressure, (hull1.Pressure + hull2.Pressure) / 2);
- }
-
-
+ }
}
//there's water in the upper room, drop to lower
diff --git a/Subsurface/Source/Map/MapEntityPrefab.cs b/Subsurface/Source/Map/MapEntityPrefab.cs
index 3a387a439..8f981c5ff 100644
--- a/Subsurface/Source/Map/MapEntityPrefab.cs
+++ b/Subsurface/Source/Map/MapEntityPrefab.cs
@@ -7,9 +7,10 @@ using Microsoft.Xna.Framework.Input;
namespace Barotrauma
{
+ [Flags]
enum MapEntityCategory
{
- Structure, Machine, Equipment, Electrical, Material, Misc
+ Structure = 1, Machine = 2, Equipment = 4, Electrical = 8, Material = 16, Misc = 32
}
class MapEntityPrefab
@@ -116,6 +117,10 @@ namespace Barotrauma
}
+ public MapEntityPrefab()
+ {
+ Category = MapEntityCategory.Structure;
+ }
public virtual void UpdatePlacing(SpriteBatch spriteBatch, Camera cam)
{
diff --git a/Subsurface/Source/Map/WayPoint.cs b/Subsurface/Source/Map/WayPoint.cs
index 86f631785..814cb8cd4 100644
--- a/Subsurface/Source/Map/WayPoint.cs
+++ b/Subsurface/Source/Map/WayPoint.cs
@@ -33,8 +33,10 @@ namespace Barotrauma
private Hull currentHull;
+ private ushort ladderId;
public Ladder Ladders;
+ private ushort gapId;
public Gap ConnectedGap
{
get;
@@ -198,8 +200,8 @@ namespace Barotrauma
spawnType += (int)button.UserData;
- if (spawnType > SpawnType.Path) spawnType = SpawnType.Human;
- if (spawnType < SpawnType.Human) spawnType = SpawnType.Path;
+ if (spawnType > SpawnType.Cargo) spawnType = SpawnType.Path;
+ if (spawnType < SpawnType.Path) spawnType = SpawnType.Cargo;
spawnTypeText.Text = spawnType.ToString();
@@ -430,6 +432,7 @@ namespace Barotrauma
if (door != null)
{
WayPoint newPoint = new WayPoint(door.Item.Position, SpawnType.Path, Submarine.Loaded);
+ newPoint.Ladders = ladders;
newPoint.ConnectedGap = door.LinkedGap;
newPoint.ConnectTo(prevPoint);
@@ -656,6 +659,15 @@ namespace Barotrauma
public override void OnMapLoaded()
{
currentHull = Hull.FindHull(WorldPosition, currentHull);
+
+ if (gapId > 0) ConnectedGap = FindEntityByID(gapId) as Gap;
+
+ if (ladderId > 0)
+ {
+ var ladderItem = FindEntityByID(ladderId) as Item;
+
+ if (ladderItem != null) Ladders = ladderItem.GetComponent();
+ }
}
public override XElement Save(XDocument doc)
@@ -673,10 +685,11 @@ namespace Barotrauma
element.Add(new XAttribute("idcardtags", string.Join(",", idCardTags)));
}
- if (assignedJob != null)
- {
- element.Add(new XAttribute("job", assignedJob.Name));
- }
+ if (assignedJob != null) element.Add(new XAttribute("job", assignedJob.Name));
+
+
+ if (ConnectedGap != null) element.Add(new XAttribute("gap", ConnectedGap.ID));
+ if (Ladders != null) element.Add(new XAttribute("ladders", Ladders.Item.ID));
doc.Root.Add(element);
@@ -718,6 +731,9 @@ namespace Barotrauma
w.assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLower() == jobName);
}
+ w.ladderId = (ushort)ToolBox.GetAttributeInt(element, "ladders", 0);
+ w.gapId = (ushort)ToolBox.GetAttributeInt(element, "gap", 0);
+
w.linkedToID = new List();
int i = 0;
while (element.Attribute("linkedto" + i) != null)
diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs
index 33f4f05c8..e3476c1b3 100644
--- a/Subsurface/Source/Networking/GameClient.cs
+++ b/Subsurface/Source/Networking/GameClient.cs
@@ -766,9 +766,7 @@ namespace Barotrauma.Networking
}
Character character = Character.Create(ch, position, !isMyCharacter, false);
- GameMain.GameSession.CrewManager.characters.Add(character);
- character.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
-
+ GameMain.GameSession.CrewManager.characters.Add(character);
character.ID = ID;
diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs
index 84e7b366c..1a4f3374c 100644
--- a/Subsurface/Source/Networking/GameServer.cs
+++ b/Subsurface/Source/Networking/GameServer.cs
@@ -777,7 +777,6 @@ namespace Barotrauma.Networking
ConnectedClients[i].Character.GiveJobItems(assignedWayPoints[i]);
GameMain.GameSession.CrewManager.characters.Add(ConnectedClients[i].Character);
- ConnectedClients[i].Character.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
}
if (characterInfo != null)
@@ -788,7 +787,6 @@ namespace Barotrauma.Networking
myCharacter.GiveJobItems(assignedWayPoints[assignedWayPoints.Length - 1]);
GameMain.GameSession.CrewManager.characters.Add(myCharacter);
- myCharacter.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
}
var startMessage = CreateStartMessage(roundStartSeed, Submarine.Loaded, GameMain.GameSession.gameMode.Preset);
diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs
index 8f7159628..24884605d 100644
--- a/Subsurface/Source/Screens/EditMapScreen.cs
+++ b/Subsurface/Source/Screens/EditMapScreen.cs
@@ -57,6 +57,11 @@ namespace Barotrauma
return "Physics bodies: " + GameMain.World.BodyList.Count;
}
+ public bool CharacterMode
+ {
+ get { return characterMode; }
+ }
+
public EditMapScreen()
{
@@ -97,27 +102,28 @@ namespace Barotrauma
GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
+
int width = 400, height = 400;
int y = 160;
+ int i = 0;
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{
-
var catButton = new GUIButton(new Rectangle(0, y, 0, 20), category.ToString(), Alignment.Left, GUI.Style, GUIpanel);
- catButton.UserData = (int)category;
+ catButton.UserData = i;
catButton.OnClicked = SelectTab;
y+=25;
- GUItabs[(int)category] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
- GUItabs[(int)category].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
+ GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
+ GUItabs[i].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUI.Style, GUItabs[(int)category]);
+ GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUI.Style, GUItabs[i]);
itemList.OnSelected = SelectPrefab;
itemList.CheckSelected = MapEntityPrefab.GetSelected;
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
{
- if (ep.Category != category) continue;
+ if (!ep.Category.HasFlag(category)) continue;
Color color = ((itemList.CountChildren % 2) == 0) ? Color.Transparent : Color.White * 0.1f;
@@ -151,6 +157,7 @@ namespace Barotrauma
itemList.children.Sort((i1, i2) => (i1.UserData as MapEntityPrefab).Name.CompareTo((i2.UserData as MapEntityPrefab).Name));
+ i++;
}
y+=50;
diff --git a/Subsurface/Source/Screens/LobbyScreen.cs b/Subsurface/Source/Screens/LobbyScreen.cs
index d00e4e90c..05fd1b7e3 100644
--- a/Subsurface/Source/Screens/LobbyScreen.cs
+++ b/Subsurface/Source/Screens/LobbyScreen.cs
@@ -146,7 +146,7 @@ namespace Barotrauma
int x = selectedItemList.Rect.Width + 40;
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{
- var items = MapEntityPrefab.list.FindAll(ep => ep.Price>0.0f && ep.Category == category);
+ var items = MapEntityPrefab.list.FindAll(ep => ep.Price>0.0f && ep.Category.HasFlag(category));
if (!items.Any()) continue;
var categoryButton = new GUIButton(new Rectangle(x, 0, 100, 20), category.ToString(), GUI.Style, bottomPanel[(int)PanelTab.Store]);
@@ -443,7 +443,7 @@ namespace Barotrauma
storeItemList.ClearChildren();
MapEntityCategory category = (MapEntityCategory)selection;
- var items = MapEntityPrefab.list.FindAll(ep => ep.Price > 0.0f && ep.Category == category);
+ var items = MapEntityPrefab.list.FindAll(ep => ep.Price > 0.0f && ep.Category.HasFlag(category));
int width = storeItemList.Rect.Width;
diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo
index 4e061f525..e531daad1 100644
Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ