Fix a readable drop bug
This commit is contained in:
parent
f2b8ae4478
commit
c4b2de2132
2 changed files with 11 additions and 14 deletions
|
|
@ -116,16 +116,17 @@ class CmdDropBook(Command):
|
|||
def func(self):
|
||||
self.obj.do_burn(self.caller, drop=True)
|
||||
|
||||
class CmdSetRead(CmdSet):
|
||||
def at_cmdset_creation(self):
|
||||
self.add(CmdReadBook)
|
||||
|
||||
class CmdSetBook(CmdSet):
|
||||
priority = 2
|
||||
|
||||
def at_cmdset_creation(self):
|
||||
self.add(CmdReadBook)
|
||||
self.add(CmdBurnBook)
|
||||
self.add(CmdDropBook)
|
||||
|
||||
|
||||
class CmdSetShelf(CmdSet):
|
||||
def at_cmdset_creation(self):
|
||||
self.add(CmdLookBook)
|
||||
|
|
@ -145,29 +146,24 @@ class Readable(Object):
|
|||
"""
|
||||
called at creation
|
||||
"""
|
||||
self.cmdset.add_default(CmdSetBook)
|
||||
self.cmdset.add_default(CmdSetRead)
|
||||
|
||||
def do_read(self, reader):
|
||||
"called when 'read'."
|
||||
reader.msg(self.db.inside)
|
||||
|
||||
def do_burn(self, reader, drop=True):
|
||||
"""
|
||||
Throwing and burning books and signs.
|
||||
Leave (ie. drop) or destroy?
|
||||
"""
|
||||
if drop:
|
||||
super().at_drop(reader)
|
||||
else:
|
||||
reader.msg("The {self.name} is gone.")
|
||||
self.delete()
|
||||
|
||||
|
||||
class Letter(Readable):
|
||||
"""
|
||||
Something that can be read, but is _personal_, so if it is
|
||||
dropped, it is destroyed.
|
||||
"""
|
||||
def at_object_creation(self):
|
||||
"""
|
||||
called at creation
|
||||
"""
|
||||
self.cmdset.add_default(CmdSetBook)
|
||||
|
||||
def at_pre_drop(self, dropper):
|
||||
dropper.msg("Hrm ... you don't want to litter in such an idyllic location. But you can |bthrow|n it away.")
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ from evennia.utils import logger
|
|||
|
||||
from .objects import Object
|
||||
from .characters import Character
|
||||
from commands.misc import CmdSetPuddle
|
||||
from utils.word_list import routput
|
||||
|
||||
from random import choice, random
|
||||
|
|
|
|||
Loading…
Reference in a new issue