|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.commands.OpenCommand
Handles open, close, lock and unlock.
Nested Class Summary | |
class |
OpenCommand.KeyPredicate
A predicate to look for a key that will open the specified lock. |
Method Summary | |
void |
addCommands(java.util.Map map,
CommandList list)
Add known commands. |
CommandEvent |
createEvent(CommandEvent initial)
Implements Command.createEvent() |
GameObject |
determineTarget(java.lang.String arg,
TargetedEvent event)
Parses the args and gets the appropriate object to operate on. |
GameObject |
ensureKey(Openable target,
Commandable agent)
Makes sure user can lock or unlock the door. |
boolean |
execute(CommandEvent e)
Implements Command.execute() |
Openable |
getDirectionalTarget(int dir,
TargetedEvent event)
Looks in specified direction for an openable target. |
static OpenCommand |
getImpl()
|
GameObject |
getNoArgTarget(TargetedEvent event)
If they just typed "open", "close" or whatever, look for a nearby door to do it to. |
boolean |
knowsCommand(java.lang.String command)
We don't have any way of determining that we don't know how to handle the command based just on its arguments. |
boolean |
performClose(Openable target,
TargetedEvent event)
Attempts to close the target. |
boolean |
performLock(Openable target,
TargetedEvent event)
Attempts to lock the target. |
boolean |
performOpen(Openable obj,
TargetedEvent event)
Attempts to open the target. |
boolean |
performUnlock(Openable target,
TargetedEvent event)
Attempts to unlock the target. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static OpenCommand getImpl()
public void addCommands(java.util.Map map, CommandList list)
addCommands
in interface BuiltInCommand
map
- the map to add the commands tolist
- the CommandList the Command is being added to.public boolean knowsCommand(java.lang.String command)
knowsCommand
in interface Command
command
- the command verb to verify
public CommandEvent createEvent(CommandEvent initial)
createEvent
in interface Command
initial
- a "blank" CommandEvent containing only the
command text and the agent who's performing the command. This
initial event is created by the originator of the event (e.g.
the AI or player's command preprocessor).
Command.createEvent(wyvern.lib.CommandEvent)
public GameObject getNoArgTarget(TargetedEvent event)
event
- the event
public GameObject determineTarget(java.lang.String arg, TargetedEvent event)
arg
- the argument stringevent
- the TargetedEvent or TargetedEvent
public Openable getDirectionalTarget(int dir, TargetedEvent event)
dir
- a valid Direction constantevent
- the event for this command
public boolean execute(CommandEvent e)
execute
in interface Command
e
- the CommandEvent to execute
Command.execute(wyvern.lib.CommandEvent)
public boolean performOpen(Openable obj, TargetedEvent event)
obj
- the object to openevent
- the TargetedEvent
public boolean performClose(Openable target, TargetedEvent event)
target
- the object to closeevent
- the TargetedEvent
public boolean performLock(Openable target, TargetedEvent event)
target
- the object to lockevent
- the TargetedEvent
public boolean performUnlock(Openable target, TargetedEvent event)
target
- the object to unlockevent
- the TargetedEvent
public GameObject ensureKey(Openable target, Commandable agent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |