1 /* Copyright (C) 2000-2004 Thomas Bopp, Thorsten Hampel, Ludger Merkens
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * $Id: Room.pike,v 1.1 2008/03/31 13:39:57 exodusd Exp $
19 inherit "/classes/Container";
20 #include <attributes.h>
25 #include <exception.h>
27 //! A room is a Container with say functionality and users in it.
28 //! Rooms are connected through exits (bi-directional and uni-directional).
29 class Room : public Container{
39 object creator = get_creator();
40 if ( creator->get_object_class() & CLASS_USER )
50 bool move(object dest)
53 THROW("Cannot move workareas", E_ACCESS);
61 if ( objectp(_ROOTROOM) && get_object_id() == _ROOTROOM->get_object_id() )
62 THROW("Cannot delete rootroom !", E_ACCESS);
64 steam_error("Cannot delete a workarea !");
73 * Check if its possible to insert an object.
75 * @param object obj - the object to insert
76 * @return true or false
79 bool check_insert(object obj)
87 * Get the users inside this room.
89 * @return An array of user objects.
94 foreach(get_inventory(), object inv) {
95 if ( inv->get_object_class() & CLASS_USER )
102 * This function sends a message to the container, which actually
103 * means the say event is fired and we can have a conversation between
104 * users inside this container.
106 * @param msg - the message to say
108 bool message(string msg)
110 /* does almost nothing... */
111 try_event(EVENT_SAY, CALLER, msg);
113 run_event(EVENT_SAY, CALLER, msg);
119 return query_attribute("messages");
122 int get_object_class()
124 return ::get_object_class() | CLASS_ROOM;
129 * Is this an object ? yes!
133 final bool is_room() { return true; }