Fix weird spacing in use_item()
This commit is contained in:
parent
e61df0a400
commit
ae060ecc77
1 changed files with 28 additions and 28 deletions
|
|
@ -328,35 +328,35 @@ def spend_item_use(item, user):
|
||||||
item.delete() # Delete the spent item
|
item.delete() # Delete the spent item
|
||||||
|
|
||||||
def use_item(user, item, target):
|
def use_item(user, item, target):
|
||||||
"""
|
"""
|
||||||
Performs the action of using an item.
|
Performs the action of using an item.
|
||||||
"""
|
"""
|
||||||
# Set kwargs to pass to item_func
|
# Set kwargs to pass to item_func
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if item.db.item_kwargs:
|
if item.db.item_kwargs:
|
||||||
kwargs = item.db.item_kwargs
|
kwargs = item.db.item_kwargs
|
||||||
|
|
||||||
# Match item_func string to function
|
|
||||||
try:
|
|
||||||
item_func = ITEMFUNCS[item.db.item_func]
|
|
||||||
except KeyError:
|
|
||||||
user.msg("ERROR: %s not defined in ITEMFUNCS" % item.db.item_func)
|
|
||||||
return
|
|
||||||
|
|
||||||
# Call the item function - abort if it returns False, indicating an error.
|
# Match item_func string to function
|
||||||
# This performs the actual action of using the item.
|
try:
|
||||||
# Regardless of what the function returns (if anything), it's still executed.
|
item_func = ITEMFUNCS[item.db.item_func]
|
||||||
if item_func(item, user, target, **kwargs) == False:
|
except KeyError:
|
||||||
return
|
user.msg("ERROR: %s not defined in ITEMFUNCS" % item.db.item_func)
|
||||||
|
return
|
||||||
# If we haven't returned yet, we assume the item was used successfully.
|
|
||||||
# Spend one use if item has limited uses
|
# Call the item function - abort if it returns False, indicating an error.
|
||||||
if item.db.item_uses:
|
# This performs the actual action of using the item.
|
||||||
spend_item_use(item, user)
|
# Regardless of what the function returns (if anything), it's still executed.
|
||||||
|
if item_func(item, user, target, **kwargs) == False:
|
||||||
# Spend an action if in combat
|
return
|
||||||
if is_in_combat(user):
|
|
||||||
spend_action(user, 1, action_name="item")
|
# If we haven't returned yet, we assume the item was used successfully.
|
||||||
|
# Spend one use if item has limited uses
|
||||||
|
if item.db.item_uses:
|
||||||
|
spend_item_use(item, user)
|
||||||
|
|
||||||
|
# Spend an action if in combat
|
||||||
|
if is_in_combat(user):
|
||||||
|
spend_action(user, 1, action_name="item")
|
||||||
|
|
||||||
def condition_tickdown(character, turnchar):
|
def condition_tickdown(character, turnchar):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue