me corte con el cuchillo, XD
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,3 +11,5 @@ saves/
|
|||||||
# Disable accidental changes to the default bus layout. If a change to this
|
# Disable accidental changes to the default bus layout. If a change to this
|
||||||
# file is required, use git add --force
|
# file is required, use git add --force
|
||||||
addons/escoria-core/default_bus_layout.tres
|
addons/escoria-core/default_bus_layout.tres
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
extends Node
|
|
||||||
class_name ESCCombinable
|
|
||||||
|
|
||||||
var _combinations:Array
|
|
||||||
|
|
||||||
func _init(combinations: Array)-> void:
|
|
||||||
_combinations = combinations
|
|
||||||
|
|
||||||
|
|
||||||
func check(action: String) -> bool:
|
|
||||||
return action in _combinations
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
extends Node
|
|
||||||
class_name ESCTargetable
|
|
||||||
|
|
||||||
var _targets:Array
|
|
||||||
|
|
||||||
func _init(targets: Array)-> void:
|
|
||||||
_targets = targets
|
|
||||||
|
|
||||||
|
|
||||||
func check(action: String) -> bool:
|
|
||||||
return action in _targets
|
|
||||||
@@ -23,10 +23,9 @@ func configure() -> ESCCommandArgumentDescriptor:
|
|||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if not escoria.object_manager.has(arguments[0]):
|
if not escoria.object_manager.has(arguments[0]):
|
||||||
escoria.logger.error(
|
escoria.logger.report_errors(
|
||||||
self,
|
"item_count_add: invalid object",
|
||||||
"Object %s not registered"
|
["Object %s not registered" % arguments[0]]
|
||||||
% [arguments[0]]
|
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|||||||
@@ -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 escoria.action_manager\
|
if (not current_action in escoria.action_manager\
|
||||||
.current_tool.node.is_combinable(current_action) and not obj.node.is_targetable(current_action)):
|
.current_tool.node.combine_when_selected_action_is_in and not current_action in obj.node.target_when_selected_action_is_in):
|
||||||
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 obj.node.is_combinable(current_action):
|
elif current_action in obj.node.combine_when_selected_action_is_in:
|
||||||
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_tool.node.is_combinable(current_action)
|
and (current_action in current_tool.node.combine_when_selected_action_is_in
|
||||||
# MODIFIED FOR RETURN TO MONKEY UI
|
# MODIFIED FOR RETURN TO MONKEY UI
|
||||||
or obj.node.is_targetable(current_action))
|
or current_action in obj.node.target_when_selected_action_is_in)
|
||||||
|
|||||||
@@ -5,19 +5,20 @@ class_name ESCItemCountManager
|
|||||||
|
|
||||||
func add(global_id: String, value:= 1) -> void:
|
func add(global_id: String, value:= 1) -> void:
|
||||||
var item = get_item(global_id)
|
var item = get_item(global_id)
|
||||||
set(global_id, item.count + value)
|
item.count = item.count + value
|
||||||
|
updateSprite(item)
|
||||||
|
|
||||||
|
|
||||||
func remove(global_id: String, value:= 1) -> void:
|
func remove(global_id: String, value:= 1) -> void:
|
||||||
var item = get_item(global_id)
|
var item = get_item(global_id)
|
||||||
set(global_id, item.count - value)
|
item.count = item.count - value
|
||||||
|
updateSprite(item)
|
||||||
|
|
||||||
|
|
||||||
func set(global_id: String, value: int) -> void:
|
func set(global_id: String, value: int) -> void:
|
||||||
var item = get_item(global_id)
|
var item = get_item(global_id)
|
||||||
item.count = value
|
item.count = value
|
||||||
updateSprite(item)
|
updateSprite(item)
|
||||||
escoria.globals_manager.set_global(global_id, value)
|
|
||||||
|
|
||||||
|
|
||||||
func removeFromInventoryIfCountLessThan(global_id: String, value:= 1) -> void:
|
func removeFromInventoryIfCountLessThan(global_id: String, value:= 1) -> void:
|
||||||
@@ -41,9 +42,9 @@ func get_item(global_id: String) -> ESCItem:
|
|||||||
func updateSprite(item: ESCItemWithTooltip) -> void:
|
func updateSprite(item: ESCItemWithTooltip) -> void:
|
||||||
var child_node = item.get_node("Sprite") as Sprite
|
var child_node = item.get_node("Sprite") as Sprite
|
||||||
if not child_node is Sprite:
|
if not child_node is Sprite:
|
||||||
escoria.logger.error(
|
escoria.logger.report_errors(
|
||||||
self,
|
"item_count_add: invalid sprite",
|
||||||
"No Sprite node found"
|
["No Sprite node found"]
|
||||||
)
|
)
|
||||||
|
|
||||||
var texture_path = getCountTexturePath(item)
|
var texture_path = getCountTexturePath(item)
|
||||||
|
|||||||
@@ -46,27 +46,6 @@ 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
|
||||||
@@ -89,14 +68,6 @@ 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:
|
if target_obj is ESCItem or ESCItemWithTooltip:
|
||||||
$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)
|
||||||
@@ -310,9 +310,7 @@ func click_on_inventory_item(item_global_id: String, event: InputEvent, action:
|
|||||||
|
|
||||||
# If item needs combination with this action, use the item texture as mouse cursor
|
# If item needs combination with this action, use the item texture as mouse cursor
|
||||||
if action in target_obj.combine_when_selected_action_is_in:
|
if action in target_obj.combine_when_selected_action_is_in:
|
||||||
var texture = target_obj.inventory_texture
|
Input.set_custom_mouse_cursor(target_obj.inventory_texture)
|
||||||
var middleOfTheTexture = Vector2(texture.get_width() / 2, texture.get_height() / 2)
|
|
||||||
Input.set_custom_mouse_cursor(target_obj.inventory_texture, 0, middleOfTheTexture)
|
|
||||||
|
|
||||||
escoria.action_manager.do(
|
escoria.action_manager.do(
|
||||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||||
@@ -334,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 ESCItem:
|
if target_obj is ESCItemWithTooltip:
|
||||||
$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)
|
||||||
|
|
||||||
@@ -399,7 +397,7 @@ func apply_custom_settings(custom_settings: Dictionary):
|
|||||||
|
|
||||||
func get_custom_data() -> Dictionary:
|
func get_custom_data() -> Dictionary:
|
||||||
return {
|
return {
|
||||||
"ui_type": "rtmi-ui"
|
"ui_type": "simplemouse"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -159,11 +159,6 @@ _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",
|
||||||
@@ -439,11 +434,6 @@ _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",
|
||||||
@@ -760,7 +750,6 @@ _global_script_class_icons={
|
|||||||
"ESCCamera": "",
|
"ESCCamera": "",
|
||||||
"ESCCameraBaseCommand": "",
|
"ESCCameraBaseCommand": "",
|
||||||
"ESCCameraLimits": "",
|
"ESCCameraLimits": "",
|
||||||
"ESCCombinable": "",
|
|
||||||
"ESCCommand": "",
|
"ESCCommand": "",
|
||||||
"ESCCommandArgumentDescriptor": "",
|
"ESCCommandArgumentDescriptor": "",
|
||||||
"ESCCommandRegistry": "",
|
"ESCCommandRegistry": "",
|
||||||
@@ -816,7 +805,6 @@ _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