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

@@ -43,7 +43,7 @@
description="Generally used for storing backup power in case of a reactor failure."> 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"> <PowerContainer capacity="2000.0" maxrechargespeed="500.0" maxoutput="1000.0" canbeselected = "true">
<GuiFrame rect="0,-100,350,160" alignment="Center" style="ItemUI"/> <GuiFrame rect="0,-100,350,160" alignment="Center" style="ItemUI"/>
@@ -86,4 +86,31 @@
<input name="power_in"/> <input name="power_in"/>
</ConnectionPanel> </ConnectionPanel>
</Item> </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> </Items>
@@ -115,7 +115,7 @@
<StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="15.0" disabledeltatime="true"> <StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="15.0" disabledeltatime="true">
<sound file="Content/Items/Weapons/stunbaton.ogg"/> <sound file="Content/Items/Weapons/stunbaton.ogg"/>
<RequiredItem name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/> <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>
<StatusEffect type="OnUse" target="Contained,Character" Condition="-15.0" stun="30.0" disabledeltatime="true"> <StatusEffect type="OnUse" target="Contained,Character" Condition="-15.0" stun="30.0" disabledeltatime="true">
<sound file="Content/Items/Weapons/stunbaton.ogg"/> <sound file="Content/Items/Weapons/stunbaton.ogg"/>
@@ -34,6 +34,8 @@ namespace Barotrauma.Items.Components
if (voltage < minVoltage) return; if (voltage < minVoltage) return;
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (powerConsumption == 0.0f) voltage = 1.0f; if (powerConsumption == 0.0f) voltage = 1.0f;
progressTimer += deltaTime*voltage; progressTimer += deltaTime*voltage;
@@ -209,7 +209,7 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
#if CLIENT #if CLIENT
if (progressBar!=null) if (progressBar != null)
{ {
progressBar.BarSize = fabricatedItem == null ? 0.0f : (fabricatedItem.RequiredTime - timeUntilReady) / fabricatedItem.RequiredTime; progressBar.BarSize = fabricatedItem == null ? 0.0f : (fabricatedItem.RequiredTime - timeUntilReady) / fabricatedItem.RequiredTime;
} }
@@ -217,6 +217,8 @@ namespace Barotrauma.Items.Components
if (voltage < minVoltage) return; if (voltage < minVoltage) return;
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (powerConsumption == 0) voltage = 1.0f; if (powerConsumption == 0) voltage = 1.0f;
timeUntilReady -= deltaTime*voltage; timeUntilReady -= deltaTime*voltage;
@@ -62,6 +62,11 @@ namespace Barotrauma.Items.Components
hasPower = voltage > minVoltage; hasPower = voltage > minVoltage;
if (hasPower)
{
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
}
voltage = 0.0f; voltage = 0.0f;
} }
@@ -64,8 +64,6 @@ namespace Barotrauma.Items.Components
powerDownTimer = 0.0f; powerDownTimer = 0.0f;
} }
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
running = true; running = true;
CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount*100.0f; CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount*100.0f;
@@ -189,13 +189,13 @@ namespace Barotrauma.Items.Components
fissionRate = Math.Min(fissionRate, AvailableFuel); 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 heatDissipation = 50 * coolingRate + Math.Max(ExtraCooling, 5.0f);
float deltaTemp = (((heat - heatDissipation) * 5) - temperature) / 10000.0f; float deltaTemp = (((heat - heatDissipation) * 5) - temperature) / 10000.0f;
Temperature = temperature + deltaTemp; Temperature = temperature + deltaTemp;
if (temperature>fireTemp && temperature-deltaTemp<fireTemp) if (temperature > fireTemp && temperature - deltaTemp < fireTemp)
{ {
#if CLIENT #if CLIENT
Vector2 baseVel = Rand.Vector(300.0f); Vector2 baseVel = Rand.Vector(300.0f);
@@ -130,6 +130,8 @@ namespace Barotrauma.Items.Components
if (voltage < minVoltage && powerConsumption > 0.0f) return; if (voltage < minVoltage && powerConsumption > 0.0f) return;
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (autoPilot) if (autoPilot)
{ {
UpdateAutoPilot(deltaTime); UpdateAutoPilot(deltaTime);
@@ -138,12 +140,10 @@ namespace Barotrauma.Items.Components
item.SendSignal(0, targetVelocity.X.ToString(CultureInfo.InvariantCulture), "velocity_x_out", null); item.SendSignal(0, targetVelocity.X.ToString(CultureInfo.InvariantCulture), "velocity_x_out", null);
float targetLevel = -targetVelocity.Y; float targetLevel = -targetVelocity.Y;
targetLevel += (neutralBallastLevel - 0.5f) * 100.0f; targetLevel += (neutralBallastLevel - 0.5f) * 100.0f;
item.SendSignal(0, targetLevel.ToString(CultureInfo.InvariantCulture), "velocity_y_out", null); item.SendSignal(0, targetLevel.ToString(CultureInfo.InvariantCulture), "velocity_y_out", null);
voltage -= deltaTime; voltage -= deltaTime;
} }
@@ -111,8 +111,6 @@ namespace Barotrauma.Items.Components
float gridPower = 0.0f; float gridPower = 0.0f;
float gridLoad = 0.0f; float gridLoad = 0.0f;
//if (item.linkedTo.Count == 0) return;
foreach (Connection c in item.Connections) foreach (Connection c in item.Connections)
{ {
if (c.Name == "power_in") continue; if (c.Name == "power_in") continue;
@@ -126,17 +124,11 @@ namespace Barotrauma.Items.Components
} }
} }
//float gridRate = voltage;
if (chargeRatio > 0.0f) if (chargeRatio > 0.0f)
{ {
ApplyStatusEffects(ActionType.OnActive, deltaTime, null); ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
} }
//recharge
//if (gridRate >= chargeRate)
//{
if (charge >= capacity) if (charge >= capacity)
{ {
rechargeVoltage = 0.0f; rechargeVoltage = 0.0f;
@@ -150,8 +142,6 @@ namespace Barotrauma.Items.Components
Charge += currPowerConsumption * rechargeVoltage / 3600.0f; Charge += currPowerConsumption * rechargeVoltage / 3600.0f;
} }
//}
//provide power to the grid //provide power to the grid
if (gridLoad > 0.0f) if (gridLoad > 0.0f)
{ {
@@ -91,6 +91,7 @@ namespace Barotrauma.Items.Components
#if CLIENT #if CLIENT
if (voltage > minVoltage) if (voltage > minVoltage)
{ {
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (!powerOnSoundPlayed) if (!powerOnSoundPlayed)
{ {
powerOnSound.Play(1.0f, 600.0f, item.WorldPosition); powerOnSound.Play(1.0f, 600.0f, item.WorldPosition);
@@ -101,6 +102,11 @@ namespace Barotrauma.Items.Components
{ {
powerOnSoundPlayed = false; powerOnSoundPlayed = false;
} }
#else
if (voltage > minVoltage)
{
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
}
#endif #endif
} }
@@ -136,8 +136,6 @@ namespace Barotrauma.Items.Components
light.ParentSub = item.Submarine; light.ParentSub = item.Submarine;
#endif #endif
ApplyStatusEffects(ActionType.OnActive, deltaTime);
#if CLIENT #if CLIENT
if (item.Container != null) if (item.Container != null)
{ {