diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index a38c3cead..662e956f3 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -524,6 +524,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest Designer diff --git a/Subsurface/Content/Items/Artifacts/artifactholder.png b/Subsurface/Content/Items/Artifacts/artifactholder.png new file mode 100644 index 000000000..bca7f24fe Binary files /dev/null and b/Subsurface/Content/Items/Artifacts/artifactholder.png differ diff --git a/Subsurface/Content/Items/Artifacts/artifacts.xml b/Subsurface/Content/Items/Artifacts/artifacts.xml index 3f11229ed..3a6b3ee62 100644 --- a/Subsurface/Content/Items/Artifacts/artifacts.xml +++ b/Subsurface/Content/Items/Artifacts/artifacts.xml @@ -3,6 +3,7 @@ @@ -24,6 +25,7 @@ @@ -46,6 +48,7 @@ @@ -66,7 +69,7 @@ name="Oxygenite Shard" category="Alien" pickdistance="150" - tags="smallitem" + tags="alien,smallitem" impacttolerance="8"> @@ -86,7 +89,7 @@ name="Sulphurite Shard" category="Alien" pickdistance="150" - tags="smallitem" + tags="alien,smallitem" impacttolerance="8" spritecolor="1.0,0.0,0.0,1.0"> @@ -109,7 +112,7 @@ @@ -147,6 +150,7 @@ @@ -169,6 +173,7 @@ name="Alien Door" category="Alien" linkable="true" + Tags="alien" pickdistance="150.0"> @@ -190,6 +195,7 @@ name="Alien Motion Sensor" linkable="true" category="Alien" + Tags="alien" pickdistance="150.0"> @@ -201,4 +207,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Subsurface/Content/Map/RuinConfig.xml b/Subsurface/Content/Map/RuinConfig.xml index f843d1829..6953c9539 100644 --- a/Subsurface/Content/Map/RuinConfig.xml +++ b/Subsurface/Content/Map/RuinConfig.xml @@ -27,4 +27,6 @@ + + \ No newline at end of file diff --git a/Subsurface/Source/Events/ArtifactEvent.cs b/Subsurface/Source/Events/ArtifactEvent.cs index 70767c0c5..3cbc2b822 100644 --- a/Subsurface/Source/Events/ArtifactEvent.cs +++ b/Subsurface/Source/Events/ArtifactEvent.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using System.Xml.Linq; namespace Barotrauma @@ -37,6 +38,21 @@ namespace Barotrauma item = new Item(itemPrefab, position, null); item.MoveWithLevel = true; item.body.FarseerBody.IsKinematic = true; + + //try to find a nearby artifact holder (or any alien itemcontainer) and place the artifact inside it + foreach (Item it in Item.ItemList) + { + if (it.Submarine != null || !it.HasTag("alien")) continue; + + if (Math.Abs(item.WorldPosition.X - it.WorldPosition.X) > 2000.0f) continue; + if (Math.Abs(item.WorldPosition.Y - it.WorldPosition.Y) > 2000.0f) continue; + + var itemContainer = it.GetComponent(); + if (itemContainer == null) continue; + + itemContainer.Combine(item); + break; + } } public override void Update(float deltaTime) diff --git a/Subsurface/Source/Items/Components/Power/PowerContainer.cs b/Subsurface/Source/Items/Components/Power/PowerContainer.cs index f793dce9d..b5377d5b8 100644 --- a/Subsurface/Source/Items/Components/Power/PowerContainer.cs +++ b/Subsurface/Source/Items/Components/Power/PowerContainer.cs @@ -82,23 +82,26 @@ namespace Barotrauma.Items.Components IsActive = true; - var button = new GUIButton(new Rectangle(160, 50, 30,30), "-", GUI.Style, GuiFrame); - button.OnClicked = (GUIButton btn, object obj) => + if (canBeSelected) { - RechargeSpeed = Math.Max(rechargeSpeed - maxRechargeSpeed * 0.1f, 0.0f); - item.NewComponentEvent(this, true, false); + var button = new GUIButton(new Rectangle(160, 50, 30,30), "-", GUI.Style, GuiFrame); + button.OnClicked = (GUIButton btn, object obj) => + { + RechargeSpeed = Math.Max(rechargeSpeed - maxRechargeSpeed * 0.1f, 0.0f); + item.NewComponentEvent(this, true, false); - return true; - }; + return true; + }; - button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", GUI.Style, GuiFrame); - button.OnClicked = (GUIButton btn, object obj) => - { - RechargeSpeed = Math.Max(rechargeSpeed + maxRechargeSpeed * 0.1f, 0.0f); - item.NewComponentEvent(this, true, false); + button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", GUI.Style, GuiFrame); + button.OnClicked = (GUIButton btn, object obj) => + { + RechargeSpeed = Math.Max(rechargeSpeed + maxRechargeSpeed * 0.1f, 0.0f); + item.NewComponentEvent(this, true, false); - return true; - }; + return true; + }; + } } public override bool Pick(Character picker) @@ -167,28 +170,18 @@ namespace Barotrauma.Items.Components return; } - //currPowerConsumption = MathHelper.Lerp( - // currPowerConsumption, - // -maxOutput * chargeRate, - // 0.1f); - if (gridPower < gridLoad) { - // CurrPowerOutput = MathHelper.Lerp( - //CurrPowerOutput, Math.Min(maxOutput * chargeRate, gridLoad), 0.05f); - CurrPowerOutput = MathHelper.Lerp( CurrPowerOutput, - Math.Min(maxOutput * chargeRate, gridLoad - (gridLoad * outputVoltage)), - 0.05f); + Math.Min(maxOutput * chargeRate, gridLoad), + deltaTime); } else { - CurrPowerOutput = MathHelper.Lerp(CurrPowerOutput, 0.0f, 0.05f); + CurrPowerOutput = MathHelper.Lerp(CurrPowerOutput, 0.0f, deltaTime); } - - //powerConsumption = Math.Min(powerConsumption, 0.0f); Charge -= CurrPowerOutput / 3600.0f; }