C# Class SSTUTools.SSTUResourceList

Will be the base class for manipulating resources in a part, including cross-module manipulation.
Mostrar archivo Open project: shadowmage45/SSTULabs Class Usage Examples

Public Methods

Method Description
addResource ( String name, float fillMaxUnits ) : void

Add a resource, by units, setting/adjusting fill and max units by the units specified

addResource ( string name, float fill, float max ) : void

Add a resource, by units, setting/adjusting fill and max units by the units specified

addResourceByVolume ( String name, float cubicMetersTotalFilled ) : void

Add a resource, by volume, setting/adjusting fill and max units by the volume specified

addResourceByVolume ( string name, float cubicMetersFilled, float totalCubicMeters ) : void

Add a resource, by volume, setting/adjusting fill and max units by the volumes specified

removeResource ( String name ) : void

Remove a resource from the list entirely

removeResource ( String name, float removeFromMax ) : void

Remove a specified number of units from the resource maximum; if fill>max after this, fill will be set to max. If max==0, resource will be removed from list entirely

removeResource ( String name, float removeFromFill, float removeFromMax ) : void

Remove a specified number of units from the resource fill and maximum values; if fill>max after this, fill will be set to max. If max==0, resource will be removed from list entirely

setResource ( string name, float fill, float max ) : void

Blindly set the quanity of a resource. Adds new resource if not present, removes resource if present and max==0.

setResourcesToPart ( Part part ) : void

Actually set the resources from this list to the input part; if the current part resources match this list exactly they will be updated in-place, else all resources from the part will be cleared and the new list of resources added.

Method Details

addResource() public method

Add a resource, by units, setting/adjusting fill and max units by the units specified
public addResource ( String name, float fillMaxUnits ) : void
name String
fillMaxUnits float
return void

addResource() public method

Add a resource, by units, setting/adjusting fill and max units by the units specified
public addResource ( string name, float fill, float max ) : void
name string
fill float
max float
return void

addResourceByVolume() public method

Add a resource, by volume, setting/adjusting fill and max units by the volume specified
public addResourceByVolume ( String name, float cubicMetersTotalFilled ) : void
name String
cubicMetersTotalFilled float
return void

addResourceByVolume() public method

Add a resource, by volume, setting/adjusting fill and max units by the volumes specified
public addResourceByVolume ( string name, float cubicMetersFilled, float totalCubicMeters ) : void
name string
cubicMetersFilled float
totalCubicMeters float
return void

removeResource() public method

Remove a resource from the list entirely
public removeResource ( String name ) : void
name String
return void

removeResource() public method

Remove a specified number of units from the resource maximum; if fill>max after this, fill will be set to max. If max==0, resource will be removed from list entirely
public removeResource ( String name, float removeFromMax ) : void
name String
removeFromMax float
return void

removeResource() public method

Remove a specified number of units from the resource fill and maximum values; if fill>max after this, fill will be set to max. If max==0, resource will be removed from list entirely
public removeResource ( String name, float removeFromFill, float removeFromMax ) : void
name String
removeFromFill float
removeFromMax float
return void

setResource() public method

Blindly set the quanity of a resource. Adds new resource if not present, removes resource if present and max==0.
public setResource ( string name, float fill, float max ) : void
name string
fill float
max float
return void

setResourcesToPart() public method

Actually set the resources from this list to the input part; if the current part resources match this list exactly they will be updated in-place, else all resources from the part will be cleared and the new list of resources added.
public setResourcesToPart ( Part part ) : void
part Part
return void