ESC compiler rewrite
Splits the former ESC_Runner and ESC_Level_Runner into multiple dedicated managers. Authored-by: Dennis Ploeger <develop@dieploegers.de>
This commit is contained in:
@@ -55,10 +55,11 @@ func left_double_click_on_bg(position : Vector2) -> void:
|
||||
## ITEM/HOTSPOT FOCUS ##
|
||||
|
||||
func element_focused(element_id : String) -> void:
|
||||
var target_obj = escoria.esc_runner.get_object(element_id)
|
||||
var target_obj = escoria.object_manager.get_object(element_id).node
|
||||
$ui/tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||
|
||||
if escoria.esc_runner.current_action != "use" && escoria.esc_runner.current_tool == null:
|
||||
if escoria.action_manager.current_action != "use" \
|
||||
and escoria.action_manager.current_tool == null:
|
||||
if target_obj is ESCItem:
|
||||
$ui/verbs_layer/verbs_menu.set_by_name(target_obj.default_action)
|
||||
|
||||
@@ -81,8 +82,10 @@ func left_double_click_on_item(item_global_id : String, event : InputEvent) -> v
|
||||
## INVENTORY ##
|
||||
func left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
||||
escoria.do("item_left_click", [inventory_item_global_id, event])
|
||||
if escoria.esc_runner.current_action == "use":
|
||||
var item = escoria.esc_runner.get_object(inventory_item_global_id)
|
||||
if escoria.action_manager.current_action == "use":
|
||||
var item = escoria.object_manager.get_object(
|
||||
inventory_item_global_id
|
||||
).node
|
||||
if item.get_node("sprite").texture:
|
||||
$ui/verbs_layer/verbs_menu.set_tool_texture(item.get_node("sprite").texture)
|
||||
elif item.inventory_item_scene_file.instance().texture_normal:
|
||||
@@ -96,7 +99,11 @@ func left_double_click_on_inventory_item(inventory_item_global_id : String, even
|
||||
pass
|
||||
|
||||
func inventory_item_focused(inventory_item_global_id : String) -> void:
|
||||
$ui/tooltip_layer/tooltip.set_target(escoria.esc_runner.get_object(inventory_item_global_id).tooltip_name)
|
||||
$ui/tooltip_layer/tooltip.set_target(
|
||||
escoria.object_manager.get_object(
|
||||
inventory_item_global_id
|
||||
).node.tooltip_name
|
||||
)
|
||||
|
||||
func inventory_item_unfocused() -> void:
|
||||
$ui/tooltip_layer/tooltip.set_target("")
|
||||
@@ -119,5 +126,5 @@ func show_ui():
|
||||
$ui/inventory_layer/inventory_ui.show()
|
||||
|
||||
func _on_event_done(event_name: String):
|
||||
escoria.esc_runner.clear_current_action()
|
||||
escoria.action_manager.clear_current_action()
|
||||
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
||||
|
||||
@@ -32,7 +32,7 @@ func iterate_actions_cursor(direction : int):
|
||||
current_cursor_id = cursors.size() - 1
|
||||
|
||||
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
|
||||
escoria.esc_runner.set_current_action(cursors[current_cursor_id].name)
|
||||
escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
|
||||
if $mouse_position/tool.texture != null:
|
||||
clear_tool_texture()
|
||||
|
||||
@@ -43,7 +43,7 @@ func set_by_name(name : String) -> void:
|
||||
break
|
||||
|
||||
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
|
||||
escoria.esc_runner.set_current_action(cursors[current_cursor_id].name)
|
||||
escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
|
||||
|
||||
func set_tool_texture(texture : Texture):
|
||||
set_process(true)
|
||||
|
||||
Reference in New Issue
Block a user