mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 18:26:32 +01:00
update container docs, test
This commit is contained in:
parent
30834af5ac
commit
a76ca4e387
2 changed files with 19 additions and 2 deletions
|
|
@ -73,6 +73,9 @@ class ContribContainer(_BASE_OBJECT_TYPECLASS):
|
|||
|
||||
Returns:
|
||||
boolean: Whether the object `target` should be gotten or not.
|
||||
|
||||
Notes:
|
||||
If this method returns False/None, the getting is cancelled before it is even started.
|
||||
"""
|
||||
return True
|
||||
|
||||
|
|
@ -87,7 +90,8 @@ class ContribContainer(_BASE_OBJECT_TYPECLASS):
|
|||
Returns:
|
||||
boolean: Whether the object `target` should be put down or not.
|
||||
|
||||
Note:
|
||||
Notes:
|
||||
If this method returns False/None, the putting is cancelled before it is even started.
|
||||
To add more complex capacity checks, modify this method on your child typeclass.
|
||||
"""
|
||||
# check if we're already at capacity
|
||||
|
|
@ -261,7 +265,7 @@ class CmdPut(CmdDrop):
|
|||
if container.db.put_err_msg:
|
||||
self.msg(container.db.put_err_msg)
|
||||
else:
|
||||
self.msg("You can't get things from that.")
|
||||
self.msg("You can't put things in that.")
|
||||
return
|
||||
|
||||
# Call the object script's at_pre_drop() method.
|
||||
|
|
|
|||
|
|
@ -36,3 +36,16 @@ class TestContainerCmds(BaseEvenniaCommandTest):
|
|||
self.call(CmdPut(), "obj in box", "You put an Obj in a Box.")
|
||||
# get from the container
|
||||
self.call(CmdContainerGet(), "obj from box", "You get an Obj from a Box.")
|
||||
|
||||
def test_locked_get_put(self):
|
||||
# lock container
|
||||
self.container.locks.add("get_from:false()")
|
||||
# move object to container to try getting
|
||||
self.obj1.location = self.container
|
||||
self.call(CmdContainerGet(), "obj from box", "You can't get things from that.")
|
||||
# move object to character to try putting
|
||||
self.obj1.location = self.char1
|
||||
self.call(CmdPut(), "obj in box", "You can't put things in that.")
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue