Supercapacitor, shooting a turret wont use power if there isn't any ammo
This commit is contained in:
@@ -41,7 +41,27 @@
|
|||||||
|
|
||||||
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="power_in"/>
|
<input name="power"/>
|
||||||
</ConnectionPanel>
|
</ConnectionPanel>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
|
<Item
|
||||||
|
name="Supercapacitor"
|
||||||
|
linkable="true"
|
||||||
|
pickdistance="150">
|
||||||
|
|
||||||
|
<Sprite texture ="supercapacitor.png" depth="0.8"/>
|
||||||
|
|
||||||
|
<PowerContainer capacity="2000.0" maxrechargespeed="2000.0" maxoutput="2000.0" canbeselected = "true">
|
||||||
|
<GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/>
|
||||||
|
</PowerContainer>
|
||||||
|
|
||||||
|
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
|
<input name="power"/>
|
||||||
|
</ConnectionPanel>
|
||||||
|
</Item>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Items>
|
</Items>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 528 B |
@@ -5,9 +5,9 @@
|
|||||||
Tags="smallitem"
|
Tags="smallitem"
|
||||||
pickdistance="150">
|
pickdistance="150">
|
||||||
|
|
||||||
<Sprite texture ="idcard.png" depth="0.5f"/>
|
<Sprite texture ="idcard.png" depth="0.8f"/>
|
||||||
|
|
||||||
<Body width="16" height="16" density="10"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Pickable/>
|
<Pickable/>
|
||||||
</Item>
|
</Item>
|
||||||
|
|||||||
@@ -121,8 +121,31 @@ namespace Subsurface.Items.Components
|
|||||||
if (reload > 0.0f) return false;
|
if (reload > 0.0f) return false;
|
||||||
|
|
||||||
Projectile projectileComponent = null;
|
Projectile projectileComponent = null;
|
||||||
|
//search for a projectile from linked containers
|
||||||
|
Item projectile = null;
|
||||||
|
foreach (MapEntity e in item.linkedTo)
|
||||||
|
{
|
||||||
|
Item container = e as Item;
|
||||||
|
if (container == null) continue;
|
||||||
|
|
||||||
|
ItemContainer containerComponent = container.GetComponent<ItemContainer>();
|
||||||
|
if (containerComponent == null) continue;
|
||||||
|
|
||||||
|
for (int i = 0; i < containerComponent.inventory.items.Length; i++)
|
||||||
|
{
|
||||||
|
if (containerComponent.inventory.items[i] == null) continue;
|
||||||
|
if ((projectileComponent = containerComponent.inventory.items[i].GetComponent<Projectile>()) != null)
|
||||||
|
{
|
||||||
|
projectile = containerComponent.inventory.items[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (projectileComponent != null) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (projectile == null || projectileComponent == null) return false;
|
||||||
|
|
||||||
//currPowerConsumption = powerConsumption;
|
|
||||||
|
|
||||||
float availablePower = 0.0f;
|
float availablePower = 0.0f;
|
||||||
//List<PowerContainer> batteries = new List<PowerContainer>();
|
//List<PowerContainer> batteries = new List<PowerContainer>();
|
||||||
@@ -147,31 +170,6 @@ namespace Subsurface.Items.Components
|
|||||||
|
|
||||||
if (availablePower < currPowerConsumption) return false;
|
if (availablePower < currPowerConsumption) return false;
|
||||||
|
|
||||||
//search for a projectile from linked containers
|
|
||||||
Item projectile = null;
|
|
||||||
foreach (MapEntity e in item.linkedTo)
|
|
||||||
{
|
|
||||||
Item container = e as Item;
|
|
||||||
if (container == null) continue;
|
|
||||||
|
|
||||||
ItemContainer containerComponent = container.GetComponent<ItemContainer>();
|
|
||||||
if (containerComponent == null) continue;
|
|
||||||
|
|
||||||
for (int i = 0; i < containerComponent.inventory.items.Length; i++)
|
|
||||||
{
|
|
||||||
if (containerComponent.inventory.items[i] == null) continue;
|
|
||||||
if ((projectileComponent = containerComponent.inventory.items[i].GetComponent<Projectile>()) != null)
|
|
||||||
{
|
|
||||||
projectile = containerComponent.inventory.items[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (projectileComponent != null) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (projectile == null || projectileComponent==null) return false;
|
|
||||||
|
|
||||||
projectile.body.ResetDynamics();
|
projectile.body.ResetDynamics();
|
||||||
projectile.body.Enabled = true;
|
projectile.body.Enabled = true;
|
||||||
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y)), -rotation);
|
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y)), -rotation);
|
||||||
|
|||||||
@@ -315,6 +315,9 @@
|
|||||||
<Content Include="Content\Items\Electricity\lamp.png">
|
<Content Include="Content\Items\Electricity\lamp.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Content\Items\Electricity\supercapacitor.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Content\Items\Electricity\wifi.png">
|
<Content Include="Content\Items\Electricity\wifi.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -594,6 +597,7 @@
|
|||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\Electricity\poweritems.xml">
|
<Content Include="Content\Items\Electricity\poweritems.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\Weapons\railgun.xml">
|
<Content Include="Content\Items\Weapons\railgun.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user