mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 09:46:32 +01:00
Created a state system. See
http://groups.google.com/group/evennia/browse_thread/thread/66a7ff6cce5303b7 for more detailed description. Created a new folder gamesrc/commands/examples and moved all examples in there. /Griatch
This commit is contained in:
parent
cae925c29b
commit
0efe2c3095
9 changed files with 415 additions and 30 deletions
|
|
@ -117,6 +117,10 @@ class Object(models.Model):
|
|||
|
||||
objects = ObjectManager()
|
||||
|
||||
#state system can set a particular command table to be used.
|
||||
state = None
|
||||
|
||||
|
||||
def __cmp__(self, other):
|
||||
"""
|
||||
Used to figure out if one object is the same as another.
|
||||
|
|
@ -981,5 +985,21 @@ class Object(models.Model):
|
|||
otype = int(self.type)
|
||||
return defines_global.OBJECT_TYPES[otype][1][0]
|
||||
|
||||
|
||||
def get_state(self):
|
||||
return self.state
|
||||
|
||||
def set_state(self, cmd_table=None):
|
||||
"""
|
||||
Set the state by defining which cmd_table is currently used.
|
||||
"""
|
||||
if self.is_player():
|
||||
self.state = cmd_table
|
||||
|
||||
def clear_state(self):
|
||||
self.state = None
|
||||
|
||||
|
||||
|
||||
# Deferred imports are poopy. This will require some thought to fix.
|
||||
from src import cmdhandler
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue