- implemented @destroy as per the MUX help specifications. As part of this, fixed the object recycling routines to actually properly replace GARBAGE-flagged objects (it crashed before).
- Set up a global cleaner event to clean all @destroyed objects every 30 minutes (makes their dbrefs available). - Added the @recover command for recovering @destroyed objects up until the point that the cleaner runs and actually destroys them. This can recover @destroyed objects, rooms and exits to the same state as before @destroy. It could easily be made to recover player objects too, but I'm thinking this would be a security issue. - Added to @dig in order to allow for creating rooms with a particular parent. Also auto-creates exits in each room if desired. The only things that is not implemented is the aliases of the exits, I don't really know how to do that. - Changed the @create command format to match the @dig (it uses : to mark the parent instead of = now, since MUX' @dig reserve = to the exit list.) - Added extra security in the example event to guard against the bug that causes the whole scheduler to freak out if the event_function() gives a traceback. - Changed many instances of type to point to the defines_global.OTYPE instead of giving the integer explicitly. /Starkiel
This commit is contained in:
parent
8799a0fd55
commit
3eb4cddf42
8 changed files with 274 additions and 77 deletions
|
|
@ -13,8 +13,8 @@ from src.events import IntervalEvent
|
|||
from src.scheduler import add_event
|
||||
from src.objects.models import Object
|
||||
|
||||
#the logger is useful for debugging since there is no source object to send to
|
||||
from src.logger import log_infomsg
|
||||
#the logger is useful for debugging
|
||||
from src.logger import log_errmsg
|
||||
|
||||
#Example of the event system. This example adds an event to the red_button parent
|
||||
#in parents/examples. It makes the button blink temptingly at a regular interval.
|
||||
|
|
@ -46,7 +46,6 @@ class EventBlinkButton(IntervalEvent):
|
|||
#stored with the gamesrc/parent/ drawer as a base)
|
||||
parent = 'examples.red_button'
|
||||
buttons = Object.objects.global_object_script_parent_search(parent)
|
||||
#log_infomsg("buttons found: %s" % buttons)
|
||||
|
||||
for b in buttons:
|
||||
try:
|
||||
|
|
@ -55,10 +54,10 @@ class EventBlinkButton(IntervalEvent):
|
|||
#button has no blink() method. Just ignore.
|
||||
pass
|
||||
except:
|
||||
#show other tracebacks to owner of object.
|
||||
#this is important, we must handle this exception
|
||||
#gracefully!
|
||||
#show other tracebacks to log and owner of object.
|
||||
#This is important, we must handle these exceptions gracefully!
|
||||
b.get_owner().emit_to(sys.exc_info()[1])
|
||||
log_errmsg(sys.exc_info()[1])
|
||||
|
||||
#create and add the event to the global handler
|
||||
blink_event = EventBlinkButton()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ gamesrc/parents and set SCRIPT_DEFAULT_OBJECT = 'custom_basicobject'
|
|||
in game/settings.py.
|
||||
|
||||
Generally, if you want to conveniently set future objects to inherit from this
|
||||
script parent (not as a default), this files and others like it need to be
|
||||
script parent, this files and others like it need to be
|
||||
located under the game/gamesrc/parent directory.
|
||||
"""
|
||||
from game.gamesrc.parents.base.basicobject import BasicObject
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ particular object. See example.py in gamesrc/commands for more info
|
|||
on the pluggable command system.
|
||||
|
||||
Assuming this script remains in gamesrc/parents/examples, create an object
|
||||
of this type using @create button=examples.red_button
|
||||
of this type using @create button:examples.red_button
|
||||
|
||||
This file also shows the use of the Event system to make the button
|
||||
send a message to the players at regular intervals. Note that if you create a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue