WIP
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
extends Node
|
||||||
|
class_name ESCCombinable
|
||||||
|
|
||||||
|
var _combinations:Array
|
||||||
|
|
||||||
|
func _init(combinations: Array)-> void:
|
||||||
|
_combinations = combinations
|
||||||
|
|
||||||
|
|
||||||
|
func check(action: String) -> bool:
|
||||||
|
return action in _combinations
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
extends Node
|
||||||
|
class_name ESCTargetable
|
||||||
|
|
||||||
|
var _targets:Array
|
||||||
|
|
||||||
|
func _init(targets: Array)-> void:
|
||||||
|
_targets = targets
|
||||||
|
|
||||||
|
|
||||||
|
func check(action: String) -> bool:
|
||||||
|
return action in _targets
|
||||||
@@ -297,8 +297,8 @@ func _set_tool_and_action(obj: ESCObject, default_action: bool):
|
|||||||
# Check if current_action and current_tool are already set
|
# Check if current_action and current_tool are already set
|
||||||
if current_action and current_tool:
|
if current_action and current_tool:
|
||||||
# MODIFIED FOR RETURN TO MONKEY UI
|
# MODIFIED FOR RETURN TO MONKEY UI
|
||||||
if (not current_action in escoria.action_manager\
|
if (not escoria.action_manager\
|
||||||
.current_tool.node.combine_when_selected_action_is_in and not current_action in obj.node.target_when_selected_action_is_in):
|
.current_tool.node.is_combinable(current_action) and not obj.node.is_targetable(current_action)):
|
||||||
current_tool = obj
|
current_tool = obj
|
||||||
tool_just_set = true
|
tool_just_set = true
|
||||||
elif default_action:
|
elif default_action:
|
||||||
@@ -306,7 +306,7 @@ func _set_tool_and_action(obj: ESCObject, default_action: bool):
|
|||||||
current_action = obj.node.default_action_inventory
|
current_action = obj.node.default_action_inventory
|
||||||
else:
|
else:
|
||||||
current_action = obj.node.default_action
|
current_action = obj.node.default_action
|
||||||
elif current_action in obj.node.combine_when_selected_action_is_in:
|
elif obj.node.is_combinable(current_action):
|
||||||
current_tool = obj
|
current_tool = obj
|
||||||
tool_just_set = true
|
tool_just_set = true
|
||||||
return tool_just_set
|
return tool_just_set
|
||||||
@@ -320,6 +320,6 @@ func _set_tool_and_action(obj: ESCObject, default_action: bool):
|
|||||||
func _check_item_needs_combine_obj(obj: ESCObject) -> bool:
|
func _check_item_needs_combine_obj(obj: ESCObject) -> bool:
|
||||||
return current_action \
|
return current_action \
|
||||||
and current_tool \
|
and current_tool \
|
||||||
and (current_action in current_tool.node.combine_when_selected_action_is_in
|
and (current_tool.node.is_combinable(current_action)
|
||||||
# MODIFIED FOR RETURN TO MONKEY UI
|
# MODIFIED FOR RETURN TO MONKEY UI
|
||||||
or current_action in obj.node.target_when_selected_action_is_in)
|
or obj.node.is_targetable(current_action))
|
||||||
|
|||||||
@@ -32,6 +32,27 @@ var lastHighlightState: bool
|
|||||||
|
|
||||||
var active: bool
|
var active: bool
|
||||||
|
|
||||||
|
# The targetable subnode
|
||||||
|
var _targetable: ESCTargetable = null
|
||||||
|
# Whether this item is targetable.
|
||||||
|
export(bool) var _is_targetable = false
|
||||||
|
|
||||||
|
func is_targetable(action: String) -> bool:
|
||||||
|
if !_is_targetable:
|
||||||
|
return false
|
||||||
|
return _targetable.check(action)
|
||||||
|
|
||||||
|
# The targetable subnode
|
||||||
|
var _combinable: ESCCombinable = null
|
||||||
|
# Whether this item is targetable.
|
||||||
|
export(bool) var _is_combinable = false
|
||||||
|
|
||||||
|
func is_combinable(action: String) -> bool:
|
||||||
|
if !_is_targetable:
|
||||||
|
return false
|
||||||
|
return _combinable.check(action)
|
||||||
|
|
||||||
|
|
||||||
# React to the mouse entering the item by emitting the respective signal
|
# React to the mouse entering the item by emitting the respective signal
|
||||||
func mouse_entered():
|
func mouse_entered():
|
||||||
active = true
|
active = true
|
||||||
@@ -54,6 +75,14 @@ func _ready():
|
|||||||
##outline.offset = Vector2(1,1)
|
##outline.offset = Vector2(1,1)
|
||||||
collision.add_child(outline)
|
collision.add_child(outline)
|
||||||
outline.hide()
|
outline.hide()
|
||||||
|
if _is_targetable:
|
||||||
|
_targetable = ESCTargetable.new(target_when_selected_action_is_in)
|
||||||
|
|
||||||
|
add_child(_targetable)
|
||||||
|
if _is_combinable:
|
||||||
|
_combinable = ESCCombinable.new(combine_when_selected_action_is_in)
|
||||||
|
|
||||||
|
add_child(_targetable)
|
||||||
|
|
||||||
func _process(_delta) -> void:
|
func _process(_delta) -> void:
|
||||||
if(is_interactive == false):
|
if(is_interactive == false):
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ func left_double_click_on_bg(position: Vector2) -> void:
|
|||||||
|
|
||||||
func element_focused(element_id: String) -> void:
|
func element_focused(element_id: String) -> void:
|
||||||
var target_obj = escoria.object_manager.get_object(element_id).node
|
var target_obj = escoria.object_manager.get_object(element_id).node
|
||||||
if target_obj is ESCItem or ESCItemWithTooltip:
|
if target_obj is ESCItem:
|
||||||
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||||
$tooltip_layer/tooltip.set_target_object(target_obj)
|
$tooltip_layer/tooltip.set_target_object(target_obj)
|
||||||
target_obj.highlight(true)
|
target_obj.highlight(true)
|
||||||
@@ -332,7 +332,7 @@ func right_click_on_inventory_item(inventory_item_global_id: String, event: Inpu
|
|||||||
|
|
||||||
func inventory_item_focused(inventory_item_global_id: String) -> void:
|
func inventory_item_focused(inventory_item_global_id: String) -> void:
|
||||||
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
|
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
|
||||||
if target_obj is ESCItemWithTooltip:
|
if target_obj is ESCItem:
|
||||||
$tooltip_layer/tooltip.set_target(target_obj.action3_text)
|
$tooltip_layer/tooltip.set_target(target_obj.action3_text)
|
||||||
$tooltip_layer/tooltip.set_target_object(target_obj)
|
$tooltip_layer/tooltip.set_target_object(target_obj)
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ func apply_custom_settings(custom_settings: Dictionary):
|
|||||||
|
|
||||||
func get_custom_data() -> Dictionary:
|
func get_custom_data() -> Dictionary:
|
||||||
return {
|
return {
|
||||||
"ui_type": "simplemouse"
|
"ui_type": "rtmi-ui"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -159,6 +159,11 @@ _global_script_classes=[ {
|
|||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/scenes/camera_player/esc_camera_limits.gd"
|
"path": "res://addons/escoria-core/game/scenes/camera_player/esc_camera_limits.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "Node",
|
||||||
|
"class": "ESCCombinable",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/behaviors/esc_combinable.gd"
|
||||||
|
}, {
|
||||||
"base": "ESCStatement",
|
"base": "ESCStatement",
|
||||||
"class": "ESCCommand",
|
"class": "ESCCommand",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
@@ -429,6 +434,11 @@ _global_script_classes=[ {
|
|||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/core-scripts/esc/types/esc_statement.gd"
|
"path": "res://addons/escoria-core/game/core-scripts/esc/types/esc_statement.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "Node",
|
||||||
|
"class": "ESCTargetable",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/behaviors/esc_targetable.gd"
|
||||||
|
}, {
|
||||||
"base": "Navigation2D",
|
"base": "Navigation2D",
|
||||||
"class": "ESCTerrain",
|
"class": "ESCTerrain",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
@@ -730,6 +740,7 @@ _global_script_class_icons={
|
|||||||
"ESCCamera": "",
|
"ESCCamera": "",
|
||||||
"ESCCameraBaseCommand": "",
|
"ESCCameraBaseCommand": "",
|
||||||
"ESCCameraLimits": "",
|
"ESCCameraLimits": "",
|
||||||
|
"ESCCombinable": "",
|
||||||
"ESCCommand": "",
|
"ESCCommand": "",
|
||||||
"ESCCommandArgumentDescriptor": "",
|
"ESCCommandArgumentDescriptor": "",
|
||||||
"ESCCommandRegistry": "",
|
"ESCCommandRegistry": "",
|
||||||
@@ -784,6 +795,7 @@ _global_script_class_icons={
|
|||||||
"ESCSoundPlayer": "",
|
"ESCSoundPlayer": "",
|
||||||
"ESCSpeechPlayer": "",
|
"ESCSpeechPlayer": "",
|
||||||
"ESCStatement": "",
|
"ESCStatement": "",
|
||||||
|
"ESCTargetable": "",
|
||||||
"ESCTerrain": "res://addons/escoria-core/design/esc_terrain.svg",
|
"ESCTerrain": "res://addons/escoria-core/design/esc_terrain.svg",
|
||||||
"ESCTooltip": "",
|
"ESCTooltip": "",
|
||||||
"ESCTransitionPlayer": "",
|
"ESCTransitionPlayer": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user