Erase all references to use_from_inventory_only

This commit is contained in:
2023-03-09 19:33:43 +01:00
parent 56bf73b639
commit 99d2b89a4e
5 changed files with 40 additions and 62 deletions

View File

@@ -55,63 +55,50 @@ func _get_event_to_queue(
or combine_with): or combine_with):
# or (combine_with && action in combine_with.node.combine_when_selected_action_is_in)): # or (combine_with && action in combine_with.node.combine_when_selected_action_is_in)):
# Check if object must be in inventory to be used # Player has item in inventory, we check the element to use on
if target.node.use_from_inventory_only: if escoria.inventory_manager.inventory_has(target.global_id):
if escoria.inventory_manager.inventory_has(target.global_id): if combine_with:
# Player has item in inventory, we check the element to use on var target_event = "%s %s" % [
if combine_with: action,
var target_event = "%s %s" % [ combine_with.global_id
action, ]
combine_with.global_id var combine_with_event = "%s %s" % [
] action,
var combine_with_event = "%s %s" % [ target.global_id
action, ]
target.global_id
]
if target.events.has(target_event): if target.events.has(target_event):
event_to_return = target.events[target_event] event_to_return = target.events[target_event]
elif combine_with.events.has(combine_with_event)\ elif combine_with.events.has(combine_with_event)\
and not combine_with.node.combine_is_one_way: and not combine_with.node.combine_is_one_way:
event_to_return = combine_with.events[combine_with_event] event_to_return = combine_with.events[combine_with_event]
else:
# Check to see if there isn't a "fallback" action to
# run before we declare this a failure.
if escoria.action_default_script \
and escoria.action_default_script.events.has(action):
event_to_return = escoria.action_default_script.events[action]
else: else:
# Check to see if there isn't a "fallback" action to var errors = [
# run before we declare this a failure. "Attempted to execute action %s between item %s and item %s" % [
if escoria.action_default_script \ action,
and escoria.action_default_script.events.has(action): target.global_id,
combine_with.global_id
event_to_return = escoria.action_default_script.events[action]
else:
var errors = [
"Attempted to execute action %s between item %s and item %s" % [
action,
target.global_id,
combine_with.global_id
]
] ]
]
if combine_with.node.combine_is_one_way: if combine_with.node.combine_is_one_way:
errors.append( errors.append(
("Reason: %s's item interaction " + \ ("Reason: %s's item interaction " + \
"is one-way.") % combine_with.global_id "is one-way.") % combine_with.global_id
)
escoria.logger.warn(
self,
"Invalid action: " + str(errors)
) )
else:
escoria.logger.warn( escoria.logger.warn(
self, self,
"Invalid action on item: " + "Invalid action: " + str(errors)
"Trying to run action %s on object %s, " % )
[
action,
target.node.global_id
]
+ "but item must be in inventory."
)
else: else:
if target.events.has(action): if target.events.has(action):
event_to_return = target.events[action] event_to_return = target.events[action]
@@ -221,12 +208,7 @@ func perform_inputevent_on_object(
current_target current_target
) )
else: else:
# Check if object must be in inventory to be used and update if need_combine:
# action state if necessary
if obj.node.use_from_inventory_only and \
escoria.inventory_manager.inventory_has(obj.global_id) and \
need_combine:
# We're missing a target here for our tool to be used on # We're missing a target here for our tool to be used on
current_tool = obj current_tool = obj
set_action_input_state( set_action_input_state(

View File

@@ -13,7 +13,6 @@ script = ExtResource( 1 )
global_id = "caja_herramientas" global_id = "caja_herramientas"
esc_script = "res://gymkhana/items/inventory/caja_herramientas.esc" esc_script = "res://gymkhana/items/inventory/caja_herramientas.esc"
combine_when_selected_action_is_in = [ "action4" ] combine_when_selected_action_is_in = [ "action4" ]
use_from_inventory_only = true
inventory_texture = ExtResource( 2 ) inventory_texture = ExtResource( 2 )
dialog_color = Color( 1, 1, 1, 1 ) dialog_color = Color( 1, 1, 1, 1 )
action1_text = "¿Que es esto?" action1_text = "¿Que es esto?"

View File

@@ -17,7 +17,6 @@ action2_text = "Coger"
action3_text = "¿Que es esto?" action3_text = "¿Que es esto?"
action4_text = "Usar" action4_text = "Usar"
combine_when_selected_action_is_in = [ "action4" ] combine_when_selected_action_is_in = [ "action4" ]
use_from_inventory_only = true
inventory_texture = ExtResource( 1 ) inventory_texture = ExtResource( 1 )
dialog_color = Color( 1, 1, 1, 1 ) dialog_color = Color( 1, 1, 1, 1 )
animations = null animations = null

View File

@@ -3,8 +3,7 @@ say current_player "Tiene pinta de que fuma"
:action2 :action2
> [whatsapp_blocked] > [whatsapp_blocked]
say current_player "Hola" say current_player "Hola..."
say current_player "..."
say current_player "No me escucha, parece que me tiene bloqueado" say current_player "No me escucha, parece que me tiene bloqueado"
stop stop

View File

@@ -105,7 +105,6 @@ script = ExtResource( 28 )
global_id = "bombona2" global_id = "bombona2"
esc_script = "res://gymkhana/items/inventory/bombona2.esc" esc_script = "res://gymkhana/items/inventory/bombona2.esc"
combine_when_selected_action_is_in = [ "action3" ] combine_when_selected_action_is_in = [ "action3" ]
use_from_inventory_only = true
inventory_texture = ExtResource( 29 ) inventory_texture = ExtResource( 29 )
dialog_color = Color( 1, 1, 1, 1 ) dialog_color = Color( 1, 1, 1, 1 )
action1_text = "Mirar bombona" action1_text = "Mirar bombona"