com.planet_ink.coffee_mud.Items.Software
Class RocketShipProgram

java.lang.Object
  extended by com.planet_ink.coffee_mud.Items.Basic.StdItem
      extended by com.planet_ink.coffee_mud.Items.Software.StdProgram
          extended by com.planet_ink.coffee_mud.Items.Software.GenSoftware
              extended by com.planet_ink.coffee_mud.Items.Software.GenShipProgram
                  extended by com.planet_ink.coffee_mud.Items.Software.RocketShipProgram
All Implemented Interfaces:
Affectable, Behavable, CMObject, Contingent, DBIdentifiable, Environmental, Modifiable, MsgListener, Physical, PhysicalAgent, Readable, Rider, StatsAffecting, Tickable, Item, Software, Technical, Wearable, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class RocketShipProgram
extends GenShipProgram


Nested Class Summary
protected static class RocketShipProgram.RocketStateMachine
           
 
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
 
Field Summary
protected  java.util.List<TechComponent> components
           
protected  SpaceObject currentTarget
           
protected  java.util.List<TechComponent> dampers
           
protected  java.util.List<ShipEngine> engines
           
protected  java.lang.Double lastAcceleration
           
protected  java.lang.Double lastAngle
           
protected  java.lang.Double lastInject
           
protected  long nextPowerCycleTmr
           
protected  java.lang.String noActivationMenu
           
protected  java.util.Map<ShipEngine,java.lang.Double[]> primeInjects
           
protected  java.util.List<ShipEngine> programEngines
           
protected  SpaceObject programPlanet
           
protected  RocketShipProgram.RocketStateMachine rocketState
           
protected  java.util.List<SpaceObject> sensorReport
           
protected  PairSLinkedList<java.lang.Long,java.util.List<SpaceObject>> sensorReports
           
protected  java.util.List<TechComponent> sensors
           
protected  java.lang.Double targetAcceleration
           
protected  java.lang.Double targetLeadPct
           
protected  java.util.Map<ShipWarComponent,java.lang.Double> weaponEmissionPct
           
 
Fields inherited from class com.planet_ink.coffee_mud.Items.Software.GenShipProgram
circuitKey, readableText
 
Fields inherited from class com.planet_ink.coffee_mud.Items.Software.StdProgram
currentScreen, nextMsg
 
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
 
Constructor Summary
RocketShipProgram()
           
 
Method Summary
protected  java.lang.Double calculateMarginalTargetInjection(java.lang.Double newInject, double targetAcceleration)
           
 boolean changeFacing(SpaceShip ship, double[] newFacing)
           
 boolean checkActivate(MOB mob, java.lang.String message)
           
 boolean checkDeactivate(MOB mob, java.lang.String message)
           
 boolean checkPowerCurrent(int value)
           
 boolean checkTyping(MOB mob, java.lang.String message)
           
 void executeMsg(Environmental host, CMMsg msg)
          The general message event handler for the object.
protected  TechComponent findComponentByName(java.util.List<? extends TechComponent> list, java.lang.String prefix, java.lang.String name)
           
protected  ShipEngine findEngineByName(java.lang.String name)
           
protected  TechComponent findSensorByName(java.lang.String name)
           
protected  ShipWarComponent findShieldByName(java.lang.String name)
           
protected  ShipWarComponent findWeaponByName(java.lang.String name)
           
protected  java.lang.Double fixInjection(java.lang.Double lastInject, java.lang.Double lastAcceleration, double targetAcceleration)
           
 boolean flipForAllStop(SpaceShip ship)
           
protected  java.lang.Double forceAccelerationAllProgramEngines(double targetAcceleration)
           
 java.lang.String getActivationMenu()
          Returns the menu name of this software, so that it can be identified on its parent screen.
protected  java.util.List<TechComponent> getComponent(Technical.TechType type)
           
 java.lang.String getCurrentScreenDisplay()
          Returns the full screen appearance of this program when it is activated and on the screen.
protected  java.util.List<TechComponent> getDampeners()
           
protected  java.util.List<ShipEngine> getEngines()
           
 java.lang.String getInternalName()
          Returns the internal name of this software.
 java.lang.String getParentMenu()
          The parent menu that this software gets access from.
protected  java.util.List<TechComponent> getShipSensors()
           
protected  java.util.List<TechComponent> getTechComponents()
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 boolean isActivationString(java.lang.String word)
          Returns whether the given computer-entry command should be responded to by THIS software object on an activation command.
 boolean isCommandString(java.lang.String word, boolean isActive)
          Returns whether the given computer-entry command should be responded to by THIS software object on a WRITE/ENTER command.
 boolean isDeActivationString(java.lang.String word)
          Returns whether the given computer-entry command should be responded to by THIS software object on a deactivation command.
 void onActivate(MOB mob, java.lang.String message)
           
 void onDeactivate(MOB mob, java.lang.String message)
           
 void onPowerCurrent(int value)
           
 void onTyping(MOB mob, java.lang.String message)
           
protected  void performSimpleThrust(ShipEngine engineE, java.lang.Double thrustInject, boolean alwaysThrust)
           
 ShipEngine primeMainThrusters(SpaceShip ship)
           
 java.util.List<SpaceObject> takeSensorReport(TechComponent sensor)
           
protected  void trySendMsgToItem(MOB mob, Item engineE, CMMsg msg)
           
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Software.GenShipProgram
getTechType, setCircuitKey
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Software.GenSoftware
getStat, getStatCodes, isGeneric, readableText, sameAs, setMiscText, setReadableText, setStat, text
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Software.StdProgram
addScreenMessage, display, display, display, displayPerSec, forceNewMenuRead, forceNewMessageScan, forceUpMenu, getScreenMessage, okMessage, setCurrentScreenDisplay, setTechLevel, techLevel
 
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, copyOf, databaseID, delAllBehaviors, delAllEffects, delAllScripts, delBehavior, delEffect, delScript, description, description, destroy, displayText, displayText, eachBehavior, eachEffect, eachScript, effects, expirationDate, fetchBehavior, fetchBehavior, fetchEffect, fetchEffect, fetchScript, fitsOn, getCodeNum, getSaveStatIndex, getTickStatus, I, image, initializeClass, isReadable, isSavable, isStat, L, material, maxRange, minRange, miscTextFormat, name, Name, name, newInstance, numBehaviors, numberOfItems, numEffects, numScripts, owner, phyStats, rawImage, rawLogicalAnd, rawProperLocationBitmap, rawSecretIdentity, rawWornCode, recoverPhyStats, recursiveWeight, removeFromOwnerContainer, riding, scripts, secretIdentity, setBasePhyStats, setBaseValue, setContainer, setDatabaseID, setDescription, setDisplayText, setExpirationDate, setImage, setMaterial, setName, setOwner, setRawLogicalAnd, setRawProperLocationBitmap, setRawWornCode, setReadable, setRiding, setSavable, setSecretIdentity, setUsesRemaining, stopTicking, subjectToWearAndTear, tackOns, tick, 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.Item
baseGoldValue, container, material, numberOfItems, owner, rawSecretIdentity, recursiveWeight, removeFromOwnerContainer, secretIdentity, setBaseValue, setContainer, setMaterial, setOwner, 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
copyOf, 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, setReadable
 

Field Detail

nextPowerCycleTmr

protected volatile long nextPowerCycleTmr

noActivationMenu

protected java.lang.String noActivationMenu

engines

protected volatile java.util.List<ShipEngine> engines

sensors

protected volatile java.util.List<TechComponent> sensors

components

protected volatile java.util.List<TechComponent> components

dampers

protected volatile java.util.List<TechComponent> dampers

lastAcceleration

protected volatile java.lang.Double lastAcceleration

lastAngle

protected volatile java.lang.Double lastAngle

lastInject

protected volatile java.lang.Double lastInject

targetAcceleration

protected volatile java.lang.Double targetAcceleration

rocketState

protected volatile RocketShipProgram.RocketStateMachine rocketState

currentTarget

protected volatile SpaceObject currentTarget

targetLeadPct

protected volatile java.lang.Double targetLeadPct

programPlanet

protected volatile SpaceObject programPlanet

programEngines

protected volatile java.util.List<ShipEngine> programEngines

sensorReport

protected final java.util.List<SpaceObject> sensorReport

sensorReports

protected final PairSLinkedList<java.lang.Long,java.util.List<SpaceObject>> sensorReports

weaponEmissionPct

protected final java.util.Map<ShipWarComponent,java.lang.Double> weaponEmissionPct

primeInjects

protected volatile java.util.Map<ShipEngine,java.lang.Double[]> primeInjects
Constructor Detail

RocketShipProgram

public RocketShipProgram()
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 GenShipProgram
Returns:
the name of this class

getParentMenu

public java.lang.String getParentMenu()
Description copied from interface: Software
The parent menu that this software gets access from. When Software is available from root, "" is returned.

Specified by:
getParentMenu in interface Software
Overrides:
getParentMenu in class GenShipProgram
Returns:
parent menu that this software gets access from

getInternalName

public java.lang.String getInternalName()
Description copied from interface: Software
Returns the internal name of this software.

Specified by:
getInternalName in interface Software
Overrides:
getInternalName in class GenShipProgram
Returns:
the internal name of this software.

getCurrentScreenDisplay

public java.lang.String getCurrentScreenDisplay()
Description copied from interface: Software
Returns the full screen appearance of this program when it is activated and on the screen. Only those intentially looking at the screen again, or forced by the program, will see this larger message.

Specified by:
getCurrentScreenDisplay in interface Software
Overrides:
getCurrentScreenDisplay in class StdProgram
Returns:
the entire screen message
See Also:
Software.addScreenMessage(String), Software.getScreenMessage()

getComponent

protected java.util.List<TechComponent> getComponent(Technical.TechType type)

getEngines

protected java.util.List<ShipEngine> getEngines()

getTechComponents

protected java.util.List<TechComponent> getTechComponents()

getShipSensors

protected java.util.List<TechComponent> getShipSensors()

getDampeners

protected java.util.List<TechComponent> getDampeners()

isActivationString

public boolean isActivationString(java.lang.String word)
Description copied from interface: Software
Returns whether the given computer-entry command should be responded to by THIS software object on an activation command.

Specified by:
isActivationString in interface Software
Overrides:
isActivationString in class GenShipProgram
Parameters:
word - the computer-entry command entered
Returns:
true if this software should respond.

isDeActivationString

public boolean isDeActivationString(java.lang.String word)
Description copied from interface: Software
Returns whether the given computer-entry command should be responded to by THIS software object on a deactivation command.

Specified by:
isDeActivationString in interface Software
Overrides:
isDeActivationString in class GenShipProgram
Parameters:
word - the computer-entry command entered
Returns:
true if this software should respond.

findComponentByName

protected TechComponent findComponentByName(java.util.List<? extends TechComponent> list,
                                            java.lang.String prefix,
                                            java.lang.String name)

findEngineByName

protected ShipEngine findEngineByName(java.lang.String name)

findSensorByName

protected TechComponent findSensorByName(java.lang.String name)

findWeaponByName

protected ShipWarComponent findWeaponByName(java.lang.String name)

findShieldByName

protected ShipWarComponent findShieldByName(java.lang.String name)

isCommandString

public boolean isCommandString(java.lang.String word,
                               boolean isActive)
Description copied from interface: Software
Returns whether the given computer-entry command should be responded to by THIS software object on a WRITE/ENTER command.

Specified by:
isCommandString in interface Software
Overrides:
isCommandString in class GenShipProgram
Parameters:
word - the computer-entry command
isActive - true if the software is already activated
Returns:
true if this software can respond

takeSensorReport

public java.util.List<SpaceObject> takeSensorReport(TechComponent sensor)

getActivationMenu

public java.lang.String getActivationMenu()
Description copied from interface: Software
Returns the menu name of this software, so that it can be identified on its parent screen.

Specified by:
getActivationMenu in interface Software
Overrides:
getActivationMenu in class GenShipProgram
Returns:
the menu name of this software

checkActivate

public boolean checkActivate(MOB mob,
                             java.lang.String message)
Overrides:
checkActivate in class GenShipProgram

checkDeactivate

public boolean checkDeactivate(MOB mob,
                               java.lang.String message)
Overrides:
checkDeactivate in class GenShipProgram

checkTyping

public boolean checkTyping(MOB mob,
                           java.lang.String message)
Overrides:
checkTyping in class GenShipProgram

trySendMsgToItem

protected void trySendMsgToItem(MOB mob,
                                Item engineE,
                                CMMsg msg)

fixInjection

protected java.lang.Double fixInjection(java.lang.Double lastInject,
                                        java.lang.Double lastAcceleration,
                                        double targetAcceleration)

calculateMarginalTargetInjection

protected java.lang.Double calculateMarginalTargetInjection(java.lang.Double newInject,
                                                            double targetAcceleration)

forceAccelerationAllProgramEngines

protected java.lang.Double forceAccelerationAllProgramEngines(double targetAcceleration)

performSimpleThrust

protected void performSimpleThrust(ShipEngine engineE,
                                   java.lang.Double thrustInject,
                                   boolean alwaysThrust)

checkPowerCurrent

public boolean checkPowerCurrent(int value)
Overrides:
checkPowerCurrent in class GenShipProgram

flipForAllStop

public boolean flipForAllStop(SpaceShip ship)

changeFacing

public boolean changeFacing(SpaceShip ship,
                            double[] newFacing)

primeMainThrusters

public ShipEngine primeMainThrusters(SpaceShip ship)

onTyping

public void onTyping(MOB mob,
                     java.lang.String message)
Overrides:
onTyping in class GenShipProgram

onActivate

public void onActivate(MOB mob,
                       java.lang.String message)
Overrides:
onActivate in class GenShipProgram

onDeactivate

public void onDeactivate(MOB mob,
                         java.lang.String message)
Overrides:
onDeactivate in class GenShipProgram

onPowerCurrent

public void onPowerCurrent(int value)
Overrides:
onPowerCurrent in class GenShipProgram

executeMsg

public void executeMsg(Environmental host,
                       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 StdProgram
Parameters:
host - either the initiator of the event, or the host of this object
msg - the CMMsg that needs to be executed
See Also:
CMMsg