diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index e67fcd210..16d8b61d6 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -1036,6 +1036,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Subsurface/Content/Characters/Human/head5.png b/Subsurface/Content/Characters/Human/head5.png index 7395e91c1..b7d1e2fa4 100644 Binary files a/Subsurface/Content/Characters/Human/head5.png and b/Subsurface/Content/Characters/Human/head5.png differ diff --git a/Subsurface/Content/Items/Electricity/signalcomp.png b/Subsurface/Content/Items/Electricity/signalcomp.png index bb7510542..bce494f54 100644 Binary files a/Subsurface/Content/Items/Electricity/signalcomp.png and b/Subsurface/Content/Items/Electricity/signalcomp.png differ diff --git a/Subsurface/Content/Items/Electricity/signalitems.xml b/Subsurface/Content/Items/Electricity/signalitems.xml index d4ebf5678..abf9de80d 100644 --- a/Subsurface/Content/Items/Electricity/signalitems.xml +++ b/Subsurface/Content/Items/Electricity/signalitems.xml @@ -222,6 +222,11 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Subsurface/Content/Items/Fabricators/fabricators.xml b/Subsurface/Content/Items/Fabricators/fabricators.xml index e786b0d12..4f703dc21 100644 --- a/Subsurface/Content/Items/Fabricators/fabricators.xml +++ b/Subsurface/Content/Items/Fabricators/fabricators.xml @@ -23,6 +23,8 @@ + + @@ -35,6 +37,8 @@ + + diff --git a/Subsurface/Content/Items/warningBeep.ogg b/Subsurface/Content/Items/warningBeep.ogg new file mode 100644 index 000000000..973e30fe1 Binary files /dev/null and b/Subsurface/Content/Items/warningBeep.ogg differ diff --git a/Subsurface/Content/Items/warningSiren.ogg b/Subsurface/Content/Items/warningSiren.ogg new file mode 100644 index 000000000..bd8cb29d3 Binary files /dev/null and b/Subsurface/Content/Items/warningSiren.ogg differ diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs index 7f607a810..2c1e84ce5 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs @@ -104,7 +104,7 @@ namespace Barotrauma var indoorsSteering = character.AIController.SteeringManager as IndoorsSteeringManager; - if (indoorsSteering.CurrentPath.Unreachable) + if (indoorsSteering.CurrentPath==null || indoorsSteering.CurrentPath.Unreachable) { indoorsSteering.SteeringWander(); } diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 733b1ef9b..0d971f697 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -756,7 +756,7 @@ namespace Barotrauma if (torso == null) return null; Vector2 pos = (torso.body.TargetPosition != Vector2.Zero) ? torso.body.TargetPosition : torso.SimPosition; - Vector2 pickPos = selectedConstruction == null ? mouseSimPos : selectedConstruction.SimPosition; + Vector2 pickPos = selectedConstruction == null ? mouseSimPos : ConvertUnits.ToSimUnits(selectedConstruction.WorldPosition); if (Submarine != null) { diff --git a/Subsurface/Source/Items/Components/Holdable/Holdable.cs b/Subsurface/Source/Items/Components/Holdable/Holdable.cs index cef636e57..caf61341f 100644 --- a/Subsurface/Source/Items/Components/Holdable/Holdable.cs +++ b/Subsurface/Source/Items/Components/Holdable/Holdable.cs @@ -241,7 +241,7 @@ namespace Barotrauma.Items.Components public override void Update(float deltaTime, Camera cam) { - if (!item.body.Enabled) return; + if (item.body==null || !item.body.Enabled) return; if (!picker.HasSelectedItem(item)) IsActive = false; ApplyStatusEffects(ActionType.OnActive, deltaTime, picker); diff --git a/Subsurface/Source/Items/Components/ItemComponent.cs b/Subsurface/Source/Items/Components/ItemComponent.cs index 43884d32a..2ecc873c8 100644 --- a/Subsurface/Source/Items/Components/ItemComponent.cs +++ b/Subsurface/Source/Items/Components/ItemComponent.cs @@ -211,7 +211,7 @@ namespace Barotrauma.Items.Components { DebugConsole.ThrowError("Invalid pick key in " + element + "!", e); } - + properties = ObjectProperty.InitProperties(this, element); foreach (XElement subElement in element.Elements()) @@ -265,7 +265,15 @@ namespace Barotrauma.Items.Components break; case "sound": string filePath = ToolBox.GetAttributeString(subElement, "file", ""); - if (filePath=="") continue; + + if (filePath == "") filePath = ToolBox.GetAttributeString(subElement, "sound", ""); + + if (filePath == "") + { + DebugConsole.ThrowError("Error when instantiating item ''"+item.Name+"'' - sound with no file path set"); + continue; + } + if (!filePath.Contains("/") && !filePath.Contains("\\") && !filePath.Contains(Path.DirectorySeparatorChar)) { filePath = Path.Combine(Path.GetDirectoryName(item.Prefab.ConfigFile), filePath); @@ -447,12 +455,7 @@ namespace Barotrauma.Items.Components //called then the item is dropped or dragged out of a "limbslot" public virtual void Unequip(Character character) { } - - public virtual bool UseOtherItem(Item item) - { - return false; - } - + public virtual void ReceiveSignal(string signal, Connection connection, Item sender, float power = 0.0f) { @@ -462,6 +465,13 @@ namespace Barotrauma.Items.Components case "use": item.Use(1.0f); break; + case "toggle": + IsActive = !isActive; + break; + case "set_active": + case "set_state": + IsActive = signal != "0"; + break; } } diff --git a/Subsurface/Source/Items/Components/ItemLabel.cs b/Subsurface/Source/Items/Components/ItemLabel.cs index 62f7cb682..c9e51fe14 100644 --- a/Subsurface/Source/Items/Components/ItemLabel.cs +++ b/Subsurface/Source/Items/Components/ItemLabel.cs @@ -26,17 +26,18 @@ namespace Barotrauma.Items.Components set { textColor = new Color(ToolBox.ParseToVector4(value)); + if (textBlock != null) textBlock.TextColor = textColor; } } - + private GUITextBlock TextBlock { get { - if (textBlock==null) + if (textBlock == null) { textBlock = new GUITextBlock(new Rectangle(item.Rect.X,-item.Rect.Y,item.Rect.Width, item.Rect.Height), "", - Color.Transparent, Color.Black, + Color.Transparent, textColor, Alignment.TopLeft, Alignment.Center, null, null, true); textBlock.Font = GUI.SmallFont; @@ -46,7 +47,7 @@ namespace Barotrauma.Items.Components return textBlock; } } - + public override void Move(Vector2 amount) { textBlock.Rect = new Rectangle(item.Rect.X, -item.Rect.Y, item.Rect.Width, item.Rect.Height); diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs index ad73b568d..8bc36ee5c 100644 --- a/Subsurface/Source/Screens/EditMapScreen.cs +++ b/Subsurface/Source/Screens/EditMapScreen.cs @@ -286,7 +286,7 @@ namespace Barotrauma for (int i = 0; i ip.Name == "Screwdriver") as ItemPrefab; var item = new Item(screwdriverPrefab, Vector2.Zero, null); - dummyCharacter.Inventory.TryPutItem(item, new List() { LimbSlot.RightHand }, false); + dummyCharacter.Inventory.TryPutItem(item, new List() {LimbSlot.RightHand}, false); wiringToolPanel = CreateWiringPanel(); } + else + { + RemoveDummyCharacter(); + } return true; } + private void RemoveDummyCharacter() + { + if (dummyCharacter == null) return; + + foreach (Item item in dummyCharacter.Inventory.Items) + { + if (item == null) continue; + + item.Remove(); + } + + dummyCharacter.Remove(); + dummyCharacter = null; + + } + private GUIFrame CreateWiringPanel() { GUIFrame frame = new GUIFrame(new Rectangle(0,0,50,300), null, Alignment.Right | Alignment.CenterY, GUI.Style); @@ -627,7 +643,7 @@ namespace Barotrauma //cam.Zoom = MathHelper.Clamp(cam.Zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f)*cam.Zoom, 0.1f, 2.0f); } - if (characterMode) + if (characterMode || wiringMode) { if (dummyCharacter == null || Entity.FindEntityByID(dummyCharacter.ID) != dummyCharacter) { @@ -709,7 +725,7 @@ namespace Barotrauma Submarine.Draw(spriteBatch, true); - if (!characterMode) + if (!characterMode && !wiringMode) { if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.UpdatePlacing(spriteBatch, cam); @@ -728,7 +744,7 @@ namespace Barotrauma //EntityPrefab.DrawList(spriteBatch, new Vector2(20,50)); - if (characterMode && dummyCharacter != null) + if ((characterMode || wiringMode) && dummyCharacter != null) { dummyCharacter.AnimController.FindHull(dummyCharacter.CursorWorldPosition, false); @@ -747,14 +763,9 @@ namespace Barotrauma if (PlayerInput.KeyHit(InputType.Select) && dummyCharacter.ClosestItem != dummyCharacter.SelectedConstruction) dummyCharacter.SelectedConstruction = null; } - if (!wiringMode) - { - dummyCharacter.DrawHUD(spriteBatch, cam); - } - else - { - wiringToolPanel.Draw(spriteBatch); - } + dummyCharacter.DrawHUD(spriteBatch, cam); + + if (wiringMode) wiringToolPanel.Draw(spriteBatch); } else {