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):
|
def func(self):
|
||||||
self.obj.do_burn(self.caller, drop=True)
|
self.obj.do_burn(self.caller, drop=True)
|
||||||
|
|
||||||
|
class CmdSetRead(CmdSet):
|
||||||
|
def at_cmdset_creation(self):
|
||||||
|
self.add(CmdReadBook)
|
||||||
|
|
||||||
class CmdSetBook(CmdSet):
|
class CmdSetBook(CmdSet):
|
||||||
priority = 2
|
priority = 2
|
||||||
|
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
self.add(CmdReadBook)
|
|
||||||
self.add(CmdBurnBook)
|
self.add(CmdBurnBook)
|
||||||
self.add(CmdDropBook)
|
self.add(CmdDropBook)
|
||||||
|
|
||||||
|
|
||||||
class CmdSetShelf(CmdSet):
|
class CmdSetShelf(CmdSet):
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
self.add(CmdLookBook)
|
self.add(CmdLookBook)
|
||||||
|
|
@ -145,29 +146,24 @@ class Readable(Object):
|
||||||
"""
|
"""
|
||||||
called at creation
|
called at creation
|
||||||
"""
|
"""
|
||||||
self.cmdset.add_default(CmdSetBook)
|
self.cmdset.add_default(CmdSetRead)
|
||||||
|
|
||||||
def do_read(self, reader):
|
def do_read(self, reader):
|
||||||
"called when 'read'."
|
"called when 'read'."
|
||||||
reader.msg(self.db.inside)
|
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):
|
class Letter(Readable):
|
||||||
"""
|
"""
|
||||||
Something that can be read, but is _personal_, so if it is
|
Something that can be read, but is _personal_, so if it is
|
||||||
dropped, it is destroyed.
|
dropped, it is destroyed.
|
||||||
"""
|
"""
|
||||||
|
def at_object_creation(self):
|
||||||
|
"""
|
||||||
|
called at creation
|
||||||
|
"""
|
||||||
|
self.cmdset.add_default(CmdSetBook)
|
||||||
|
|
||||||
def at_pre_drop(self, dropper):
|
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.")
|
dropper.msg("Hrm ... you don't want to litter in such an idyllic location. But you can |bthrow|n it away.")
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ from evennia.utils import logger
|
||||||
|
|
||||||
from .objects import Object
|
from .objects import Object
|
||||||
from .characters import Character
|
from .characters import Character
|
||||||
|
from commands.misc import CmdSetPuddle
|
||||||
from utils.word_list import routput
|
from utils.word_list import routput
|
||||||
|
|
||||||
from random import choice, random
|
from random import choice, random
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue