Basic Mud ObjectsThe main classes that anyone should be aware of are: MudObjectImplA base object which all mud objects should extend. This object has the following attributes: - name (string)
- description (string)
- weight (double)
- shortNames (list)
- articleRequired (boolean)
- initialBehaviours (list)
- heartbeatBehaviours (list)
- triggeredBehaviours (list)
- view (View - see [views])
ContainerImplThis is any kind of container, from a room to a cardboard box. These have an inventoryHandler object, which contains a Map of all the items and their various names. MOBImplAbstract MOB, with basic race, guild and skill behaviours. You can also attach a terminal io to the MOB to read messages. MOBs extend ContainerImpl, and have all its methods as well as: - principals (Collection of MudPrincipals and permissions)
- terminalOutput (a handle to the io system)
- gender;
- oldDescription
- oldName
- departureMessage (closure describing the characters movement message)
- arrivalMessage
PlayerImplExtends MOB, but allows username, password and overrides "dest" so they don't lose their character stuff if they leave. AliveAn interface: both monsters and players are "alive" and will receive mud heart beats. A heart beat can be used in the doHeartBeat method to make the character do stuff every so often. PlayerPlayers are also MudObjects and Alive, and this interface gives you access to these abilities for AbstractPlayers without having to cast objects around. ExitImplAllows Monsters and Players to move between one room and another. Sends a MovementEvent so the mud moves the character and relevant MessageEvents to inform players something has moved. ViewA view is an interface (yes, I know) by which an MudObject exerts a presence in the mud. Every mudobject must have an associated View object. This defines how an object is seen to Mobs and Players and is invoked using the look.groovy script. The view object can render dynamic text by parsing [Templates]. This is a very powerful tool, as you can build very large areas with very little coding, reusing templates and views as you need them. Using Spring and Beanbuilder power, you can assign a single view object to a number of MudObjects, thus sharing views over particular object types (weapons, rooms) or special views for individual objects. RoomImplA groovy implementation of a room. This groovy object is an example of a room with exits. The description of rooms can be defined in [Templates] and is dynamically loaded by the RoomImpl's View object.
|