- changed how PowerContainers determine how much power to provide to the grid, batteries can now match the load of the grid

- light-emitting alien structures that hold the artifacts instead of just having the artifacts lay on the floor (can also be used for turning artifacts into power sources if installed in a sub)
This commit is contained in:
Regalis
2016-11-19 14:53:53 +02:00
parent 6ca605aa57
commit 50d706c67b
6 changed files with 80 additions and 29 deletions
+3
View File
@@ -524,6 +524,9 @@
<Content Include="Content\Items\Artifacts\artifact.png"> <Content Include="Content\Items\Artifacts\artifact.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Items\Artifacts\artifactholder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Artifacts\artifacts.xml"> <Content Include="Content\Items\Artifacts\artifacts.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType> <SubType>Designer</SubType>
Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

@@ -3,6 +3,7 @@
<Item <Item
name="Skyholder Artifact" name="Skyholder Artifact"
category="Alien" category="Alien"
Tags="alien"
pickdistance="150"> pickdistance="150">
<Sprite texture="artifact.png" depth="0.7" sourcerect="59,0,60,61"/> <Sprite texture="artifact.png" depth="0.7" sourcerect="59,0,60,61"/>
@@ -24,6 +25,7 @@
<Item <Item
name="Thermal Artifact" name="Thermal Artifact"
category="Alien" category="Alien"
Tags="alien"
pickdistance="150"> pickdistance="150">
<Sprite texture="artifact.png" depth="0.7" sourcerect="0,0,58,56"/> <Sprite texture="artifact.png" depth="0.7" sourcerect="0,0,58,56"/>
@@ -46,6 +48,7 @@
<Item <Item
name="Faraday Artifact" name="Faraday Artifact"
Tags="alien"
pickdistance="150"> pickdistance="150">
<Sprite texture="artifact.png" depth="0.7" sourcerect="0,56,60,49"/> <Sprite texture="artifact.png" depth="0.7" sourcerect="0,56,60,49"/>
@@ -66,7 +69,7 @@
name="Oxygenite Shard" name="Oxygenite Shard"
category="Alien" category="Alien"
pickdistance="150" pickdistance="150"
tags="smallitem" tags="alien,smallitem"
impacttolerance="8"> impacttolerance="8">
<Sprite texture="artifact.png" depth="0.7" sourcerect="119,96,9,32"/> <Sprite texture="artifact.png" depth="0.7" sourcerect="119,96,9,32"/>
@@ -86,7 +89,7 @@
name="Sulphurite Shard" name="Sulphurite Shard"
category="Alien" category="Alien"
pickdistance="150" pickdistance="150"
tags="smallitem" tags="alien,smallitem"
impacttolerance="8" impacttolerance="8"
spritecolor="1.0,0.0,0.0,1.0"> spritecolor="1.0,0.0,0.0,1.0">
@@ -109,7 +112,7 @@
<Item <Item
name="Ancient Weapon" name="Ancient Weapon"
category="Alien" category="Alien"
Tags="smallitem" Tags="alien,smallitem"
pickdistance="200"> pickdistance="200">
<Deconstruct time="20"> <Deconstruct time="20">
@@ -147,6 +150,7 @@
<Item <Item
name="Alien Hatch" name="Alien Hatch"
category="Alien" category="Alien"
Tags="alien"
linkable="true" linkable="true"
pickdistance="150.0"> pickdistance="150.0">
@@ -169,6 +173,7 @@
name="Alien Door" name="Alien Door"
category="Alien" category="Alien"
linkable="true" linkable="true"
Tags="alien"
pickdistance="150.0"> pickdistance="150.0">
<Sprite texture="Content/Map/ruins.png" sourcerect="746,101,93,259" depth="0.8" origin="0.5,0.5"/> <Sprite texture="Content/Map/ruins.png" sourcerect="746,101,93,259" depth="0.8" origin="0.5,0.5"/>
@@ -190,6 +195,7 @@
name="Alien Motion Sensor" name="Alien Motion Sensor"
linkable="true" linkable="true"
category="Alien" category="Alien"
Tags="alien"
pickdistance="150.0"> pickdistance="150.0">
<Sprite texture="Content/Map/ruins.png" sourcerect="55,608,81,103" depth="0.8" origin="0.5,0.5"/> <Sprite texture="Content/Map/ruins.png" sourcerect="55,608,81,103" depth="0.8" origin="0.5,0.5"/>
@@ -201,4 +207,35 @@
<output name="state_out"/> <output name="state_out"/>
</ConnectionPanel> </ConnectionPanel>
</Item> </Item>
<Item
name="Artifact Holder"
linkable="true"
category="Alien"
Tags="alien"
pickdistance="150.0">
<Sprite texture="artifactholder.png" depth="0.8"/>
<ItemContainer capacity="1" canbeselected="true" hideitems="false" itempos="128,-128">
<Containable name="Alien"/>
<Containable name="Thermal Artifact">
<StatusEffect type="OnContaining" target="This" Charge="1000.0"/>
</Containable>
<Containable name="Faraday Artifact">
<StatusEffect type="OnContaining" target="This" Charge="10.0"/>
</Containable>
</ItemContainer>
<LightComponent lightcolor="0.6,0.8,1.0,1.0" range="800.0" IsOn="true"/>
<PowerContainer capacity="20000.0" maxrechargespeed="10000.0" maxoutput="10000.0">
<StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/>
</PowerContainer>
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/>
<output name="power_out"/>
</ConnectionPanel>
</Item>
</Items> </Items>
+2
View File
@@ -27,4 +27,6 @@
<item prefab="Alien Door" alignment="Center" type="Door"/> <item prefab="Alien Door" alignment="Center" type="Door"/>
<item prefab="Alien Hatch" alignment="Center" type="Hatch"/> <item prefab="Alien Hatch" alignment="Center" type="Hatch"/>
<item prefab="Artifact Holder" alignment="Center" type="Prop" commonness="5"/>
</Structures> </Structures>
+16
View File
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System;
using System.Xml.Linq; using System.Xml.Linq;
namespace Barotrauma namespace Barotrauma
@@ -37,6 +38,21 @@ namespace Barotrauma
item = new Item(itemPrefab, position, null); item = new Item(itemPrefab, position, null);
item.MoveWithLevel = true; item.MoveWithLevel = true;
item.body.FarseerBody.IsKinematic = 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<Items.Components.ItemContainer>();
if (itemContainer == null) continue;
itemContainer.Combine(item);
break;
}
} }
public override void Update(float deltaTime) public override void Update(float deltaTime)
@@ -82,23 +82,26 @@ namespace Barotrauma.Items.Components
IsActive = true; IsActive = true;
var button = new GUIButton(new Rectangle(160, 50, 30,30), "-", GUI.Style, GuiFrame); if (canBeSelected)
button.OnClicked = (GUIButton btn, object obj) =>
{ {
RechargeSpeed = Math.Max(rechargeSpeed - maxRechargeSpeed * 0.1f, 0.0f); var button = new GUIButton(new Rectangle(160, 50, 30,30), "-", GUI.Style, GuiFrame);
item.NewComponentEvent(this, true, false); 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 = new GUIButton(new Rectangle(200, 50, 30, 30), "+", GUI.Style, GuiFrame);
button.OnClicked = (GUIButton btn, object obj) => button.OnClicked = (GUIButton btn, object obj) =>
{ {
RechargeSpeed = Math.Max(rechargeSpeed + maxRechargeSpeed * 0.1f, 0.0f); RechargeSpeed = Math.Max(rechargeSpeed + maxRechargeSpeed * 0.1f, 0.0f);
item.NewComponentEvent(this, true, false); item.NewComponentEvent(this, true, false);
return true; return true;
}; };
}
} }
public override bool Pick(Character picker) public override bool Pick(Character picker)
@@ -167,28 +170,18 @@ namespace Barotrauma.Items.Components
return; return;
} }
//currPowerConsumption = MathHelper.Lerp(
// currPowerConsumption,
// -maxOutput * chargeRate,
// 0.1f);
if (gridPower < gridLoad) if (gridPower < gridLoad)
{ {
// CurrPowerOutput = MathHelper.Lerp(
//CurrPowerOutput, Math.Min(maxOutput * chargeRate, gridLoad), 0.05f);
CurrPowerOutput = MathHelper.Lerp( CurrPowerOutput = MathHelper.Lerp(
CurrPowerOutput, CurrPowerOutput,
Math.Min(maxOutput * chargeRate, gridLoad - (gridLoad * outputVoltage)), Math.Min(maxOutput * chargeRate, gridLoad),
0.05f); deltaTime);
} }
else 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; Charge -= CurrPowerOutput / 3600.0f;
} }