Merge branch 'gymkhana/main' of git.fosil.eu:gymkhana/gymkhana into gymkhana/main

This commit is contained in:
2023-02-14 02:29:47 +01:00
36 changed files with 34 additions and 2104 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 96 KiB

View File

@@ -76,8 +76,10 @@ var _current_mouse_pos = Vector2.ZERO
var tooltip2_node: Object
func _ready():
$tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position")
$tooltip_layer/tooltip.connect("tooltip2_size_updated", self, "update_tooltip2_following_mouse_position")
if $tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position", [tooltip_node]) != 0:
escoria.logger.error(self, "Error connecting tooltip_size_updated")
if $tooltip_layer/tooltip2.connect("tooltip2_size_updated", self, "update_tooltip_following_mouse_position", [tooltip2_node]) != 0:
escoria.logger.error(self, "Error connecting tooltip2_size_updated")
func _enter_tree():
@@ -100,7 +102,8 @@ func _enter_tree():
if _is_gamepad_connected:
_on_gamepad_connected()
Input.connect("joy_connection_changed", self, "_on_joy_connection_changed")
if Input.connect("joy_connection_changed", self, "_on_joy_connection_changed") != 0:
escoria.logger.error(self, "Error connecting joy_connection_changed")
func _exit_tree():
@@ -114,8 +117,8 @@ func _input(event: InputEvent) -> void:
if escoria.get_escoria().is_ready_for_inputs():
if event is InputEventMouseMotion:
_current_mouse_pos = get_global_mouse_position()
update_tooltip_following_mouse_position()
update_tooltip2_following_mouse_position()
update_tooltip_following_mouse_position(tooltip_node)
update_tooltip_following_mouse_position(tooltip2_node)
# https://github.com/godotengine/godot-demo-projects/blob/3.4-585455e/misc/joypads/joypads.gd
@@ -164,9 +167,7 @@ func _process(_delta) -> void:
var delta_x = int(x * AXIS_WEIGHT) if abs(x) > DEADZONE else 0
var delta_y = int(y * AXIS_WEIGHT) if abs(y) > DEADZONE else 0
if delta_x or delta_y:
var direction: Vector2
direction.x = delta_x
direction.y = delta_y
var direction = Vector2(delta_x, delta_y)
escoria.logger.trace("gamepad direction:", [direction])
var viewport = get_viewport()
viewport.warp_mouse(viewport.get_mouse_position() + direction)
@@ -199,8 +200,6 @@ func click_on_bg(position: Vector2) -> void:
[escoria.main.current_scene.player.global_id, position],
true
)
$mouse_layer/verbs_menu.set_by_name(VERB_WALK)
$mouse_layer/verbs_menu.clear_tool_texture()
func left_click_on_bg(position: Vector2) -> void:
click_on_bg(position)
@@ -215,8 +214,6 @@ func left_double_click_on_bg(position: Vector2) -> void:
[escoria.main.current_scene.player.global_id, position, true],
true
)
$mouse_layer/verbs_menu.set_by_name(VERB_WALK)
$mouse_layer/verbs_menu.clear_tool_texture()
## ITEM/HOTSPOT FOCUS ##
@@ -225,14 +222,6 @@ func element_focused(element_id: String) -> void:
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
if escoria.action_manager.current_action != VERB_USE \
and escoria.action_manager.current_tool == null \
and target_obj is ESCItem:
$mouse_layer/verbs_menu.set_by_name(
target_obj.default_action
)
func element_unfocused() -> void:
$tooltip_layer/tooltip.set_target("")
$tooltip_layer/tooltip2.set_target("")
@@ -244,14 +233,6 @@ func click_on_item(item_global_id: String, event: InputEvent, action: String) ->
var target_obj = escoria.object_manager.get_object(item_global_id).node
# current_action will be empty if an event completes between when you stop
# moving the mouse and when you click.
if escoria.action_manager.current_action == "":
if target_obj is ESCItem:
$mouse_layer/verbs_menu.set_by_name(
target_obj.default_action
)
escoria.action_manager.do(
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
[item_global_id, event],
@@ -283,26 +264,6 @@ func left_click_on_inventory_item(inventory_item_global_id: String, event: Input
[inventory_item_global_id, event]
)
if escoria.action_manager.current_action == VERB_USE:
var item = escoria.object_manager.get_object(
inventory_item_global_id
).node
if item.has_method("get_sprite") and item.get_sprite().texture:
$mouse_layer/verbs_menu.set_tool_texture(
item.get_sprite().texture
)
elif item.inventory_item.texture_normal:
$mouse_layer/verbs_menu.set_tool_texture(
item.inventory_item.texture_normal
)
# func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
# mousewheel_action(1)
# func left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
# pass
func inventory_item_focused(inventory_item_global_id: String) -> void:
$tooltip_layer/tooltip.set_target(
@@ -316,24 +277,16 @@ func inventory_item_unfocused() -> void:
$tooltip_layer/tooltip.set_target("")
$tooltip_layer/tooltip2.set_target("")
func open_inventory():
$CanvasLayer/ui/HBoxContainer/inventory_ui.show_inventory()
func close_inventory():
$CanvasLayer/ui/HBoxContainer/inventory_ui.hide_inventory()
# func mousewheel_action(direction: int):
# $mouse_layer/verbs_menu.iterate_actions_cursor(direction)
func hide_ui():
$CanvasLayer/ui/HBoxContainer/inventory_ui.hide()
$CanvasLayer/ui.hide()
func show_ui():
$CanvasLayer/ui/HBoxContainer/inventory_ui.show()
$CanvasLayer/ui.show()
@@ -385,68 +338,38 @@ func get_custom_data() -> Dictionary:
}
# Update the tooltip1
func update_tooltip_following_mouse_position():
# Update the tooltip position
func update_tooltip_following_mouse_position(tooltip: Object):
if tooltip == null:
return
var corrected_position = _current_mouse_pos \
- Vector2(
tooltip_node.rect_size.x / 2,
tooltip_node.rect_size.y / 2
tooltip.rect_size.x / 2,
tooltip.rect_size.y / 2
)
# clamp TOP
if tooltip_node.tooltip_distance_to_edge_top(_current_mouse_pos) <= mouse_tooltip_margin:
if tooltip.tooltip_distance_to_edge_top(_current_mouse_pos) <= mouse_tooltip_margin:
corrected_position.y = mouse_tooltip_margin
# clamp BOTTOM
if tooltip_node.tooltip_distance_to_edge_bottom(_current_mouse_pos + tooltip_node.rect_size) <= mouse_tooltip_margin:
corrected_position.y = escoria.game_size.y - mouse_tooltip_margin - tooltip_node.rect_size.y
if tooltip.tooltip_distance_to_edge_bottom(_current_mouse_pos + tooltip.rect_size) <= mouse_tooltip_margin:
corrected_position.y = escoria.game_size.y - mouse_tooltip_margin - tooltip.rect_size.y
# clamp LEFT
if tooltip_node.tooltip_distance_to_edge_left(_current_mouse_pos - tooltip_node.rect_size/2) <= mouse_tooltip_margin:
if tooltip.tooltip_distance_to_edge_left(_current_mouse_pos - tooltip.rect_size/2) <= mouse_tooltip_margin:
corrected_position.x = mouse_tooltip_margin
# clamp RIGHT
if tooltip_node.tooltip_distance_to_edge_right(_current_mouse_pos + tooltip_node.rect_size/2) <= mouse_tooltip_margin:
corrected_position.x = escoria.game_size.x - mouse_tooltip_margin - tooltip_node.rect_size.x
tooltip_node.rect_position = corrected_position + tooltip_node.offset_from_cursor
# Update the tooltip2
func update_tooltip2_following_mouse_position():
var corrected_position = _current_mouse_pos \
- Vector2(
tooltip2_node.rect_size.x / 2,
tooltip2_node.rect_size.y / 2
)
# clamp TOP
if tooltip2_node.tooltip_distance_to_edge_top(_current_mouse_pos) <= mouse_tooltip_margin:
corrected_position.y = mouse_tooltip_margin
# clamp BOTTOM
if tooltip2_node.tooltip_distance_to_edge_bottom(_current_mouse_pos + tooltip2_node.rect_size) <= mouse_tooltip_margin:
corrected_position.y = escoria.game_size.y - mouse_tooltip_margin - tooltip2_node.rect_size.y
# clamp LEFT
if tooltip2_node.tooltip_distance_to_edge_left(_current_mouse_pos - tooltip2_node.rect_size/2) <= mouse_tooltip_margin:
corrected_position.x = mouse_tooltip_margin
# clamp RIGHT
if tooltip2_node.tooltip_distance_to_edge_right(_current_mouse_pos + tooltip2_node.rect_size/2) <= mouse_tooltip_margin:
corrected_position.x = escoria.game_size.x - mouse_tooltip_margin - tooltip2_node.rect_size.x
tooltip2_node.rect_position = corrected_position + tooltip2_node.offset_from_cursor
func _on_action_finished():
$mouse_layer/verbs_menu.clear_tool_texture()
$mouse_layer/verbs_menu.iterate_actions_cursor(0)
if tooltip.tooltip_distance_to_edge_right(_current_mouse_pos + tooltip.rect_size/2) <= mouse_tooltip_margin:
corrected_position.x = escoria.game_size.x - mouse_tooltip_margin - tooltip.rect_size.x
tooltip.rect_position = corrected_position + tooltip.offset_from_cursor
func _on_event_done(return_code: int, _event_name: String):
if return_code == ESCExecution.RC_OK:
escoria.action_manager.clear_current_action()
$mouse_layer/verbs_menu.clear_tool_texture()
$tooltip_layer/tooltip.show()
$tooltip_layer/tooltip2.show()

View File

@@ -3,7 +3,6 @@
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd" type="Script" id=2]
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=3]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.tscn" type="PackedScene" id=4]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/game.gd" type="Script" id=5]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/target_tooltip.tscn" type="PackedScene" id=6]
[ext_resource path="res://addons/escoria-core/ui_library/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
@@ -92,19 +91,4 @@ theme = ExtResource( 9 )
bbcode_text = "[center][color=#000000][/color][/center]"
fit_content_height = true
[node name="mouse_layer" type="CanvasLayer" parent="."]
layer = 2
[node name="verbs_menu" parent="mouse_layer" instance=ExtResource( 4 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 156.0
margin_top = 810.0
margin_right = 156.0
margin_bottom = 900.0
grow_horizontal = 0
size_flags_horizontal = 2
size_flags_vertical = 3
size_flags_stretch_ratio = 3.0
[connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]

View File

@@ -33,9 +33,5 @@ func update_tooltip_text():
func _on_room_ready():
escoria.logger.warn(
self,
"ON ROOM READY TOOLTIP2 id=" + String(id)
)
escoria.main.current_scene.game.tooltip2_node = self
_room_is_ready = true

View File

@@ -33,9 +33,5 @@ func update_tooltip_text():
func _on_room_ready():
escoria.logger.warn(
self,
"ON ROOM READY id=" + String(id)
)
escoria.main.current_scene.game.tooltip_node = self
_room_is_ready = true

View File

@@ -1,53 +0,0 @@
extends Control
var current_cursor_id: int = 0
onready var cursors: Array = $actions.get_children()
"""
This script is out of Escoria's scope. It controls the UI reaction to an
UI event (eg right click) to change the cursor accordingly.
"""
enum UI_ACTIONS_DIRECTION {
UP = 1,
DOWN = -1
}
func _ready():
if !Engine.is_editor_hint():
current_cursor_id = cursors.size()
iterate_actions_cursor(UI_ACTIONS_DIRECTION.UP)
func _process(delta):
$mouse_position.rect_global_position = get_global_mouse_position()
func iterate_actions_cursor(direction: int):
current_cursor_id += direction
if current_cursor_id > cursors.size() - 1:
current_cursor_id = 0
elif current_cursor_id < 0:
current_cursor_id = cursors.size() - 1
# Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
if $mouse_position/tool.texture != null:
clear_tool_texture()
func set_by_name(name: String) -> void:
for i in cursors.size():
if cursors[i].name == name:
current_cursor_id = i
break
# Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
func set_tool_texture(texture: Texture):
set_process(true)
$mouse_position/tool.texture = texture
func clear_tool_texture():
$mouse_position/tool.texture = null
set_process(false)

View File

@@ -1,91 +0,0 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.gd" type="Script" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_examine.png" type="Texture" id=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_tool.png" type="Texture" id=3]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_dialog.png" type="Texture" id=4]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_foot.png" type="Texture" id=5]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_hand.png" type="Texture" id=6]
[node name="verbs_menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="actions" type="HBoxContainer" parent="."]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="walk" type="TextureRect" parent="actions"]
margin_left = 94.0
margin_top = 418.0
margin_right = 158.0
margin_bottom = 482.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture = ExtResource( 5 )
[node name="look" type="TextureRect" parent="actions"]
margin_left = 350.0
margin_top = 418.0
margin_right = 414.0
margin_bottom = 482.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture = ExtResource( 2 )
[node name="pickup" type="TextureRect" parent="actions"]
margin_left = 607.0
margin_top = 418.0
margin_right = 671.0
margin_bottom = 482.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture = ExtResource( 6 )
[node name="use" type="TextureRect" parent="actions"]
margin_left = 864.0
margin_top = 418.0
margin_right = 928.0
margin_bottom = 482.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture = ExtResource( 3 )
[node name="talk" type="TextureRect" parent="actions"]
margin_left = 1121.0
margin_top = 418.0
margin_right = 1185.0
margin_bottom = 482.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture = ExtResource( 4 )
[node name="mouse_position" type="Control" parent="."]
margin_left = 546.519
margin_top = 524.76
margin_right = 546.519
margin_bottom = 524.76
mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="tool" type="TextureRect" parent="mouse_position"]
margin_left = 46.4475
margin_top = 45.6984
margin_right = 86.4475
margin_bottom = 85.6984
mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}

View File

@@ -1,3 +1,7 @@
:exit_scene
:action1
play_snd res://game/sfx/sounds/doorOpen_2.ogg
change_scene "res://game/rooms/room02/room02.tscn"
change_scene "res://gymkhana/rooms/trasera_cocina/trasera_cocina.tscn"
:action2
play_snd res://game/sfx/sounds/doorOpen_2.ogg
change_scene "res://gymkhana/rooms/trasera_cocina/trasera_cocina.tscn"

View File

@@ -21,7 +21,7 @@ script = ExtResource( 6 )
__meta__ = {
"_edit_vertical_guides_": [ ]
}
global_id = "room1"
global_id = "home"
esc_script = "res://gymkhana/rooms/home/esc/room01.esc"
player_scene = ExtResource( 4 )
camera_limits = [ Rect2( 0, 0, 1280, 550 ) ]
@@ -88,11 +88,10 @@ script = ExtResource( 5 )
global_id = "r1_r_exit"
esc_script = "res://gymkhana/rooms/home/esc/right_exit.esc"
is_exit = true
tooltip_name = "Exit to room 2"
tooltip_name = "Exit to Trasera cocina"
default_action = "walk"
combine_when_selected_action_is_in = [ ]
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_door"]
polygon = PoolVector2Array( 1173, 63, 1278, 106, 1278, 420, 1172, 356 )
@@ -107,11 +106,10 @@ script = ExtResource( 5 )
global_id = "r1_wall_item1"
esc_script = "res://gymkhana/rooms/home/esc/wall_item.esc"
tooltip_name = "This is action1"
tooltip2_name = "This is action2"
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 10 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null
tooltip2_name = "This is action2"
[node name="Art1" type="Sprite" parent="Hotspots/artwork1"]
position = Vector2( 470, 140 )
@@ -134,7 +132,6 @@ custom_fonts/font = ExtResource( 3 )
text = "If you look at this object, the character's
speech will appear above his head"
__meta__ = {
"_edit_use_anchors_": false,
"_editor_description_": ""
}
@@ -148,7 +145,6 @@ default_action = "action2"
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 9 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="Art12" type="Sprite" parent="Hotspots/artwork2"]
position = Vector2( 830, 140 )
@@ -184,7 +180,6 @@ is_trigger = true
player_orients_on_arrival = false
combine_when_selected_action_is_in = [ ]
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/trigger_talk"]
polygon = PoolVector2Array( 1027, 352, 1187, 502, 1249.67, 445.131, 1123, 351 )

View File

@@ -8,4 +8,4 @@ play_snd res://game/sfx/Game-Menu_Looping.mp3 _music
:newgame
# 1/ Simple scene
change_scene res://gymkhana/rooms/home/room01.tscn
change_scene res://gymkhana/rooms/home/home.tscn

View File

@@ -876,7 +876,7 @@ debug/crash_message="We're sorry, but the game crashed. Please send us the follo
%s"
debug/enable_room_selector=true
debug/room_selector_room_dir="res://game/rooms"
debug/room_selector_room_dir="res://gymkhana/rooms"
ui/game_scene="res://gymkhana/addons/escoria-ui-return-monkey-island/game.tscn"
ui/inventory_items_path="res://game/items/inventory"
ui/default_transition="instant"