Difference between revisions of "Sandbox.ModAPI.Ingame.IMyBatteryBlock"

From Space Engineers Wiki
Jump to: navigation, search
(DetailedInfo: Added detailedinfo output)
(HasCapacityRemaining)
 
Line 155: Line 155:
 
bool HasCapacityRemaining{get;}
 
bool HasCapacityRemaining{get;}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
Returns true/false whether there is any capacity remaining in the battery (not fully discharged).
 
===IsBeingHacked===
 
===IsBeingHacked===
 
<syntaxhighlight lang="csharp">
 
<syntaxhighlight lang="csharp">

Latest revision as of 04:49, 13 January 2015

Sandbox.ModAPI.Ingame.IMyBattery

This interface is used to work with Battery blocks.

Namespace

Sandbox.ModAPI.Ingame

Assembly

Sandbox.Common (Sandbox.Common.dll)

Syntax

public interface IMyBatteryBlock : IMyFunctionalBlock, IMyTerminalBlock, IMyCubeBlock, IMyEntity

Methods

GetActions

void GetActions(List<ITerminalAction> resultList, Func<ITerminalAction, bool> collect = null)

This returns an ITerminalAction list containing a list of all valid actions for the block.

GetActionWithName

ITerminalAction GetActionWithName(string name)

This searches the block for an associated action corresponding to the specified name.

GetOwnerFactionTag

string GetOwnerFactionTag()

This returns a string with the faction tag of the associated owner.

GetPlayerRelationToOwner

MyRelationsBetweenPlayerAndBlock GetUserRelationToOwner(long playerId)

GetUserRelationToOwner

MyRelationsBetweenPlayerAndBlock GetUserRelationToOWner(long playerId)

HasLocalPlayerAccess

bool HasLocalPlayerAccess()

HasPlayerAccess

bool HasPlayerAccess(long playerId)

RequestEnable

void RequestEnable(bool enable)

Turns the block off or on depending on if true or false. Same as action OnOff_On or OnOff_Off.

RequestShowOnHUD

void RequestShowOnHUD(bool enable)

Enables or disables the ShowOnHUD option. If an antenna is present, the block will transmit its name and location to users in range of the antenna.

SearchActionsOfName

void SearchActionsOfName(string name, List<ITerminalAction> resultList, Func<ITerminalAction, bool> collect = null)

Search for all actions that start with the specified name. For instance, if you search for OnOff, you will get a list of actions returned including "OnOff_On" and "OnOff_Off"

SetCustomName

void SetCustomName(string text)
void SetCustomName(StringBuilder text)

This sets the name of the block. This is the same as changing the block's name in the terminal.

UpdateIsWorking

void UpdateIsWorking()

Updates the current value of the IsWorking property.

UpdateVisual

void UpdateVisual()

Properties

BlockDefinition

SerializableDefinitionId BlockDefinition {get;}

CheckConnectionAllowed

bool CheckConnectionAllowed {get;}

CubeGrid

IMyCubeGrid CubeGrid {get;}

CustomName

string CustomName {get;}

The name of the block as shown in the terminal list.

CustomNameWithFaction

string CustomNameWithFaction {get;}

DefinitionDisplayNameText

string DefinitionDisplayNameText {get;}

DetailedInfo

string DetailedInfo {get;}

Output for Assembler:
Type: Battery\nMax Output: <float> MW\nMax Required Input: <float> MW\nMax Stored Power: <float> MWh\nCurrent Output: <int> W\nStored power: <int> Wh\nFully depleted in <int> sec
Type: Battery\nMax Output: <float> MW\nMax Required Input: <float> MW\nMax Stored Power: <float> MWh\nCurrent Output: <int> W\nStored power: <int> Wh\nFully charged in <int> sec

With Line Breaks:
Type: Battery
Max Output: <float> MW
Max Required Input: <float> MW
Max Stored Power: <float> MWh
Current Output: <int> W
Stored power: <int> Wh
Fully depleted in <int> sec
OR
Fully charged in <int> sec

DisassembleRatio

float DisassembleRatio {get;}

DisplayNameText

string DisplayNameText {get;}

Enabled

bool Enabled {get;}

On/Off state of the block.

HasCapacityRemaining

bool HasCapacityRemaining{get;}

Returns true/false whether there is any capacity remaining in the battery (not fully discharged).

IsBeingHacked

bool IsBeingHacked {get;}

If the block is being ground down, returns true.

IsFunctional

bool IsFunctional {get;}

Determines whether or not the block is built enough to perform its function.

IsProducing

bool IsProducing {get;}

Returns whether the block is actively working on its queue.

IsQueueEmpty

bool IsQueueEmpty {get;}

Returns whether or not the block's queue is empty.

IsWorking

bool IsWorking {get;}

Max

Vector3I Max {get;}

Min

Vector3I Min {get;}

NumberInGrid

int NumberInGrid {get;}

Returns the number of this block's type in the grid (not quantity of blocks of that type on the grid). For instance, if you have a thruster, and add a second thruster, this will return 2. If you remove the second thruster and build another one to replace it, it will return 3.

Orientation

MyBlockOrientation Orientation {get;}

OwnerId

long OwnerId {get;}

Position

Vector3I Position {get;}

ShowOnHUD

Bool ShowOnHUD {get;}

Returns whether or not ShowOnHUD is active.