- 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

View File

@@ -524,6 +524,9 @@
<Content Include="Content\Items\Artifacts\artifact.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Artifacts\artifactholder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Artifacts\artifacts.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@@ -3,6 +3,7 @@
<Item
name="Skyholder Artifact"
category="Alien"
Tags="alien"
pickdistance="150">
<Sprite texture="artifact.png" depth="0.7" sourcerect="59,0,60,61"/>
@@ -24,6 +25,7 @@
<Item
name="Thermal Artifact"
category="Alien"
Tags="alien"
pickdistance="150">
<Sprite texture="artifact.png" depth="0.7" sourcerect="0,0,58,56"/>
@@ -46,6 +48,7 @@
<Item
name="Faraday Artifact"
Tags="alien"
pickdistance="150">
<Sprite texture="artifact.png" depth="0.7" sourcerect="0,56,60,49"/>
@@ -66,7 +69,7 @@
name="Oxygenite Shard"
category="Alien"
pickdistance="150"
tags="smallitem"
tags="alien,smallitem"
impacttolerance="8">
<Sprite texture="artifact.png" depth="0.7" sourcerect="119,96,9,32"/>
@@ -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 @@
<Item
name="Ancient Weapon"
category="Alien"
Tags="smallitem"
Tags="alien,smallitem"
pickdistance="200">
<Deconstruct time="20">
@@ -147,6 +150,7 @@
<Item
name="Alien Hatch"
category="Alien"
Tags="alien"
linkable="true"
pickdistance="150.0">
@@ -169,6 +173,7 @@
name="Alien Door"
category="Alien"
linkable="true"
Tags="alien"
pickdistance="150.0">
<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"
linkable="true"
category="Alien"
Tags="alien"
pickdistance="150.0">
<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"/>
</ConnectionPanel>
</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>

View File

@@ -27,4 +27,6 @@
<item prefab="Alien Door" alignment="Center" type="Door"/>
<item prefab="Alien Hatch" alignment="Center" type="Hatch"/>
<item prefab="Artifact Holder" alignment="Center" type="Prop" commonness="5"/>
</Structures>

View File

@@ -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<Items.Components.ItemContainer>();
if (itemContainer == null) continue;
itemContainer.Combine(item);
break;
}
}
public override void Update(float deltaTime)

View File

@@ -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;
}