Implement save and loading games (#8)
This commit is contained in:
@@ -32,16 +32,16 @@ var walk_context: ESCWalkContext = null
|
|||||||
var moved: bool
|
var moved: bool
|
||||||
|
|
||||||
# Angle degrees to the last position (TODO is that correct?)
|
# Angle degrees to the last position (TODO is that correct?)
|
||||||
var last_deg : int
|
var last_deg: int
|
||||||
|
|
||||||
# Direction of the last position (TODO is that correct?)
|
# Direction of the last position (TODO is that correct?)
|
||||||
var last_dir : int
|
var last_dir: int
|
||||||
|
|
||||||
# Scale of the last position (TODO is that correct?)
|
# Scale of the last position (TODO is that correct?)
|
||||||
var last_scale : Vector2
|
var last_scale: Vector2
|
||||||
|
|
||||||
# TODO Isn't this actually the flip state of the current animation?
|
# TODO Isn't this actually the flip state of the current animation?
|
||||||
var pose_scale : int
|
var pose_scale: int
|
||||||
|
|
||||||
|
|
||||||
var _orig_speed: float = 0.0
|
var _orig_speed: float = 0.0
|
||||||
@@ -157,16 +157,9 @@ func _process(delta: float) -> void:
|
|||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - target: Vector2, Position2d or ESCItem
|
# - target: Position2d or ESCItem to teleport to
|
||||||
func teleport(target, angle : Object = null) -> void:
|
func teleport(target: Node, angle: Object = null) -> void:
|
||||||
if typeof(target) == TYPE_VECTOR2 :
|
if target is Position2D:
|
||||||
escoria.logger.info(
|
|
||||||
"Object %s teleported at position %s with angle" %
|
|
||||||
[parent.global_id, str(target)],
|
|
||||||
[angle]
|
|
||||||
)
|
|
||||||
parent.position = target
|
|
||||||
elif target is Position2D:
|
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
"Object %s teleported at position %s with angle" %
|
"Object %s teleported at position %s with angle" %
|
||||||
[parent.global_id, str(target.position)],
|
[parent.global_id, str(target.position)],
|
||||||
@@ -185,7 +178,27 @@ func teleport(target, angle : Object = null) -> void:
|
|||||||
+ str(parent.position) + " with angle ", str(angle))
|
+ str(parent.position) + " with angle ", str(angle))
|
||||||
else:
|
else:
|
||||||
escoria.logger.report_errors("escitem.gd:teleport()",
|
escoria.logger.report_errors("escitem.gd:teleport()",
|
||||||
["Target to teleport to is null or unusable (" + target + ")"])
|
["Target to teleport to is null or unusable (" + str(target) + ")"])
|
||||||
|
|
||||||
|
|
||||||
|
# Teleports this item to the target position.
|
||||||
|
# TODO angle is only used for logging and has no further use, so it probably
|
||||||
|
# can be removed
|
||||||
|
#
|
||||||
|
# #### Parameters
|
||||||
|
#
|
||||||
|
# - target: Vector2 target position to teleport to
|
||||||
|
func teleport_to(target: Vector2, angle: Object = null) -> void:
|
||||||
|
if typeof(target) == TYPE_VECTOR2 :
|
||||||
|
escoria.logger.info(
|
||||||
|
"Object %s teleported at position %s with angle" %
|
||||||
|
[parent.global_id, str(target)],
|
||||||
|
[angle]
|
||||||
|
)
|
||||||
|
parent.position = target
|
||||||
|
else:
|
||||||
|
escoria.logger.report_errors("escitem.gd:teleport_to()",
|
||||||
|
["Target to teleport to is null or unusable (" + str(target) + ")"])
|
||||||
|
|
||||||
|
|
||||||
# Walk to a given position
|
# Walk to a given position
|
||||||
@@ -194,7 +207,7 @@ func teleport(target, angle : Object = null) -> void:
|
|||||||
#
|
#
|
||||||
# - pos: Position to walk to
|
# - pos: Position to walk to
|
||||||
# - p_walk_context: Walk context to use
|
# - p_walk_context: Walk context to use
|
||||||
func walk_to(pos : Vector2, p_walk_context: ESCWalkContext = null) -> void:
|
func walk_to(pos: Vector2, p_walk_context: ESCWalkContext = null) -> void:
|
||||||
if not parent.terrain:
|
if not parent.terrain:
|
||||||
walk_stop(parent.get_position())
|
walk_stop(parent.get_position())
|
||||||
return
|
return
|
||||||
@@ -334,7 +347,7 @@ func update_terrain(on_event_finished_name = null) -> void:
|
|||||||
#
|
#
|
||||||
# - angle: The rotation angle
|
# - angle: The rotation angle
|
||||||
# - animations: The list of character animations
|
# - animations: The list of character animations
|
||||||
func _get_dir(angle : float, animations) -> int:
|
func _get_dir(angle: float, animations) -> int:
|
||||||
var deg = escoria.utils.get_deg_from_rad(angle)
|
var deg = escoria.utils.get_deg_from_rad(angle)
|
||||||
return _get_dir_deg(deg, animations)
|
return _get_dir_deg(deg, animations)
|
||||||
|
|
||||||
@@ -377,10 +390,10 @@ func _get_dir_deg(deg: int, animations: Script) -> int:
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - angle: Angle to test
|
# - angle: Angle to test
|
||||||
# - interval : Array of size 2, containing the starting angle, and the size of
|
# - interval: Array of size 2, containing the starting angle, and the size of
|
||||||
# interval
|
# interval
|
||||||
# eg: [90, 40] corresponds to angle between 90° and 130°
|
# eg: [90, 40] corresponds to angle between 90° and 130°
|
||||||
func is_angle_in_interval(angle: float, interval : Array) -> bool:
|
func is_angle_in_interval(angle: float, interval: Array) -> bool:
|
||||||
angle = wrapi(angle, 0, 360)
|
angle = wrapi(angle, 0, 360)
|
||||||
if angle == 0:
|
if angle == 0:
|
||||||
angle = 360
|
angle = 360
|
||||||
@@ -419,7 +432,7 @@ func is_angle_in_interval(angle: float, interval : Array) -> bool:
|
|||||||
# - immediate bool (currently unused, see TODO below)
|
# - immediate bool (currently unused, see TODO below)
|
||||||
# If true, direction is switched immediately. Else, successive animations are
|
# If true, direction is switched immediately. Else, successive animations are
|
||||||
# used so that the character turns to target angle.
|
# used so that the character turns to target angle.
|
||||||
func set_angle(deg : int, immediate = true) -> void:
|
func set_angle(deg: int, immediate = true) -> void:
|
||||||
if deg < 0 or deg > 360:
|
if deg < 0 or deg > 360:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"movable.gd:set_angle()",
|
"movable.gd:set_angle()",
|
||||||
@@ -436,3 +449,8 @@ func set_angle(deg : int, immediate = true) -> void:
|
|||||||
parent.animation_sprite.play(parent.animations.idles[last_dir][0])
|
parent.animation_sprite.play(parent.animations.idles[last_dir][0])
|
||||||
pose_scale = parent.animations.idles[last_dir][1]
|
pose_scale = parent.animations.idles[last_dir][1]
|
||||||
update_terrain()
|
update_terrain()
|
||||||
|
|
||||||
|
# Returns the angle that corresponds to the current direction of the object.
|
||||||
|
func _get_angle() -> int:
|
||||||
|
return parent.animations.dir_angles[last_dir][0]
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Sets the camera limits to the one defined under `camlimits_id` in ESCRoom's
|
# Sets the camera limits to the one defined under `camlimits_id` in ESCRoom's
|
||||||
# camera_limits array.
|
# camera_limits array.
|
||||||
# - camlimits_id : int : id of the camera limits to apply (defined in ESCRoom's
|
# - camlimits_id: int: id of the camera limits to apply (defined in ESCRoom's
|
||||||
# camera_limits array)
|
# camera_limits array)
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ func configure() -> ESCCommandArgumentDescriptor:
|
|||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
var name : String = command_params[0]
|
var name: String = command_params[0]
|
||||||
if escoria.room_terrain.has_node(name):
|
if escoria.room_terrain.has_node(name):
|
||||||
var new_active_navigation_instance = \
|
var new_active_navigation_instance = \
|
||||||
escoria.room_terrain.get_node(name)
|
escoria.room_terrain.get_node(name)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ func configure() -> ESCCommandArgumentDescriptor:
|
|||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
|
|
||||||
var dict : Dictionary
|
var dict: Dictionary
|
||||||
var dialog_scene_name = ProjectSettings.get_setting(
|
var dialog_scene_name = ProjectSettings.get_setting(
|
||||||
"escoria/ui/default_dialog_scene"
|
"escoria/ui/default_dialog_scene"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func configure() -> ESCCommandArgumentDescriptor:
|
|||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_INT],
|
[TYPE_STRING, TYPE_INT],
|
||||||
[null, true]
|
[null, null]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -40,6 +40,6 @@ func run(command_params: Array) -> int:
|
|||||||
# angle against X axis not Y, we need to check direction using (angle-90°).
|
# angle against X axis not Y, we need to check direction using (angle-90°).
|
||||||
# Since the ESC command already gives the right angle, we add 90.
|
# Since the ESC command already gives the right angle, we add 90.
|
||||||
escoria.object_manager.get_object(command_params[0]).node\
|
escoria.object_manager.get_object(command_params[0]).node\
|
||||||
.set_angle(int(command_params[1] + 90))
|
.set_angle(wrapi(int(command_params[1]) + 90, 0, 360))
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# `teleport_pos object1 x y
|
||||||
|
#
|
||||||
|
# Sets the position of object1 to the position (x,y).
|
||||||
|
# FIXME re-add the angle parameter here
|
||||||
|
#
|
||||||
|
# @ESC
|
||||||
|
extends ESCBaseCommand
|
||||||
|
class_name TeleportPosCommand
|
||||||
|
|
||||||
|
|
||||||
|
# Return the descriptor of the arguments of this command
|
||||||
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
|
return ESCCommandArgumentDescriptor.new(
|
||||||
|
2,
|
||||||
|
[TYPE_STRING, TYPE_INT, TYPE_INT],
|
||||||
|
[null, null, null]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Validate wether the given arguments match the command descriptor
|
||||||
|
func validate(arguments: Array):
|
||||||
|
if not escoria.object_manager.objects.has(arguments[0]):
|
||||||
|
escoria.logger.report_errors(
|
||||||
|
"teleport_pos: invalid first object",
|
||||||
|
[
|
||||||
|
"Object with global id %s not found" % arguments[0]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
|
# Run the command
|
||||||
|
func run(command_params: Array) -> int:
|
||||||
|
(escoria.object_manager.get_object(command_params[0]).node as ESCPlayer)\
|
||||||
|
.teleport_to(Vector2(int(command_params[1]), int(command_params[2])))
|
||||||
|
return ESCExecution.RC_OK
|
||||||
@@ -8,14 +8,14 @@ signal action_changed
|
|||||||
|
|
||||||
|
|
||||||
# Current verb used
|
# Current verb used
|
||||||
var current_action : String = "" setget set_current_action
|
var current_action: String = "" setget set_current_action
|
||||||
|
|
||||||
# Current tool (ESCItem/ESCInventoryItem) used
|
# Current tool (ESCItem/ESCInventoryItem) used
|
||||||
var current_tool: ESCObject
|
var current_tool: ESCObject
|
||||||
|
|
||||||
|
|
||||||
# Set the current action
|
# Set the current action
|
||||||
func set_current_action(action : String):
|
func set_current_action(action: String):
|
||||||
if action != current_action:
|
if action != current_action:
|
||||||
clear_current_tool()
|
clear_current_tool()
|
||||||
|
|
||||||
|
|||||||
@@ -93,3 +93,15 @@ func set_global_wildcard(pattern: String, value) -> void:
|
|||||||
for global_key in _globals.keys:
|
for global_key in _globals.keys:
|
||||||
if global_key.match(pattern):
|
if global_key.match(pattern):
|
||||||
self.set_global(global_key, value)
|
self.set_global(global_key, value)
|
||||||
|
|
||||||
|
|
||||||
|
# Save the state of globals in the savegame.
|
||||||
|
#
|
||||||
|
# #### Parameters
|
||||||
|
# - p_savegame: ESCSaveGame resource that holds all data of the save
|
||||||
|
func save_game(p_savegame: ESCSaveGame) -> void:
|
||||||
|
p_savegame.globals = {}
|
||||||
|
for g in _globals:
|
||||||
|
if g in RESERVED_GLOBALS:
|
||||||
|
continue
|
||||||
|
p_savegame.globals[g] = _globals[g]
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ class_name ESCObjectManager
|
|||||||
|
|
||||||
|
|
||||||
const RESERVED_OBJECTS = [
|
const RESERVED_OBJECTS = [
|
||||||
"bg_music"
|
"bg_music",
|
||||||
|
"bg_sound"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ func _process(_delta):
|
|||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - object: Obejct to register
|
# - object: Object to register
|
||||||
# - force: Register the object, even if it has already been registered
|
# - force: Register the object, even if it has already been registered
|
||||||
func register_object(object: ESCObject, force: bool = false) -> void:
|
func register_object(object: ESCObject, force: bool = false) -> void:
|
||||||
if objects.has(object.global_id) and not force:
|
if objects.has(object.global_id) and not force:
|
||||||
@@ -70,6 +71,11 @@ func has(global_id: String) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
# Get the object from the object registry
|
# Get the object from the object registry
|
||||||
|
#
|
||||||
|
# #### Parameters
|
||||||
|
#
|
||||||
|
# - global_id: The global id of the object to retrieve
|
||||||
|
# **Returns** The retrieved object, or null if not found
|
||||||
func get_object(global_id: String) -> ESCObject:
|
func get_object(global_id: String) -> ESCObject:
|
||||||
if objects.has(global_id):
|
if objects.has(global_id):
|
||||||
return objects[global_id]
|
return objects[global_id]
|
||||||
@@ -93,3 +99,17 @@ func unregister_object(object: ESCObject) -> void:
|
|||||||
and not object.global_id in RESERVED_OBJECTS:
|
and not object.global_id in RESERVED_OBJECTS:
|
||||||
|
|
||||||
objects.erase(object.global_id)
|
objects.erase(object.global_id)
|
||||||
|
|
||||||
|
|
||||||
|
# Insert data to save into savegame.
|
||||||
|
#
|
||||||
|
# #### Parameters
|
||||||
|
#
|
||||||
|
# - p_savegame: The savegame resource
|
||||||
|
func save_game(p_savegame: ESCSaveGame) -> void:
|
||||||
|
p_savegame.objects = {}
|
||||||
|
for obj_global_id in objects:
|
||||||
|
if !objects[obj_global_id] is ESCObject:
|
||||||
|
continue
|
||||||
|
p_savegame.objects[obj_global_id] = \
|
||||||
|
objects[obj_global_id].get_save_data()
|
||||||
|
|||||||
@@ -70,3 +70,21 @@ func set_state(p_state: String, immediate: bool = false):
|
|||||||
func _set_active(value: bool):
|
func _set_active(value: bool):
|
||||||
active = value
|
active = value
|
||||||
self.node.visible = value
|
self.node.visible = value
|
||||||
|
|
||||||
|
|
||||||
|
# Return the data of the object to be inserted in a savegame file.
|
||||||
|
#
|
||||||
|
# **Returns**
|
||||||
|
# A dictionary containing the data to be saved for this object.
|
||||||
|
func get_save_data() -> Dictionary:
|
||||||
|
var save_data: Dictionary = {}
|
||||||
|
save_data["active"] = self.active
|
||||||
|
save_data["interactive"] = self.interactive
|
||||||
|
save_data["state"] = self.state
|
||||||
|
|
||||||
|
if self.node.get("is_movable") and self.node.is_movable:
|
||||||
|
save_data["global_transform"] = self.node.global_transform
|
||||||
|
save_data["last_deg"] = wrapi(self.node._movable._get_angle() + 1, 0, 360)
|
||||||
|
save_data["last_dir"] = self.node._movable.last_dir
|
||||||
|
|
||||||
|
return save_data
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ func manage_input(_viewport, event, _shape_idx) -> void:
|
|||||||
# Texture or set size
|
# Texture or set size
|
||||||
# **Returns** The correct area size
|
# **Returns** The correct area size
|
||||||
func get_full_area_rect2() -> Rect2:
|
func get_full_area_rect2() -> Rect2:
|
||||||
var area_rect2 : Rect2 = Rect2()
|
var area_rect2: Rect2 = Rect2()
|
||||||
var pos = get_global_position()
|
var pos = get_global_position()
|
||||||
var size : Vector2
|
var size: Vector2
|
||||||
if get_texture():
|
if get_texture():
|
||||||
size = get_texture().get_size()
|
size = get_texture().get_size()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export(float) var mouse_tooltip_margin = 50.0
|
|||||||
|
|
||||||
|
|
||||||
# A reference to the node handling tooltips
|
# A reference to the node handling tooltips
|
||||||
var tooltip_node : Object
|
var tooltip_node: Object
|
||||||
|
|
||||||
|
|
||||||
# Which (if any) debug mode for the editor is used
|
# Which (if any) debug mode for the editor is used
|
||||||
@@ -36,7 +36,7 @@ func _draw():
|
|||||||
return
|
return
|
||||||
|
|
||||||
if editor_debug_mode == EDITOR_GAME_DEBUG_DISPLAY.MOUSE_TOOLTIP_LIMITS:
|
if editor_debug_mode == EDITOR_GAME_DEBUG_DISPLAY.MOUSE_TOOLTIP_LIMITS:
|
||||||
var mouse_limits : Rect2 = get_viewport_rect().grow(-mouse_tooltip_margin)
|
var mouse_limits: Rect2 = get_viewport_rect().grow(-mouse_tooltip_margin)
|
||||||
print(mouse_limits)
|
print(mouse_limits)
|
||||||
|
|
||||||
# Draw lines for tooltip limits
|
# Draw lines for tooltip limits
|
||||||
@@ -173,7 +173,7 @@ func left_double_click_on_inventory_item(
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - inventory_item_global_id: Global id of the inventory item that was focused
|
# - inventory_item_global_id: Global id of the inventory item that was focused
|
||||||
func inventory_item_focused(inventory_item_global_id : String) -> void:
|
func inventory_item_focused(inventory_item_global_id: String) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ func close_inventory():
|
|||||||
# #### Parameter
|
# #### Parameter
|
||||||
#
|
#
|
||||||
# - direction: The direction in which the mouse wheel was rotated
|
# - direction: The direction in which the mouse wheel was rotated
|
||||||
func mousewheel_action(direction : int):
|
func mousewheel_action(direction: int):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ func show_ui():
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - p_position: Position of the mouse
|
# - p_position: Position of the mouse
|
||||||
func update_tooltip_following_mouse_position(p_position : Vector2):
|
func update_tooltip_following_mouse_position(p_position: Vector2):
|
||||||
var corrected_position = p_position
|
var corrected_position = p_position
|
||||||
|
|
||||||
# clamp TOP
|
# clamp TOP
|
||||||
@@ -246,6 +246,6 @@ func update_tooltip_following_mouse_position(p_position : Vector2):
|
|||||||
|
|
||||||
|
|
||||||
# Set the Editor debug mode
|
# Set the Editor debug mode
|
||||||
func _set_editor_debug_mode(p_editor_debug_mode : int) -> void:
|
func _set_editor_debug_mode(p_editor_debug_mode: int) -> void:
|
||||||
editor_debug_mode = p_editor_debug_mode
|
editor_debug_mode = p_editor_debug_mode
|
||||||
update()
|
update()
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ func _ready():
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - event: The event received
|
# - event: The event received
|
||||||
func _on_inventory_item_gui_input(event : InputEvent):
|
func _on_inventory_item_gui_input(event: InputEvent):
|
||||||
if event.is_action_pressed("switch_action_verb"):
|
if event.is_action_pressed("switch_action_verb"):
|
||||||
if event.button_index == BUTTON_WHEEL_UP:
|
if event.button_index == BUTTON_WHEEL_UP:
|
||||||
escoria.inputs_manager._on_mousewheel_action(-1)
|
escoria.inputs_manager._on_mousewheel_action(-1)
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export(bool) var use_from_inventory_only = false
|
|||||||
|
|
||||||
# Scene based on ESCInventoryItem used in inventory for the object if it is
|
# Scene based on ESCInventoryItem used in inventory for the object if it is
|
||||||
# picked up, that displays and handles the item
|
# picked up, that displays and handles the item
|
||||||
export(PackedScene) var inventory_item_scene_file : PackedScene
|
export(PackedScene) var inventory_item_scene_file: PackedScene
|
||||||
|
|
||||||
# Color used for dialogs
|
# Color used for dialogs
|
||||||
export(Color) var dialog_color = ColorN("white")
|
export(Color) var dialog_color = ColorN("white")
|
||||||
@@ -115,10 +115,10 @@ export(Color) var dialog_color = ColorN("white")
|
|||||||
export(bool) var dont_apply_terrain_scaling = false
|
export(bool) var dont_apply_terrain_scaling = false
|
||||||
|
|
||||||
# Speed of this item ifmovable
|
# Speed of this item ifmovable
|
||||||
export(int) var speed : int = 300
|
export(int) var speed: int = 300
|
||||||
|
|
||||||
# Speed damp of this item if movable
|
# Speed damp of this item if movable
|
||||||
export(float) var v_speed_damp : float = 1.0
|
export(float) var v_speed_damp: float = 1.0
|
||||||
|
|
||||||
# Animations script (for walking, idling...)
|
# Animations script (for walking, idling...)
|
||||||
export(Script) var animations
|
export(Script) var animations
|
||||||
@@ -224,9 +224,9 @@ func get_interact_position() -> Vector2:
|
|||||||
# - event: Triggered event
|
# - event: Triggered event
|
||||||
# - _shape_idx: not used
|
# - _shape_idx: not used
|
||||||
func manage_input(
|
func manage_input(
|
||||||
_viewport : Viewport,
|
_viewport: Viewport,
|
||||||
event : InputEvent,
|
event: InputEvent,
|
||||||
_shape_idx : int
|
_shape_idx: int
|
||||||
) -> void:
|
) -> void:
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
|
|
||||||
@@ -276,18 +276,27 @@ func element_exited(body):
|
|||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - target: Target item to teleport to
|
# - target: Target node to teleport to
|
||||||
func teleport(target: Node) -> void:
|
func teleport(target: Node) -> void:
|
||||||
_movable.teleport(target)
|
_movable.teleport(target)
|
||||||
|
|
||||||
|
|
||||||
|
# Use the movable node to teleport this item to the target position
|
||||||
|
#
|
||||||
|
# #### Parameters
|
||||||
|
#
|
||||||
|
# - target: Vector2 position to teleport to
|
||||||
|
func teleport_to(target: Vector2) -> void:
|
||||||
|
_movable.teleport_to(target)
|
||||||
|
|
||||||
|
|
||||||
# Use the movable node to make the item walk to the given position
|
# Use the movable node to make the item walk to the given position
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - pos: Position to walk to
|
# - pos: Position to walk to
|
||||||
# - p_walk_context: Walk context to use
|
# - p_walk_context: Walk context to use
|
||||||
func walk_to(pos : Vector2, p_walk_context: ESCWalkContext = null) -> void:
|
func walk_to(pos: Vector2, p_walk_context: ESCWalkContext = null) -> void:
|
||||||
_movable.walk_to(pos, p_walk_context)
|
_movable.walk_to(pos, p_walk_context)
|
||||||
|
|
||||||
|
|
||||||
@@ -296,7 +305,7 @@ func walk_to(pos : Vector2, p_walk_context: ESCWalkContext = null) -> void:
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - speed_value: Set the new speed
|
# - speed_value: Set the new speed
|
||||||
func set_speed(speed_value : int) -> void:
|
func set_speed(speed_value: int) -> void:
|
||||||
speed = speed_value
|
speed = speed_value
|
||||||
|
|
||||||
|
|
||||||
@@ -310,7 +319,7 @@ func has_moved() -> bool:
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# Set the angle
|
# Set the angle
|
||||||
func set_angle(deg : int, immediate = true):
|
func set_angle(deg: int, immediate = true):
|
||||||
_movable.set_angle(deg, immediate)
|
_movable.set_angle(deg, immediate)
|
||||||
|
|
||||||
|
|
||||||
@@ -359,3 +368,4 @@ func _get_inventory_item() -> ESCInventoryItem:
|
|||||||
inventory_item.global_id = self.global_id
|
inventory_item.global_id = self.global_id
|
||||||
return inventory_item
|
return inventory_item
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
extends Object
|
extends Object
|
||||||
class_name ESCResourceCache
|
class_name ESCResourceCache
|
||||||
|
|
||||||
var thread : Thread
|
var thread: Thread
|
||||||
var mutex : Mutex
|
var mutex: Mutex
|
||||||
var sem : Semaphore
|
var sem: Semaphore
|
||||||
|
|
||||||
var queue : Array = []
|
var queue: Array = []
|
||||||
var pending : Dictionary = {}
|
var pending: Dictionary = {}
|
||||||
|
|
||||||
signal resource_loading_progress(path, progress)
|
signal resource_loading_progress(path, progress)
|
||||||
signal resource_loading_done(path)
|
signal resource_loading_done(path)
|
||||||
@@ -31,7 +31,7 @@ func _wait(caller):
|
|||||||
sem.wait()
|
sem.wait()
|
||||||
|
|
||||||
|
|
||||||
func queue_resource(path : String, p_in_front : bool = false, p_permanent : bool = false):
|
func queue_resource(path: String, p_in_front: bool = false, p_permanent: bool = false):
|
||||||
_lock("queue_resource")
|
_lock("queue_resource")
|
||||||
if path in pending:
|
if path in pending:
|
||||||
_unlock("queue_resource")
|
_unlock("queue_resource")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export(String, FILE, "*.esc") var esc_script = ""
|
|||||||
export(PackedScene) var player_scene
|
export(PackedScene) var player_scene
|
||||||
|
|
||||||
# The camera limits available in this room
|
# The camera limits available in this room
|
||||||
export(Array, Rect2) var camera_limits : Array = [Rect2()] setget set_camera_limits
|
export(Array, Rect2) var camera_limits: Array = [Rect2()] setget set_camera_limits
|
||||||
|
|
||||||
# The editor debug display mode
|
# The editor debug display mode
|
||||||
export(int) var editor_debug_mode = EditorRoomDebugDisplay.NONE setget set_editor_debug_mode
|
export(int) var editor_debug_mode = EditorRoomDebugDisplay.NONE setget set_editor_debug_mode
|
||||||
@@ -89,7 +89,7 @@ func _draw():
|
|||||||
if editor_debug_mode == EditorRoomDebugDisplay.NONE:
|
if editor_debug_mode == EditorRoomDebugDisplay.NONE:
|
||||||
return
|
return
|
||||||
|
|
||||||
var camera_limits_colors : Array = [
|
var camera_limits_colors: Array = [
|
||||||
ColorN("red"), ColorN("blue"), ColorN("green")
|
ColorN("red"), ColorN("blue"), ColorN("green")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ func _ready():
|
|||||||
navigation_enabled_found = true
|
navigation_enabled_found = true
|
||||||
current_active_navigation_instance = n
|
current_active_navigation_instance = n
|
||||||
|
|
||||||
|
|
||||||
if !Engine.is_editor_hint():
|
if !Engine.is_editor_hint():
|
||||||
escoria.room_terrain = self
|
escoria.room_terrain = self
|
||||||
_update_texture()
|
_update_texture()
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ func get_class():
|
|||||||
|
|
||||||
|
|
||||||
# Infinitive verb
|
# Infinitive verb
|
||||||
var current_action : String
|
var current_action: String
|
||||||
# Target item/hotspot
|
# Target item/hotspot
|
||||||
var current_target : String setget set_target
|
var current_target: String setget set_target
|
||||||
# Preposition: on, with...
|
# Preposition: on, with...
|
||||||
var current_prep : String = "with"
|
var current_prep: String = "with"
|
||||||
# Target 2 item/hotspot
|
# Target 2 item/hotspot
|
||||||
var current_target2 : String
|
var current_target2: String
|
||||||
# True if tooltip is waiting for a click on second target (use x with y)
|
# True if tooltip is waiting for a click on second target (use x with y)
|
||||||
var waiting_for_target2 = false
|
var waiting_for_target2 = false
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ export(Color) var color setget set_color
|
|||||||
export(Vector2) var offset_from_cursor = Vector2(10,0)
|
export(Vector2) var offset_from_cursor = Vector2(10,0)
|
||||||
|
|
||||||
export(bool) var debug_mode = false setget set_debug_mode
|
export(bool) var debug_mode = false setget set_debug_mode
|
||||||
var debug_texturerect_node : TextureRect
|
var debug_texturerect_node: TextureRect
|
||||||
|
|
||||||
const MAX_WIDTH = 200
|
const MAX_WIDTH = 200
|
||||||
const MIN_HEIGHT = 30
|
const MIN_HEIGHT = 30
|
||||||
@@ -36,12 +36,12 @@ func _ready():
|
|||||||
escoria.action_manager.connect("action_changed", self, "on_action_selected")
|
escoria.action_manager.connect("action_changed", self, "on_action_selected")
|
||||||
|
|
||||||
|
|
||||||
func set_color(p_color : Color):
|
func set_color(p_color: Color):
|
||||||
color = p_color
|
color = p_color
|
||||||
update_tooltip_text()
|
update_tooltip_text()
|
||||||
|
|
||||||
|
|
||||||
func set_debug_mode(p_debug_mode : bool):
|
func set_debug_mode(p_debug_mode: bool):
|
||||||
debug_mode = p_debug_mode
|
debug_mode = p_debug_mode
|
||||||
if debug_mode:
|
if debug_mode:
|
||||||
# Add a white TextureRect behind the RTL to see its actual size
|
# Add a white TextureRect behind the RTL to see its actual size
|
||||||
@@ -67,14 +67,14 @@ func on_action_selected() -> void:
|
|||||||
update_tooltip_text()
|
update_tooltip_text()
|
||||||
|
|
||||||
|
|
||||||
func set_target(target : String, needs_second_target : bool = false) -> void:
|
func set_target(target: String, needs_second_target: bool = false) -> void:
|
||||||
current_target = target
|
current_target = target
|
||||||
if needs_second_target:
|
if needs_second_target:
|
||||||
waiting_for_target2 = true
|
waiting_for_target2 = true
|
||||||
update_tooltip_text()
|
update_tooltip_text()
|
||||||
|
|
||||||
|
|
||||||
func set_target2(target2 : String) -> void:
|
func set_target2(target2: String) -> void:
|
||||||
current_target2 = target2
|
current_target2 = target2
|
||||||
update_tooltip_text()
|
update_tooltip_text()
|
||||||
|
|
||||||
@@ -142,16 +142,16 @@ func _offset(position):
|
|||||||
return position
|
return position
|
||||||
|
|
||||||
|
|
||||||
func tooltip_distance_to_edge_top(position : Vector2):
|
func tooltip_distance_to_edge_top(position: Vector2):
|
||||||
return position.y
|
return position.y
|
||||||
|
|
||||||
func tooltip_distance_to_edge_bottom(position: Vector2):
|
func tooltip_distance_to_edge_bottom(position: Vector2):
|
||||||
return escoria.game_size.y - position.y
|
return escoria.game_size.y - position.y
|
||||||
|
|
||||||
func tooltip_distance_to_edge_left(position : Vector2):
|
func tooltip_distance_to_edge_left(position: Vector2):
|
||||||
return position.x
|
return position.x
|
||||||
|
|
||||||
func tooltip_distance_to_edge_right(position : Vector2):
|
func tooltip_distance_to_edge_right(position: Vector2):
|
||||||
return escoria.game_size.x - position.x
|
return escoria.game_size.x - position.x
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class_name ESCLogger
|
|||||||
|
|
||||||
# The path of the ESC file that was reported last (used for removing
|
# The path of the ESC file that was reported last (used for removing
|
||||||
# duplicate warnings
|
# duplicate warnings
|
||||||
var warning_path : String
|
var warning_path: String
|
||||||
|
|
||||||
|
|
||||||
# Valid log levels
|
# Valid log levels
|
||||||
@@ -27,7 +27,7 @@ var _level_map: Dictionary = {
|
|||||||
#
|
#
|
||||||
# * string: Text to log
|
# * string: Text to log
|
||||||
# * args: Additional information
|
# * args: Additional information
|
||||||
func debug(string : String, args = []):
|
func debug(string: String, args = []):
|
||||||
if _get_log_level() >= LOG_DEBUG:
|
if _get_log_level() >= LOG_DEBUG:
|
||||||
var argsstr = str(args) if !args.empty() else ""
|
var argsstr = str(args) if !args.empty() else ""
|
||||||
printerr("(D)\t" + string + " \t" + argsstr)
|
printerr("(D)\t" + string + " \t" + argsstr)
|
||||||
@@ -39,7 +39,7 @@ func debug(string : String, args = []):
|
|||||||
#
|
#
|
||||||
# * string: Text to log
|
# * string: Text to log
|
||||||
# * args: Additional information
|
# * args: Additional information
|
||||||
func info(string : String, args = []):
|
func info(string: String, args = []):
|
||||||
if _get_log_level() >= LOG_INFO:
|
if _get_log_level() >= LOG_INFO:
|
||||||
var argsstr = []
|
var argsstr = []
|
||||||
if !args.empty():
|
if !args.empty():
|
||||||
@@ -58,7 +58,7 @@ func info(string : String, args = []):
|
|||||||
#
|
#
|
||||||
# * string: Text to log
|
# * string: Text to log
|
||||||
# * args: Additional information
|
# * args: Additional information
|
||||||
func warning(string : String, args = []):
|
func warning(string: String, args = []):
|
||||||
if _get_log_level() >= LOG_WARNING:
|
if _get_log_level() >= LOG_WARNING:
|
||||||
var argsstr = str(args) if !args.empty() else ""
|
var argsstr = str(args) if !args.empty() else ""
|
||||||
printerr("(W)\t" + string + " \t" + argsstr)
|
printerr("(W)\t" + string + " \t" + argsstr)
|
||||||
@@ -73,7 +73,7 @@ func warning(string : String, args = []):
|
|||||||
#
|
#
|
||||||
# * string: Text to log
|
# * string: Text to log
|
||||||
# * args: Additional information
|
# * args: Additional information
|
||||||
func error(string : String, args = []):
|
func error(string: String, args = []):
|
||||||
if _get_log_level() >= LOG_ERROR:
|
if _get_log_level() >= LOG_ERROR:
|
||||||
var argsstr = str(args) if !args.empty() else ""
|
var argsstr = str(args) if !args.empty() else ""
|
||||||
printerr("(E)\t" + string + " \t" + argsstr)
|
printerr("(E)\t" + string + " \t" + argsstr)
|
||||||
@@ -89,7 +89,7 @@ func error(string : String, args = []):
|
|||||||
# * p_path: Path to the file
|
# * p_path: Path to the file
|
||||||
# * warnings: Array of warnings to put out
|
# * warnings: Array of warnings to put out
|
||||||
# * report_once: Additional messages about the same file will be ignored
|
# * report_once: Additional messages about the same file will be ignored
|
||||||
func report_warnings(p_path : String, warnings : Array, report_once = false) -> void:
|
func report_warnings(p_path: String, warnings: Array, report_once = false) -> void:
|
||||||
var warning_is_reported = false
|
var warning_is_reported = false
|
||||||
if p_path == warning_path:
|
if p_path == warning_path:
|
||||||
warning_is_reported = true
|
warning_is_reported = true
|
||||||
@@ -113,7 +113,7 @@ func report_warnings(p_path : String, warnings : Array, report_once = false) ->
|
|||||||
#
|
#
|
||||||
# * p_path: Path to the file
|
# * p_path: Path to the file
|
||||||
# * errors: Array of errors to put out
|
# * errors: Array of errors to put out
|
||||||
func report_errors(p_path : String, errors : Array) -> void:
|
func report_errors(p_path: String, errors: Array) -> void:
|
||||||
var text = "Errors in file "+p_path+"\n"
|
var text = "Errors in file "+p_path+"\n"
|
||||||
for e in errors:
|
for e in errors:
|
||||||
if e is Array:
|
if e is Array:
|
||||||
|
|||||||
@@ -0,0 +1,207 @@
|
|||||||
|
# Saves and loads savegame and settings files
|
||||||
|
class_name ESCSaveManager
|
||||||
|
|
||||||
|
# Variable containing the saves folder obtained from Project Settings
|
||||||
|
var save_folder: String
|
||||||
|
|
||||||
|
# Template for savegames filenames
|
||||||
|
const SAVE_NAME_TEMPLATE: String = "save_%03d.tres"
|
||||||
|
|
||||||
|
# Variable containing the settings folder obtained from Project Settings
|
||||||
|
var settings_folder: String
|
||||||
|
|
||||||
|
# Template for settings filename
|
||||||
|
const SETTINGS_TEMPLATE: String = "settings.tres"
|
||||||
|
|
||||||
|
# Constructor of ESCSaveManager object.
|
||||||
|
func _init():
|
||||||
|
save_folder = ProjectSettings.get_setting("escoria/main/savegames_path")
|
||||||
|
settings_folder = ProjectSettings.get_setting("escoria/main/settings_path")
|
||||||
|
|
||||||
|
# Return a list of savegames metadata (id, date, name and game version)
|
||||||
|
func get_saves_list() -> Dictionary:
|
||||||
|
var regex = RegEx.new()
|
||||||
|
regex.compile("save_([0-9]{3})\\.tres")
|
||||||
|
|
||||||
|
var saves = {}
|
||||||
|
var dirsave = Directory.new()
|
||||||
|
if dirsave.open(save_folder) == OK:
|
||||||
|
dirsave.list_dir_begin(true, true)
|
||||||
|
var nextfile = dirsave.get_next()
|
||||||
|
while nextfile != "":
|
||||||
|
var save_path = save_folder.plus_file(nextfile)
|
||||||
|
var file: File = File.new()
|
||||||
|
var save_game_res: Resource = load(save_path)
|
||||||
|
var save_game_data = {
|
||||||
|
"date": save_game_res["date"],
|
||||||
|
"name": save_game_res["name"],
|
||||||
|
"game_version": save_game_res["game_version"],
|
||||||
|
}
|
||||||
|
|
||||||
|
var id: int
|
||||||
|
var matches = regex.search(nextfile)
|
||||||
|
if matches.strings.size() > 1:
|
||||||
|
id = int(matches.strings[1])
|
||||||
|
|
||||||
|
saves[id] = save_game_data
|
||||||
|
nextfile = dirsave.get_next()
|
||||||
|
return saves
|
||||||
|
|
||||||
|
|
||||||
|
# Returns true whether the savegame identified by id does exist
|
||||||
|
#
|
||||||
|
# ## Parameters
|
||||||
|
# - id: integer suffix of the savegame file
|
||||||
|
func save_game_exists(id: int) -> bool:
|
||||||
|
var save_file_path: String = save_folder.plus_file(SAVE_NAME_TEMPLATE % id)
|
||||||
|
var file: File = File.new()
|
||||||
|
return file.file_exists(save_file_path)
|
||||||
|
|
||||||
|
|
||||||
|
# Save the current state of the game in a file suffixed with the id value.
|
||||||
|
# This id can help with slots development for the game developer.
|
||||||
|
#
|
||||||
|
# ## Parameters
|
||||||
|
# - id: integer suffix of the savegame file
|
||||||
|
# - p_savename: name of the savegame
|
||||||
|
func save_game(id: int, p_savename: String):
|
||||||
|
var save_game := ESCSaveGame.new()
|
||||||
|
save_game.escoria_version = escoria.ESCORIA_VERSION
|
||||||
|
save_game.game_version = ProjectSettings.get_setting(
|
||||||
|
"escoria/main/game_version"
|
||||||
|
)
|
||||||
|
save_game.name = p_savename
|
||||||
|
|
||||||
|
var datetime = OS.get_datetime()
|
||||||
|
var datetime_string = "%02d/%02d/%02d %02d:%02d" % [
|
||||||
|
datetime["day"],
|
||||||
|
datetime["month"],
|
||||||
|
datetime["year"],
|
||||||
|
datetime["hour"],
|
||||||
|
datetime["minute"],
|
||||||
|
]
|
||||||
|
save_game.date = datetime_string
|
||||||
|
|
||||||
|
escoria.globals_manager.save_game(save_game)
|
||||||
|
escoria.object_manager.save_game(save_game)
|
||||||
|
escoria.main.save_game(save_game)
|
||||||
|
|
||||||
|
var directory: Directory = Directory.new()
|
||||||
|
if not directory.dir_exists(save_folder):
|
||||||
|
directory.make_dir_recursive(save_folder)
|
||||||
|
|
||||||
|
var save_path = save_folder.plus_file(SAVE_NAME_TEMPLATE % id)
|
||||||
|
var error: int = ResourceSaver.save(save_path, save_game)
|
||||||
|
if error != OK:
|
||||||
|
escoria.logger.report_errors(
|
||||||
|
"esc_save_data_resources.gd",
|
||||||
|
["There was an issue writing the save %s to %s" % [id, save_path]])
|
||||||
|
|
||||||
|
# Load a savegame file from its id.
|
||||||
|
#
|
||||||
|
# ## Parameters
|
||||||
|
# - id: integer suffix of the savegame file
|
||||||
|
func load_game(id: int):
|
||||||
|
var save_file_path: String = save_folder.plus_file(SAVE_NAME_TEMPLATE % id)
|
||||||
|
var file: File = File.new()
|
||||||
|
if not file.file_exists(save_file_path):
|
||||||
|
escoria.logger.report_errors(
|
||||||
|
"esc_save_data_resources.gd",
|
||||||
|
["Save file %s doesn't exist" % save_file_path])
|
||||||
|
return
|
||||||
|
|
||||||
|
var save_game: Resource = ResourceLoader.load(save_file_path)
|
||||||
|
|
||||||
|
var load_event = ESCEvent.new(":load")
|
||||||
|
var load_statements = []
|
||||||
|
|
||||||
|
## GLOBALS
|
||||||
|
for k in save_game.globals.keys():
|
||||||
|
load_statements.append(
|
||||||
|
ESCCommand.new("set_global %s \"%s\"\n" \
|
||||||
|
% [k, save_game.globals[k]])
|
||||||
|
)
|
||||||
|
|
||||||
|
## ROOM
|
||||||
|
load_statements.append(
|
||||||
|
ESCCommand.new("change_scene %s true" \
|
||||||
|
% save_game.main["current_scene_filename"])
|
||||||
|
)
|
||||||
|
|
||||||
|
## OBJECTS
|
||||||
|
for object_global_id in save_game.objects.keys():
|
||||||
|
if save_game.objects[object_global_id].has("active"):
|
||||||
|
load_statements.append(ESCCommand.new("set_active %s %s" \
|
||||||
|
% [object_global_id,
|
||||||
|
save_game.objects[object_global_id]["active"]])
|
||||||
|
)
|
||||||
|
|
||||||
|
if save_game.objects[object_global_id].has("interactive"):
|
||||||
|
load_statements.append(ESCCommand.new("set_interactive %s %s" \
|
||||||
|
% [object_global_id,
|
||||||
|
save_game.objects[object_global_id]["interactive"]])
|
||||||
|
)
|
||||||
|
|
||||||
|
if save_game.objects[object_global_id].has("state"):
|
||||||
|
load_statements.append(ESCCommand.new("set_state %s %s true" \
|
||||||
|
% [object_global_id,
|
||||||
|
save_game.objects[object_global_id]["state"]])
|
||||||
|
)
|
||||||
|
|
||||||
|
if save_game.objects[object_global_id].has("global_transform"):
|
||||||
|
load_statements.append(ESCCommand.new("teleport_pos %s %s %s" \
|
||||||
|
% [object_global_id,
|
||||||
|
save_game.objects[object_global_id] \
|
||||||
|
["global_transform"].origin.x,
|
||||||
|
save_game.objects[object_global_id] \
|
||||||
|
["global_transform"].origin.y])
|
||||||
|
)
|
||||||
|
load_statements.append(ESCCommand.new("set_angle %s %s" \
|
||||||
|
% [object_global_id,
|
||||||
|
save_game.objects[object_global_id]["last_deg"]])
|
||||||
|
)
|
||||||
|
|
||||||
|
load_event.statements = load_statements
|
||||||
|
escoria.event_manager.queue_event(load_event)
|
||||||
|
|
||||||
|
|
||||||
|
# Save the game settings in the settings file.
|
||||||
|
func save_settings():
|
||||||
|
var settings_res := ESCSaveSettings.new()
|
||||||
|
settings_res.escoria_version = escoria.ESCORIA_VERSION
|
||||||
|
settings_res.text_lang = escoria.settings.text_lang
|
||||||
|
settings_res.voice_lang = escoria.settings.voice_lang
|
||||||
|
settings_res.speech_enabled = escoria.settings.speech_enabled
|
||||||
|
settings_res.master_volume = escoria.settings.master_volume
|
||||||
|
settings_res.music_volume = escoria.settings.music_volume
|
||||||
|
settings_res.sfx_volume = escoria.settings.sfx_volume
|
||||||
|
settings_res.voice_volume = escoria.settings.voice_volume
|
||||||
|
settings_res.fullscreen = escoria.settings.fullscreen
|
||||||
|
settings_res.skip_dialog = escoria.settings.skip_dialog
|
||||||
|
settings_res.rate_shown = escoria.settings.rate_shown
|
||||||
|
|
||||||
|
var directory: Directory = Directory.new()
|
||||||
|
if not directory.dir_exists(settings_folder):
|
||||||
|
directory.make_dir_recursive(settings_folder)
|
||||||
|
|
||||||
|
var save_path = settings_folder.plus_file(SETTINGS_TEMPLATE)
|
||||||
|
var error: int = ResourceSaver.save(save_path, settings_res)
|
||||||
|
if error != OK:
|
||||||
|
escoria.logger.report_errors(
|
||||||
|
"esc_save_data_resources.gd:save_settings()",
|
||||||
|
["There was an issue writing settings %s" % save_path])
|
||||||
|
|
||||||
|
# Load the game settings from the settings file
|
||||||
|
func load_settings():
|
||||||
|
var save_settings_path: String = settings_folder.plus_file(SETTINGS_TEMPLATE)
|
||||||
|
var file: File = File.new()
|
||||||
|
if not file.file_exists(save_settings_path):
|
||||||
|
escoria.logger.report_warnings(
|
||||||
|
"esc_save_data_resources.gd:load_settings()",
|
||||||
|
["Settings file %s doesn't exist" % save_settings_path,
|
||||||
|
"Setting default settings."])
|
||||||
|
save_settings()
|
||||||
|
return
|
||||||
|
|
||||||
|
var settings_resource: Resource = load(save_settings_path)
|
||||||
|
escoria._on_settings_loaded(settings_resource)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Resource used for holding savegames data.
|
||||||
|
extends Resource
|
||||||
|
class_name ESCSaveGame
|
||||||
|
|
||||||
|
# Access key for the main data last_scene_global_id
|
||||||
|
const MAIN_LAST_SCENE_GLOBAL_ID_KEY = "last_scene_global_id"
|
||||||
|
# Access key for the main data current_scene_filename
|
||||||
|
const MAIN_CURRENT_SCENE_FILENAME_KEY = "current_scene_filename"
|
||||||
|
|
||||||
|
# Escoria version which the savegame was created with.
|
||||||
|
export var escoria_version: String
|
||||||
|
|
||||||
|
# Game version which the savegame was created with.
|
||||||
|
export var game_version: String = ""
|
||||||
|
|
||||||
|
# Name of the savegame. Can be custom value, provided by the player.
|
||||||
|
export var name: String = ""
|
||||||
|
|
||||||
|
# Date of creation of the savegame.
|
||||||
|
export var date: String = ""
|
||||||
|
|
||||||
|
# Main data to be saved
|
||||||
|
export var main: Dictionary = {}
|
||||||
|
|
||||||
|
# Escoria Global variables exported from ESCGlobalsManager
|
||||||
|
export var globals: Dictionary = {}
|
||||||
|
|
||||||
|
# Escoria objects exported from ESCObjectsManager
|
||||||
|
export var objects: Dictionary = {}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# Resource holding game settings.
|
||||||
|
extends Resource
|
||||||
|
class_name ESCSaveSettings
|
||||||
|
|
||||||
|
# Version of ESCORIA Framework
|
||||||
|
export var escoria_version: String
|
||||||
|
|
||||||
|
# Language of displayed text
|
||||||
|
export var text_lang: String = ProjectSettings.get_setting("escoria/main/text_lang")
|
||||||
|
|
||||||
|
# Language of voice speech
|
||||||
|
export var voice_lang: String = ProjectSettings.get_setting("escoria/main/voice_lang")
|
||||||
|
|
||||||
|
# Whether speech is enabled
|
||||||
|
export var speech_enabled: bool = ProjectSettings.get_setting(
|
||||||
|
"escoria/sound/speech_enabled")
|
||||||
|
|
||||||
|
# Master volume (mix of music, voice and sfx)
|
||||||
|
export var master_volume: float = ProjectSettings.get_setting(
|
||||||
|
"escoria/sound/master_volume")
|
||||||
|
|
||||||
|
# Volume of music only
|
||||||
|
export var music_volume: float = ProjectSettings.get_setting(
|
||||||
|
"escoria/sound/music_volume")
|
||||||
|
|
||||||
|
# Volume of SFX only
|
||||||
|
export var sfx_volume: float = ProjectSettings.get_setting("escoria/sound/sfx_volume")
|
||||||
|
|
||||||
|
# Voice volume only
|
||||||
|
export var voice_volume: float = ProjectSettings.get_setting(
|
||||||
|
"escoria/sound/speech_volume")
|
||||||
|
|
||||||
|
# True if game has to be fullscreen
|
||||||
|
export var fullscreen: bool = false
|
||||||
|
|
||||||
|
# True if skipping dialogs is allowed
|
||||||
|
export var skip_dialog: bool = true
|
||||||
|
|
||||||
|
# FIXME: to be defined (achievements?)
|
||||||
|
export var rate_shown: bool = false
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
|
|
||||||
const DATA_STRING = 0
|
|
||||||
const DATA_STRING_ARRAY = 1
|
|
||||||
const DATA_VARIANT = 2
|
|
||||||
|
|
||||||
var base = "user://esc_saves"
|
|
||||||
var slots = {}
|
|
||||||
var max_slots = 3
|
|
||||||
var settings
|
|
||||||
|
|
||||||
func save_settings(p_data, p_callback):
|
|
||||||
var f = File.new()
|
|
||||||
f.open("user://settings.json", File.WRITE)
|
|
||||||
f.store_string(to_json(p_data))
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
if typeof(p_callback) != typeof(null):
|
|
||||||
p_callback[0].call_deferred(p_callback[1], OK)
|
|
||||||
|
|
||||||
return OK
|
|
||||||
|
|
||||||
|
|
||||||
func check_settings():
|
|
||||||
var f = File.new()
|
|
||||||
var error = f.open("user://settings.json", File.READ)
|
|
||||||
if !f.is_open() and error != OK:
|
|
||||||
match error:
|
|
||||||
ERR_FILE_NOT_FOUND:
|
|
||||||
f.close()
|
|
||||||
save_settings(escoria.settings_default, null)
|
|
||||||
|
|
||||||
|
|
||||||
func load_settings(p_callback):
|
|
||||||
var f = File.new()
|
|
||||||
var error = f.open("user://settings.json", File.READ)
|
|
||||||
if !f.is_open() and error != OK:
|
|
||||||
escoria.logger.report_warnings("save_data.gd:load_settings()",
|
|
||||||
["Failed opening settings file user://settings.json.",
|
|
||||||
"File.open() returned " + error])
|
|
||||||
|
|
||||||
if typeof(p_callback) != typeof(null):
|
|
||||||
p_callback[0].call_deferred(p_callback[1], null)
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
settings = f.get_as_text()
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
if typeof(p_callback) != typeof(null):
|
|
||||||
p_callback[0].call_deferred(p_callback[1], settings)
|
|
||||||
|
|
||||||
return settings
|
|
||||||
|
|
||||||
|
|
||||||
func _get_fname(p_slot):
|
|
||||||
|
|
||||||
var date = OS.get_date()
|
|
||||||
var time = OS.get_time()
|
|
||||||
|
|
||||||
var day = str(date.day)
|
|
||||||
if date.day < 10:
|
|
||||||
day = "0"+day
|
|
||||||
|
|
||||||
|
|
||||||
var hour = str(time.hour)
|
|
||||||
if time.hour < 10:
|
|
||||||
hour = "0"+hour
|
|
||||||
|
|
||||||
var minute = str(time.minute)
|
|
||||||
if time.minute < 10:
|
|
||||||
minute = "0"+minute
|
|
||||||
|
|
||||||
var second = str(time.second)
|
|
||||||
if time.second < 10:
|
|
||||||
second = "0"+second
|
|
||||||
|
|
||||||
var fname = str(p_slot) + "-"
|
|
||||||
fname = fname + day + "-" + str(date.month) + "-" + str(date.year) + " " + hour+"."+minute+"."+second+".esc"
|
|
||||||
|
|
||||||
return fname
|
|
||||||
|
|
||||||
|
|
||||||
func save_game(p_data, p_slot, p_callback):
|
|
||||||
|
|
||||||
if p_slot < 0 || p_slot >= max_slots:
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
var fname = _get_fname(p_slot)
|
|
||||||
var ret = _do_save(base + "/" + fname, p_data)
|
|
||||||
if ret != OK:
|
|
||||||
if typeof(p_callback) != typeof(null):
|
|
||||||
p_callback[0].call_deferred(p_callback[1], FAILED)
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
if p_slot in slots:
|
|
||||||
var old_fname = slots[p_slot].fname
|
|
||||||
var d = Directory.new()
|
|
||||||
d.open(base)
|
|
||||||
d.remove(old_fname)
|
|
||||||
|
|
||||||
if typeof(p_callback) != typeof(null):
|
|
||||||
p_callback[0].call_deferred(p_callback[1], OK)
|
|
||||||
return OK
|
|
||||||
|
|
||||||
func _do_save(fname, p_data):
|
|
||||||
var f = File.new()
|
|
||||||
var ret = f.open(fname, File.WRITE)
|
|
||||||
if ret or not f.is_open():
|
|
||||||
print("Unable to open file for save ", fname)
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
if typeof(p_data) == typeof([]):
|
|
||||||
for s in p_data:
|
|
||||||
f.store_string(s)
|
|
||||||
else:
|
|
||||||
f.store_string(p_data)
|
|
||||||
|
|
||||||
f.close()
|
|
||||||
printt("Saved game to " + fname)
|
|
||||||
|
|
||||||
return OK
|
|
||||||
|
|
||||||
func load_slot(p_slot, p_callback):
|
|
||||||
if p_callback == null:
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
if !(p_slot in slots):
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
var data = _do_load(slots[p_slot].fname)
|
|
||||||
if !data:
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
p_callback[0].call_deferred(p_callback[1], data)
|
|
||||||
|
|
||||||
return OK
|
|
||||||
|
|
||||||
|
|
||||||
func load_autosave(p_callback):
|
|
||||||
if p_callback == null:
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
var data = _do_load("user://quick_save.esc")
|
|
||||||
if data == null:
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
p_callback[0].call_deferred(p_callback[1], data)
|
|
||||||
|
|
||||||
return OK
|
|
||||||
|
|
||||||
|
|
||||||
func _do_load(fname):
|
|
||||||
var f = File.new()
|
|
||||||
if !f.file_exists(fname):
|
|
||||||
return null
|
|
||||||
|
|
||||||
f.open(fname, File.READ)
|
|
||||||
var data = f.get_as_text()
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
func autosave(p_data, p_callback):
|
|
||||||
var err = _do_save("user://quick_save.esc", p_data)
|
|
||||||
|
|
||||||
if typeof(p_callback) != typeof(null):
|
|
||||||
p_callback[0].call_deferred(p_callback[1], err)
|
|
||||||
|
|
||||||
return err
|
|
||||||
|
|
||||||
func get_slots_available(p_callback):
|
|
||||||
|
|
||||||
if p_callback == null:
|
|
||||||
return FAILED
|
|
||||||
|
|
||||||
var d = Directory.new()
|
|
||||||
d.open("user://")
|
|
||||||
if !d.dir_exists(base):
|
|
||||||
d.make_dir(base)
|
|
||||||
d.open(base)
|
|
||||||
|
|
||||||
|
|
||||||
d.list_dir_begin()
|
|
||||||
var f = d.get_next()
|
|
||||||
while f != "":
|
|
||||||
|
|
||||||
if f.find(".esc") < 0 || f.find("-") < 0:
|
|
||||||
f = d.get_next()
|
|
||||||
continue
|
|
||||||
|
|
||||||
var sep = f.find("-")
|
|
||||||
var n = int(f.substr(0, sep))
|
|
||||||
if n >= max_slots:
|
|
||||||
f = d.get_next()
|
|
||||||
continue
|
|
||||||
|
|
||||||
var t = f.replace(".esc", "")
|
|
||||||
t = t.substr(2, t.length()-2)
|
|
||||||
var l = t.split(" ")
|
|
||||||
var h = l[1]
|
|
||||||
var date = l[0]
|
|
||||||
|
|
||||||
slots[n] = { "n": n, "fname": base + "/" + f, "date": date, "hour": h }
|
|
||||||
|
|
||||||
f = d.get_next()
|
|
||||||
|
|
||||||
d.list_dir_end()
|
|
||||||
|
|
||||||
p_callback[0].call_deferred(p_callback[1], slots)
|
|
||||||
|
|
||||||
return OK
|
|
||||||
|
|
||||||
func autosave_available():
|
|
||||||
var f = File.new()
|
|
||||||
return f.file_exists("user://quick_save.esc")
|
|
||||||
|
|
||||||
func start():
|
|
||||||
pass
|
|
||||||
@@ -9,7 +9,7 @@ class_name ESCUtils
|
|||||||
#
|
#
|
||||||
# - rad_angle: Angle in radians
|
# - rad_angle: Angle in radians
|
||||||
# **Returns** Degrees
|
# **Returns** Degrees
|
||||||
func get_deg_from_rad(rad_angle : float):
|
func get_deg_from_rad(rad_angle: float):
|
||||||
var deg = rad2deg(rad_angle)
|
var deg = rad2deg(rad_angle)
|
||||||
if deg >= 360.0:
|
if deg >= 360.0:
|
||||||
deg = clamp(deg, 0.0, 360.0)
|
deg = clamp(deg, 0.0, 360.0)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# The escorie main script
|
# The escoria main script
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
# Escoria version number
|
||||||
|
const ESCORIA_VERSION = "0.1.0"
|
||||||
|
|
||||||
# Current game state
|
# Current game state
|
||||||
# * DEFAULT: Common game function
|
# * DEFAULT: Common game function
|
||||||
@@ -56,31 +58,7 @@ var dialog_player
|
|||||||
var inventory
|
var inventory
|
||||||
|
|
||||||
# These are settings that the player can affect and save/load later
|
# These are settings that the player can affect and save/load later
|
||||||
var settings : Dictionary
|
var settings: ESCSaveSettings
|
||||||
|
|
||||||
# These are default settings
|
|
||||||
var settings_default : Dictionary = {
|
|
||||||
# Text language
|
|
||||||
"text_lang": ProjectSettings.get_setting("escoria/main/text_lang"),
|
|
||||||
# Voice language
|
|
||||||
"voice_lang": ProjectSettings.get_setting("escoria/main/voice_lang"),
|
|
||||||
# Speech enabled
|
|
||||||
"speech_enabled": ProjectSettings.get_setting("escoria/sound/speech_enabled"),
|
|
||||||
# Master volume (max is 1.0)
|
|
||||||
"master_volume": ProjectSettings.get_setting("escoria/sound/master_volume"),
|
|
||||||
# Music volume (max is 1.0)
|
|
||||||
"music_volume": ProjectSettings.get_setting("escoria/sound/music_volume"),
|
|
||||||
# Sound effects volume (max is 1.0)
|
|
||||||
"sfx_volume": ProjectSettings.get_setting("escoria/sound/sfx_volume"),
|
|
||||||
# Voice volume (for speech only, max is 1.0)
|
|
||||||
"voice_volume": ProjectSettings.get_setting("escoria/sound/speech_volume"),
|
|
||||||
# Set fullscreen
|
|
||||||
"fullscreen": false,
|
|
||||||
# Allow dialog skipping
|
|
||||||
"skip_dialog": true,
|
|
||||||
# XXX: What is this? `achievements.gd` looks like iOS-only
|
|
||||||
"rate_shown": false,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# The current state of the game
|
# The current state of the game
|
||||||
@@ -95,8 +73,8 @@ onready var main = $main
|
|||||||
# The escoria inputs manager
|
# The escoria inputs manager
|
||||||
onready var inputs_manager = $inputs_manager
|
onready var inputs_manager = $inputs_manager
|
||||||
|
|
||||||
# Savegame management
|
# Savegames and settings manager
|
||||||
onready var save_data = load("res://addons/escoria-core/game/core-scripts/save_data/save_data.gd").new()
|
var save_manager: ESCSaveManager
|
||||||
|
|
||||||
|
|
||||||
# Initialize various objects
|
# Initialize various objects
|
||||||
@@ -113,14 +91,13 @@ func _init():
|
|||||||
self.esc_compiler = ESCCompiler.new()
|
self.esc_compiler = ESCCompiler.new()
|
||||||
self.resource_cache = ESCResourceCache.new()
|
self.resource_cache = ESCResourceCache.new()
|
||||||
self.resource_cache.start()
|
self.resource_cache.start()
|
||||||
|
self.save_manager = ESCSaveManager.new()
|
||||||
|
|
||||||
|
|
||||||
# Load settings
|
# Load settings
|
||||||
func _ready():
|
func _ready():
|
||||||
save_data.start()
|
settings = ESCSaveSettings.new()
|
||||||
save_data.check_settings()
|
settings = save_manager.load_settings()
|
||||||
var settings = save_data.load_settings(null)
|
|
||||||
escoria.settings = parse_json(settings)
|
|
||||||
escoria._on_settings_loaded(escoria.settings)
|
escoria._on_settings_loaded(escoria.settings)
|
||||||
|
|
||||||
|
|
||||||
@@ -148,7 +125,7 @@ func new_game():
|
|||||||
#
|
#
|
||||||
# - action: type of the action to run
|
# - action: type of the action to run
|
||||||
# - params: Parameters for the action
|
# - params: Parameters for the action
|
||||||
func do(action : String, params : Array = []) -> void:
|
func do(action: String, params: Array = []) -> void:
|
||||||
if current_state == GAME_STATE.DEFAULT:
|
if current_state == GAME_STATE.DEFAULT:
|
||||||
match action:
|
match action:
|
||||||
"walk":
|
"walk":
|
||||||
@@ -171,7 +148,7 @@ func do(action : String, params : Array = []) -> void:
|
|||||||
# Walk to Position2D.
|
# Walk to Position2D.
|
||||||
if params[1] is Vector2:
|
if params[1] is Vector2:
|
||||||
var target_position = params[1]
|
var target_position = params[1]
|
||||||
var is_fast : bool = false
|
var is_fast: bool = false
|
||||||
if params.size() > 2 and params[2] == true:
|
if params.size() > 2 and params[2] == true:
|
||||||
is_fast = true
|
is_fast = true
|
||||||
var walk_context = ESCWalkContext.new(
|
var walk_context = ESCWalkContext.new(
|
||||||
@@ -195,9 +172,9 @@ func do(action : String, params : Array = []) -> void:
|
|||||||
|
|
||||||
var object = self.object_manager.get_object(params[1])
|
var object = self.object_manager.get_object(params[1])
|
||||||
if object:
|
if object:
|
||||||
var target_position : Vector2 = \
|
var target_position: Vector2 = \
|
||||||
object.node.interact_position
|
object.node.interact_position
|
||||||
var is_fast : bool = false
|
var is_fast: bool = false
|
||||||
if params.size() > 2 and params[2] == true:
|
if params.size() > 2 and params[2] == true:
|
||||||
is_fast = true
|
is_fast = true
|
||||||
var walk_context = ESCWalkContext.new(
|
var walk_context = ESCWalkContext.new(
|
||||||
@@ -211,7 +188,7 @@ func do(action : String, params : Array = []) -> void:
|
|||||||
"item_left_click":
|
"item_left_click":
|
||||||
if params[0] is String:
|
if params[0] is String:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"escoria.do() : item_left_click on item ",
|
"escoria.do(): item_left_click on item ",
|
||||||
[params[0]]
|
[params[0]]
|
||||||
)
|
)
|
||||||
var item = self.object_manager.get_object(params[0])
|
var item = self.object_manager.get_object(params[0])
|
||||||
@@ -220,7 +197,7 @@ func do(action : String, params : Array = []) -> void:
|
|||||||
"item_right_click":
|
"item_right_click":
|
||||||
if params[0] is String:
|
if params[0] is String:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"escoria.do() : item_right_click on item ",
|
"escoria.do(): item_right_click on item ",
|
||||||
[params[0]]
|
[params[0]]
|
||||||
)
|
)
|
||||||
var item = self.object_manager.get_object(params[0])
|
var item = self.object_manager.get_object(params[0])
|
||||||
@@ -230,7 +207,7 @@ func do(action : String, params : Array = []) -> void:
|
|||||||
var trigger_id = params[0]
|
var trigger_id = params[0]
|
||||||
var object_id = params[1]
|
var object_id = params[1]
|
||||||
var trigger_in_verb = params[2]
|
var trigger_in_verb = params[2]
|
||||||
self.logger.info("escoria.do() : trigger_in %s by %s" % [
|
self.logger.info("escoria.do(): trigger_in %s by %s" % [
|
||||||
trigger_id,
|
trigger_id,
|
||||||
object_id
|
object_id
|
||||||
])
|
])
|
||||||
@@ -244,7 +221,7 @@ func do(action : String, params : Array = []) -> void:
|
|||||||
var trigger_id = params[0]
|
var trigger_id = params[0]
|
||||||
var object_id = params[1]
|
var object_id = params[1]
|
||||||
var trigger_out_verb = params[2]
|
var trigger_out_verb = params[2]
|
||||||
self.logger.info("escoria.do() : trigger_out %s by %s" % [
|
self.logger.info("escoria.do(): trigger_out %s by %s" % [
|
||||||
trigger_id,
|
trigger_id,
|
||||||
object_id
|
object_id
|
||||||
])
|
])
|
||||||
@@ -299,7 +276,7 @@ func _ev_left_click_on_item(obj, event, default_action = false):
|
|||||||
# Don't interact after player movement towards object
|
# Don't interact after player movement towards object
|
||||||
# (because object is inactive for example)
|
# (because object is inactive for example)
|
||||||
var dont_interact = false
|
var dont_interact = false
|
||||||
var destination_position : Vector2 = main.current_scene.player.\
|
var destination_position: Vector2 = main.current_scene.player.\
|
||||||
global_position
|
global_position
|
||||||
|
|
||||||
# Create walk context
|
# Create walk context
|
||||||
@@ -386,16 +363,12 @@ func _ev_left_click_on_item(obj, event, default_action = false):
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * p_settings: Loaded settings
|
# * p_settings: Loaded settings
|
||||||
func _on_settings_loaded(p_settings : Dictionary) -> void:
|
func _on_settings_loaded(p_settings: ESCSaveSettings) -> void:
|
||||||
escoria.logger.info("******* settings loaded", p_settings)
|
escoria.logger.info("******* settings loaded")
|
||||||
if p_settings != null:
|
if p_settings != null:
|
||||||
settings = p_settings
|
settings = p_settings
|
||||||
else:
|
else:
|
||||||
settings = {}
|
settings = ESCSaveSettings.new()
|
||||||
|
|
||||||
for k in settings_default:
|
|
||||||
if !(k in settings):
|
|
||||||
settings[k] = settings_default[k]
|
|
||||||
|
|
||||||
# TODO Apply globally
|
# TODO Apply globally
|
||||||
# AudioServer.set_fx_global_volume_scale(settings.sfx_volume)
|
# AudioServer.set_fx_global_volume_scale(settings.sfx_volume)
|
||||||
@@ -414,4 +387,3 @@ func _on_settings_loaded(p_settings : Dictionary) -> void:
|
|||||||
TranslationServer.set_locale(settings.text_lang)
|
TranslationServer.set_locale(settings.text_lang)
|
||||||
# music_volume_changed()
|
# music_volume_changed()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ extends Node
|
|||||||
|
|
||||||
|
|
||||||
# A LIFO stack of hovered items
|
# A LIFO stack of hovered items
|
||||||
onready var hover_stack : Array = []
|
onready var hover_stack: Array = []
|
||||||
|
|
||||||
# The global id fo the topmost item from the hover_stack
|
# The global id fo the topmost item from the hover_stack
|
||||||
onready var hotspot_focused : String = ""
|
onready var hotspot_focused: String = ""
|
||||||
|
|
||||||
|
|
||||||
# Input event handler
|
# Input event handler
|
||||||
@@ -117,7 +117,7 @@ func _on_mouse_exited_inventory_item() -> void:
|
|||||||
#
|
#
|
||||||
# - item: The Escoria item hovered
|
# - item: The Escoria item hovered
|
||||||
func _on_mouse_entered_item(item: ESCItem) -> void:
|
func _on_mouse_entered_item(item: ESCItem) -> void:
|
||||||
escoria.logger.info("Item focused : ", [item.global_id])
|
escoria.logger.info("Item focused: ", [item.global_id])
|
||||||
_clean_hover_stack()
|
_clean_hover_stack()
|
||||||
|
|
||||||
if !hover_stack.empty():
|
if !hover_stack.empty():
|
||||||
@@ -137,8 +137,8 @@ func _on_mouse_entered_item(item: ESCItem) -> void:
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - item: The Escoria item hovered
|
# - item: The Escoria item hovered
|
||||||
func _on_mouse_exited_item(item : ESCItem) -> void:
|
func _on_mouse_exited_item(item: ESCItem) -> void:
|
||||||
escoria.logger.info("Item unfocused : ", [item.global_id])
|
escoria.logger.info("Item unfocused: ", [item.global_id])
|
||||||
_hover_stack_pop(item)
|
_hover_stack_pop(item)
|
||||||
if hover_stack.empty():
|
if hover_stack.empty():
|
||||||
hotspot_focused = ""
|
hotspot_focused = ""
|
||||||
@@ -154,7 +154,7 @@ func _on_mouse_exited_item(item : ESCItem) -> void:
|
|||||||
#
|
#
|
||||||
# - item: The Escoria item clicked
|
# - item: The Escoria item clicked
|
||||||
# - event: The input event from the click
|
# - event: The input event from the click
|
||||||
func _on_mouse_left_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
func _on_mouse_left_clicked_item(item: ESCItem, event: InputEvent) -> void:
|
||||||
if hover_stack.empty() or hover_stack.back() == item:
|
if hover_stack.empty() or hover_stack.back() == item:
|
||||||
escoria.logger.info("Item left clicked", [item.global_id, event])
|
escoria.logger.info("Item left clicked", [item.global_id, event])
|
||||||
escoria.main.current_scene.game.left_click_on_item(item.global_id, event)
|
escoria.main.current_scene.game.left_click_on_item(item.global_id, event)
|
||||||
@@ -166,7 +166,7 @@ func _on_mouse_left_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
|||||||
#
|
#
|
||||||
# - item: The Escoria item clicked
|
# - item: The Escoria item clicked
|
||||||
# - event: The input event from the click
|
# - event: The input event from the click
|
||||||
func _on_mouse_left_double_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
func _on_mouse_left_double_clicked_item(item: ESCItem, event: InputEvent) -> void:
|
||||||
escoria.logger.info("Item left double clicked", [item.global_id, event])
|
escoria.logger.info("Item left double clicked", [item.global_id, event])
|
||||||
escoria.main.current_scene.game.left_double_click_on_item(item.global_id, event)
|
escoria.main.current_scene.game.left_double_click_on_item(item.global_id, event)
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ func _on_mouse_left_double_clicked_item(item : ESCItem, event : InputEvent) -> v
|
|||||||
#
|
#
|
||||||
# - item: The Escoria item clicked
|
# - item: The Escoria item clicked
|
||||||
# - event: The input event from the click
|
# - event: The input event from the click
|
||||||
func _on_mouse_right_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
func _on_mouse_right_clicked_item(item: ESCItem, event: InputEvent) -> void:
|
||||||
escoria.logger.info("Item right clicked", [item.global_id, event])
|
escoria.logger.info("Item right clicked", [item.global_id, event])
|
||||||
escoria.main.current_scene.game.right_click_on_item(item.global_id, event)
|
escoria.main.current_scene.game.right_click_on_item(item.global_id, event)
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ func _on_mouse_right_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - direction: The direction the wheel was turned. 1 = up, -1 = down
|
# - direction: The direction the wheel was turned. 1 = up, -1 = down
|
||||||
func _on_mousewheel_action(direction : int):
|
func _on_mousewheel_action(direction: int):
|
||||||
escoria.main.current_scene.game.mousewheel_action(direction)
|
escoria.main.current_scene.game.mousewheel_action(direction)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ func _on_wait_finished() -> void:
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * camera_limits_id: The id of the room's camera limits to set
|
# * camera_limits_id: The id of the room's camera limits to set
|
||||||
func set_camera_limits(camera_limit_id : int = 0) -> void:
|
func set_camera_limits(camera_limit_id: int = 0) -> void:
|
||||||
var limits = {}
|
var limits = {}
|
||||||
var scene_camera_limits = current_scene.camera_limits[camera_limit_id]
|
var scene_camera_limits = current_scene.camera_limits[camera_limit_id]
|
||||||
if scene_camera_limits.size.x == 0 and scene_camera_limits.size.y == 0:
|
if scene_camera_limits.size.x == 0 and scene_camera_limits.size.y == 0:
|
||||||
@@ -116,6 +116,13 @@ func set_camera_limits(camera_limit_id : int = 0) -> void:
|
|||||||
current_scene.game.get_node("camera").set_offset(screen_ofs * 2)
|
current_scene.game.get_node("camera").set_offset(screen_ofs * 2)
|
||||||
|
|
||||||
|
|
||||||
|
func save_game(p_savegame_res: Resource) -> void:
|
||||||
|
p_savegame_res.main = {
|
||||||
|
ESCSaveGame.MAIN_LAST_SCENE_GLOBAL_ID_KEY: last_scene_global_id,
|
||||||
|
ESCSaveGame.MAIN_CURRENT_SCENE_FILENAME_KEY: current_scene.filename
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Sanity check that the game.tscn scene's root node script MUST
|
# Sanity check that the game.tscn scene's root node script MUST
|
||||||
# implement the following methods. If they do not exist, stop immediately.
|
# implement the following methods. If they do not exist, stop immediately.
|
||||||
# Implement them, even if empty
|
# Implement them, even if empty
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ func _ready():
|
|||||||
"escoria/ui/main_menu_scene"
|
"escoria/ui/main_menu_scene"
|
||||||
)
|
)
|
||||||
var main_menu_scene = load(main_menu_path).instance()
|
var main_menu_scene = load(main_menu_path).instance()
|
||||||
# get_tree().get_root().call_deferred("add_child", main_menu_scene)
|
|
||||||
escoria.call_deferred("add_child", main_menu_scene)
|
escoria.call_deferred("add_child", main_menu_scene)
|
||||||
escoria.main_menu_instance = main_menu_scene
|
escoria.main_menu_instance = main_menu_scene
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export(NodePath) var inventory_ui_container
|
|||||||
|
|
||||||
|
|
||||||
# A registry of inventory ESCInventoryItem nodes
|
# A registry of inventory ESCInventoryItem nodes
|
||||||
var items_ids_in_inventory : Dictionary = {}
|
var items_ids_in_inventory: Dictionary = {}
|
||||||
|
|
||||||
|
|
||||||
# Fill the items the player has from the start, do sanity checks and
|
# Fill the items the player has from the start, do sanity checks and
|
||||||
@@ -36,7 +36,7 @@ func _ready():
|
|||||||
|
|
||||||
|
|
||||||
# add item to Inventory UI using its id set in its scene
|
# add item to Inventory UI using its id set in its scene
|
||||||
func add_new_item_by_id(item_id : String) -> void:
|
func add_new_item_by_id(item_id: String) -> void:
|
||||||
if item_id.begins_with("i/"):
|
if item_id.begins_with("i/"):
|
||||||
item_id = item_id.rsplit("i/", false)[0]
|
item_id = item_id.rsplit("i/", false)[0]
|
||||||
if not items_ids_in_inventory.has(item_id):
|
if not items_ids_in_inventory.has(item_id):
|
||||||
@@ -108,7 +108,7 @@ func add_new_item_by_id(item_id : String) -> void:
|
|||||||
|
|
||||||
|
|
||||||
# remove item fromInventory UI using its id set in its scene
|
# remove item fromInventory UI using its id set in its scene
|
||||||
func remove_item_by_id(item_id : String) -> void:
|
func remove_item_by_id(item_id: String) -> void:
|
||||||
if items_ids_in_inventory.has(item_id):
|
if items_ids_in_inventory.has(item_id):
|
||||||
var item_inventory_button = items_ids_in_inventory[item_id]
|
var item_inventory_button = items_ids_in_inventory[item_id]
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ func remove_item_by_id(item_id : String) -> void:
|
|||||||
|
|
||||||
|
|
||||||
# React to changes to inventory globals adding items or removing them
|
# React to changes to inventory globals adding items or removing them
|
||||||
func _on_escoria_global_changed(global : String, old_value, new_value) -> void:
|
func _on_escoria_global_changed(global: String, old_value, new_value) -> void:
|
||||||
if !global.begins_with("i/"):
|
if !global.begins_with("i/"):
|
||||||
return
|
return
|
||||||
var item = global.rsplit("i/", false)
|
var item = global.rsplit("i/", false)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
tool
|
tool
|
||||||
extends EditorPlugin
|
extends EditorPlugin
|
||||||
|
|
||||||
|
|
||||||
# Autoloads to instantiate
|
# Autoloads to instantiate
|
||||||
const autoloads = {
|
const autoloads = {
|
||||||
"escoria": "res://addons/escoria-core/game/escoria.tscn",
|
"escoria": "res://addons/escoria-core/game/escoria.tscn",
|
||||||
@@ -18,7 +17,6 @@ func _enter_tree():
|
|||||||
set_escoria_main_settings()
|
set_escoria_main_settings()
|
||||||
set_escoria_debug_settings()
|
set_escoria_debug_settings()
|
||||||
set_escoria_ui_settings()
|
set_escoria_ui_settings()
|
||||||
set_escoria_internal_settings()
|
|
||||||
set_escoria_sound_settings()
|
set_escoria_sound_settings()
|
||||||
set_escoria_platform_settings()
|
set_escoria_platform_settings()
|
||||||
|
|
||||||
@@ -92,6 +90,15 @@ func set_escoria_ui_settings():
|
|||||||
|
|
||||||
# Prepare the settings in the Escoria main category
|
# Prepare the settings in the Escoria main category
|
||||||
func set_escoria_main_settings():
|
func set_escoria_main_settings():
|
||||||
|
|
||||||
|
if !ProjectSettings.has_setting("escoria/main/game_version"):
|
||||||
|
ProjectSettings.set_setting("escoria/main/game_version", "")
|
||||||
|
var game_version_property_info = {
|
||||||
|
"name": "escoria/main/game_version",
|
||||||
|
"type": TYPE_STRING
|
||||||
|
}
|
||||||
|
ProjectSettings.add_property_info(game_version_property_info)
|
||||||
|
|
||||||
if !ProjectSettings.has_setting("escoria/main/game_start_script"):
|
if !ProjectSettings.has_setting("escoria/main/game_start_script"):
|
||||||
ProjectSettings.set_setting("escoria/main/game_start_script", "")
|
ProjectSettings.set_setting("escoria/main/game_start_script", "")
|
||||||
var game_start_script_property_info = {
|
var game_start_script_property_info = {
|
||||||
@@ -121,7 +128,6 @@ func set_escoria_main_settings():
|
|||||||
"type": TYPE_ARRAY,
|
"type": TYPE_ARRAY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
if !ProjectSettings.has_setting("escoria/main/text_lang"):
|
if !ProjectSettings.has_setting("escoria/main/text_lang"):
|
||||||
ProjectSettings.set_setting("escoria/main/text_lang", TranslationServer.get_locale())
|
ProjectSettings.set_setting("escoria/main/text_lang", TranslationServer.get_locale())
|
||||||
var text_lang_property_info = {
|
var text_lang_property_info = {
|
||||||
@@ -140,6 +146,30 @@ func set_escoria_main_settings():
|
|||||||
}
|
}
|
||||||
ProjectSettings.add_property_info(voice_lang_property_info)
|
ProjectSettings.add_property_info(voice_lang_property_info)
|
||||||
|
|
||||||
|
if !ProjectSettings.has_setting("escoria/main/savegames_path"):
|
||||||
|
ProjectSettings.set_setting(
|
||||||
|
"escoria/main/savegames_path",
|
||||||
|
"user://saves/"
|
||||||
|
)
|
||||||
|
var savegames_path_property_info = {
|
||||||
|
"name": "escoria/main/savegames_path",
|
||||||
|
"type": TYPE_STRING,
|
||||||
|
"hint": PROPERTY_HINT_DIR
|
||||||
|
}
|
||||||
|
ProjectSettings.add_property_info(savegames_path_property_info)
|
||||||
|
|
||||||
|
if !ProjectSettings.has_setting("escoria/main/settings_path"):
|
||||||
|
ProjectSettings.set_setting(
|
||||||
|
"escoria/main/settings_path",
|
||||||
|
"user://"
|
||||||
|
)
|
||||||
|
var settings_path_property_info = {
|
||||||
|
"name": "escoria/main/settings_path",
|
||||||
|
"type": TYPE_STRING,
|
||||||
|
"hint": PROPERTY_HINT_DIR
|
||||||
|
}
|
||||||
|
ProjectSettings.add_property_info(settings_path_property_info)
|
||||||
|
|
||||||
|
|
||||||
# Prepare the settings in the Escoria debug category
|
# Prepare the settings in the Escoria debug category
|
||||||
func set_escoria_debug_settings():
|
func set_escoria_debug_settings():
|
||||||
@@ -165,19 +195,6 @@ func set_escoria_debug_settings():
|
|||||||
ProjectSettings.add_property_info(property_info)
|
ProjectSettings.add_property_info(property_info)
|
||||||
|
|
||||||
|
|
||||||
# Prepare the settings in the Escoria internal category
|
|
||||||
func set_escoria_internal_settings():
|
|
||||||
if !ProjectSettings.has_setting("escoria/internals/save_data"):
|
|
||||||
ProjectSettings.set_setting("escoria/internals/save_data", "")
|
|
||||||
var save_data_property_info = {
|
|
||||||
"name": "escoria/internals/save_data",
|
|
||||||
"type": TYPE_STRING,
|
|
||||||
"hint": PROPERTY_HINT_FILE,
|
|
||||||
"hint_string": "*.tscn, *.scn"
|
|
||||||
}
|
|
||||||
ProjectSettings.add_property_info(save_data_property_info)
|
|
||||||
|
|
||||||
|
|
||||||
# Prepare the settings in the Escoria sound settings
|
# Prepare the settings in the Escoria sound settings
|
||||||
func set_escoria_sound_settings():
|
func set_escoria_sound_settings():
|
||||||
if !ProjectSettings.has_setting("escoria/sound/master_volume"):
|
if !ProjectSettings.has_setting("escoria/sound/master_volume"):
|
||||||
@@ -220,6 +237,14 @@ func set_escoria_sound_settings():
|
|||||||
}
|
}
|
||||||
ProjectSettings.add_property_info(speech_data_property_info)
|
ProjectSettings.add_property_info(speech_data_property_info)
|
||||||
|
|
||||||
|
if !ProjectSettings.has_setting("escoria/sound/speech_enabled"):
|
||||||
|
ProjectSettings.set_setting("escoria/sound/speech_enabled", 1)
|
||||||
|
var speech_enabled_property_info = {
|
||||||
|
"name": "escoria/sound/speech_enabled",
|
||||||
|
"type": TYPE_BOOL
|
||||||
|
}
|
||||||
|
ProjectSettings.add_property_info(speech_enabled_property_info)
|
||||||
|
|
||||||
|
|
||||||
# Prepare the settings in the Escoria platform category and may need special
|
# Prepare the settings in the Escoria platform category and may need special
|
||||||
# setting per build
|
# setting per build
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ character: global id of the character who speaks
|
|||||||
params: Dictionary
|
params: Dictionary
|
||||||
line: line of dialog to say
|
line: line of dialog to say
|
||||||
"""
|
"""
|
||||||
func say(character : String, params : Dictionary) :
|
func say(character: String, params: Dictionary) :
|
||||||
show()
|
show()
|
||||||
|
|
||||||
emit_signal("dialog_line_started")
|
emit_signal("dialog_line_started")
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ extends Node2D
|
|||||||
# Clicking under his feet is angle 180.
|
# Clicking under his feet is angle 180.
|
||||||
# etc.
|
# etc.
|
||||||
|
|
||||||
var number_of_directions : int
|
var number_of_directions: int
|
||||||
var angle_horizontal_axes : float
|
var angle_horizontal_axes: float
|
||||||
var angle_vertical_axes : float
|
var angle_vertical_axes: float
|
||||||
var angle_diagonal_axes : float
|
var angle_diagonal_axes: float
|
||||||
const POLYGON_DISTANCE = 400
|
const POLYGON_DISTANCE = 400
|
||||||
|
|
||||||
enum Directions {
|
enum Directions {
|
||||||
@@ -50,55 +50,55 @@ var colors = [
|
|||||||
var result_angles = []
|
var result_angles = []
|
||||||
|
|
||||||
#onready var result_angles_anim = {
|
#onready var result_angles_anim = {
|
||||||
# "angle_offset_rad" : PI/2,
|
# "angle_offset_rad": PI/2,
|
||||||
# Directions.NORTH : {
|
# Directions.NORTH: {
|
||||||
# "direction_base_angle_rad" : 0,
|
# "direction_base_angle_rad": 0,
|
||||||
# "angle_start_deg" : 0,
|
# "angle_start_deg": 0,
|
||||||
# "angle_area_deg" : 0,
|
# "angle_area_deg": 0,
|
||||||
# "animations" : {}
|
# "animations": {}
|
||||||
# },
|
# },
|
||||||
# Directions.NORTHEAST : {
|
# Directions.NORTHEAST: {
|
||||||
# "direction_base_angle_rad" : PI/4,
|
# "direction_base_angle_rad": PI/4,
|
||||||
# "angle_start_deg" : 0,
|
# "angle_start_deg": 0,
|
||||||
# "angle_area_deg" : 0,
|
# "angle_area_deg": 0,
|
||||||
# "animation" : ""
|
# "animation": ""
|
||||||
# },
|
# },
|
||||||
# Directions.EAST : {
|
# Directions.EAST: {
|
||||||
# "direction_base_angle_rad" : PI/2,
|
# "direction_base_angle_rad": PI/2,
|
||||||
# "angle_start_deg" : 0,
|
# "angle_start_deg": 0,
|
||||||
# "angle_area_deg" : 0,
|
# "angle_area_deg": 0,
|
||||||
# "animation" : ""
|
# "animation": ""
|
||||||
# },
|
# },
|
||||||
# Directions.SOUTHEAST : {
|
# Directions.SOUTHEAST: {
|
||||||
# "direction_base_angle_rad" : 3*PI/4,
|
# "direction_base_angle_rad": 3*PI/4,
|
||||||
# "angle_start_deg" : 0,
|
# "angle_start_deg": 0,
|
||||||
# "angle_area_deg" : 0,
|
# "angle_area_deg": 0,
|
||||||
# "animation" : ""
|
# "animation": ""
|
||||||
# },
|
# },
|
||||||
# Directions.SOUTH : {
|
# Directions.SOUTH: {
|
||||||
# "direction_base_angle_rad" : PI,
|
# "direction_base_angle_rad": PI,
|
||||||
# "angle_start_deg" : 0,
|
# "angle_start_deg": 0,
|
||||||
# "angle_area_deg" : 0,
|
# "angle_area_deg": 0,
|
||||||
# "animation" : ""
|
# "animation": ""
|
||||||
#
|
#
|
||||||
# },
|
# },
|
||||||
# Directions.SOUTHWEST : {
|
# Directions.SOUTHWEST: {
|
||||||
# "direction_base_angle_rad" : 5*PI/4,
|
# "direction_base_angle_rad": 5*PI/4,
|
||||||
# "angle_start_deg" : 0,
|
# "angle_start_deg": 0,
|
||||||
# "angle_area_deg" : 0,
|
# "angle_area_deg": 0,
|
||||||
# "animation" : ""
|
# "animation": ""
|
||||||
# },
|
# },
|
||||||
# Directions.WEST : {
|
# Directions.WEST: {
|
||||||
# "direction_base_angle_rad" : 3*PI/2,
|
# "direction_base_angle_rad": 3*PI/2,
|
||||||
# "angle_start_deg" : 0,
|
# "angle_start_deg": 0,
|
||||||
# "angle_area_deg" : 0,
|
# "angle_area_deg": 0,
|
||||||
# "animation" : ""
|
# "animation": ""
|
||||||
# },
|
# },
|
||||||
# Directions.NORTHWEST : {
|
# Directions.NORTHWEST: {
|
||||||
# "direction_base_angle_rad" : 7*PI/4,
|
# "direction_base_angle_rad": 7*PI/4,
|
||||||
# "angle_start_deg" : 0,
|
# "angle_start_deg": 0,
|
||||||
# "angle_area_deg" : 0,
|
# "angle_area_deg": 0,
|
||||||
# "animation" : ""
|
# "animation": ""
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ func _ready():
|
|||||||
$player_animations.add_item(anim_name)
|
$player_animations.add_item(anim_name)
|
||||||
|
|
||||||
# Set initial angles
|
# Set initial angles
|
||||||
var initial_angle : float = 360.0 / 8.0
|
var initial_angle: float = 360.0 / 8.0
|
||||||
$VBoxContainer/angle_x/angle_horiz.text = str(40)
|
$VBoxContainer/angle_x/angle_horiz.text = str(40)
|
||||||
$VBoxContainer/angle_y/angle_vert.text = str(40)
|
$VBoxContainer/angle_y/angle_vert.text = str(40)
|
||||||
$VBoxContainer/angle_diag/angle_diag.text = str(50)
|
$VBoxContainer/angle_diag/angle_diag.text = str(50)
|
||||||
@@ -122,7 +122,7 @@ func _ready():
|
|||||||
calculate_areas()
|
calculate_areas()
|
||||||
|
|
||||||
|
|
||||||
func _on_number_of_directions_text_changed(new_text : String):
|
func _on_number_of_directions_text_changed(new_text: String):
|
||||||
if !new_text.is_valid_integer():
|
if !new_text.is_valid_integer():
|
||||||
return
|
return
|
||||||
number_of_directions = int(new_text)
|
number_of_directions = int(new_text)
|
||||||
@@ -134,12 +134,12 @@ func clear_areas_node():
|
|||||||
n.queue_free()
|
n.queue_free()
|
||||||
|
|
||||||
|
|
||||||
func calculate_areas(nb_directions : int = 8):
|
func calculate_areas(nb_directions: int = 8):
|
||||||
clear_areas_node()
|
clear_areas_node()
|
||||||
var angles = []
|
var angles = []
|
||||||
for i in range(nb_directions):
|
for i in range(nb_directions):
|
||||||
var angle_area : float = 0.0
|
var angle_area: float = 0.0
|
||||||
var start_angle : float = 0.0
|
var start_angle: float = 0.0
|
||||||
# MANUAL
|
# MANUAL
|
||||||
match i:
|
match i:
|
||||||
Directions.EAST,Directions.WEST:
|
Directions.EAST,Directions.WEST:
|
||||||
@@ -162,8 +162,8 @@ func calculate_areas(nb_directions : int = 8):
|
|||||||
$VBoxContainer/VBoxContainer/angles/angle_array.text = str(result_angles)
|
$VBoxContainer/VBoxContainer/angles/angle_array.text = str(result_angles)
|
||||||
construct_scene_nodes(angles)
|
construct_scene_nodes(angles)
|
||||||
|
|
||||||
func construct_scene_nodes(angles):
|
|
||||||
|
|
||||||
|
func construct_scene_nodes(angles):
|
||||||
var areas_nodes = []
|
var areas_nodes = []
|
||||||
for i in angles.size():
|
for i in angles.size():
|
||||||
var polygon_node = Polygon2D.new()
|
var polygon_node = Polygon2D.new()
|
||||||
@@ -188,7 +188,7 @@ func construct_scene_nodes(angles):
|
|||||||
$areas.add_child(polygon_node)
|
$areas.add_child(polygon_node)
|
||||||
|
|
||||||
|
|
||||||
func _on_angle_horiz_text_changed(new_text : String):
|
func _on_angle_horiz_text_changed(new_text: String):
|
||||||
if !new_text.is_valid_float():
|
if !new_text.is_valid_float():
|
||||||
return
|
return
|
||||||
angle_horizontal_axes = float(new_text)
|
angle_horizontal_axes = float(new_text)
|
||||||
@@ -197,7 +197,7 @@ func _on_angle_horiz_text_changed(new_text : String):
|
|||||||
calculate_areas()
|
calculate_areas()
|
||||||
|
|
||||||
|
|
||||||
func _on_angle_vert_text_changed(new_text : String):
|
func _on_angle_vert_text_changed(new_text: String):
|
||||||
if !new_text.is_valid_float():
|
if !new_text.is_valid_float():
|
||||||
return
|
return
|
||||||
angle_vertical_axes = float(new_text)
|
angle_vertical_axes = float(new_text)
|
||||||
@@ -206,7 +206,7 @@ func _on_angle_vert_text_changed(new_text : String):
|
|||||||
calculate_areas()
|
calculate_areas()
|
||||||
|
|
||||||
|
|
||||||
func _on_angle_diag_text_changed(new_text : String):
|
func _on_angle_diag_text_changed(new_text: String):
|
||||||
if !new_text.is_valid_float():
|
if !new_text.is_valid_float():
|
||||||
return
|
return
|
||||||
angle_diagonal_axes = float(new_text)
|
angle_diagonal_axes = float(new_text)
|
||||||
@@ -217,11 +217,11 @@ func _on_angle_diag_text_changed(new_text : String):
|
|||||||
calculate_areas()
|
calculate_areas()
|
||||||
|
|
||||||
|
|
||||||
func _on_area_click(viewport: Object, event: InputEvent, shape_idx: int, area_name : String):
|
func _on_area_click(viewport: Object, event: InputEvent, shape_idx: int, area_name: String):
|
||||||
if event is InputEventMouseButton and event.is_pressed():
|
if event is InputEventMouseButton and event.is_pressed():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func clamp360(angle : float):
|
func clamp360(angle: float):
|
||||||
if angle < 0.0:
|
if angle < 0.0:
|
||||||
while angle < 0.0:
|
while angle < 0.0:
|
||||||
angle += 360.0
|
angle += 360.0
|
||||||
|
|||||||
@@ -64,16 +64,16 @@ func _on_new_text_pressed():
|
|||||||
emit_signal("text_selected", pressed_button.text)
|
emit_signal("text_selected", pressed_button.text)
|
||||||
|
|
||||||
|
|
||||||
func tooltip_distance_to_edge_top(position : Vector2):
|
func tooltip_distance_to_edge_top(position: Vector2):
|
||||||
return position.y
|
return position.y
|
||||||
|
|
||||||
func tooltip_distance_to_edge_bottom(position: Vector2):
|
func tooltip_distance_to_edge_bottom(position: Vector2):
|
||||||
return screen_height - position.y
|
return screen_height - position.y
|
||||||
|
|
||||||
func tooltip_distance_to_edge_left(position : Vector2):
|
func tooltip_distance_to_edge_left(position: Vector2):
|
||||||
return position.x
|
return position.x
|
||||||
|
|
||||||
func tooltip_distance_to_edge_right(position : Vector2):
|
func tooltip_distance_to_edge_right(position: Vector2):
|
||||||
return screen_width - position.x
|
return screen_width - position.x
|
||||||
|
|
||||||
func _on_Control_mouse_moved(mouse_pos):
|
func _on_Control_mouse_moved(mouse_pos):
|
||||||
|
|||||||
@@ -9,191 +9,191 @@
|
|||||||
[ext_resource path="res://game/characters/mark/png/mark_talk_right.png" type="Texture" id=7]
|
[ext_resource path="res://game/characters/mark/png/mark_talk_right.png" type="Texture" id=7]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=1]
|
[sub_resource type="AtlasTexture" id=1]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 2 )
|
||||||
region = Rect2( 48, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=2]
|
|
||||||
atlas = ExtResource( 5 )
|
|
||||||
region = Rect2( 0, 0, 24, 70 )
|
region = Rect2( 0, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=3]
|
[sub_resource type="AtlasTexture" id=2]
|
||||||
atlas = ExtResource( 5 )
|
atlas = ExtResource( 2 )
|
||||||
region = Rect2( 24, 0, 24, 70 )
|
region = Rect2( 24, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=4]
|
[sub_resource type="AtlasTexture" id=3]
|
||||||
atlas = ExtResource( 5 )
|
atlas = ExtResource( 2 )
|
||||||
region = Rect2( 48, 0, 24, 70 )
|
region = Rect2( 48, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=5]
|
[sub_resource type="AtlasTexture" id=4]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 96, 0, 24, 70 )
|
region = Rect2( 96, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=5]
|
||||||
|
atlas = ExtResource( 5 )
|
||||||
|
region = Rect2( 0, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=6]
|
[sub_resource type="AtlasTexture" id=6]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 5 )
|
||||||
region = Rect2( 72, 0, 24, 70 )
|
region = Rect2( 24, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=7]
|
[sub_resource type="AtlasTexture" id=7]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 5 )
|
||||||
region = Rect2( 216, 0, 24, 70 )
|
region = Rect2( 48, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=8]
|
[sub_resource type="AtlasTexture" id=8]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 240, 0, 24, 70 )
|
region = Rect2( 24, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=9]
|
[sub_resource type="AtlasTexture" id=9]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 264, 0, 24, 70 )
|
region = Rect2( 0, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=10]
|
[sub_resource type="AtlasTexture" id=10]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 7 )
|
||||||
region = Rect2( 288, 0, 24, 70 )
|
region = Rect2( 0, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=11]
|
[sub_resource type="AtlasTexture" id=11]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 7 )
|
||||||
region = Rect2( 312, 0, 24, 70 )
|
region = Rect2( 24, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=12]
|
[sub_resource type="AtlasTexture" id=12]
|
||||||
atlas = ExtResource( 7 )
|
atlas = ExtResource( 7 )
|
||||||
region = Rect2( 0, 0, 24, 70 )
|
region = Rect2( 48, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=13]
|
[sub_resource type="AtlasTexture" id=13]
|
||||||
atlas = ExtResource( 7 )
|
atlas = ExtResource( 7 )
|
||||||
region = Rect2( 24, 0, 24, 70 )
|
region = Rect2( 72, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=14]
|
[sub_resource type="AtlasTexture" id=14]
|
||||||
atlas = ExtResource( 7 )
|
atlas = ExtResource( 7 )
|
||||||
region = Rect2( 48, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=15]
|
|
||||||
atlas = ExtResource( 7 )
|
|
||||||
region = Rect2( 72, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=16]
|
|
||||||
atlas = ExtResource( 7 )
|
|
||||||
region = Rect2( 96, 0, 24, 70 )
|
region = Rect2( 96, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=17]
|
[sub_resource type="AtlasTexture" id=15]
|
||||||
atlas = ExtResource( 4 )
|
|
||||||
region = Rect2( 0, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=18]
|
|
||||||
atlas = ExtResource( 4 )
|
|
||||||
region = Rect2( 120, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=19]
|
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 144, 0, 24, 70 )
|
region = Rect2( 144, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=20]
|
[sub_resource type="AtlasTexture" id=16]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 168, 0, 24, 70 )
|
region = Rect2( 168, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=21]
|
[sub_resource type="AtlasTexture" id=17]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 192, 0, 24, 70 )
|
region = Rect2( 192, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=22]
|
[sub_resource type="AtlasTexture" id=18]
|
||||||
atlas = ExtResource( 2 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 0, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=23]
|
|
||||||
atlas = ExtResource( 2 )
|
|
||||||
region = Rect2( 24, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=24]
|
|
||||||
atlas = ExtResource( 2 )
|
|
||||||
region = Rect2( 48, 0, 24, 70 )
|
region = Rect2( 48, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=19]
|
||||||
|
atlas = ExtResource( 4 )
|
||||||
|
region = Rect2( 120, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=20]
|
||||||
|
atlas = ExtResource( 4 )
|
||||||
|
region = Rect2( 216, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=21]
|
||||||
|
atlas = ExtResource( 4 )
|
||||||
|
region = Rect2( 240, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=22]
|
||||||
|
atlas = ExtResource( 4 )
|
||||||
|
region = Rect2( 264, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=23]
|
||||||
|
atlas = ExtResource( 4 )
|
||||||
|
region = Rect2( 288, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=24]
|
||||||
|
atlas = ExtResource( 4 )
|
||||||
|
region = Rect2( 312, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=25]
|
[sub_resource type="AtlasTexture" id=25]
|
||||||
atlas = ExtResource( 6 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 0, 0, 24, 70 )
|
region = Rect2( 72, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=26]
|
[sub_resource type="AtlasTexture" id=26]
|
||||||
atlas = ExtResource( 6 )
|
|
||||||
region = Rect2( 24, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=27]
|
|
||||||
atlas = ExtResource( 4 )
|
|
||||||
region = Rect2( 24, 0, 24, 70 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=28]
|
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 336, 0, 24, 70 )
|
region = Rect2( 336, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=29]
|
[sub_resource type="AtlasTexture" id=27]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 360, 0, 24, 70 )
|
region = Rect2( 360, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=30]
|
[sub_resource type="AtlasTexture" id=28]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 384, 0, 24, 70 )
|
region = Rect2( 384, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=29]
|
||||||
|
atlas = ExtResource( 6 )
|
||||||
|
region = Rect2( 0, 0, 24, 70 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=30]
|
||||||
|
atlas = ExtResource( 6 )
|
||||||
|
region = Rect2( 24, 0, 24, 70 )
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id=31]
|
[sub_resource type="SpriteFrames" id=31]
|
||||||
animations = [ {
|
animations = [ {
|
||||||
"frames": [ SubResource( 1 ) ],
|
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 2 ), SubResource( 3 ) ],
|
||||||
"loop": true,
|
|
||||||
"name": "idle_right",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "speak_down_right",
|
|
||||||
"speed": 6.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 5 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "idle_left",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 6 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "idle_up",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "walk_right",
|
|
||||||
"speed": 6.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "speak_right",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 17 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "idle_down",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 18 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "idle_down_left",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 20 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "walk_down",
|
|
||||||
"speed": 6.0
|
|
||||||
}, {
|
|
||||||
"frames": [ SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 23 ), SubResource( 24 ) ],
|
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "speak_down",
|
"name": "speak_down",
|
||||||
"speed": 6.0
|
"speed": 6.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 25 ), SubResource( 26 ), SubResource( 26 ) ],
|
"frames": [ SubResource( 4 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "speak_up",
|
"name": "idle_left",
|
||||||
"speed": 3.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 27 ) ],
|
"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "speak_down_right",
|
||||||
|
"speed": 6.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 8 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "idle_down_right",
|
"name": "idle_down_right",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 29 ) ],
|
"frames": [ SubResource( 9 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "idle_down",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "speak_right",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 16 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "walk_down",
|
||||||
|
"speed": 6.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 18 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "idle_right",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 19 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "idle_down_left",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "walk_right",
|
||||||
|
"speed": 6.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 25 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "idle_up",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 27 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "walk_up",
|
"name": "walk_up",
|
||||||
"speed": 6.0
|
"speed": 6.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 29 ), SubResource( 30 ), SubResource( 29 ), SubResource( 30 ), SubResource( 30 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "speak_up",
|
||||||
|
"speed": 3.0
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id=32]
|
[sub_resource type="CapsuleShape2D" id=32]
|
||||||
@@ -202,6 +202,7 @@ height = 0.0
|
|||||||
[node name="mark" type="Area2D"]
|
[node name="mark" type="Area2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
global_id = "player"
|
global_id = "player"
|
||||||
|
is_movable = true
|
||||||
dialog_color = Color( 1, 1, 1, 1 )
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
animations = ExtResource( 3 )
|
animations = ExtResource( 3 )
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const dir_angles = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Array of animations for each direction, from UP to RIGHT_UP clockwise
|
# Array of animations for each direction, from UP to RIGHT_UP clockwise
|
||||||
# [animation_name, scale] : scale parameter can be set to -1 to mirror the animation
|
# [animation_name, scale]: scale parameter can be set to -1 to mirror the animation
|
||||||
const directions = [
|
const directions = [
|
||||||
["walk_up", 1], # 0 UP
|
["walk_up", 1], # 0 UP
|
||||||
["walk_up", 1], # 1 RIGHT UP
|
["walk_up", 1], # 1 RIGHT UP
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#]
|
#]
|
||||||
|
|
||||||
# Angle is [from_angle, area_angle]
|
# Angle is [from_angle, area_angle]
|
||||||
# example : on a clock, [180, 45] starts exactly from 6 o'clock (180°)
|
# example: on a clock, [180, 45] starts exactly from 6 o'clock (180°)
|
||||||
# and stops between 7 o'clock and 8 o'clock (45° from 6 o'clock)
|
# and stops between 7 o'clock and 8 o'clock (45° from 6 o'clock)
|
||||||
const dir_angles = [
|
const dir_angles = [
|
||||||
[340, 40], # 0 UP
|
[340, 40], # 0 UP
|
||||||
@@ -24,7 +24,7 @@ const dir_angles = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Array of animations for each direction, from UP to RIGHT_UP clockwise
|
# Array of animations for each direction, from UP to RIGHT_UP clockwise
|
||||||
# [animation_name, scale] : scale parameter can be set to -1 to mirror the animation
|
# [animation_name, scale]: scale parameter can be set to -1 to mirror the animation
|
||||||
const directions = [
|
const directions = [
|
||||||
["walk_up", 1], # 0 UP
|
["walk_up", 1], # 0 UP
|
||||||
["walk_up", 1], # 1 RIGHT UP
|
["walk_up", 1], # 1 RIGHT UP
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ say player "Hey!"
|
|||||||
enable_terrain bridge_open
|
enable_terrain bridge_open
|
||||||
set_global r2_bridge_closed false
|
set_global r2_bridge_closed false
|
||||||
#set_interactive r2_right_platform true
|
#set_interactive r2_right_platform true
|
||||||
|
set_interactive r2_bridge false
|
||||||
stop
|
stop
|
||||||
> [!r2_bridge_closed]
|
> [!r2_bridge_closed]
|
||||||
set_state r2_bridge bridge_close
|
set_state r2_bridge bridge_close
|
||||||
|
|||||||
@@ -16,18 +16,9 @@ player_scene = ExtResource( 4 )
|
|||||||
camera_limits = [ Rect2( 0, 0, 1289, 555 ) ]
|
camera_limits = [ Rect2( 0, 0, 1289, 555 ) ]
|
||||||
|
|
||||||
[node name="walkable_area" parent="." instance=ExtResource( 1 )]
|
[node name="walkable_area" parent="." instance=ExtResource( 1 )]
|
||||||
scales = null
|
|
||||||
bitmaps_scale = Vector2( 1, 1 )
|
|
||||||
lightmap = null
|
|
||||||
player_speed_multiplier = 1.0
|
|
||||||
player_doubleclick_speed_multiplier = 1.5
|
|
||||||
lightmap_modulate = Color( 1, 1, 1, 1 )
|
|
||||||
debug_mode = 1
|
debug_mode = 1
|
||||||
scale_min = 0.3
|
|
||||||
scale_max = 1.0
|
|
||||||
|
|
||||||
[node name="background" parent="." instance=ExtResource( 2 )]
|
[node name="background" parent="." instance=ExtResource( 2 )]
|
||||||
esc_script = ""
|
|
||||||
|
|
||||||
[node name="room_label" type="Label" parent="background"]
|
[node name="room_label" type="Label" parent="background"]
|
||||||
margin_right = 40.0
|
margin_right = 40.0
|
||||||
@@ -44,26 +35,10 @@ __meta__ = {
|
|||||||
script = ExtResource( 7 )
|
script = ExtResource( 7 )
|
||||||
global_id = "r2_right_platform"
|
global_id = "r2_right_platform"
|
||||||
esc_script = "res://game/rooms/room2/esc/right_platform.esc"
|
esc_script = "res://game/rooms/room2/esc/right_platform.esc"
|
||||||
is_exit = false
|
|
||||||
is_trigger = false
|
|
||||||
trigger_in_verb = "trigger_in"
|
|
||||||
trigger_out_verb = "trigger_out"
|
|
||||||
is_interactive = true
|
|
||||||
player_orients_on_arrival = true
|
|
||||||
interaction_direction = 3
|
interaction_direction = 3
|
||||||
tooltip_name = "Right platform"
|
tooltip_name = "Right platform"
|
||||||
default_action = "look"
|
default_action = "look"
|
||||||
combine_if_action_used_among = PoolStringArray( )
|
|
||||||
combine_is_one_way = false
|
|
||||||
use_from_inventory_only = false
|
|
||||||
inventory_item_scene_file = null
|
|
||||||
dialog_color = Color( 1, 1, 1, 1 )
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
interact_positions = {
|
|
||||||
"default": Vector2( 430.893, 451.052 )
|
|
||||||
}
|
|
||||||
animations = null
|
|
||||||
speed = 300
|
|
||||||
v_speed_damp = 1.0
|
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_platform"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_platform"]
|
||||||
polygon = PoolVector2Array( 870.974, 538.342, 827.536, 353.995, 1181.4, 357.174, 1287.34, 413.325, 1289.46, 545.758 )
|
polygon = PoolVector2Array( 870.974, 538.342, 827.536, 353.995, 1181.4, 357.174, 1287.34, 413.325, 1289.46, 545.758 )
|
||||||
@@ -76,25 +51,9 @@ script = ExtResource( 7 )
|
|||||||
global_id = "r2_r_exit"
|
global_id = "r2_r_exit"
|
||||||
esc_script = "res://game/rooms/room2/esc/right_exit.esc"
|
esc_script = "res://game/rooms/room2/esc/right_exit.esc"
|
||||||
is_exit = true
|
is_exit = true
|
||||||
is_trigger = false
|
|
||||||
trigger_in_verb = "trigger_in"
|
|
||||||
trigger_out_verb = "trigger_out"
|
|
||||||
is_interactive = true
|
|
||||||
player_orients_on_arrival = true
|
|
||||||
interaction_direction = 0
|
|
||||||
tooltip_name = "Right exit"
|
tooltip_name = "Right exit"
|
||||||
default_action = "walk"
|
default_action = "walk"
|
||||||
combine_if_action_used_among = PoolStringArray( )
|
|
||||||
combine_is_one_way = false
|
|
||||||
use_from_inventory_only = false
|
|
||||||
inventory_item_scene_file = null
|
|
||||||
dialog_color = Color( 1, 1, 1, 1 )
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
interact_positions = {
|
|
||||||
"default": Vector2( 1225.47, 353.99 )
|
|
||||||
}
|
|
||||||
animations = null
|
|
||||||
speed = 300
|
|
||||||
v_speed_damp = 1.0
|
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_door"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_door"]
|
||||||
polygon = PoolVector2Array( 1177.94, 348.61, 1175.95, 45.3759, 1276.06, 92.0953, 1277.95, 399.407 )
|
polygon = PoolVector2Array( 1177.94, 348.61, 1175.95, 45.3759, 1276.06, 92.0953, 1277.95, 399.407 )
|
||||||
@@ -107,25 +66,9 @@ script = ExtResource( 7 )
|
|||||||
global_id = "r2_l_exit"
|
global_id = "r2_l_exit"
|
||||||
esc_script = "res://game/rooms/room2/esc/left_exit.esc"
|
esc_script = "res://game/rooms/room2/esc/left_exit.esc"
|
||||||
is_exit = true
|
is_exit = true
|
||||||
is_trigger = false
|
|
||||||
trigger_in_verb = "trigger_in"
|
|
||||||
trigger_out_verb = "trigger_out"
|
|
||||||
is_interactive = true
|
|
||||||
player_orients_on_arrival = true
|
|
||||||
interaction_direction = 0
|
|
||||||
tooltip_name = "Left exit"
|
tooltip_name = "Left exit"
|
||||||
default_action = "walk"
|
default_action = "walk"
|
||||||
combine_if_action_used_among = PoolStringArray( )
|
|
||||||
combine_is_one_way = false
|
|
||||||
use_from_inventory_only = false
|
|
||||||
inventory_item_scene_file = null
|
|
||||||
dialog_color = Color( 1, 1, 1, 1 )
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
interact_positions = {
|
|
||||||
"default": Vector2( 52.1462, 384.691 )
|
|
||||||
}
|
|
||||||
animations = null
|
|
||||||
speed = 300
|
|
||||||
v_speed_damp = 1.0
|
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/l_door"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/l_door"]
|
||||||
polygon = PoolVector2Array( -1.37926, 443.158, 7.96461, 122.796, 84.0504, 77.4118, 88.055, 377.751 )
|
polygon = PoolVector2Array( -1.37926, 443.158, 7.96461, 122.796, 84.0504, 77.4118, 88.055, 377.751 )
|
||||||
@@ -137,24 +80,7 @@ position = Vector2( 52.1462, 384.691 )
|
|||||||
position = Vector2( 958.107, 176.401 )
|
position = Vector2( 958.107, 176.401 )
|
||||||
global_id = "r2_button_right"
|
global_id = "r2_button_right"
|
||||||
esc_script = "res://game/rooms/room2/esc/button.esc"
|
esc_script = "res://game/rooms/room2/esc/button.esc"
|
||||||
is_exit = false
|
|
||||||
is_trigger = false
|
|
||||||
trigger_in_verb = "trigger_in"
|
|
||||||
trigger_out_verb = "trigger_out"
|
|
||||||
is_interactive = true
|
|
||||||
player_orients_on_arrival = true
|
|
||||||
interaction_direction = 0
|
|
||||||
combine_if_action_used_among = PoolStringArray( )
|
|
||||||
combine_is_one_way = false
|
|
||||||
use_from_inventory_only = false
|
|
||||||
inventory_item_scene_file = null
|
|
||||||
dialog_color = Color( 0, 1, 0.109804, 1 )
|
dialog_color = Color( 0, 1, 0.109804, 1 )
|
||||||
interact_positions = {
|
|
||||||
"default": Vector2( 987.537, 371.812 )
|
|
||||||
}
|
|
||||||
animations = null
|
|
||||||
speed = 300
|
|
||||||
v_speed_damp = 1.0
|
|
||||||
|
|
||||||
[node name="Position2D" type="Position2D" parent="Hotspots/button_right"]
|
[node name="Position2D" type="Position2D" parent="Hotspots/button_right"]
|
||||||
position = Vector2( 29.4302, 195.411 )
|
position = Vector2( 29.4302, 195.411 )
|
||||||
@@ -166,24 +92,7 @@ __meta__ = {
|
|||||||
position = Vector2( 288.82, 171.439 )
|
position = Vector2( 288.82, 171.439 )
|
||||||
global_id = "r2_button"
|
global_id = "r2_button"
|
||||||
esc_script = "res://game/rooms/room2/esc/button.esc"
|
esc_script = "res://game/rooms/room2/esc/button.esc"
|
||||||
is_exit = false
|
|
||||||
is_trigger = false
|
|
||||||
trigger_in_verb = "trigger_in"
|
|
||||||
trigger_out_verb = "trigger_out"
|
|
||||||
is_interactive = true
|
|
||||||
player_orients_on_arrival = true
|
|
||||||
interaction_direction = 0
|
|
||||||
combine_if_action_used_among = PoolStringArray( )
|
|
||||||
combine_is_one_way = false
|
|
||||||
use_from_inventory_only = false
|
|
||||||
inventory_item_scene_file = null
|
|
||||||
dialog_color = Color( 0, 1, 0.109804, 1 )
|
dialog_color = Color( 0, 1, 0.109804, 1 )
|
||||||
interact_positions = {
|
|
||||||
"default": Vector2( 313.488, 368.437 )
|
|
||||||
}
|
|
||||||
animations = null
|
|
||||||
speed = 300
|
|
||||||
v_speed_damp = 1.0
|
|
||||||
|
|
||||||
[node name="Position2D" type="Position2D" parent="Hotspots/button_left"]
|
[node name="Position2D" type="Position2D" parent="Hotspots/button_left"]
|
||||||
position = Vector2( 24.6681, 196.998 )
|
position = Vector2( 24.6681, 196.998 )
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ say player "I must USE this."
|
|||||||
enable_terrain bridge_closed
|
enable_terrain bridge_closed
|
||||||
set_global r3_bridge_closed true
|
set_global r3_bridge_closed true
|
||||||
set_interactive r3_right_platform false
|
set_interactive r3_right_platform false
|
||||||
|
set_interactive r3_bridge false
|
||||||
stop
|
stop
|
||||||
|
|
||||||
> [!button_broken, r3_bridge_closed]
|
> [!button_broken, r3_bridge_closed]
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
stop
|
stop
|
||||||
|
|
||||||
:ready
|
:ready
|
||||||
set_global bridge_closed false
|
set_global r3_bridge_closed false
|
||||||
set_state r3_button button_broken
|
set_state r3_button button_broken
|
||||||
set_global button_broken true
|
set_global button_broken true
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
extends Panel
|
extends Panel
|
||||||
|
|
||||||
var numbers_array : Array
|
var numbers_array: Array
|
||||||
var next_to_be_pressed : int = 1
|
var next_to_be_pressed: int = 1
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
randomize()
|
randomize()
|
||||||
@@ -32,8 +32,8 @@ func reset():
|
|||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
func _button_pressed(button : Button):
|
func _button_pressed(button: Button):
|
||||||
var number : String= button.text
|
var number: String= button.text
|
||||||
if int(number) != next_to_be_pressed:
|
if int(number) != next_to_be_pressed:
|
||||||
reset()
|
reset()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -8,3 +8,6 @@ OPTIONS_LANGUAGE,Language,Langue
|
|||||||
GENERAL_VOLUME,General,Général
|
GENERAL_VOLUME,General,Général
|
||||||
MUSIC_VOLUME,Music,Musique
|
MUSIC_VOLUME,Music,Musique
|
||||||
SOUND_VOLUME,Sound effects,Effets sonores
|
SOUND_VOLUME,Sound effects,Effets sonores
|
||||||
|
CANCEL,Cancel,Annuler
|
||||||
|
OK,OK,OK
|
||||||
|
ENTER_SAVE_NAME,Enter the save name:,Entrez un nom de sauvegarde
|
||||||
|
|||||||
|
Binary file not shown.
Binary file not shown.
26
game/ui/commons/load/load_game.gd
Normal file
26
game/ui/commons/load/load_game.gd
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
signal back_button_pressed
|
||||||
|
|
||||||
|
export(PackedScene) var slot_ui_scene
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
refresh_savegames()
|
||||||
|
|
||||||
|
func _on_slot_pressed(slot_id: int) -> void:
|
||||||
|
escoria.save_manager.load_game(slot_id)
|
||||||
|
|
||||||
|
func _on_back_pressed():
|
||||||
|
emit_signal("back_button_pressed")
|
||||||
|
|
||||||
|
func refresh_savegames():
|
||||||
|
for slot in $ScrollContainer/slots.get_children():
|
||||||
|
$ScrollContainer/slots.remove_child(slot)
|
||||||
|
|
||||||
|
var saves_list = escoria.save_manager.get_saves_list()
|
||||||
|
for i in saves_list.size():
|
||||||
|
var save_data = saves_list[i+1]
|
||||||
|
var new_slot = slot_ui_scene.instance()
|
||||||
|
$ScrollContainer/slots.add_child(new_slot)
|
||||||
|
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
|
||||||
|
new_slot.connect("pressed", self, "_on_slot_pressed", [i+1])
|
||||||
50
game/ui/commons/load/load_game.tscn
Normal file
50
game/ui/commons/load/load_game.tscn
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||||
|
[ext_resource path="res://game/ui/commons/load_save_slot/load_save_slot.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://game/ui/commons/load/load_game.gd" type="Script" id=3]
|
||||||
|
|
||||||
|
[node name="load_game" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
slot_ui_scene = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="back" type="Button" parent="."]
|
||||||
|
margin_left = 130.0
|
||||||
|
margin_top = 329.0
|
||||||
|
margin_right = 304.0
|
||||||
|
margin_bottom = 383.0
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
text = "OPTIONS_BACK"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||||
|
anchor_left = 0.291
|
||||||
|
anchor_top = 0.369
|
||||||
|
anchor_right = 0.709
|
||||||
|
anchor_bottom = 0.941
|
||||||
|
margin_left = -0.480011
|
||||||
|
margin_top = -1.10001
|
||||||
|
margin_right = 0.479919
|
||||||
|
margin_bottom = -0.900024
|
||||||
|
scroll_horizontal_enabled = false
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="slots" type="VBoxContainer" parent="ScrollContainer"]
|
||||||
|
margin_right = 536.0
|
||||||
|
margin_bottom = 515.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
|
||||||
7
game/ui/commons/load_save_slot/load_save_slot.gd
Normal file
7
game/ui/commons/load_save_slot/load_save_slot.gd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
extends Button
|
||||||
|
|
||||||
|
|
||||||
|
func set_slot_name_date(p_name: String, p_date: String):
|
||||||
|
$VBoxContainer/slot_name.text = p_name
|
||||||
|
$VBoxContainer/date.text = p_date
|
||||||
|
|
||||||
38
game/ui/commons/load_save_slot/load_save_slot.tscn
Normal file
38
game/ui/commons/load_save_slot/load_save_slot.tscn
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||||
|
[ext_resource path="res://game/ui/commons/load_save_slot/load_save_slot.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[node name="slot" type="Button"]
|
||||||
|
margin_right = 665.0
|
||||||
|
margin_bottom = 86.0
|
||||||
|
rect_min_size = Vector2( 0, 100 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
alignment = 1
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="slot_name" type="Label" parent="VBoxContainer"]
|
||||||
|
margin_top = 27.0
|
||||||
|
margin_right = 665.0
|
||||||
|
margin_bottom = 48.0
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
text = "slot_name"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="date" type="Label" parent="VBoxContainer"]
|
||||||
|
margin_top = 52.0
|
||||||
|
margin_right = 665.0
|
||||||
|
margin_bottom = 73.0
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
text = "date"
|
||||||
|
align = 1
|
||||||
@@ -25,24 +25,25 @@ func _on_continue_pressed():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func switch_language(lang: String):
|
||||||
|
|
||||||
|
|
||||||
func switch_language(lang : String):
|
|
||||||
TranslationServer.set_locale(lang)
|
TranslationServer.set_locale(lang)
|
||||||
|
|
||||||
|
|
||||||
func _on_new_game_pressed():
|
func _on_new_game_pressed():
|
||||||
escoria.new_game()
|
escoria.new_game()
|
||||||
|
|
||||||
|
|
||||||
func _on_load_game_pressed():
|
func _on_load_game_pressed():
|
||||||
# Show Loading screen
|
$Panel/main.hide()
|
||||||
pass
|
$Panel/load_game.refresh_savegames()
|
||||||
|
$Panel/load_game.show()
|
||||||
|
|
||||||
|
|
||||||
func _on_options_pressed():
|
func _on_options_pressed():
|
||||||
$Panel/main.hide()
|
$Panel/main.hide()
|
||||||
$Panel/options.show()
|
$Panel/options.show()
|
||||||
|
|
||||||
|
|
||||||
func _on_quit_pressed():
|
func _on_quit_pressed():
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|
||||||
@@ -50,8 +51,12 @@ func _on_quit_pressed():
|
|||||||
###########################################################################
|
###########################################################################
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
||||||
|
func _on_options_back_button_pressed():
|
||||||
func _on_back_pressed():
|
|
||||||
$Panel/options.hide()
|
$Panel/options.hide()
|
||||||
$Panel/main.show()
|
$Panel/main.show()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_load_game_back_button_pressed():
|
||||||
|
$Panel/load_game.hide()
|
||||||
|
$Panel/main.show()
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://game/ui/commons/main_menu/main_menu.gd" type="Script" id=1]
|
[ext_resource path="res://game/ui/commons/main_menu/main_menu.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://game/ui/commons/main_menu/main.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://game/ui/commons/main_menu/main.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/escoria-core/logo/escoria-logo-small.png" type="Texture" id=3]
|
[ext_resource path="res://addons/escoria-core/logo/escoria-logo-small.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://game/ui/commons/main_menu/options.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://game/ui/commons/options/options.tscn" type="PackedScene" id=4]
|
||||||
|
[ext_resource path="res://game/ui/commons/load/load_game.tscn" type="PackedScene" id=5]
|
||||||
|
|
||||||
[node name="main_menu" type="Control"]
|
[node name="main_menu" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -38,11 +39,14 @@ __meta__ = {
|
|||||||
[node name="options" parent="Panel" instance=ExtResource( 4 )]
|
[node name="options" parent="Panel" instance=ExtResource( 4 )]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
|
[node name="load_game" parent="Panel" instance=ExtResource( 5 )]
|
||||||
|
visible = false
|
||||||
|
|
||||||
[connection signal="pressed" from="Panel/main/new_game" to="." method="_on_new_game_pressed"]
|
[connection signal="pressed" from="Panel/main/new_game" to="." method="_on_new_game_pressed"]
|
||||||
[connection signal="pressed" from="Panel/main/load_game" to="." method="_on_load_game_pressed"]
|
[connection signal="pressed" from="Panel/main/load_game" to="." method="_on_load_game_pressed"]
|
||||||
[connection signal="pressed" from="Panel/main/options" to="." method="_on_options_pressed"]
|
[connection signal="pressed" from="Panel/main/options" to="." method="_on_options_pressed"]
|
||||||
[connection signal="pressed" from="Panel/main/quit" to="." method="_on_quit_pressed"]
|
[connection signal="pressed" from="Panel/main/quit" to="." method="_on_quit_pressed"]
|
||||||
[connection signal="pressed" from="Panel/options/back" to="." method="_on_back_pressed"]
|
[connection signal="back_button_pressed" from="Panel/options" to="." method="_on_options_back_button_pressed"]
|
||||||
|
[connection signal="back_button_pressed" from="Panel/load_game" to="." method="_on_load_game_back_button_pressed"]
|
||||||
|
|
||||||
[editable path="Panel/main"]
|
[editable path="Panel/main"]
|
||||||
[editable path="Panel/options"]
|
|
||||||
|
|||||||
@@ -1,35 +1,63 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
signal back_button_pressed
|
||||||
|
|
||||||
|
onready var settings_changed = false
|
||||||
|
onready var backup_settings
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
initialize_options(escoria.settings)
|
initialize_options(escoria.settings)
|
||||||
|
|
||||||
|
|
||||||
|
func show():
|
||||||
|
backup_settings = escoria.settings.duplicate()
|
||||||
|
initialize_options(backup_settings)
|
||||||
|
visible = true
|
||||||
|
|
||||||
|
|
||||||
func initialize_options(p_settings):
|
func initialize_options(p_settings):
|
||||||
$options/general_volume.value = p_settings["master_volume"]
|
$options/general_volume.value = p_settings["master_volume"]
|
||||||
$options/sound_volume.value = p_settings["sfx_volume"]
|
$options/sound_volume.value = p_settings["sfx_volume"]
|
||||||
$options/music_volume.value = p_settings["music_volume"]
|
$options/music_volume.value = p_settings["music_volume"]
|
||||||
|
|
||||||
func greyout_other_languages(except_lang : String) -> void:
|
|
||||||
|
func greyout_other_languages(except_lang: String) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _on_language_input(event : InputEvent, language : String):
|
|
||||||
|
func _on_language_input(event: InputEvent, language: String):
|
||||||
if event.is_pressed():
|
if event.is_pressed():
|
||||||
TranslationServer.set_locale(language)
|
TranslationServer.set_locale(language)
|
||||||
escoria.settings["text_lang"] = language
|
escoria.settings["text_lang"] = language
|
||||||
escoria.save_data.save_settings(escoria.settings, null)
|
settings_changed = true
|
||||||
|
|
||||||
|
|
||||||
func _on_sound_volume_changed(value):
|
func _on_sound_volume_changed(value):
|
||||||
escoria.settings["sfx_volume"] = value
|
escoria.settings["sfx_volume"] = value
|
||||||
escoria.save_data.save_settings(escoria.settings, null)
|
|
||||||
escoria._on_settings_loaded(escoria.settings)
|
escoria._on_settings_loaded(escoria.settings)
|
||||||
|
settings_changed = true
|
||||||
|
|
||||||
|
|
||||||
func _on_music_volume_changed(value):
|
func _on_music_volume_changed(value):
|
||||||
escoria.settings["music_volume"] = value
|
escoria.settings["music_volume"] = value
|
||||||
escoria.save_data.save_settings(escoria.settings, null)
|
|
||||||
escoria._on_settings_loaded(escoria.settings)
|
escoria._on_settings_loaded(escoria.settings)
|
||||||
|
settings_changed = true
|
||||||
|
|
||||||
|
|
||||||
func _on_general_volume_changed(value):
|
func _on_general_volume_changed(value):
|
||||||
escoria.settings["master_volume"] = value
|
escoria.settings["master_volume"] = value
|
||||||
escoria.save_data.save_settings(escoria.settings, null)
|
|
||||||
escoria._on_settings_loaded(escoria.settings)
|
escoria._on_settings_loaded(escoria.settings)
|
||||||
|
settings_changed = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_apply_pressed():
|
||||||
|
escoria.save_manager.save_settings()
|
||||||
|
settings_changed = false
|
||||||
|
emit_signal("back_button_pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_back_pressed():
|
||||||
|
escoria.settings = backup_settings
|
||||||
|
escoria._on_settings_loaded(escoria.settings)
|
||||||
|
emit_signal("back_button_pressed")
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||||
[ext_resource path="res://game/ui/commons/main_menu/flags/en_EN_small.png" type="Texture" id=2]
|
[ext_resource path="res://game/ui/commons/main_menu/flags/en_EN_small.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://game/ui/commons/main_menu/flags/fr_FR_small.png" type="Texture" id=3]
|
[ext_resource path="res://game/ui/commons/main_menu/flags/fr_FR_small.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://game/ui/commons/main_menu/options.gd" type="Script" id=4]
|
[ext_resource path="res://game/ui/commons/options/options.gd" type="Script" id=4]
|
||||||
|
|
||||||
[node name="options" type="Control"]
|
[node name="options" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -125,8 +125,21 @@ max_value = 1.0
|
|||||||
step = 0.001
|
step = 0.001
|
||||||
value = 0.001
|
value = 0.001
|
||||||
|
|
||||||
|
[node name="apply" type="Button" parent="."]
|
||||||
|
margin_left = 364.0
|
||||||
|
margin_top = 712.0
|
||||||
|
margin_right = 544.0
|
||||||
|
margin_bottom = 767.0
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
text = "APPLY"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
|
||||||
[connection signal="gui_input" from="options/flags/fr" to="." method="_on_language_input" binds= [ "fr" ]]
|
[connection signal="gui_input" from="options/flags/fr" to="." method="_on_language_input" binds= [ "fr" ]]
|
||||||
[connection signal="gui_input" from="options/flags/en" to="." method="_on_language_input" binds= [ "en" ]]
|
[connection signal="gui_input" from="options/flags/en" to="." method="_on_language_input" binds= [ "en" ]]
|
||||||
[connection signal="value_changed" from="options/general_volume" to="." method="_on_general_volume_changed"]
|
[connection signal="value_changed" from="options/general_volume" to="." method="_on_general_volume_changed"]
|
||||||
[connection signal="value_changed" from="options/sound_volume" to="." method="_on_sound_volume_changed"]
|
[connection signal="value_changed" from="options/sound_volume" to="." method="_on_sound_volume_changed"]
|
||||||
[connection signal="value_changed" from="options/music_volume" to="." method="_on_music_volume_changed"]
|
[connection signal="value_changed" from="options/music_volume" to="." method="_on_music_volume_changed"]
|
||||||
|
[connection signal="pressed" from="apply" to="." method="_on_apply_pressed"]
|
||||||
@@ -6,12 +6,25 @@ func _on_continue_pressed():
|
|||||||
|
|
||||||
|
|
||||||
func _on_save_game_pressed():
|
func _on_save_game_pressed():
|
||||||
pass
|
$Panel/VBoxContainer.hide()
|
||||||
|
$save_game.show()
|
||||||
|
|
||||||
|
|
||||||
func _on_load_game_pressed():
|
func _on_load_game_pressed():
|
||||||
pass
|
$Panel/VBoxContainer.hide()
|
||||||
|
$load_game.refresh_savegames()
|
||||||
|
$load_game.show()
|
||||||
|
|
||||||
|
|
||||||
func _on_quit_pressed():
|
func _on_quit_pressed():
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_save_game_back_button_pressed():
|
||||||
|
$Panel/VBoxContainer.show()
|
||||||
|
$save_game.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_load_game_back_button_pressed():
|
||||||
|
$Panel/VBoxContainer.show()
|
||||||
|
$load_game.hide()
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://game/ui/commons/pause_menu/pause_menu.gd" type="Script" id=1]
|
[ext_resource path="res://game/ui/commons/pause_menu/pause_menu.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=2]
|
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=2]
|
||||||
[ext_resource path="res://addons/escoria-core/logo/escoria-logo-small.png" type="Texture" id=3]
|
[ext_resource path="res://addons/escoria-core/logo/escoria-logo-small.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://game/ui/commons/save/save_game.tscn" type="PackedScene" id=4]
|
||||||
|
[ext_resource path="res://game/ui/commons/load/load_game.tscn" type="PackedScene" id=5]
|
||||||
|
|
||||||
[node name="pause_menu" type="Control"]
|
[node name="pause_menu" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -87,7 +89,15 @@ __meta__ = {
|
|||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="save_game" parent="." instance=ExtResource( 4 )]
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
[node name="load_game" parent="." instance=ExtResource( 5 )]
|
||||||
|
visible = false
|
||||||
|
|
||||||
[connection signal="pressed" from="Panel/VBoxContainer/continue" to="." method="_on_continue_pressed"]
|
[connection signal="pressed" from="Panel/VBoxContainer/continue" to="." method="_on_continue_pressed"]
|
||||||
[connection signal="pressed" from="Panel/VBoxContainer/save_game" to="." method="_on_save_game_pressed"]
|
[connection signal="pressed" from="Panel/VBoxContainer/save_game" to="." method="_on_save_game_pressed"]
|
||||||
[connection signal="pressed" from="Panel/VBoxContainer/load_game" to="." method="_on_load_game_pressed"]
|
[connection signal="pressed" from="Panel/VBoxContainer/load_game" to="." method="_on_load_game_pressed"]
|
||||||
[connection signal="pressed" from="Panel/VBoxContainer/quit" to="." method="_on_quit_pressed"]
|
[connection signal="pressed" from="Panel/VBoxContainer/quit" to="." method="_on_quit_pressed"]
|
||||||
|
[connection signal="back_button_pressed" from="save_game" to="." method="_on_save_game_back_button_pressed"]
|
||||||
|
[connection signal="back_button_pressed" from="load_game" to="." method="_on_load_game_back_button_pressed"]
|
||||||
|
|||||||
59
game/ui/commons/save/save_game.gd
Normal file
59
game/ui/commons/save/save_game.gd
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
signal back_button_pressed
|
||||||
|
|
||||||
|
export(PackedScene) var slot_ui_scene
|
||||||
|
|
||||||
|
var slot_pressed
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
refresh_savegames()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_slot_pressed(p_slot_n: int):
|
||||||
|
slot_pressed = p_slot_n
|
||||||
|
if escoria.save_manager.save_game_exists(p_slot_n):
|
||||||
|
# TODO Manage save override, ask for confirmation
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
$save_name_popup.popup()
|
||||||
|
|
||||||
|
|
||||||
|
func refresh_savegames():
|
||||||
|
for slot in $ScrollContainer/slots.get_children():
|
||||||
|
$ScrollContainer/slots.remove_child(slot)
|
||||||
|
|
||||||
|
var saves_list = escoria.save_manager.get_saves_list()
|
||||||
|
for i in saves_list.size():
|
||||||
|
var save_data = saves_list[i+1]
|
||||||
|
var new_slot = slot_ui_scene.instance()
|
||||||
|
$ScrollContainer/slots.add_child(new_slot)
|
||||||
|
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
|
||||||
|
new_slot.connect("pressed", self, "_on_slot_pressed", [i+1])
|
||||||
|
|
||||||
|
var datetime = OS.get_datetime()
|
||||||
|
var datetime_string = "%02d/%02d/%02d %02d:%02d" % [
|
||||||
|
datetime["day"],
|
||||||
|
datetime["month"],
|
||||||
|
datetime["year"],
|
||||||
|
datetime["hour"],
|
||||||
|
datetime["minute"],
|
||||||
|
]
|
||||||
|
var new_slot = slot_ui_scene.instance()
|
||||||
|
$ScrollContainer/slots.add_child(new_slot)
|
||||||
|
new_slot.set_slot_name_date(tr("New save"), datetime_string)
|
||||||
|
new_slot.connect("pressed", self, "_on_slot_pressed", [saves_list.size()+1])
|
||||||
|
|
||||||
|
|
||||||
|
func _on_back_pressed():
|
||||||
|
emit_signal("back_button_pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_save_name_popup_savegame_name_ok(p_savename: String):
|
||||||
|
escoria.save_manager.save_game(slot_pressed, p_savename)
|
||||||
|
refresh_savegames()
|
||||||
|
slot_pressed = null
|
||||||
|
|
||||||
|
|
||||||
|
func _on_save_name_popup_savegame_cancel():
|
||||||
|
pass
|
||||||
54
game/ui/commons/save/save_game.tscn
Normal file
54
game/ui/commons/save/save_game.tscn
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://game/ui/commons/load_save_slot/load_save_slot.tscn" type="PackedScene" id=1]
|
||||||
|
[ext_resource path="res://game/ui/commons/save/save_game.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3]
|
||||||
|
[ext_resource path="res://game/ui/commons/save/save_name_popup.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
[node name="save_game" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
slot_ui_scene = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="back" type="Button" parent="."]
|
||||||
|
margin_left = 130.0
|
||||||
|
margin_top = 329.0
|
||||||
|
margin_right = 304.0
|
||||||
|
margin_bottom = 383.0
|
||||||
|
custom_fonts/font = ExtResource( 3 )
|
||||||
|
text = "OPTIONS_BACK"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||||
|
anchor_left = 0.284
|
||||||
|
anchor_top = 0.367
|
||||||
|
anchor_right = 0.709
|
||||||
|
anchor_bottom = 0.94
|
||||||
|
margin_left = 8.47998
|
||||||
|
margin_top = 0.699982
|
||||||
|
margin_right = 0.479919
|
||||||
|
margin_bottom = -6.10352e-05
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="slots" type="VBoxContainer" parent="ScrollContainer"]
|
||||||
|
margin_right = 536.0
|
||||||
|
margin_bottom = 515.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="save_name_popup" parent="." instance=ExtResource( 4 )]
|
||||||
|
|
||||||
|
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
|
||||||
|
[connection signal="savegame_cancel" from="save_name_popup" to="." method="_on_save_name_popup_savegame_cancel"]
|
||||||
|
[connection signal="savegame_name_ok" from="save_name_popup" to="." method="_on_save_name_popup_savegame_name_ok"]
|
||||||
14
game/ui/commons/save/save_name_popup.gd
Normal file
14
game/ui/commons/save/save_name_popup.gd
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
extends PopupDialog
|
||||||
|
|
||||||
|
signal savegame_name_ok(savegame_name)
|
||||||
|
signal savegame_cancel
|
||||||
|
|
||||||
|
func _on_cancel_pressed():
|
||||||
|
emit_signal("savegame_cancel")
|
||||||
|
hide()
|
||||||
|
|
||||||
|
func _on_ok_pressed():
|
||||||
|
if not $MarginContainer/VBoxContainer/LineEdit.text.empty():
|
||||||
|
emit_signal("savegame_name_ok", $MarginContainer/VBoxContainer/LineEdit.text)
|
||||||
|
$MarginContainer/VBoxContainer/LineEdit.clear()
|
||||||
|
hide()
|
||||||
81
game/ui/commons/save/save_name_popup.tscn
Normal file
81
game/ui/commons/save/save_name_popup.tscn
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||||
|
[ext_resource path="res://game/ui/commons/save/save_name_popup.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[node name="save_name_popup" type="PopupDialog"]
|
||||||
|
margin_left = 429.0
|
||||||
|
margin_top = 281.0
|
||||||
|
margin_right = 863.0
|
||||||
|
margin_bottom = 442.0
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
custom_constants/margin_right = 30
|
||||||
|
custom_constants/margin_top = 30
|
||||||
|
custom_constants/margin_left = 30
|
||||||
|
custom_constants/margin_bottom = 30
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||||
|
margin_left = 30.0
|
||||||
|
margin_top = 30.0
|
||||||
|
margin_right = 404.0
|
||||||
|
margin_bottom = 131.0
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||||
|
margin_right = 374.0
|
||||||
|
margin_bottom = 21.0
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
text = "ENTER_SAVE_NAME"
|
||||||
|
|
||||||
|
[node name="LineEdit" type="LineEdit" parent="MarginContainer/VBoxContainer"]
|
||||||
|
margin_top = 25.0
|
||||||
|
margin_right = 374.0
|
||||||
|
margin_bottom = 56.0
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = -224.0
|
||||||
|
margin_top = -56.0
|
||||||
|
margin_right = -30.0
|
||||||
|
margin_bottom = -20.0
|
||||||
|
custom_constants/separation = 10
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="cancel" type="Button" parent="HBoxContainer"]
|
||||||
|
margin_right = 96.0
|
||||||
|
margin_bottom = 36.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
text = "CANCEL"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ok" type="Button" parent="HBoxContainer"]
|
||||||
|
margin_left = 106.0
|
||||||
|
margin_right = 194.0
|
||||||
|
margin_bottom = 36.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
text = "OK"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[connection signal="pressed" from="HBoxContainer/cancel" to="." method="_on_cancel_pressed"]
|
||||||
|
[connection signal="pressed" from="HBoxContainer/ok" to="." method="_on_ok_pressed"]
|
||||||
@@ -4,26 +4,26 @@ extends ESCGame
|
|||||||
"""
|
"""
|
||||||
Implement methods to react to inputs.
|
Implement methods to react to inputs.
|
||||||
|
|
||||||
- left_click_on_bg(position : Vector2)
|
- left_click_on_bg(position: Vector2)
|
||||||
- right_click_on_bg(position : Vector2)
|
- right_click_on_bg(position: Vector2)
|
||||||
- left_double_click_on_bg(position : Vector2)
|
- left_double_click_on_bg(position: Vector2)
|
||||||
|
|
||||||
- element_focused(element_id : String)
|
- element_focused(element_id: String)
|
||||||
- element_unfocused()
|
- element_unfocused()
|
||||||
|
|
||||||
- left_click_on_item(item_global_id : String, event : InputEvent)
|
- left_click_on_item(item_global_id: String, event: InputEvent)
|
||||||
- right_click_on_item(item_global_id : String, event : InputEvent)
|
- right_click_on_item(item_global_id: String, event: InputEvent)
|
||||||
- left_double_click_on_item(item_global_id : String, event : InputEvent)
|
- left_double_click_on_item(item_global_id: String, event: InputEvent)
|
||||||
|
|
||||||
- left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
- left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||||
- right_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
- right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||||
- left_double_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
- left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||||
- inventory_item_focused(inventory_item_global_id : String)
|
- inventory_item_focused(inventory_item_global_id: String)
|
||||||
- inventory_item_unfocused()
|
- inventory_item_unfocused()
|
||||||
- open_inventory()
|
- open_inventory()
|
||||||
- close_inventory()
|
- close_inventory()
|
||||||
|
|
||||||
- mousewheel_action(direction : int)
|
- mousewheel_action(direction: int)
|
||||||
|
|
||||||
- hide_ui()
|
- hide_ui()
|
||||||
- show_ui()
|
- show_ui()
|
||||||
@@ -47,17 +47,17 @@ func _input(event):
|
|||||||
|
|
||||||
## BACKGROUND ##
|
## BACKGROUND ##
|
||||||
|
|
||||||
func left_click_on_bg(position : Vector2) -> void:
|
func left_click_on_bg(position: Vector2) -> void:
|
||||||
escoria.do("walk", ["player", position])
|
escoria.do("walk", ["player", position])
|
||||||
escoria.action_manager.clear_current_action()
|
escoria.action_manager.clear_current_action()
|
||||||
verbs_menu.unselect_actions()
|
verbs_menu.unselect_actions()
|
||||||
|
|
||||||
func right_click_on_bg(position : Vector2) -> void:
|
func right_click_on_bg(position: Vector2) -> void:
|
||||||
escoria.do("walk", ["player", position])
|
escoria.do("walk", ["player", position])
|
||||||
escoria.action_manager.clear_current_action()
|
escoria.action_manager.clear_current_action()
|
||||||
verbs_menu.unselect_actions()
|
verbs_menu.unselect_actions()
|
||||||
|
|
||||||
func left_double_click_on_bg(position : Vector2) -> void:
|
func left_double_click_on_bg(position: Vector2) -> void:
|
||||||
escoria.do("walk", ["player", position, true])
|
escoria.do("walk", ["player", position, true])
|
||||||
escoria.action_manager.clear_current_action()
|
escoria.action_manager.clear_current_action()
|
||||||
verbs_menu.unselect_actions()
|
verbs_menu.unselect_actions()
|
||||||
@@ -65,7 +65,7 @@ func left_double_click_on_bg(position : Vector2) -> void:
|
|||||||
|
|
||||||
## ITEM FOCUS ##
|
## ITEM FOCUS ##
|
||||||
|
|
||||||
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
|
||||||
tooltip.set_target(target_obj.tooltip_name)
|
tooltip.set_target(target_obj.tooltip_name)
|
||||||
|
|
||||||
@@ -80,30 +80,30 @@ func element_unfocused() -> void:
|
|||||||
|
|
||||||
## ITEMS ##
|
## ITEMS ##
|
||||||
|
|
||||||
func left_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.do("item_left_click", [item_global_id, event])
|
escoria.do("item_left_click", [item_global_id, event])
|
||||||
|
|
||||||
func right_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.action_manager.set_current_action(verbs_menu.selected_action)
|
escoria.action_manager.set_current_action(verbs_menu.selected_action)
|
||||||
escoria.do("item_right_click", [item_global_id, event])
|
escoria.do("item_right_click", [item_global_id, event])
|
||||||
|
|
||||||
func left_double_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
func left_double_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.do("item_left_click", [item_global_id, event])
|
escoria.do("item_left_click", [item_global_id, event])
|
||||||
|
|
||||||
|
|
||||||
## INVENTORY ##
|
## INVENTORY ##
|
||||||
func left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.do("item_left_click", [inventory_item_global_id, event])
|
escoria.do("item_left_click", [inventory_item_global_id, event])
|
||||||
|
|
||||||
|
|
||||||
func right_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.action_manager.set_current_action(verbs_menu.selected_action)
|
escoria.action_manager.set_current_action(verbs_menu.selected_action)
|
||||||
escoria.do("item_right_click", [inventory_item_global_id, event])
|
escoria.do("item_right_click", [inventory_item_global_id, event])
|
||||||
|
|
||||||
func left_double_click_on_inventory_item(_inventory_item_global_id : String, _event : InputEvent) -> void:
|
func left_double_click_on_inventory_item(_inventory_item_global_id: String, _event: InputEvent) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
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(
|
var target_obj = escoria.object_manager.get_object(
|
||||||
inventory_item_global_id
|
inventory_item_global_id
|
||||||
).node
|
).node
|
||||||
@@ -128,13 +128,14 @@ func close_inventory():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func mousewheel_action(_direction : int):
|
func mousewheel_action(_direction: int):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func hide_ui():
|
func hide_ui():
|
||||||
$ui/panel_down.hide()
|
$ui/panel_down.hide()
|
||||||
verbs_menu.hide()
|
verbs_menu.hide()
|
||||||
|
$ui/panel_down/verbs_layer/room_select.hide()
|
||||||
$ui/panel_down/inventory_layer/inventory_ui.hide()
|
$ui/panel_down/inventory_layer/inventory_ui.hide()
|
||||||
tooltip.hide()
|
tooltip.hide()
|
||||||
|
|
||||||
@@ -142,6 +143,7 @@ func hide_ui():
|
|||||||
func show_ui():
|
func show_ui():
|
||||||
$ui/panel_down.show()
|
$ui/panel_down.show()
|
||||||
verbs_menu.show()
|
verbs_menu.show()
|
||||||
|
$ui/panel_down/verbs_layer/room_select.show()
|
||||||
$ui/panel_down/inventory_layer/inventory_ui.show()
|
$ui/panel_down/inventory_layer/inventory_ui.show()
|
||||||
tooltip.show()
|
tooltip.show()
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ This script is totally user-defined. It does exactly what the user wants the
|
|||||||
inventory to look like. It only requires 4 functions to be defined:
|
inventory to look like. It only requires 4 functions to be defined:
|
||||||
- is_empty() -> bool
|
- is_empty() -> bool
|
||||||
- get_items() -> Array
|
- get_items() -> Array
|
||||||
- add_item(inventory_item : ESCInventoryItem)
|
- add_item(inventory_item: ESCInventoryItem)
|
||||||
- remove_item(inventory_item : ESCInventoryItem)
|
- remove_item(inventory_item: ESCInventoryItem)
|
||||||
The user is free to implement these methods the way s-he likes.
|
The user is free to implement these methods the way s-he likes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ func is_empty() -> bool:
|
|||||||
func get_items() -> Array:
|
func get_items() -> Array:
|
||||||
return current_nodes_in_container.keys()
|
return current_nodes_in_container.keys()
|
||||||
|
|
||||||
func add_item(inventory_item : ESCInventoryItem):
|
func add_item(inventory_item: ESCInventoryItem):
|
||||||
var center_container = CenterContainer.new()
|
var center_container = CenterContainer.new()
|
||||||
center_container.size_flags_horizontal = SIZE_EXPAND_FILL
|
center_container.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||||
center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||||
@@ -28,7 +28,7 @@ func add_item(inventory_item : ESCInventoryItem):
|
|||||||
add_child(center_container)
|
add_child(center_container)
|
||||||
current_nodes_in_container[inventory_item] = center_container
|
current_nodes_in_container[inventory_item] = center_container
|
||||||
|
|
||||||
func remove_item(inventory_item : ESCInventoryItem):
|
func remove_item(inventory_item: ESCInventoryItem):
|
||||||
var node_to_remove = current_nodes_in_container[inventory_item]
|
var node_to_remove = current_nodes_in_container[inventory_item]
|
||||||
current_nodes_in_container.erase(node_to_remove)
|
current_nodes_in_container.erase(node_to_remove)
|
||||||
node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ func _ready():
|
|||||||
but.connect("pressed", self, "_on_action_selected", [but.name])
|
but.connect("pressed", self, "_on_action_selected", [but.name])
|
||||||
but.toggle_mode = true
|
but.toggle_mode = true
|
||||||
|
|
||||||
func _on_action_selected(action : String):
|
func _on_action_selected(action: String):
|
||||||
escoria.action_manager.set_current_action(action)
|
escoria.action_manager.set_current_action(action)
|
||||||
|
|
||||||
for but in get_children():
|
for but in get_children():
|
||||||
@@ -23,7 +23,7 @@ func unselect_actions():
|
|||||||
for but in get_children():
|
for but in get_children():
|
||||||
but.set_pressed(false)
|
but.set_pressed(false)
|
||||||
|
|
||||||
func set_by_name(action_name : String):
|
func set_by_name(action_name: String):
|
||||||
selected_action = action_name
|
selected_action = action_name
|
||||||
for but in get_children():
|
for but in get_children():
|
||||||
but.set_pressed(but.get_name() == action_name)
|
but.set_pressed(but.get_name() == action_name)
|
||||||
|
|||||||
@@ -4,26 +4,26 @@ extends ESCGame
|
|||||||
"""
|
"""
|
||||||
Implement methods to react to inputs.
|
Implement methods to react to inputs.
|
||||||
|
|
||||||
- left_click_on_bg(position : Vector2)
|
- left_click_on_bg(position: Vector2)
|
||||||
- right_click_on_bg(position : Vector2)
|
- right_click_on_bg(position: Vector2)
|
||||||
- left_double_click_on_bg(position : Vector2)
|
- left_double_click_on_bg(position: Vector2)
|
||||||
|
|
||||||
- element_focused(element_id : String)
|
- element_focused(element_id: String)
|
||||||
- element_unfocused()
|
- element_unfocused()
|
||||||
|
|
||||||
- left_click_on_item(item_global_id : String, event : InputEvent)
|
- left_click_on_item(item_global_id: String, event: InputEvent)
|
||||||
- right_click_on_item(item_global_id : String, event : InputEvent)
|
- right_click_on_item(item_global_id: String, event: InputEvent)
|
||||||
- left_double_click_on_item(item_global_id : String, event : InputEvent)
|
- left_double_click_on_item(item_global_id: String, event: InputEvent)
|
||||||
|
|
||||||
- left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
- left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||||
- right_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
- right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||||
- left_double_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
- left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||||
- inventory_item_focused(inventory_item_global_id : String)
|
- inventory_item_focused(inventory_item_global_id: String)
|
||||||
- inventory_item_unfocused()
|
- inventory_item_unfocused()
|
||||||
- open_inventory()
|
- open_inventory()
|
||||||
- close_inventory()
|
- close_inventory()
|
||||||
|
|
||||||
- mousewheel_action(direction : int)
|
- mousewheel_action(direction: int)
|
||||||
|
|
||||||
- hide_ui()
|
- hide_ui()
|
||||||
- show_ui()
|
- show_ui()
|
||||||
@@ -37,24 +37,24 @@ func _ready():
|
|||||||
|
|
||||||
## BACKGROUND ##
|
## BACKGROUND ##
|
||||||
|
|
||||||
func left_click_on_bg(position : Vector2) -> void:
|
func left_click_on_bg(position: Vector2) -> void:
|
||||||
escoria.do("walk", ["player", position])
|
escoria.do("walk", ["player", position])
|
||||||
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
||||||
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
||||||
|
|
||||||
func right_click_on_bg(position : Vector2) -> void:
|
func right_click_on_bg(position: Vector2) -> void:
|
||||||
escoria.do("walk", ["player", position])
|
escoria.do("walk", ["player", position])
|
||||||
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
||||||
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
||||||
|
|
||||||
func left_double_click_on_bg(position : Vector2) -> void:
|
func left_double_click_on_bg(position: Vector2) -> void:
|
||||||
escoria.do("walk", ["player", position, true])
|
escoria.do("walk", ["player", position, true])
|
||||||
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
||||||
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
||||||
|
|
||||||
## ITEM/HOTSPOT FOCUS ##
|
## ITEM/HOTSPOT FOCUS ##
|
||||||
|
|
||||||
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
|
||||||
$ui/tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
$ui/tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||||
|
|
||||||
@@ -69,42 +69,49 @@ func element_unfocused() -> void:
|
|||||||
|
|
||||||
## ITEMS ##
|
## ITEMS ##
|
||||||
|
|
||||||
func left_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.do("item_left_click", [item_global_id, event])
|
escoria.do("item_left_click", [item_global_id, event])
|
||||||
|
|
||||||
func right_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.do("item_right_click", [item_global_id, event])
|
escoria.do("item_right_click", [item_global_id, event])
|
||||||
|
|
||||||
func left_double_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
func left_double_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.do("item_left_click", [item_global_id, event])
|
escoria.do("item_left_click", [item_global_id, event])
|
||||||
|
|
||||||
|
|
||||||
## INVENTORY ##
|
## INVENTORY ##
|
||||||
func left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.do("item_left_click", [inventory_item_global_id, event])
|
escoria.do("item_left_click", [inventory_item_global_id, event])
|
||||||
if escoria.action_manager.current_action == "use":
|
if escoria.action_manager.current_action == "use":
|
||||||
var item = escoria.object_manager.get_object(
|
var item = escoria.object_manager.get_object(
|
||||||
inventory_item_global_id
|
inventory_item_global_id
|
||||||
).node
|
).node
|
||||||
if item.get_node("sprite").texture:
|
if item.get_node("sprite").texture:
|
||||||
$ui/verbs_layer/verbs_menu.set_tool_texture(item.get_node("sprite").texture)
|
$ui/verbs_layer/verbs_menu.set_tool_texture(
|
||||||
|
item.get_node("sprite").texture
|
||||||
|
)
|
||||||
elif item.inventory_item.texture_normal:
|
elif item.inventory_item.texture_normal:
|
||||||
$ui/verbs_layer/verbs_menu.set_tool_texture(item.inventory_item.texture_normal)
|
$ui/verbs_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:
|
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||||
escoria.do("item_right_click", [inventory_item_global_id, event])
|
escoria.do("item_right_click", [inventory_item_global_id, event])
|
||||||
|
|
||||||
func left_double_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
|
||||||
|
func left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func inventory_item_focused(inventory_item_global_id : String) -> void:
|
|
||||||
|
func inventory_item_focused(inventory_item_global_id: String) -> void:
|
||||||
$ui/tooltip_layer/tooltip.set_target(
|
$ui/tooltip_layer/tooltip.set_target(
|
||||||
escoria.object_manager.get_object(
|
escoria.object_manager.get_object(
|
||||||
inventory_item_global_id
|
inventory_item_global_id
|
||||||
).node.tooltip_name
|
).node.tooltip_name
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func inventory_item_unfocused() -> void:
|
func inventory_item_unfocused() -> void:
|
||||||
$ui/tooltip_layer/tooltip.set_target("")
|
$ui/tooltip_layer/tooltip.set_target("")
|
||||||
|
|
||||||
@@ -116,7 +123,7 @@ func open_inventory():
|
|||||||
func close_inventory():
|
func close_inventory():
|
||||||
$ui/inventory_layer/inventory_ui/inventory_button.close_inventory()
|
$ui/inventory_layer/inventory_ui/inventory_button.close_inventory()
|
||||||
|
|
||||||
func mousewheel_action(direction : int):
|
func mousewheel_action(direction: int):
|
||||||
$ui/verbs_layer/verbs_menu.iterate_actions_cursor(direction)
|
$ui/verbs_layer/verbs_menu.iterate_actions_cursor(direction)
|
||||||
|
|
||||||
func hide_ui():
|
func hide_ui():
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
var showed : bool = false
|
var showed: bool = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ This script is totally user-defined. It does exactly what the user wants the
|
|||||||
inventory to look like. It only requires 4 functions to be defined:
|
inventory to look like. It only requires 4 functions to be defined:
|
||||||
- is_empty() -> bool
|
- is_empty() -> bool
|
||||||
- get_items() -> Array
|
- get_items() -> Array
|
||||||
- add_item(inventory_item : ESCInventoryItem)
|
- add_item(inventory_item: ESCInventoryItem)
|
||||||
- remove_item(inventory_item : ESCInventoryItem)
|
- remove_item(inventory_item: ESCInventoryItem)
|
||||||
The user is free to implement these methods the way s-he likes.
|
The user is free to implement these methods the way s-he likes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ func is_empty() -> bool:
|
|||||||
func get_items() -> Array:
|
func get_items() -> Array:
|
||||||
return current_nodes_in_container.keys()
|
return current_nodes_in_container.keys()
|
||||||
|
|
||||||
func add_item(inventory_item : ESCInventoryItem):
|
func add_item(inventory_item: ESCInventoryItem):
|
||||||
var center_container = CenterContainer.new()
|
var center_container = CenterContainer.new()
|
||||||
center_container.size_flags_horizontal = SIZE_EXPAND_FILL
|
center_container.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||||
center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||||
@@ -27,7 +27,7 @@ func add_item(inventory_item : ESCInventoryItem):
|
|||||||
add_child(center_container)
|
add_child(center_container)
|
||||||
current_nodes_in_container[inventory_item] = center_container
|
current_nodes_in_container[inventory_item] = center_container
|
||||||
|
|
||||||
func remove_item(inventory_item : ESCInventoryItem):
|
func remove_item(inventory_item: ESCInventoryItem):
|
||||||
var node_to_remove = current_nodes_in_container[inventory_item]
|
var node_to_remove = current_nodes_in_container[inventory_item]
|
||||||
current_nodes_in_container.erase(node_to_remove)
|
current_nodes_in_container.erase(node_to_remove)
|
||||||
node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ tool
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
var current_cursor_id : int = 0
|
var current_cursor_id: int = 0
|
||||||
onready var cursors : Array = $actions.get_children()
|
onready var cursors: Array = $actions.get_children()
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -24,7 +24,7 @@ func _process(delta):
|
|||||||
$mouse_position.rect_global_position = get_global_mouse_position()
|
$mouse_position.rect_global_position = get_global_mouse_position()
|
||||||
|
|
||||||
|
|
||||||
func iterate_actions_cursor(direction : int):
|
func iterate_actions_cursor(direction: int):
|
||||||
current_cursor_id += direction
|
current_cursor_id += direction
|
||||||
if current_cursor_id > cursors.size() - 1:
|
if current_cursor_id > cursors.size() - 1:
|
||||||
current_cursor_id = 0
|
current_cursor_id = 0
|
||||||
@@ -36,7 +36,7 @@ func iterate_actions_cursor(direction : int):
|
|||||||
if $mouse_position/tool.texture != null:
|
if $mouse_position/tool.texture != null:
|
||||||
clear_tool_texture()
|
clear_tool_texture()
|
||||||
|
|
||||||
func set_by_name(name : String) -> void:
|
func set_by_name(name: String) -> void:
|
||||||
for i in cursors.size():
|
for i in cursors.size():
|
||||||
if cursors[i].name == name:
|
if cursors[i].name == name:
|
||||||
current_cursor_id = i
|
current_cursor_id = i
|
||||||
@@ -45,7 +45,7 @@ func set_by_name(name : String) -> void:
|
|||||||
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
|
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
|
||||||
escoria.action_manager.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):
|
func set_tool_texture(texture: Texture):
|
||||||
set_process(true)
|
set_process(true)
|
||||||
$mouse_position/tool.texture = texture
|
$mouse_position/tool.texture = texture
|
||||||
|
|
||||||
|
|||||||
@@ -239,6 +239,21 @@ _global_script_classes=[ {
|
|||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/core-scripts/esc_room.gd"
|
"path": "res://addons/escoria-core/game/core-scripts/esc_room.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "Resource",
|
||||||
|
"class": "ESCSaveGame",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/escoria-core/game/core-scripts/save_data/esc_savegame.gd"
|
||||||
|
}, {
|
||||||
|
"base": "Reference",
|
||||||
|
"class": "ESCSaveManager",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/escoria-core/game/core-scripts/save_data/esc_save_manager.gd"
|
||||||
|
}, {
|
||||||
|
"base": "Resource",
|
||||||
|
"class": "ESCSaveSettings",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/escoria-core/game/core-scripts/save_data/esc_savesettings.gd"
|
||||||
|
}, {
|
||||||
"base": "Object",
|
"base": "Object",
|
||||||
"class": "ESCScheduledEvent",
|
"class": "ESCScheduledEvent",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
@@ -400,6 +415,11 @@ _global_script_classes=[ {
|
|||||||
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/teleport.gd"
|
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/teleport.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "ESCBaseCommand",
|
"base": "ESCBaseCommand",
|
||||||
|
"class": "TeleportPosCommand",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/teleport_pos.gd"
|
||||||
|
}, {
|
||||||
|
"base": "ESCBaseCommand",
|
||||||
"class": "TurnToCommand",
|
"class": "TurnToCommand",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/turn_to.gd"
|
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/turn_to.gd"
|
||||||
@@ -476,6 +496,9 @@ _global_script_class_icons={
|
|||||||
"ESCPlayer": "",
|
"ESCPlayer": "",
|
||||||
"ESCResourceCache": "",
|
"ESCResourceCache": "",
|
||||||
"ESCRoom": "",
|
"ESCRoom": "",
|
||||||
|
"ESCSaveGame": "",
|
||||||
|
"ESCSaveManager": "",
|
||||||
|
"ESCSaveSettings": "",
|
||||||
"ESCScheduledEvent": "",
|
"ESCScheduledEvent": "",
|
||||||
"ESCScript": "",
|
"ESCScript": "",
|
||||||
"ESCStatement": "",
|
"ESCStatement": "",
|
||||||
@@ -508,6 +531,7 @@ _global_script_class_icons={
|
|||||||
"SpawnCommand": "",
|
"SpawnCommand": "",
|
||||||
"StopCommand": "",
|
"StopCommand": "",
|
||||||
"TeleportCommand": "",
|
"TeleportCommand": "",
|
||||||
|
"TeleportPosCommand": "",
|
||||||
"TurnToCommand": "",
|
"TurnToCommand": "",
|
||||||
"WaitCommand": "",
|
"WaitCommand": "",
|
||||||
"WalkBlockCommand": "",
|
"WalkBlockCommand": "",
|
||||||
@@ -570,6 +594,11 @@ debug/log_level="DEBUG"
|
|||||||
platform/skip_cache=false
|
platform/skip_cache=false
|
||||||
platform/skip_cache.mobile=true
|
platform/skip_cache.mobile=true
|
||||||
ui/items_autoregister_path="res://game/items/escitems/"
|
ui/items_autoregister_path="res://game/items/escitems/"
|
||||||
|
main/game_version="0.1.0"
|
||||||
|
main/savegames_path="res://saves/"
|
||||||
|
main/settings_path="user://"
|
||||||
|
main/escoria_version=""
|
||||||
|
sound/speech_enabled=1
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user