* Implemented a non-persistent cache in src/cache.py. The cache is lost when restarting the server but it has the advantage of not hitting the database, and so is useful for implementing things that should be remembered over time but does not need to be persistently saved in the database at every point, like fast-updating combat systems, timers etc. Using the cache can substantially cut down on database access at the cost of memory comsumption. It is easiest accessed through the object model using normal dot notation. So to store a variable in volatile memory e.g. from your script parent, you can do things like self.scripted_obj.cache.myvariable = variable and be sure that later (unless there was a reboot) doing self.scripted_obj.cache.myvariable will return the value you stored there.
* OBS - doing e.g. self.scripted_obj.myvariable = variable was always iffy and since a few revisions back this will NOT work - this is because the objects are now consistently synced with the database (in the past this was not done consistently which caused strange behaviour). * Fixed some bugs in the multi-word command handler. It can handle multi-word exits as well now.
This commit is contained in:
parent
af19724bb2
commit
642932a403
9 changed files with 177 additions and 58 deletions
|
|
@ -174,7 +174,9 @@ class ObjectManager(models.Manager):
|
|||
defines_global.OTYPE_GOING])
|
||||
|
||||
def local_object_script_parent_search(self, script_parent, location):
|
||||
o_query = self.filter(script_parent__exact=script_parent).filter(location__iexact=location)
|
||||
o_query = self.filter(script_parent__exact=script_parent)
|
||||
if o_query:
|
||||
o_query = o_query.filter(location__iexact=location)
|
||||
return o_query.exclude(type__in=[defines_global.OTYPE_GARBAGE,
|
||||
defines_global.OTYPE_GOING])
|
||||
|
||||
|
|
@ -367,12 +369,13 @@ class ObjectManager(models.Manager):
|
|||
|
||||
# If the search string is one of the following, return immediately with
|
||||
# the appropriate result.
|
||||
|
||||
if searcher.get_location().dbref_match(ostring) or ostring == 'here':
|
||||
return [searcher.get_location()]
|
||||
elif ostring == 'me' and searcher:
|
||||
return [searcher]
|
||||
|
||||
if search_query[0] == "*":
|
||||
if search_query and search_query[0] == "*":
|
||||
# Player search- gotta search by name or alias
|
||||
search_target = search_query[1:]
|
||||
player_match = self.player_name_search(search_target)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue