Class SharedBatteryDrainerSystem
Basic draining prediction and API, all real logic is handled serverside.
Namespace: Content.Shared.Ninja.Systems
Assembly: Content.Shared.dll
Syntax
public abstract class SharedBatteryDrainerSystem : EntitySystem
Methods
| Improve this Doc View SourceInitialize()
Declaration
public override void Initialize()
OnDoAfterAttempt(EntityUid, BatteryDrainerComponent, DoAfterAttemptEvent<DrainDoAfterEvent>)
Cancel any drain doafters if the battery is removed or gets filled.
Declaration
protected virtual void OnDoAfterAttempt(EntityUid uid, BatteryDrainerComponent comp, DoAfterAttemptEvent<DrainDoAfterEvent> args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
BatteryDrainerComponent | comp | |
DoAfterAttemptEvent<DrainDoAfterEvent> | args |
SetBattery(EntityUid, Nullable<EntityUid>, BatteryDrainerComponent)
Sets the battery field on the drainer.
Declaration
public void SetBattery(EntityUid uid, EntityUid? battery, BatteryDrainerComponent comp = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.Nullable<EntityUid> | battery | |
BatteryDrainerComponent | comp |
TryDrainPower(EntityUid, BatteryDrainerComponent, EntityUid)
Attempt to drain as much power as possible into the powercell. Client always predicts this as succeeding since power is serverside and it can only fail once, when the powercell is filled or the target is emptied.
Declaration
protected virtual bool TryDrainPower(EntityUid uid, BatteryDrainerComponent comp, EntityUid target)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
BatteryDrainerComponent | comp | |
EntityUid | target |
Returns
Type | Description |
---|---|
System.Boolean |