GlobalRemappingclass | exec.t[615] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
Whenever an action is about to be executed, the parser runs through all of the defined global remappings, and gives each one a chance to remap the command. If any remapping succeeds, we replace the original command with the remapped version, then repeat the scan of the global remapping list from the start - we do another complete scan of the list in case there's another global mapping that applies to the remapped version of the command. We repeat this process until we make it through the whole list without finding a remapping.
GlobalRemapping instances are added to the master list of mappings automatically at pre-init time, and any time you construct one dynamically with 'new'.
class
GlobalRemapping : PreinitObject
GlobalRemapping
PreinitObject
ModuleExecObject
object
allGlobalRemappings
listNeedsSorting
remappingOrder
Inherited from ModuleExecObject
:
execAfterMe
execBeforeMe
hasInitialized_
isDoingExec_
isExecuted_
construct
execute
findGlobalRemapping
getRemapping
registerGlobalRemapping
unregisterGlobalRemapping
Inherited from ModuleExecObject
:
_execute
classExec
allGlobalRemappings | exec.t[771] |
listNeedsSorting | exec.t[778] |
remappingOrder | exec.t[661] |
construct ( ) | exec.t[740] |
execute ( ) OVERRIDDEN | exec.t[733] |
findGlobalRemapping (issuingActor, targetActor, action) | exec.t[678] |
The return value is a list, [targetActor, action], giving the resulting target actor and new action object. If we don't find any remapping, this will simply be the original values passed in as our arguments; if we do find a remapping, this will be the new version of the command.
getRemapping (issuingActor, targetActor, action) | exec.t[642] |
This routine should first check to see if the command is relevant to this remapping. In most cases, this means checking that the command matches some template, such as having a particular action (verb) and combination of potential objects. Note that the objects aren't fully resolved during global remapping - the whole point of global remapping is to catch certain phrasings before we get to the noun resolution phase - but the *phrases* involved will be known, so the range of potential matches is knowable.
If the routine decides that the action isn't relevant to this remapping, it should simply return nil.
If the action decides to remap the action, it must create a new Action object representing the replacement version of the command. Then, return a list, [targetActor, action], giving the new target actor and the new action. You don't have to change the target actor, of course, but it's included in the result so that you can change it if you want to. For example, you could use this to remap a command of the form "X, GIVE ME Y" to "ME, ASK X FOR Y" - note that the target actor changes from X to ME.
registerGlobalRemapping ( ) | exec.t[747] |
unregisterGlobalRemapping ( ) | exec.t[761] |