objects/obj_cat.lua

1
-- This is an example of one way of coding a class, using the { } constructor, see the fireplace for another method
2
 
3
classes.obj_cat =
4
{
5
	_properties = { name = "cat", longname = "a mother cat", desc = "You see at a furry object curled up in a corner. It watches comers and goers to this room as they pass." },
6
	stroke =	function (self, e)
7
				e.person:_say("/me strokes the "..self._properties.name); -- This message is said by the person who stroked the cat
8
				self:_say("/me purrs softly"); -- This message is said by 'self' which means the current object, the cat
9
			end,
10
			
11
	kill = 	function (self, e)
12
				e.person:_say("/me tries to hurt the cat");
13
				self:_say("/me runs away before "..e.person.nick.." can catch it");
14
				self:_say("Meeooooww!!!!");
15
			end,
16
			
17
	hug =	function (self, e)
18
				e.person:_say("/me hugs the cat");
19
				self:_say("/me likes "..e.person.nick);
20
			end
21
}