Fix PowerCellDrawComponent draw rate (#38562)
* fix power cell draw rate * comment
This commit is contained in:
@@ -28,7 +28,7 @@ public sealed partial class PowerCellSystem
|
||||
if (!TryGetBatteryFromSlot(uid, out var batteryEnt, out var battery, slot))
|
||||
continue;
|
||||
|
||||
if (_battery.TryUseCharge(batteryEnt.Value, comp.DrawRate, battery))
|
||||
if (_battery.TryUseCharge(batteryEnt.Value, comp.DrawRate * (float)comp.Delay.TotalSeconds, battery))
|
||||
continue;
|
||||
|
||||
var ev = new PowerCellSlotEmptyEvent();
|
||||
|
||||
@@ -18,13 +18,13 @@ public sealed partial class PowerCellDrawComponent : Component
|
||||
/// <summary>
|
||||
/// Whether there is any charge available to draw.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("canDraw"), AutoNetworkedField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool CanDraw;
|
||||
|
||||
/// <summary>
|
||||
/// Whether there is sufficient charge to use.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("canUse"), AutoNetworkedField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool CanUse;
|
||||
|
||||
#endregion
|
||||
@@ -37,17 +37,20 @@ public sealed partial class PowerCellDrawComponent : Component
|
||||
public bool Enabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// How much the entity draws while the UI is open.
|
||||
/// How much the entity draws while the UI is open (in Watts).
|
||||
/// Set to 0 if you just wish to check for power upon opening the UI.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("drawRate")]
|
||||
[DataField]
|
||||
public float DrawRate = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// How much power is used whenever the entity is "used".
|
||||
/// How much power is used whenever the entity is "used" (in Joules).
|
||||
/// This is used to ensure the UI won't open again without a minimum use power.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("useRate")]
|
||||
/// <remarks>
|
||||
/// This is not a rate how the datafield name implies, but a one-time cost.
|
||||
/// </remarks>
|
||||
[DataField]
|
||||
public float UseRate;
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user