com.planet_ink.coffee_mud.Items.CompTech
Class StdCompFuelConsumer

java.lang.Object
  extended by com.planet_ink.coffee_mud.Items.Basic.StdItem
      extended by com.planet_ink.coffee_mud.Items.Basic.StdContainer
          extended by com.planet_ink.coffee_mud.Items.BasicTech.StdElecContainer
              extended by com.planet_ink.coffee_mud.Items.CompTech.StdElecCompContainer
                  extended by com.planet_ink.coffee_mud.Items.CompTech.StdCompFuelConsumer
All Implemented Interfaces:
Affectable, Behavable, CloseableLockable, CMObject, Contingent, DBIdentifiable, Environmental, Modifiable, MsgListener, Physical, PhysicalAgent, Readable, Rider, StatsAffecting, Tickable, Container, Electronics, FuelConsumer, Item, TechComponent, Technical, Wearable, java.lang.Cloneable, java.lang.Comparable<CMObject>
Direct Known Subclasses:
StdCompGenerator, StdShipThruster

public class StdCompFuelConsumer
extends StdElecCompContainer
implements FuelConsumer


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Technical
Technical.TechCommand, Technical.TechType
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Wearable
Wearable.CODES
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Items.interfaces.TechComponent
TechComponent.ShipDir
 
Field Summary
protected  java.util.List<Item> fuelCache
           
protected  int fuelTickDown
           
protected  int[] generatedFuelTypes
           
protected  int ticksPerFuelConsume
           
 
Fields inherited from class com.planet_ink.coffee_mud.Items.CompTech.StdElecCompContainer
circuitKey, installedFactor, maxRechargePer
 
Fields inherited from class com.planet_ink.coffee_mud.Items.BasicTech.StdElecContainer
activated, cachedManufact, manufacturer, power, powerCapacity
 
Fields inherited from class com.planet_ink.coffee_mud.Items.Basic.StdContainer
capacity, containType, defaultsClosed, defaultsLocked, hasALid, hasALock, isLocked, isOpen, openDelayTicks
 
Fields inherited from class com.planet_ink.coffee_mud.Items.Basic.StdItem
affectPhyStats, affects, baseGoldValue, basePhyStats, behaviors, cachedImageName, CODES, databaseID, description, destroyed, displayText, dispossessionTime, material, me, miscText, myContainer, myUses, myWornCode, name, owner, phyStats, properWornBitmap, rawImageName, riding, scripts, secretIdentity, tickCtr, tickStatus, wornLogicalAnd, xtraValues
 
Fields inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Wearable
DEFAULT_WORN_CODES, DEFAULT_WORN_DEPENDENCYGRID, DEFAULT_WORN_DESCS, DEFAULT_WORN_ORDER, DEFAULT_WORN_USUAL_NAMES, DEFAULT_WORN_WEIGHT_POINTS, DEFAULT_WORN_WEIGHTS, FILTER_ANY, FILTER_MOBINVONLY, FILTER_ROOMONLY, FILTER_UNWORNONLY, FILTER_WORNONLY, HIGHEST_WORN_CODE, IN_INVENTORY, WORN_ABOUT_BODY, WORN_ARMS, WORN_BACK, WORN_EARS, WORN_EYES, WORN_FEET, WORN_FLOATING_NEARBY, WORN_HANDS, WORN_HEAD, WORN_HELD, WORN_LEFT_FINGER, WORN_LEFT_WRIST, WORN_LEGS, WORN_MOUTH, WORN_NECK, WORN_RIGHT_FINGER, WORN_RIGHT_WRIST, WORN_TORSO, WORN_WAIST, WORN_WIELD
 
Fields inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Container
CONTAIN_ANYTHING, CONTAIN_BODIES, CONTAIN_CAGED, CONTAIN_CLOTHES, CONTAIN_COINS, CONTAIN_DAGGERS, CONTAIN_DESCS, CONTAIN_DRINKABLES, CONTAIN_EATABLES, CONTAIN_FOOTWEAR, CONTAIN_KEYS, CONTAIN_LIQUID, CONTAIN_ONEHANDWEAPONS, CONTAIN_OTHERWEAPONS, CONTAIN_RAWMATERIALS, CONTAIN_READABLES, CONTAIN_SCROLLS, CONTAIN_SMOKEABLES, CONTAIN_SSCOMPONENTS, CONTAIN_SWORDS
 
Constructor Summary
StdCompFuelConsumer()
           
 
Method Summary
 boolean canContain(Item I)
          Returns whether this container is allowed to contain the given object.
protected  void clearFuelCache()
           
 boolean consumeFuel(int amount)
          Forces this fuel consumer to consumer some amount of its fuel, without any other effect.
 long containTypes()
          Returns a bitmap of the types of things that this container can hold.
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
protected  void engineShutdown()
           
 void executeMsg(Environmental myHost, CMMsg msg)
          The general message event handler for the object.
 int[] getConsumedFuelTypes()
          Gets an array of RawMaterial codes representing the type of fuel that must be put inside this fuel container for it to consume it.
protected  java.util.List<Item> getFuel()
           
 int getFuelRemaining()
          Returns the amount of fuel remaining in this container.
 int getTicksPerFuelConsume()
          Gets the number of ticks between each consumption of fuel.
 int getTotalFuelCapacity()
          Returns the amount of total fuel this container can hold.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 boolean sameAs(Environmental E)
          Whether this object instance is functionally identical to the object passed in.
 void setConsumedFuelType(int[] resources)
          Sets an array of RawMaterial codes representing the type of fuel that must be put inside this fuel container for it to consume it.
 void setContainTypes(long containTypes)
          Sets a bitmap of the types of things that this container can hold.
 void setOwner(ItemPossessor newOwner)
          Sets the Room or MOB representing where this item is located.
 void setTicksPerFuelConsume(int tick)
          Sets the number of ticks between each consumption of fuel.
protected  boolean willConsumeFuelIdle()
           
 
Methods inherited from class com.planet_ink.coffee_mud.Items.CompTech.StdElecCompContainer
destroy, getComputedEfficiency, getInstalledFactor, getRechargeRate, isAllWiringHot, isInstalled, isThisPanelActivated, okMessage, powerNeeds, reportError, setInstalledFactor, setRechargeRate, subjectToWearAndTear
 
Methods inherited from class com.planet_ink.coffee_mud.Items.BasicTech.StdElecContainer
activate, activated, getFinalManufacturer, getManufacturerName, getTechType, powerCapacity, powerRemaining, setManufacturerName, setPowerCapacity, setPowerRemaining, setTechLevel, techLevel
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Basic.StdContainer
capacity, defaultsClosed, defaultsLocked, emptyPlease, getContents, getDeepContents, hasADoor, hasALock, hasContent, isInside, isLocked, isOpen, keyName, numberOfItems, openDelayTicks, recursiveWeight, setCapacity, setDoorsNLocks, setKeyName, setMiscText, setOpenDelayTicks, tick
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Basic.StdItem
abilityImbuesMagic, addBehavior, addEffect, addNonUninvokableEffect, addScript, affectCharState, affectCharStats, affectPhyStats, alreadyWornMsg, amBeingWornProperly, amDestroyed, amWearingAt, baseGoldValue, basePhyStats, behaviors, canSaveDatabaseID, canWear, canWearComplete, cloneFix, compareProperLocations, compareTo, container, databaseID, delAllBehaviors, delAllEffects, delAllScripts, delBehavior, delEffect, delScript, description, description, displayText, displayText, eachBehavior, eachEffect, eachScript, effects, expirationDate, fetchBehavior, fetchBehavior, fetchEffect, fetchEffect, fetchScript, fitsOn, getCodeNum, getSaveStatIndex, getStat, getStatCodes, getTickStatus, I, image, initializeClass, isGeneric, isReadable, isSavable, isStat, L, material, maxRange, minRange, miscTextFormat, name, Name, name, newInstance, numBehaviors, numEffects, numScripts, owner, phyStats, rawImage, rawLogicalAnd, rawProperLocationBitmap, rawSecretIdentity, rawWornCode, readableText, recoverPhyStats, removeFromOwnerContainer, riding, scripts, secretIdentity, setBasePhyStats, setBaseValue, setContainer, setDatabaseID, setDescription, setDisplayText, setExpirationDate, setImage, setMaterial, setName, setRawLogicalAnd, setRawProperLocationBitmap, setRawWornCode, setReadable, setReadableText, setRiding, setSavable, setSecretIdentity, setStat, setUsesRemaining, stopTicking, tackOns, text, ultimateContainer, unWear, usesRemaining, value, wearAt, wearEvenIfImpossible, wearIfPossible, wearIfPossible, whereCantWear
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Electronics
activate, activated, getFinalManufacturer, getManufacturerName, powerCapacity, powerNeeds, powerRemaining, setManufacturerName, setPowerCapacity, setPowerRemaining
 
Methods inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Technical
getTechType, setTechLevel, techLevel
 
Methods inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Item
baseGoldValue, container, material, numberOfItems, owner, rawSecretIdentity, recursiveWeight, removeFromOwnerContainer, secretIdentity, setBaseValue, setContainer, setMaterial, setSecretIdentity, setUsesRemaining, stopTicking, subjectToWearAndTear, ultimateContainer, usesRemaining, value
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Rider
riding, setRiding
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.DBIdentifiable
canSaveDatabaseID, databaseID, setDatabaseID
 
Methods inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Wearable
amBeingWornProperly, amWearingAt, canWear, compareProperLocations, fitsOn, rawLogicalAnd, rawProperLocationBitmap, rawWornCode, setRawLogicalAnd, setRawProperLocationBitmap, setRawWornCode, unWear, wearAt, wearEvenIfImpossible, wearIfPossible, wearIfPossible, whereCantWear
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Readable
isReadable, readableText, setReadable, setReadableText
 
Methods inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Container
capacity, emptyPlease, getContents, getDeepContents, hasContent, isInside, setCapacity
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CloseableLockable
defaultsClosed, defaultsLocked, hasADoor, hasALock, isLocked, isOpen, keyName, openDelayTicks, setDoorsNLocks, setKeyName, setOpenDelayTicks
 

Field Detail

generatedFuelTypes

protected int[] generatedFuelTypes

ticksPerFuelConsume

protected int ticksPerFuelConsume

fuelTickDown

protected volatile int fuelTickDown

fuelCache

protected volatile java.util.List<Item> fuelCache
Constructor Detail

StdCompFuelConsumer

public StdCompFuelConsumer()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Overrides:
ID in class StdElecCompContainer
Returns:
the name of this class

sameAs

public boolean sameAs(Environmental E)
Description copied from interface: Environmental
Whether this object instance is functionally identical to the object passed in. Works by repeatedly calling getStat on both objects and comparing the values.

Specified by:
sameAs in interface Environmental
Overrides:
sameAs in class StdElecCompContainer
Parameters:
E - the object to compare this one to
Returns:
whether this object is the same as the one passed in
See Also:
Modifiable.getStatCodes(), Modifiable.getStat(String)

willConsumeFuelIdle

protected boolean willConsumeFuelIdle()

copyOf

public CMObject copyOf()
Description copied from interface: CMObject
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.

Specified by:
copyOf in interface CMObject
Overrides:
copyOf in class StdItem
Returns:
a clone of this object

containTypes

public long containTypes()
Description copied from interface: Container
Returns a bitmap of the types of things that this container can hold.

Specified by:
containTypes in interface Container
Overrides:
containTypes in class StdContainer
Returns:
a bitmap of the types of things that this container can hold
See Also:
Container.setContainTypes(long), Container.CONTAIN_ANYTHING, Container.CONTAIN_DESCS

setContainTypes

public void setContainTypes(long containTypes)
Description copied from interface: Container
Sets a bitmap of the types of things that this container can hold.

Specified by:
setContainTypes in interface Container
Overrides:
setContainTypes in class StdContainer
Parameters:
containTypes - a bitmap of the types of things that this container can hold.
See Also:
Container.containTypes(), Container.CONTAIN_ANYTHING, Container.CONTAIN_DESCS

getTicksPerFuelConsume

public int getTicksPerFuelConsume()
Description copied from interface: FuelConsumer
Gets the number of ticks between each consumption of fuel. This determines the rate of fuel consumption, assuming the amount of fuel itself is fixed, or determined internally. This is the only way variation in consumption is controlled from outside.

Specified by:
getTicksPerFuelConsume in interface FuelConsumer
Returns:
the number of ticks between each consumption of fuel.
See Also:
FuelConsumer.setTicksPerFuelConsume(int)

setTicksPerFuelConsume

public void setTicksPerFuelConsume(int tick)
Description copied from interface: FuelConsumer
Sets the number of ticks between each consumption of fuel. This determines the rate of fuel consumption, assuming the amount of fuel itself is fixed, or determined internally. This is the only way variation in consumption is controlled from outside.

Specified by:
setTicksPerFuelConsume in interface FuelConsumer
Parameters:
tick - the number of ticks between each consumption of fuel.
See Also:
FuelConsumer.getTicksPerFuelConsume()

getConsumedFuelTypes

public int[] getConsumedFuelTypes()
Description copied from interface: FuelConsumer
Gets an array of RawMaterial codes representing the type of fuel that must be put inside this fuel container for it to consume it.

Specified by:
getConsumedFuelTypes in interface FuelConsumer
Returns:
an array of RawMaterial codes
See Also:
FuelConsumer.setConsumedFuelType(int[]), RawMaterial

setConsumedFuelType

public void setConsumedFuelType(int[] resources)
Description copied from interface: FuelConsumer
Sets an array of RawMaterial codes representing the type of fuel that must be put inside this fuel container for it to consume it.

Specified by:
setConsumedFuelType in interface FuelConsumer
Parameters:
resources - an array of RawMaterial codes
See Also:
FuelConsumer.getConsumedFuelTypes(), RawMaterial

getFuelRemaining

public int getFuelRemaining()
Description copied from interface: FuelConsumer
Returns the amount of fuel remaining in this container.

Specified by:
getFuelRemaining in interface FuelConsumer
Returns:
the amount of fuel remaining in this container.
See Also:
FuelConsumer.getTotalFuelCapacity()

getTotalFuelCapacity

public int getTotalFuelCapacity()
Description copied from interface: FuelConsumer
Returns the amount of total fuel this container can hold.

Specified by:
getTotalFuelCapacity in interface FuelConsumer
Returns:
the amount of total fuel this container can hold.
See Also:
FuelConsumer.getFuelRemaining()

canContain

public boolean canContain(Item I)
Description copied from interface: Container
Returns whether this container is allowed to contain the given object.

Specified by:
canContain in interface Container
Overrides:
canContain in class StdContainer
Parameters:
I - the item to check against the allowed content
Returns:
true if the given item can go in this container, false otherwise
See Also:
Container.setContainTypes(long), Container.containTypes()

engineShutdown

protected void engineShutdown()

getFuel

protected java.util.List<Item> getFuel()

clearFuelCache

protected void clearFuelCache()

setOwner

public void setOwner(ItemPossessor newOwner)
Description copied from interface: Item
Sets the Room or MOB representing where this item is located. Containers are handled by another pointer, container(), so those two methods be used together to determine where a given item is. This method is called by the addItem method on mobs and the addItem interface on Rooms. Alone, this method is insufficient to properly determine an items location, so one of the two above should be called instead.

Specified by:
setOwner in interface Item
Overrides:
setOwner in class StdElecCompContainer
Parameters:
newOwner - the mob or room where the item is located
See Also:
ItemCollection.addItem(Item)

consumeFuel

public boolean consumeFuel(int amount)
Description copied from interface: FuelConsumer
Forces this fuel consumer to consumer some amount of its fuel, without any other effect. If there was not enough fuel to be consumed, it might result in de-activation.

Specified by:
consumeFuel in interface FuelConsumer
Parameters:
amount - the amount of fuel to consume
Returns:
true if there was NOT enough fuel, false if fuel was consumed OK.

executeMsg

public void executeMsg(Environmental myHost,
                       CMMsg msg)
Description copied from interface: MsgListener
The general message event handler for the object. Messages passed herein may not necessarily be FOR this object, or from it, but will almost always represent events happening in the same room. The messages have already been through an approval process, so this method is called only to affect the final execution of the meaning of the message. Every game event goes through these methods.

Specified by:
executeMsg in interface MsgListener
Overrides:
executeMsg in class StdElecCompContainer
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that needs to be executed
See Also:
CMMsg