| 1 | -- This is an example of one way of coding a class, using the { } constructor, see the cat for another method |
| 2 | |
| 3 | classes.obj_fireplace = |
| 4 | { |
| 5 | _properties = { name = "fire", longname = "an ornate fireplace", desc = "You see a decorative fireplace, in which a warming fire is burning.", static = true }; |
| 6 | _parent = nil; -- This class inherits methods and properties from no other class (except classes.default). If you don't set _parent, this is the default |
| 7 | } |
| 8 | |
| 9 | function classes.obj_fireplace:touch(e) |
| 10 | e.person:_say("/me touches the fire", false); -- Everyone else in the room will see this, user will not |
| 11 | e.person:_say("Oouuchhh!!!!"); -- By default, all see the message |
| 12 | e.person:_tell("That hurt!"); -- Only the user sees this |
| 13 | end |