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

View File

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

View File

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

View File

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

View File

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