Added battery recharge docks, moved applying OnActive statuseffects to the Powered itemcomponent, removed smoke particles from stun baton hit effect

This commit is contained in:
Joonas Rikkonen
2017-09-03 16:57:32 +03:00
parent 7625d04807
commit 1311a286f5
12 changed files with 57 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -43,7 +43,7 @@
description="Generally used for storing backup power in case of a reactor failure.">
<Sprite texture ="battery.png" depth="0.8"/>
<Sprite texture ="battery.png" sourcerect="0,0,58,77" depth="0.8"/>
<PowerContainer capacity="2000.0" maxrechargespeed="500.0" maxoutput="1000.0" canbeselected = "true">
<GuiFrame rect="0,-100,350,160" alignment="Center" style="ItemUI"/>
@@ -86,4 +86,31 @@
<input name="power_in"/>
</ConnectionPanel>
</Item>
<Item
name="Charging Dock"
category="Electrical"
linkable="true"
description="A wall-mounted battery cell charging dock.">
<Sprite texture ="battery.png" sourcerect="0,80,58,16" depth="0.8"/>
<Powered powerconsumption="200" currpowerconsumption="200" isactive="true">
<GuiFrame rect="0,-100,350,160" alignment="Center" style="ItemUI"/>
<StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/>
</Powered>
<ConnectionPanel selectkey="Action" canbeselected="true" msg="Rewire [Screwdriver]">
<StatusEffect type="OnFailure" target="Character">
<Explosion range="100.0" damage="15" stun="10" force="3.0" flames="false" shockwave="false" sparks="true"/>
</StatusEffect>
<requireditem name="Screwdriver" type="Equipped"/>
<input name="power_in"/>
</ConnectionPanel>
<ItemContainer capacity="4" canbeselected="true" hideitems="false" itempos="9,9" iteminterval="14,0" itemrotation="90">
<Containable name="loadable"/>
</ItemContainer>
</Item>
</Items>

View File

@@ -115,7 +115,7 @@
<StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="15.0" disabledeltatime="true">
<sound file="Content/Items/Weapons/stunbaton.ogg"/>
<RequiredItem name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
<Explosion range="100.0" force="0.1" shockwave="false" flames="false" camerashake="5.0"/>
<Explosion range="100.0" force="0.1" shockwave="false" flames="false" smoke="false" camerashake="5.0"/>
</StatusEffect>
<StatusEffect type="OnUse" target="Contained,Character" Condition="-15.0" stun="30.0" disabledeltatime="true">
<sound file="Content/Items/Weapons/stunbaton.ogg"/>

View File

@@ -33,6 +33,8 @@ namespace Barotrauma.Items.Components
}
if (voltage < minVoltage) return;
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (powerConsumption == 0.0f) voltage = 1.0f;

View File

@@ -209,7 +209,7 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam)
{
#if CLIENT
if (progressBar!=null)
if (progressBar != null)
{
progressBar.BarSize = fabricatedItem == null ? 0.0f : (fabricatedItem.RequiredTime - timeUntilReady) / fabricatedItem.RequiredTime;
}
@@ -217,6 +217,8 @@ namespace Barotrauma.Items.Components
if (voltage < minVoltage) return;
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (powerConsumption == 0) voltage = 1.0f;
timeUntilReady -= deltaTime*voltage;

View File

@@ -62,6 +62,11 @@ namespace Barotrauma.Items.Components
hasPower = voltage > minVoltage;
if (hasPower)
{
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
}
voltage = 0.0f;
}

View File

@@ -64,8 +64,6 @@ namespace Barotrauma.Items.Components
powerDownTimer = 0.0f;
}
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
running = true;
CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount*100.0f;

View File

@@ -186,16 +186,16 @@ namespace Barotrauma.Items.Components
}
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
fissionRate = Math.Min(fissionRate, AvailableFuel);
float heat = 80 * fissionRate * (AvailableFuel/2000.0f);
float heat = 80 * fissionRate * (AvailableFuel / 2000.0f);
float heatDissipation = 50 * coolingRate + Math.Max(ExtraCooling, 5.0f);
float deltaTemp = (((heat - heatDissipation) * 5) - temperature) / 10000.0f;
Temperature = temperature + deltaTemp;
if (temperature>fireTemp && temperature-deltaTemp<fireTemp)
if (temperature > fireTemp && temperature - deltaTemp < fireTemp)
{
#if CLIENT
Vector2 baseVel = Rand.Vector(300.0f);

View File

@@ -129,7 +129,9 @@ namespace Barotrauma.Items.Components
}
if (voltage < minVoltage && powerConsumption > 0.0f) return;
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (autoPilot)
{
UpdateAutoPilot(deltaTime);
@@ -138,12 +140,10 @@ namespace Barotrauma.Items.Components
item.SendSignal(0, targetVelocity.X.ToString(CultureInfo.InvariantCulture), "velocity_x_out", null);
float targetLevel = -targetVelocity.Y;
targetLevel += (neutralBallastLevel - 0.5f) * 100.0f;
item.SendSignal(0, targetLevel.ToString(CultureInfo.InvariantCulture), "velocity_y_out", null);
voltage -= deltaTime;
}

View File

@@ -110,9 +110,7 @@ namespace Barotrauma.Items.Components
float chargeRatio = (float)(Math.Sqrt(charge / capacity));
float gridPower = 0.0f;
float gridLoad = 0.0f;
//if (item.linkedTo.Count == 0) return;
foreach (Connection c in item.Connections)
{
if (c.Name == "power_in") continue;
@@ -125,18 +123,12 @@ namespace Barotrauma.Items.Components
gridPower -= pt.CurrPowerConsumption;
}
}
//float gridRate = voltage;
if (chargeRatio > 0.0f)
{
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
}
//recharge
//if (gridRate >= chargeRate)
//{
if (charge >= capacity)
{
rechargeVoltage = 0.0f;
@@ -149,9 +141,7 @@ namespace Barotrauma.Items.Components
currPowerConsumption = MathHelper.Lerp(currPowerConsumption, rechargeSpeed, 0.05f);
Charge += currPowerConsumption * rechargeVoltage / 3600.0f;
}
//}
//provide power to the grid
if (gridLoad > 0.0f)
{

View File

@@ -91,6 +91,7 @@ namespace Barotrauma.Items.Components
#if CLIENT
if (voltage > minVoltage)
{
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (!powerOnSoundPlayed)
{
powerOnSound.Play(1.0f, 600.0f, item.WorldPosition);
@@ -101,6 +102,11 @@ namespace Barotrauma.Items.Components
{
powerOnSoundPlayed = false;
}
#else
if (voltage > minVoltage)
{
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
}
#endif
}

View File

@@ -135,9 +135,7 @@ namespace Barotrauma.Items.Components
#if CLIENT
light.ParentSub = item.Submarine;
#endif
ApplyStatusEffects(ActionType.OnActive, deltaTime);
#if CLIENT
if (item.Container != null)
{