Make CmdGet/Drop/Give give error if obj.move_to returns False. Resolves #2168.
This commit is contained in:
parent
54e70a40b7
commit
1f506de12c
2 changed files with 33 additions and 23 deletions
|
|
@ -64,6 +64,7 @@ without arguments starts a full interactive Python console.
|
||||||
- Update Twisted requirement to >=2.3.0 to close security vulnerability
|
- Update Twisted requirement to >=2.3.0 to close security vulnerability
|
||||||
- Add `$random` inlinefunc, supports minval,maxval arguments that can be ints and floats.
|
- Add `$random` inlinefunc, supports minval,maxval arguments that can be ints and floats.
|
||||||
- Add `evennia.utils.inlinefuncs.raw(<str>)` as a helper to escape inlinefuncs in a string.
|
- Add `evennia.utils.inlinefuncs.raw(<str>)` as a helper to escape inlinefuncs in a string.
|
||||||
|
- Make CmdGet/Drop/Give give proper error if `obj.move_to` returns `False`.
|
||||||
|
|
||||||
|
|
||||||
## Evennia 0.9 (2018-2019)
|
## Evennia 0.9 (2018-2019)
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,10 @@ class CmdGet(COMMAND_DEFAULT_CLASS):
|
||||||
if not obj.at_before_get(caller):
|
if not obj.at_before_get(caller):
|
||||||
return
|
return
|
||||||
|
|
||||||
obj.move_to(caller, quiet=True)
|
success = obj.move_to(caller, quiet=True)
|
||||||
|
if not success:
|
||||||
|
caller.msg("This can't be picked up.")
|
||||||
|
else:
|
||||||
caller.msg("You pick up %s." % obj.name)
|
caller.msg("You pick up %s." % obj.name)
|
||||||
caller.location.msg_contents("%s picks up %s." % (caller.name, obj.name), exclude=caller)
|
caller.location.msg_contents("%s picks up %s." % (caller.name, obj.name), exclude=caller)
|
||||||
# calling at_get hook method
|
# calling at_get hook method
|
||||||
|
|
@ -471,7 +474,10 @@ class CmdDrop(COMMAND_DEFAULT_CLASS):
|
||||||
if not obj.at_before_drop(caller):
|
if not obj.at_before_drop(caller):
|
||||||
return
|
return
|
||||||
|
|
||||||
obj.move_to(caller.location, quiet=True)
|
success = obj.move_to(caller.location, quiet=True)
|
||||||
|
if not success:
|
||||||
|
caller.msg("This couldn't be dropped.")
|
||||||
|
else:
|
||||||
caller.msg("You drop %s." % (obj.name,))
|
caller.msg("You drop %s." % (obj.name,))
|
||||||
caller.location.msg_contents("%s drops %s." % (caller.name, obj.name), exclude=caller)
|
caller.location.msg_contents("%s drops %s." % (caller.name, obj.name), exclude=caller)
|
||||||
# Call the object script's at_drop() method.
|
# Call the object script's at_drop() method.
|
||||||
|
|
@ -522,8 +528,11 @@ class CmdGive(COMMAND_DEFAULT_CLASS):
|
||||||
return
|
return
|
||||||
|
|
||||||
# give object
|
# give object
|
||||||
|
success = to_give.move_to(target, quiet=True)
|
||||||
|
if not success:
|
||||||
|
caller.msg("This could not be given.")
|
||||||
|
else:
|
||||||
caller.msg("You give %s to %s." % (to_give.key, target.key))
|
caller.msg("You give %s to %s." % (to_give.key, target.key))
|
||||||
to_give.move_to(target, quiet=True)
|
|
||||||
target.msg("%s gives you %s." % (caller.key, to_give.key))
|
target.msg("%s gives you %s." % (caller.key, to_give.key))
|
||||||
# Call the object script's at_give() method.
|
# Call the object script's at_give() method.
|
||||||
to_give.at_give(caller, target)
|
to_give.at_give(caller, target)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue