refactor: Whitespace removal from all .gd files (#494)
Co-authored-by: Balloonpopper <balloonpopper@git.com>
This commit is contained in:
@@ -13,7 +13,7 @@ func _test_basic() -> bool:
|
|||||||
say player "Test3" [test2]
|
say player "Test3" [test2]
|
||||||
# Third group
|
# Third group
|
||||||
>
|
>
|
||||||
|
|
||||||
say player "Test4"
|
say player "Test4"
|
||||||
# Fourth group
|
# Fourth group
|
||||||
>
|
>
|
||||||
@@ -22,41 +22,41 @@ func _test_basic() -> bool:
|
|||||||
say player TEST:"Test 7"
|
say player TEST:"Test 7"
|
||||||
"""
|
"""
|
||||||
var script = escoria.esc_compiler.compile(esc.split("\n"))
|
var script = escoria.esc_compiler.compile(esc.split("\n"))
|
||||||
|
|
||||||
var subject = script
|
var subject = script
|
||||||
assert(subject is ESCScript)
|
assert(subject is ESCScript)
|
||||||
|
|
||||||
subject = script.events.keys()
|
subject = script.events.keys()
|
||||||
assert(subject.size() == 1)
|
assert(subject.size() == 1)
|
||||||
assert(subject[0] == "test")
|
assert(subject[0] == "test")
|
||||||
|
|
||||||
subject = script.events["test"].statements
|
subject = script.events["test"].statements
|
||||||
assert(subject.size() == 2)
|
assert(subject.size() == 2)
|
||||||
|
|
||||||
subject = script.events["test"].statements[0]
|
subject = script.events["test"].statements[0]
|
||||||
assert(subject is ESCGroup)
|
assert(subject is ESCGroup)
|
||||||
assert(subject.statements.size() == 4)
|
assert(subject.statements.size() == 4)
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].statements[0]
|
subject = script.events["test"].statements[0].statements[0]
|
||||||
assert(subject is ESCCommand)
|
assert(subject is ESCCommand)
|
||||||
assert(subject.name == "say")
|
assert(subject.name == "say")
|
||||||
assert(subject.parameters.size() == 2)
|
assert(subject.parameters.size() == 2)
|
||||||
assert(subject.parameters[0] == "player")
|
assert(subject.parameters[0] == "player")
|
||||||
assert(subject.parameters[1] == '"Test"')
|
assert(subject.parameters[1] == '"Test"')
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].statements[1]
|
subject = script.events["test"].statements[0].statements[1]
|
||||||
assert(subject is ESCGroup)
|
assert(subject is ESCGroup)
|
||||||
assert(subject.conditions.size() == 1)
|
assert(subject.conditions.size() == 1)
|
||||||
assert(subject.conditions[0] is ESCCondition)
|
assert(subject.conditions[0] is ESCCondition)
|
||||||
assert(subject.conditions[0].flag == "test")
|
assert(subject.conditions[0].flag == "test")
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].statements[1].statements[0]
|
subject = script.events["test"].statements[0].statements[1].statements[0]
|
||||||
assert(subject is ESCCommand)
|
assert(subject is ESCCommand)
|
||||||
assert(subject.name == "say")
|
assert(subject.name == "say")
|
||||||
assert(subject.parameters.size() == 2)
|
assert(subject.parameters.size() == 2)
|
||||||
assert(subject.parameters[0] == "player")
|
assert(subject.parameters[0] == "player")
|
||||||
assert(subject.parameters[1] == '"Test2 BLANK"')
|
assert(subject.parameters[1] == '"Test2 BLANK"')
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].statements[2]
|
subject = script.events["test"].statements[0].statements[2]
|
||||||
assert(subject is ESCCommand)
|
assert(subject is ESCCommand)
|
||||||
assert(subject.name == "say")
|
assert(subject.name == "say")
|
||||||
@@ -65,27 +65,27 @@ func _test_basic() -> bool:
|
|||||||
assert(subject.parameters[1] == '"Test3"')
|
assert(subject.parameters[1] == '"Test3"')
|
||||||
assert(subject.conditions.size() == 1)
|
assert(subject.conditions.size() == 1)
|
||||||
assert(subject.conditions[0].flag == "test2")
|
assert(subject.conditions[0].flag == "test2")
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].statements[3]
|
subject = script.events["test"].statements[0].statements[3]
|
||||||
assert(subject is ESCGroup)
|
assert(subject is ESCGroup)
|
||||||
assert(subject.statements.size() == 1)
|
assert(subject.statements.size() == 1)
|
||||||
|
|
||||||
subject = script.events["test"].statements[1]
|
subject = script.events["test"].statements[1]
|
||||||
assert(subject is ESCGroup)
|
assert(subject is ESCGroup)
|
||||||
assert(subject.statements.size() == 3)
|
assert(subject.statements.size() == 3)
|
||||||
|
|
||||||
subject = script.events["test"].statements[1].statements[1]
|
subject = script.events["test"].statements[1].statements[1]
|
||||||
assert(subject is ESCCommand)
|
assert(subject is ESCCommand)
|
||||||
assert(subject.name == "say")
|
assert(subject.name == "say")
|
||||||
assert(subject.parameters[1] == '"Test 6"')
|
assert(subject.parameters[1] == '"Test 6"')
|
||||||
|
|
||||||
subject = script.events["test"].statements[1].statements[2]
|
subject = script.events["test"].statements[1].statements[2]
|
||||||
assert(subject is ESCCommand)
|
assert(subject is ESCCommand)
|
||||||
assert(subject.name == "say")
|
assert(subject.name == "say")
|
||||||
assert(subject.parameters[1] == "TEST:\"Test 7\"")
|
assert(subject.parameters[1] == "TEST:\"Test 7\"")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
func _test_conditions() -> bool:
|
func _test_conditions() -> bool:
|
||||||
var esc = """
|
var esc = """
|
||||||
@@ -101,39 +101,39 @@ say player "Test" [eq flag 3,gt flag 5]
|
|||||||
say player "Test" [!eq flag 3]
|
say player "Test" [!eq flag 3]
|
||||||
"""
|
"""
|
||||||
var script = escoria.esc_compiler.compile(esc.split("\n"))
|
var script = escoria.esc_compiler.compile(esc.split("\n"))
|
||||||
|
|
||||||
var subject = script.events["test"].statements[0]
|
var subject = script.events["test"].statements[0]
|
||||||
assert(subject is ESCCommand)
|
assert(subject is ESCCommand)
|
||||||
assert(subject.conditions.size() == 1)
|
assert(subject.conditions.size() == 1)
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].conditions[0]
|
subject = script.events["test"].statements[0].conditions[0]
|
||||||
assert(subject.flag == "flag")
|
assert(subject.flag == "flag")
|
||||||
assert(not subject.negated)
|
assert(not subject.negated)
|
||||||
assert(not subject.inventory)
|
assert(not subject.inventory)
|
||||||
assert(subject.comparison == ESCCondition.COMPARISON_NONE)
|
assert(subject.comparison == ESCCondition.COMPARISON_NONE)
|
||||||
|
|
||||||
subject = script.events["test"].statements[1].conditions
|
subject = script.events["test"].statements[1].conditions
|
||||||
assert(subject.size() == 2)
|
assert(subject.size() == 2)
|
||||||
assert(subject[0].flag == "flag1")
|
assert(subject[0].flag == "flag1")
|
||||||
assert(subject[1].flag == "flag2")
|
assert(subject[1].flag == "flag2")
|
||||||
|
|
||||||
subject = script.events["test"].statements[2].conditions
|
subject = script.events["test"].statements[2].conditions
|
||||||
assert(subject.size() == 1)
|
assert(subject.size() == 1)
|
||||||
assert(subject[0].flag == "flag")
|
assert(subject[0].flag == "flag")
|
||||||
assert(subject[0].negated)
|
assert(subject[0].negated)
|
||||||
|
|
||||||
subject = script.events["test"].statements[3].conditions
|
subject = script.events["test"].statements[3].conditions
|
||||||
assert(subject.size() == 1)
|
assert(subject.size() == 1)
|
||||||
assert(subject[0].flag == "flag")
|
assert(subject[0].flag == "flag")
|
||||||
assert(subject[0].inventory)
|
assert(subject[0].inventory)
|
||||||
|
|
||||||
subject = script.events["test"].statements[4].conditions
|
subject = script.events["test"].statements[4].conditions
|
||||||
assert(subject.size() == 2)
|
assert(subject.size() == 2)
|
||||||
assert(subject[0].flag == "flag")
|
assert(subject[0].flag == "flag")
|
||||||
assert(subject[0].inventory)
|
assert(subject[0].inventory)
|
||||||
assert(subject[1].flag == "flag")
|
assert(subject[1].flag == "flag")
|
||||||
assert(not subject[1].inventory)
|
assert(not subject[1].inventory)
|
||||||
|
|
||||||
subject = script.events["test"].statements[5].conditions
|
subject = script.events["test"].statements[5].conditions
|
||||||
assert(subject.size() == 3)
|
assert(subject.size() == 3)
|
||||||
assert(subject[0].flag == "flag")
|
assert(subject[0].flag == "flag")
|
||||||
@@ -143,13 +143,13 @@ say player "Test" [!eq flag 3]
|
|||||||
assert(subject[2].flag == "flag2")
|
assert(subject[2].flag == "flag2")
|
||||||
assert(not subject[2].inventory)
|
assert(not subject[2].inventory)
|
||||||
assert(subject[2].negated)
|
assert(subject[2].negated)
|
||||||
|
|
||||||
subject = script.events["test"].statements[6].conditions
|
subject = script.events["test"].statements[6].conditions
|
||||||
assert(subject.size() == 1)
|
assert(subject.size() == 1)
|
||||||
assert(subject[0].flag == "flag")
|
assert(subject[0].flag == "flag")
|
||||||
assert(subject[0].comparison == ESCCondition.COMPARISON_EQ)
|
assert(subject[0].comparison == ESCCondition.COMPARISON_EQ)
|
||||||
assert(subject[0].comparison_value == 3)
|
assert(subject[0].comparison_value == 3)
|
||||||
|
|
||||||
subject = script.events["test"].statements[7].conditions
|
subject = script.events["test"].statements[7].conditions
|
||||||
assert(subject.size() == 2)
|
assert(subject.size() == 2)
|
||||||
assert(subject[0].flag == "flag")
|
assert(subject[0].flag == "flag")
|
||||||
@@ -158,14 +158,14 @@ say player "Test" [!eq flag 3]
|
|||||||
assert(subject[1].flag == "flag")
|
assert(subject[1].flag == "flag")
|
||||||
assert(subject[1].comparison == ESCCondition.COMPARISON_GT)
|
assert(subject[1].comparison == ESCCondition.COMPARISON_GT)
|
||||||
assert(subject[1].comparison_value == 5)
|
assert(subject[1].comparison_value == 5)
|
||||||
|
|
||||||
subject = script.events["test"].statements[8].conditions
|
subject = script.events["test"].statements[8].conditions
|
||||||
assert(subject.size() == 1)
|
assert(subject.size() == 1)
|
||||||
assert(subject[0].flag == "flag")
|
assert(subject[0].flag == "flag")
|
||||||
assert(subject[0].comparison == ESCCondition.COMPARISON_EQ)
|
assert(subject[0].comparison == ESCCondition.COMPARISON_EQ)
|
||||||
assert(subject[0].comparison_value == 3)
|
assert(subject[0].comparison_value == 3)
|
||||||
assert(subject[0].negated)
|
assert(subject[0].negated)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
@@ -176,31 +176,31 @@ func _test_event_flags() -> bool:
|
|||||||
:test3 | TK NO_TT NO_UI
|
:test3 | TK NO_TT NO_UI
|
||||||
"""
|
"""
|
||||||
var script = escoria.esc_compiler.compile(esc.split("\n"))
|
var script = escoria.esc_compiler.compile(esc.split("\n"))
|
||||||
|
|
||||||
var subject = script.events
|
var subject = script.events
|
||||||
assert(subject.keys().size() == 3)
|
assert(subject.keys().size() == 3)
|
||||||
assert("test" in subject.keys())
|
assert("test" in subject.keys())
|
||||||
assert("test2" in subject.keys())
|
assert("test2" in subject.keys())
|
||||||
assert("test3" in subject.keys())
|
assert("test3" in subject.keys())
|
||||||
|
|
||||||
subject = script.events["test"]
|
subject = script.events["test"]
|
||||||
assert(subject.name == "test")
|
assert(subject.name == "test")
|
||||||
assert(subject.flags & ESCEvent.FLAG_TK != 0)
|
assert(subject.flags & ESCEvent.FLAG_TK != 0)
|
||||||
assert(subject.flags & ESCEvent.FLAG_NO_TT == 0)
|
assert(subject.flags & ESCEvent.FLAG_NO_TT == 0)
|
||||||
|
|
||||||
subject = script.events["test2"]
|
subject = script.events["test2"]
|
||||||
assert(subject.name == "test2")
|
assert(subject.name == "test2")
|
||||||
assert(subject.flags & ESCEvent.FLAG_TK != 0)
|
assert(subject.flags & ESCEvent.FLAG_TK != 0)
|
||||||
assert(subject.flags & ESCEvent.FLAG_NO_TT != 0)
|
assert(subject.flags & ESCEvent.FLAG_NO_TT != 0)
|
||||||
|
|
||||||
subject = script.events["test3"]
|
subject = script.events["test3"]
|
||||||
assert(subject.name == "test3")
|
assert(subject.name == "test3")
|
||||||
assert(subject.flags & ESCEvent.FLAG_TK != 0)
|
assert(subject.flags & ESCEvent.FLAG_TK != 0)
|
||||||
assert(subject.flags & ESCEvent.FLAG_NO_TT != 0)
|
assert(subject.flags & ESCEvent.FLAG_NO_TT != 0)
|
||||||
assert(subject.flags & ESCEvent.FLAG_NO_UI != 0)
|
assert(subject.flags & ESCEvent.FLAG_NO_UI != 0)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
func _test_dialog() -> bool:
|
func _test_dialog() -> bool:
|
||||||
var esc = """
|
var esc = """
|
||||||
@@ -226,17 +226,17 @@ func _test_dialog() -> bool:
|
|||||||
!
|
!
|
||||||
"""
|
"""
|
||||||
var script = escoria.esc_compiler.compile(esc.split("\n"))
|
var script = escoria.esc_compiler.compile(esc.split("\n"))
|
||||||
|
|
||||||
var subject = script.events["test"].statements
|
var subject = script.events["test"].statements
|
||||||
assert(subject.size() == 1)
|
assert(subject.size() == 1)
|
||||||
|
|
||||||
assert(subject[0] is ESCDialog)
|
assert(subject[0] is ESCDialog)
|
||||||
assert(subject[0].options.size() == 4)
|
assert(subject[0].options.size() == 4)
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].options[0]
|
subject = script.events["test"].statements[0].options[0]
|
||||||
assert(subject is ESCDialogOption)
|
assert(subject is ESCDialogOption)
|
||||||
assert(subject.option == "Option 1")
|
assert(subject.option == "Option 1")
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].options[0].statements
|
subject = script.events["test"].statements[0].options[0].statements
|
||||||
assert(subject.size() == 3)
|
assert(subject.size() == 3)
|
||||||
assert(subject[0] is ESCCommand)
|
assert(subject[0] is ESCCommand)
|
||||||
@@ -250,13 +250,13 @@ func _test_dialog() -> bool:
|
|||||||
assert(subject[2].name == "say")
|
assert(subject[2].name == "say")
|
||||||
assert(subject[2].parameters.size() == 2)
|
assert(subject[2].parameters.size() == 2)
|
||||||
assert(subject[2].parameters[1] == '"testb?"')
|
assert(subject[2].parameters[1] == '"testb?"')
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].options[1]
|
subject = script.events["test"].statements[0].options[1]
|
||||||
assert(subject is ESCDialogOption)
|
assert(subject is ESCDialogOption)
|
||||||
assert(subject.option == "Option 2")
|
assert(subject.option == "Option 2")
|
||||||
assert(subject.conditions.size() == 1)
|
assert(subject.conditions.size() == 1)
|
||||||
assert(subject.conditions[0].flag == "flag")
|
assert(subject.conditions[0].flag == "flag")
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].options[1].statements
|
subject = script.events["test"].statements[0].options[1].statements
|
||||||
assert(subject.size() == 2)
|
assert(subject.size() == 2)
|
||||||
assert(subject[0] is ESCCommand)
|
assert(subject[0] is ESCCommand)
|
||||||
@@ -265,24 +265,24 @@ func _test_dialog() -> bool:
|
|||||||
|
|
||||||
assert(subject[1] is ESCDialog)
|
assert(subject[1] is ESCDialog)
|
||||||
assert(subject[1].options.size() == 2)
|
assert(subject[1].options.size() == 2)
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].options[2]
|
subject = script.events["test"].statements[0].options[2]
|
||||||
assert(subject is ESCDialogOption)
|
assert(subject is ESCDialogOption)
|
||||||
assert(subject.option == "Option 3")
|
assert(subject.option == "Option 3")
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].options[2].statements
|
subject = script.events["test"].statements[0].options[2].statements
|
||||||
assert(subject.size() == 1)
|
assert(subject.size() == 1)
|
||||||
assert(subject[0] is ESCGroup)
|
assert(subject[0] is ESCGroup)
|
||||||
assert(subject[0].statements.size() == 1)
|
assert(subject[0].statements.size() == 1)
|
||||||
assert(subject[0].statements[0] is ESCCommand)
|
assert(subject[0].statements[0] is ESCCommand)
|
||||||
assert(subject[0].statements[0].parameters.size() == 2)
|
assert(subject[0].statements[0].parameters.size() == 2)
|
||||||
|
|
||||||
subject = script.events["test"].statements[0].options[3]
|
subject = script.events["test"].statements[0].options[3]
|
||||||
assert(subject is ESCDialogOption)
|
assert(subject is ESCDialogOption)
|
||||||
assert(subject.option == "TEST")
|
assert(subject.option == "TEST")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
func _on_BasicFunctionality_pressed():
|
func _on_BasicFunctionality_pressed():
|
||||||
$VBoxContainer/VBoxContainer/BasicFunctionality.pressed = self._test_basic()
|
$VBoxContainer/VBoxContainer/BasicFunctionality.pressed = self._test_basic()
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ extends Control
|
|||||||
|
|
||||||
func _on_CheckESCMigrationManager_pressed() -> bool:
|
func _on_CheckESCMigrationManager_pressed() -> bool:
|
||||||
var savegame: ESCSaveGame = ESCSaveGame.new()
|
var savegame: ESCSaveGame = ESCSaveGame.new()
|
||||||
|
|
||||||
savegame.globals["test"] = "testa"
|
savegame.globals["test"] = "testa"
|
||||||
|
|
||||||
var migration_manager: ESCMigrationManager = ESCMigrationManager.new()
|
var migration_manager: ESCMigrationManager = ESCMigrationManager.new()
|
||||||
savegame = migration_manager.migrate(
|
savegame = migration_manager.migrate(
|
||||||
savegame,
|
savegame,
|
||||||
@@ -14,7 +14,7 @@ func _on_CheckESCMigrationManager_pressed() -> bool:
|
|||||||
"2.0.0",
|
"2.0.0",
|
||||||
"res://addons/escoria-core/_test/testversions"
|
"res://addons/escoria-core/_test/testversions"
|
||||||
)
|
)
|
||||||
|
|
||||||
assert(savegame.globals["test"] == "testc")
|
assert(savegame.globals["test"] == "testc")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ onready var task = MovableTask.NONE
|
|||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if not parent.has_user_signal("arrived"):
|
if not parent.has_user_signal("arrived"):
|
||||||
parent.add_user_signal("arrived")
|
parent.add_user_signal("arrived")
|
||||||
|
|
||||||
|
|
||||||
# Main processing loop
|
# Main processing loop
|
||||||
#
|
#
|
||||||
@@ -66,13 +66,13 @@ func _ready() -> void:
|
|||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
|
|
||||||
if task == MovableTask.WALK or task == MovableTask.SLIDE:
|
if task == MovableTask.WALK or task == MovableTask.SLIDE:
|
||||||
var old_pos = parent.get_position()
|
var old_pos = parent.get_position()
|
||||||
var new_pos = _calculate_movement(delta)
|
var new_pos = _calculate_movement(delta)
|
||||||
if new_pos == null:
|
if new_pos == null:
|
||||||
return
|
return
|
||||||
|
|
||||||
if task == MovableTask.WALK:
|
if task == MovableTask.WALK:
|
||||||
# Get the angle of the object to face the position to reach.
|
# Get the angle of the object to face the position to reach.
|
||||||
var angle: float = (old_pos.angle_to_point(new_pos))
|
var angle: float = (old_pos.angle_to_point(new_pos))
|
||||||
@@ -96,24 +96,24 @@ func _calculate_movement(delta: float):
|
|||||||
# Initialize the current pos and previous pos variables
|
# Initialize the current pos and previous pos variables
|
||||||
var pos: Vector2 = parent.get_position()
|
var pos: Vector2 = parent.get_position()
|
||||||
var old_pos: Vector2 = pos
|
var old_pos: Vector2 = pos
|
||||||
|
|
||||||
# Get next waypoint from the walkpath array.
|
# Get next waypoint from the walkpath array.
|
||||||
var next: Vector2
|
var next: Vector2
|
||||||
if walk_path.size() > 1:
|
if walk_path.size() > 1:
|
||||||
next = walk_path[path_ofs + 1]
|
next = walk_path[path_ofs + 1]
|
||||||
else:
|
else:
|
||||||
next = walk_path[path_ofs]
|
next = walk_path[path_ofs]
|
||||||
|
|
||||||
# Movement speed calculation
|
# Movement speed calculation
|
||||||
var movement_speed: float = parent.speed * delta * pow(last_scale.x, 2) * \
|
var movement_speed: float = parent.speed * delta * pow(last_scale.x, 2) * \
|
||||||
parent.terrain.player_speed_multiplier
|
parent.terrain.player_speed_multiplier
|
||||||
if walk_context.fast:
|
if walk_context.fast:
|
||||||
movement_speed *= parent.terrain.player_doubleclick_speed_multiplier
|
movement_speed *= parent.terrain.player_doubleclick_speed_multiplier
|
||||||
|
|
||||||
# Calculate the direction vector from current position and next waypoint
|
# Calculate the direction vector from current position and next waypoint
|
||||||
var dir: Vector2 = (next - pos).normalized()
|
var dir: Vector2 = (next - pos).normalized()
|
||||||
|
|
||||||
# If we're close to the next waypoint (ie. distance < necessary movement
|
# If we're close to the next waypoint (ie. distance < necessary movement
|
||||||
# speed to get to this waypoint, we consider the waypoint reached
|
# speed to get to this waypoint, we consider the waypoint reached
|
||||||
# and pass to the next one.
|
# and pass to the next one.
|
||||||
# Else, calculate the new position.
|
# Else, calculate the new position.
|
||||||
@@ -129,27 +129,27 @@ func _calculate_movement(delta: float):
|
|||||||
if path_ofs >= walk_path.size() - 1:
|
if path_ofs >= walk_path.size() - 1:
|
||||||
walk_stop(walk_destination)
|
walk_stop(walk_destination)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Update current position variable
|
# Update current position variable
|
||||||
pos = new_pos
|
pos = new_pos
|
||||||
parent.set_position(pos)
|
parent.set_position(pos)
|
||||||
return pos
|
return pos
|
||||||
|
|
||||||
# Calculates the orientation of the object while walking, to play the right
|
# Calculates the orientation of the object while walking, to play the right
|
||||||
# animation according to this orientation.
|
# animation according to this orientation.
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - angle: the angle X axis and object's facing direction.
|
# - angle: the angle X axis and object's facing direction.
|
||||||
func _perform_walk_orientation(angle: float):
|
func _perform_walk_orientation(angle: float):
|
||||||
last_dir = _get_dir_deg(escoria.utils.get_deg_from_rad(angle),
|
last_dir = _get_dir_deg(escoria.utils.get_deg_from_rad(angle),
|
||||||
parent.animations)
|
parent.animations)
|
||||||
|
|
||||||
var animation_player: ESCAnimationPlayer = \
|
var animation_player: ESCAnimationPlayer = \
|
||||||
parent.get_animation_player()
|
parent.get_animation_player()
|
||||||
|
|
||||||
var current_animation = animation_player.get_animation()
|
var current_animation = animation_player.get_animation()
|
||||||
|
|
||||||
var animation_to_play = \
|
var animation_to_play = \
|
||||||
parent.animations.directions[last_dir].animation
|
parent.animations.directions[last_dir].animation
|
||||||
if current_animation != animation_to_play and \
|
if current_animation != animation_to_play and \
|
||||||
@@ -168,7 +168,7 @@ func _perform_walk_orientation(angle: float):
|
|||||||
],
|
],
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
pose_scale = -1 if parent.animations.directions[last_dir].mirrored \
|
pose_scale = -1 if parent.animations.directions[last_dir].mirrored \
|
||||||
else 1
|
else 1
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ func teleport(target: Node) -> void:
|
|||||||
"Object %s is teleported at position %s" % [
|
"Object %s is teleported at position %s" % [
|
||||||
target.name,
|
target.name,
|
||||||
parent.global_position
|
parent.global_position
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
elif "position" in target:
|
elif "position" in target:
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
@@ -204,7 +204,7 @@ func teleport(target: Node) -> void:
|
|||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - target: Vector2 target position to teleport to
|
# - target: Vector2 target position to teleport to
|
||||||
func teleport_to(target: Vector2) -> void:
|
func teleport_to(target: Vector2) -> void:
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
"Object %s teleported to position %s" %
|
"Object %s teleported to position %s" %
|
||||||
@@ -223,20 +223,20 @@ 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
|
||||||
|
|
||||||
if task == MovableTask.WALK:
|
if task == MovableTask.WALK:
|
||||||
if walk_context.target_object == p_walk_context.target_object \
|
if walk_context.target_object == p_walk_context.target_object \
|
||||||
or walk_context.target_position \
|
or walk_context.target_position \
|
||||||
== p_walk_context.target_position:
|
== p_walk_context.target_position:
|
||||||
walk_context.fast = p_walk_context.fast
|
walk_context.fast = p_walk_context.fast
|
||||||
|
|
||||||
walk_context = p_walk_context
|
walk_context = p_walk_context
|
||||||
|
|
||||||
if task == MovableTask.NONE:
|
if task == MovableTask.NONE:
|
||||||
task = MovableTask.WALK
|
task = MovableTask.WALK
|
||||||
|
|
||||||
walk_path = parent.terrain.get_simple_path(parent.get_position(), pos, true)
|
walk_path = parent.terrain.get_simple_path(parent.get_position(), pos, true)
|
||||||
|
|
||||||
if walk_path.size() == 0:
|
if walk_path.size() == 0:
|
||||||
task = MovableTask.NONE
|
task = MovableTask.NONE
|
||||||
walk_stop(parent.get_position())
|
walk_stop(parent.get_position())
|
||||||
@@ -266,7 +266,7 @@ func walk_stop(pos: Vector2) -> void:
|
|||||||
task = MovableTask.NONE
|
task = MovableTask.NONE
|
||||||
moved = false
|
moved = false
|
||||||
set_process(false)
|
set_process(false)
|
||||||
|
|
||||||
# If we're heading to an object and reached its interaction position,
|
# If we're heading to an object and reached its interaction position,
|
||||||
# orient towards the defined interaction direction set on the object
|
# orient towards the defined interaction direction set on the object
|
||||||
# (if any), can be ESCItem or ESCLocation
|
# (if any), can be ESCItem or ESCLocation
|
||||||
@@ -283,7 +283,7 @@ func walk_stop(pos: Vector2) -> void:
|
|||||||
parent.animations.idles[last_dir].animation
|
parent.animations.idles[last_dir].animation
|
||||||
)
|
)
|
||||||
pose_scale = -1 if parent.animations.idles[last_dir].mirrored else 1
|
pose_scale = -1 if parent.animations.idles[last_dir].mirrored else 1
|
||||||
|
|
||||||
update_terrain()
|
update_terrain()
|
||||||
|
|
||||||
if walk_context.target_object:
|
if walk_context.target_object:
|
||||||
@@ -320,7 +320,7 @@ func update_terrain(on_event_finished_name = null) -> void:
|
|||||||
return
|
return
|
||||||
if not parent.is_inside_tree():
|
if not parent.is_inside_tree():
|
||||||
return
|
return
|
||||||
|
|
||||||
var pos = parent.global_position
|
var pos = parent.global_position
|
||||||
if pos.y <= VisualServer.CANVAS_ITEM_Z_MAX:
|
if pos.y <= VisualServer.CANVAS_ITEM_Z_MAX:
|
||||||
parent.z_index = pos.y
|
parent.z_index = pos.y
|
||||||
@@ -332,12 +332,12 @@ func update_terrain(on_event_finished_name = null) -> void:
|
|||||||
if scal != parent.get_scale():
|
if scal != parent.get_scale():
|
||||||
last_scale = scal
|
last_scale = scal
|
||||||
parent.scale = last_scale
|
parent.scale = last_scale
|
||||||
|
|
||||||
var color = parent.terrain.get_light(pos)
|
var color = parent.terrain.get_light(pos)
|
||||||
parent.modulate = color
|
parent.modulate = color
|
||||||
|
|
||||||
var sprite: Node = parent.get_sprite()
|
var sprite: Node = parent.get_sprite()
|
||||||
|
|
||||||
# Do not flip the entire character, because that would conflict
|
# Do not flip the entire character, because that would conflict
|
||||||
# with shadows that expect to be siblings of $texture
|
# with shadows that expect to be siblings of $texture
|
||||||
if pose_scale == -1 and sprite.scale.x > 0:
|
if pose_scale == -1 and sprite.scale.x > 0:
|
||||||
@@ -360,7 +360,7 @@ func _get_dir_deg(deg: int, animations: ESCAnimationResource) -> int:
|
|||||||
deg = wrapi(deg - 90, 0, 360)
|
deg = wrapi(deg - 90, 0, 360)
|
||||||
var dir = -1
|
var dir = -1
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
||||||
for direction_angle in animations.dir_angles:
|
for direction_angle in animations.dir_angles:
|
||||||
if _is_angle_in_interval(deg, direction_angle):
|
if _is_angle_in_interval(deg, direction_angle):
|
||||||
dir = i
|
dir = i
|
||||||
@@ -375,7 +375,7 @@ func _get_dir_deg(deg: int, animations: ESCAnimationResource) -> int:
|
|||||||
"esc_movable.gd:_get_dir_deg()",
|
"esc_movable.gd:_get_dir_deg()",
|
||||||
["No direction found for " + str(deg)]
|
["No direction found for " + str(deg)]
|
||||||
)
|
)
|
||||||
|
|
||||||
return dir
|
return dir
|
||||||
|
|
||||||
|
|
||||||
@@ -386,18 +386,18 @@ func _get_dir_deg(deg: int, animations: ESCAnimationResource) -> int:
|
|||||||
#
|
#
|
||||||
# - angle: Angle to test
|
# - angle: Angle to test
|
||||||
# - direction_angle: ESCDirectionAngle resource, containing the starting angle,
|
# - direction_angle: ESCDirectionAngle resource, containing the starting angle,
|
||||||
# and the size of interval
|
# and the size of interval
|
||||||
# eg: angle_start=90, angle_size=40 corresponds to angle between 90° and 130°
|
# eg: angle_start=90, angle_size=40 corresponds to angle between 90° and 130°
|
||||||
func _is_angle_in_interval(
|
func _is_angle_in_interval(
|
||||||
angle: float,
|
angle: float,
|
||||||
direction_angle: ESCDirectionAngle
|
direction_angle: ESCDirectionAngle
|
||||||
) -> bool:
|
) -> bool:
|
||||||
var start_angle = direction_angle.angle_start
|
var start_angle = direction_angle.angle_start
|
||||||
var end_angle = direction_angle.angle_start + direction_angle.angle_size
|
var end_angle = direction_angle.angle_start + direction_angle.angle_size
|
||||||
|
|
||||||
if end_angle > 360 and angle < start_angle:
|
if end_angle > 360 and angle < start_angle:
|
||||||
angle += 360
|
angle += 360
|
||||||
|
|
||||||
return (start_angle <= angle and angle <= end_angle)
|
return (start_angle <= angle and angle <= end_angle)
|
||||||
|
|
||||||
|
|
||||||
@@ -414,10 +414,10 @@ func set_angle(deg: int, wait: float = 0.0) -> void:
|
|||||||
["Invalid degree to turn to " + str(deg)]
|
["Invalid degree to turn to " + str(deg)]
|
||||||
)
|
)
|
||||||
moved = true
|
moved = true
|
||||||
|
|
||||||
var current_dir = last_dir
|
var current_dir = last_dir
|
||||||
var target_dir = _get_dir_deg(deg, parent.animations)
|
var target_dir = _get_dir_deg(deg, parent.animations)
|
||||||
|
|
||||||
var way_to_turn = get_shortest_way_to_dir(current_dir, target_dir)
|
var way_to_turn = get_shortest_way_to_dir(current_dir, target_dir)
|
||||||
|
|
||||||
var dir = current_dir
|
var dir = current_dir
|
||||||
@@ -427,14 +427,14 @@ func set_angle(deg: int, wait: float = 0.0) -> void:
|
|||||||
dir = 0
|
dir = 0
|
||||||
if dir < 0:
|
if dir < 0:
|
||||||
dir = parent.animations.dir_angles.size() - 1
|
dir = parent.animations.dir_angles.size() - 1
|
||||||
|
|
||||||
parent.get_animation_player().play(
|
parent.get_animation_player().play(
|
||||||
parent.animations.idles[dir].animation
|
parent.animations.idles[dir].animation
|
||||||
)
|
)
|
||||||
if wait > 0.0:
|
if wait > 0.0:
|
||||||
yield(get_tree().create_timer(wait), "timeout")
|
yield(get_tree().create_timer(wait), "timeout")
|
||||||
pose_scale = -1 if parent.animations.idles[dir].mirrored else 1
|
pose_scale = -1 if parent.animations.idles[dir].mirrored else 1
|
||||||
|
|
||||||
last_dir = _get_dir_deg(deg, parent.animations)
|
last_dir = _get_dir_deg(deg, parent.animations)
|
||||||
|
|
||||||
# The character may have a state animation from before, which would be
|
# The character may have a state animation from before, which would be
|
||||||
@@ -456,13 +456,13 @@ func set_angle(deg: int, wait: float = 0.0) -> void:
|
|||||||
func turn_to(item: Node, wait: float = 0.0) -> void:
|
func turn_to(item: Node, wait: float = 0.0) -> void:
|
||||||
set_angle(
|
set_angle(
|
||||||
wrapi(
|
wrapi(
|
||||||
rad2deg(parent.get_position().angle_to_point(item.get_position())),
|
rad2deg(parent.get_position().angle_to_point(item.get_position())),
|
||||||
0,
|
0,
|
||||||
360
|
360
|
||||||
),
|
),
|
||||||
wait
|
wait
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Returns the angle that corresponds to the current direction of the object.
|
# Returns the angle that corresponds to the current direction of the object.
|
||||||
func _get_angle() -> int:
|
func _get_angle() -> int:
|
||||||
@@ -470,8 +470,8 @@ func _get_angle() -> int:
|
|||||||
|
|
||||||
|
|
||||||
# Return the shortest way to turn from a direction to another. Returned way is
|
# Return the shortest way to turn from a direction to another. Returned way is
|
||||||
# either:
|
# either:
|
||||||
# -1 (shortest way is to turn anti-clockwise)
|
# -1 (shortest way is to turn anti-clockwise)
|
||||||
# 0 (already at the right direction)
|
# 0 (already at the right direction)
|
||||||
# 1 (clockwise).
|
# 1 (clockwise).
|
||||||
#
|
#
|
||||||
@@ -489,23 +489,23 @@ func get_shortest_way_to_dir(current_dir: int, target_dir: int) -> int:
|
|||||||
"esc_movable.gd:get_shortest_way_to_dir()",
|
"esc_movable.gd:get_shortest_way_to_dir()",
|
||||||
["Invalid direction (current_dir) %s" % str(current_dir)]
|
["Invalid direction (current_dir) %s" % str(current_dir)]
|
||||||
)
|
)
|
||||||
|
|
||||||
if target_dir < 0 or target_dir > parent.animations.dir_angles.size() - 1:
|
if target_dir < 0 or target_dir > parent.animations.dir_angles.size() - 1:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"esc_movable.gd:get_shortest_way_to_dir()",
|
"esc_movable.gd:get_shortest_way_to_dir()",
|
||||||
["Invalid direction (target_dir) %s " % str(target_dir)]
|
["Invalid direction (target_dir) %s " % str(target_dir)]
|
||||||
)
|
)
|
||||||
|
|
||||||
if current_dir == target_dir:
|
if current_dir == target_dir:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
var internal = false
|
var internal = false
|
||||||
if max(current_dir, target_dir) - min(current_dir, target_dir) \
|
if max(current_dir, target_dir) - min(current_dir, target_dir) \
|
||||||
< parent.animations.dir_angles.size() / 2:
|
< parent.animations.dir_angles.size() / 2:
|
||||||
internal = true
|
internal = true
|
||||||
else:
|
else:
|
||||||
internal = false
|
internal = false
|
||||||
|
|
||||||
if internal and current_dir < target_dir or \
|
if internal and current_dir < target_dir or \
|
||||||
(not internal and current_dir > target_dir):
|
(not internal and current_dir > target_dir):
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class_name AcceptInputCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_STRING],
|
[TYPE_STRING],
|
||||||
["ALL"]
|
["ALL"]
|
||||||
)
|
)
|
||||||
@@ -52,6 +52,6 @@ func run(command_params: Array) -> int:
|
|||||||
mode = escoria.inputs_manager.INPUT_NONE
|
mode = escoria.inputs_manager.INPUT_NONE
|
||||||
"SKIP":
|
"SKIP":
|
||||||
mode = escoria.inputs_manager.INPUT_SKIP
|
mode = escoria.inputs_manager.INPUT_SKIP
|
||||||
|
|
||||||
escoria.inputs_manager.input_mode = mode
|
escoria.inputs_manager.input_mode = mode
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `anim object name [reverse]`
|
# `anim object name [reverse]`
|
||||||
#
|
#
|
||||||
# Executes the animation specified in "name" on "object",
|
# Executes the animation specified in "name" on "object",
|
||||||
# without blocking. The next command in the event will be executed immediately
|
# without blocking. The next command in the event will be executed immediately
|
||||||
# after.
|
# after.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -18,12 +18,12 @@ class_name AnimCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_BOOL],
|
[TYPE_STRING, TYPE_STRING, TYPE_BOOL],
|
||||||
[null, null, false]
|
[null, null, false]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if not escoria.object_manager.objects.has(arguments[0]):
|
if not escoria.object_manager.objects.has(arguments[0]):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `anim_block object name [reverse]`
|
# `anim_block object name [reverse]`
|
||||||
#
|
#
|
||||||
# Executes the animation specified in "name" on "object",
|
# Executes the animation specified in "name" on "object",
|
||||||
# while blocking. The next command in the event will be executed when the animation
|
# while blocking. The next command in the event will be executed when the animation
|
||||||
# is finished playing.
|
# is finished playing.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
# * *object*: Global ID of the object with the animation
|
# * *object*: Global ID of the object with the animation
|
||||||
# * *name*: Name of the animation to play
|
# * *name*: Name of the animation to play
|
||||||
# * *reverse*: Plays the animation in reverse when true
|
# * *reverse*: Plays the animation in reverse when true
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name AnimBlockCommand
|
class_name AnimBlockCommand
|
||||||
@@ -18,12 +18,12 @@ class_name AnimBlockCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_BOOL],
|
[TYPE_STRING, TYPE_STRING, TYPE_BOOL],
|
||||||
[null, null, false]
|
[null, null, false]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if not escoria.object_manager.objects.has(arguments[0]):
|
if not escoria.object_manager.objects.has(arguments[0]):
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *target*: Global ID of the `ESCItem` to push the camera to. If the target
|
# - *target*: Global ID of the `ESCItem` to push the camera to. If the target
|
||||||
# has a child node called `camera_node`, its location will be used. If not,
|
# has a child node called `camera_node`, its location will be used. If not,
|
||||||
# the location of the target will be used
|
# the location of the target will be used
|
||||||
# - *time*: Number of seconds the transition should take (default: `1`)
|
# - *time*: Number of seconds the transition should take (default: `1`)
|
||||||
# - *type*: Transition type to use (default: `QUAD`)
|
# - *type*: Transition type to use (default: `QUAD`)
|
||||||
#
|
#
|
||||||
# Supported transitions include the names of the values used
|
# Supported transitions include the names of the values used
|
||||||
# in the "TransitionType" enum of the "Tween" type (without the "TRANS_" prefix):
|
# in the "TransitionType" enum of the "Tween" type (without the "TRANS_" prefix):
|
||||||
#
|
#
|
||||||
# https://docs.godotengine.org/en/stable/classes/class_tween.html?highlight=tween#enumerations
|
# https://docs.godotengine.org/en/stable/classes/class_tween.html?highlight=tween#enumerations
|
||||||
@@ -25,11 +25,11 @@ class_name CameraPushCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_STRING, [TYPE_REAL, TYPE_INT], TYPE_STRING],
|
[TYPE_STRING, [TYPE_REAL, TYPE_INT], TYPE_STRING],
|
||||||
[null, 1, "QUAD"]
|
[null, 1, "QUAD"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
@@ -41,7 +41,7 @@ func validate(arguments: Array):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *camlimits_id*: Index of the camera limit in the `camera limits`
|
# - *camlimits_id*: Index of the camera limit in the `camera limits`
|
||||||
# list of the current `ESCRoom`
|
# list of the current `ESCRoom`
|
||||||
#
|
#
|
||||||
# For more details see: https://docs.escoria-framework.org/camera
|
# For more details see: https://docs.escoria-framework.org/camera
|
||||||
@@ -17,12 +17,12 @@ class_name CameraSetLimitsCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_INT],
|
[TYPE_INT],
|
||||||
[null]
|
[null]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if escoria.main.current_scene.camera_limits.size() < arguments[0]:
|
if escoria.main.current_scene.camera_limits.size() < arguments[0]:
|
||||||
@@ -36,7 +36,7 @@ func validate(arguments: Array):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class_name CameraSetPosCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
3,
|
3,
|
||||||
[[TYPE_REAL, TYPE_INT], TYPE_INT, TYPE_INT],
|
[[TYPE_REAL, TYPE_INT], TYPE_INT, TYPE_INT],
|
||||||
[null, null, null]
|
[null, null, null]
|
||||||
)
|
)
|
||||||
@@ -28,7 +28,7 @@ func configure() -> ESCCommandArgumentDescriptor:
|
|||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
(escoria.object_manager.get_object(escoria.object_manager.CAMERA).node as ESCCamera)\
|
(escoria.object_manager.get_object(escoria.object_manager.CAMERA).node as ESCCamera)\
|
||||||
.set_target(
|
.set_target(
|
||||||
Vector2(command_params[1], command_params[2]),
|
Vector2(command_params[1], command_params[2]),
|
||||||
command_params[0]
|
command_params[0]
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ class_name CameraSetTargetCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[[TYPE_REAL, TYPE_INT], TYPE_STRING],
|
[[TYPE_REAL, TYPE_INT], TYPE_STRING],
|
||||||
[null, null]
|
[null, null]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
@@ -33,7 +33,7 @@ func validate(arguments: Array):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `camera_set_zoom magnitude [time]`
|
# `camera_set_zoom magnitude [time]`
|
||||||
#
|
#
|
||||||
# Zooms the camera in/out to the desired `magnitude`. Values larger than 1 zoom
|
# Zooms the camera in/out to the desired `magnitude`. Values larger than 1 zoom
|
||||||
# the camera out while smaller values zoom in, relative to the default value
|
# the camera out while smaller values zoom in, relative to the default value
|
||||||
# of 1.
|
# of 1.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -20,7 +20,7 @@ class_name CameraSetZoomCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[[TYPE_REAL, TYPE_INT], [TYPE_REAL, TYPE_INT]],
|
[[TYPE_REAL, TYPE_INT], [TYPE_REAL, TYPE_INT]],
|
||||||
[null, 0.0]
|
[null, 0.0]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class_name CameraSetZoomHeightCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_INT, [TYPE_INT, TYPE_REAL]],
|
[TYPE_INT, [TYPE_INT, TYPE_REAL]],
|
||||||
[null, 0.0]
|
[null, 0.0]
|
||||||
)
|
)
|
||||||
@@ -34,7 +34,7 @@ func validate(arguments: Array):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
# meaning the zoom should happen instantly (default: `1`)
|
# meaning the zoom should happen instantly (default: `1`)
|
||||||
# - *type*: Transition type to use (default: `QUAD`)
|
# - *type*: Transition type to use (default: `QUAD`)
|
||||||
#
|
#
|
||||||
# Supported transitions include the names of the values used
|
# Supported transitions include the names of the values used
|
||||||
# in the "TransitionType" enum of the "Tween" type (without the "TRANS_" prefix):
|
# in the "TransitionType" enum of the "Tween" type (without the "TRANS_" prefix):
|
||||||
#
|
#
|
||||||
# https://docs.godotengine.org/en/stable/classes/class_tween.html?highlight=tween#enumerations
|
# https://docs.godotengine.org/en/stable/classes/class_tween.html?highlight=tween#enumerations
|
||||||
@@ -25,16 +25,16 @@ class_name CameraShiftCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[
|
[
|
||||||
[TYPE_INT, TYPE_REAL],
|
[TYPE_INT, TYPE_REAL],
|
||||||
[TYPE_INT, TYPE_REAL],
|
[TYPE_INT, TYPE_REAL],
|
||||||
[TYPE_INT, TYPE_REAL],
|
[TYPE_INT, TYPE_REAL],
|
||||||
TYPE_STRING
|
TYPE_STRING
|
||||||
],
|
],
|
||||||
[null, null, 1, "QUAD"]
|
[null, null, 1, "QUAD"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *path*: Path of the new scene
|
# - *path*: Path of the new scene
|
||||||
# - *enable_automatic_transition*: Automatically transition to the new scene
|
# - *enable_automatic_transition*: Automatically transition to the new scene
|
||||||
# (default: `true`)
|
# (default: `true`)
|
||||||
# - *run_events*: Run the standard ESC events of the new scene (default: `true`)
|
# - *run_events*: Run the standard ESC events of the new scene (default: `true`)
|
||||||
#
|
#
|
||||||
@@ -17,17 +17,17 @@ class_name ChangeSceneCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_STRING, TYPE_BOOL, TYPE_BOOL],
|
[TYPE_STRING, TYPE_BOOL, TYPE_BOOL],
|
||||||
[null, true, true]
|
[null, true, true]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array) -> bool:
|
func validate(arguments: Array) -> bool:
|
||||||
if not ResourceLoader.exists(arguments[0]):
|
if not ResourceLoader.exists(arguments[0]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"change_scene: Invalid scene",
|
"change_scene: Invalid scene",
|
||||||
["Scene %s was not found" % arguments[0]]
|
["Scene %s was not found" % arguments[0]]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
@@ -35,7 +35,7 @@ func validate(arguments: Array) -> bool:
|
|||||||
escoria.project_settings_manager.get_setting(escoria.project_settings_manager.GAME_SCENE)
|
escoria.project_settings_manager.get_setting(escoria.project_settings_manager.GAME_SCENE)
|
||||||
):
|
):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"change_scene: Game scene not found",
|
"change_scene: Game scene not found",
|
||||||
[
|
[
|
||||||
"The path set in 'ui/game_scene' was not found: %s" % \
|
"The path set in 'ui/game_scene' was not found: %s" % \
|
||||||
escoria.project_settings_manager.get_setting(
|
escoria.project_settings_manager.get_setting(
|
||||||
@@ -54,7 +54,7 @@ func run(command_params: Array) -> int:
|
|||||||
command_params[0], # scene file
|
command_params[0], # scene file
|
||||||
command_params[1] # enable_automatic_transition
|
command_params[1] # enable_automatic_transition
|
||||||
])
|
])
|
||||||
|
|
||||||
escoria.room_manager.change_scene(command_params[0], command_params[1])
|
escoria.room_manager.change_scene(command_params[0], command_params[1])
|
||||||
|
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# `custom object node func_name [params]`
|
# `custom object node func_name [params]`
|
||||||
#
|
#
|
||||||
# Calls the given Godot function on a (child) node of a registered `ESCitem`.
|
# Calls the given Godot function on a (child) node of a registered `ESCitem`.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -18,7 +18,7 @@ class_name CustomCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
3,
|
3,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_ARRAY],
|
[TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_ARRAY],
|
||||||
[null, null, null, []]
|
[null, null, null, []]
|
||||||
)
|
)
|
||||||
@@ -74,7 +74,7 @@ func run(command_params: Array) -> int:
|
|||||||
command_params[0]
|
command_params[0]
|
||||||
)
|
)
|
||||||
object.node.get_node(command_params[1]).call(
|
object.node.get_node(command_params[1]).call(
|
||||||
command_params[2],
|
command_params[2],
|
||||||
command_params[3]
|
command_params[3]
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ class_name DebugCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_STRING],
|
[TYPE_STRING],
|
||||||
[""]
|
[""]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# `dec_global name value`
|
# `dec_global name value`
|
||||||
#
|
#
|
||||||
# Subtract the given value from the specified global.
|
# Subtract the given value from the specified global.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -15,7 +15,7 @@ class_name DecGlobalCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_INT],
|
[TYPE_STRING, TYPE_INT],
|
||||||
[null, 0]
|
[null, 0]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class_name EnableTerrainCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_STRING],
|
[TYPE_STRING],
|
||||||
[null]
|
[null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# `hide_menu menu_type [enable_automatic_transition]`
|
# `hide_menu menu_type [enable_automatic_transition]`
|
||||||
#
|
#
|
||||||
# Hides either the main menu or the pause menu.
|
# Hides either the main menu or the pause menu.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
@@ -15,7 +15,7 @@ class_name HideMenuCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
0,
|
0,
|
||||||
[TYPE_STRING, TYPE_BOOL],
|
[TYPE_STRING, TYPE_BOOL],
|
||||||
["main", false]
|
["main", false]
|
||||||
)
|
)
|
||||||
@@ -40,28 +40,28 @@ func run(command_params: Array) -> int:
|
|||||||
if command_params[1]:
|
if command_params[1]:
|
||||||
# Transition out from menu
|
# Transition out from menu
|
||||||
transition_id = escoria.main.scene_transition.transition(
|
transition_id = escoria.main.scene_transition.transition(
|
||||||
"",
|
"",
|
||||||
ESCTransitionPlayer.TRANSITION_MODE.OUT
|
ESCTransitionPlayer.TRANSITION_MODE.OUT
|
||||||
)
|
)
|
||||||
while yield(
|
while yield(
|
||||||
escoria.main.scene_transition,
|
escoria.main.scene_transition,
|
||||||
"transition_done"
|
"transition_done"
|
||||||
) != transition_id:
|
) != transition_id:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if command_params[0] == "main":
|
if command_params[0] == "main":
|
||||||
escoria.game_scene.hide_main_menu()
|
escoria.game_scene.hide_main_menu()
|
||||||
elif command_params[0] == "pause":
|
elif command_params[0] == "pause":
|
||||||
escoria.game_scene.unpause_game()
|
escoria.game_scene.unpause_game()
|
||||||
|
|
||||||
if command_params[1] and escoria.main.current_scene != null:
|
if command_params[1] and escoria.main.current_scene != null:
|
||||||
transition_id = escoria.main.scene_transition.transition()
|
transition_id = escoria.main.scene_transition.transition()
|
||||||
|
|
||||||
if command_params[1] and escoria.main.current_scene != null:
|
if command_params[1] and escoria.main.current_scene != null:
|
||||||
while yield(
|
while yield(
|
||||||
escoria.main.scene_transition,
|
escoria.main.scene_transition,
|
||||||
"transition_done"
|
"transition_done"
|
||||||
) != transition_id:
|
) != transition_id:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# `inc_global name value`
|
# `inc_global name value`
|
||||||
#
|
#
|
||||||
# Adds the given value to the specified global.
|
# Adds the given value to the specified global.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -15,7 +15,7 @@ class_name IncGlobalCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_INT],
|
[TYPE_STRING, TYPE_INT],
|
||||||
[null, 0]
|
[null, 0]
|
||||||
)
|
)
|
||||||
@@ -45,7 +45,7 @@ func validate(arguments: Array):
|
|||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
escoria.globals_manager.set_global(
|
escoria.globals_manager.set_global(
|
||||||
command_params[0],
|
command_params[0],
|
||||||
escoria.globals_manager.get_global(command_params[0]) +\
|
escoria.globals_manager.get_global(command_params[0]) +\
|
||||||
command_params[1]
|
command_params[1]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class_name InventoryAddCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_STRING],
|
[TYPE_STRING],
|
||||||
[null]
|
[null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class_name InventoryRemoveCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_STRING],
|
[TYPE_STRING],
|
||||||
[null]
|
[null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# `play_snd file [player]`
|
# `play_snd file [player]`
|
||||||
#
|
#
|
||||||
# Plays the specified sound without blocking the event.
|
# Plays the specified sound without blocking the event.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -17,11 +17,11 @@ class_name PlaySndCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING],
|
[TYPE_STRING, TYPE_STRING],
|
||||||
[null, "_sound"]
|
[null, "_sound"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ class_name QueueEventCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_BOOL],
|
[TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_BOOL],
|
||||||
[null, null, "_front", false]
|
[null, null, "_front", false]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
@@ -72,9 +72,9 @@ func run(arguments: Array) -> int:
|
|||||||
arguments[0]
|
arguments[0]
|
||||||
).node
|
).node
|
||||||
var esc_script = escoria.esc_compiler.load_esc_file(node.esc_script)
|
var esc_script = escoria.esc_compiler.load_esc_file(node.esc_script)
|
||||||
|
|
||||||
return escoria.event_manager.queue_event_from_esc(
|
return escoria.event_manager.queue_event_from_esc(
|
||||||
esc_script,
|
esc_script,
|
||||||
arguments[1], # event name
|
arguments[1], # event name
|
||||||
arguments[2], # channel name
|
arguments[2], # channel name
|
||||||
arguments[3] # whether to block
|
arguments[3] # whether to block
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Queues the loading of the given resource into the resource cache.
|
# Queues the loading of the given resource into the resource cache.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *path*: Path of the resource to cache
|
# - *path*: Path of the resource to cache
|
||||||
# - *front_of_queue*: Whether to put the resource at the front of the
|
# - *front_of_queue*: Whether to put the resource at the front of the
|
||||||
# queue in order to load it as soon as possible (default: `false`)
|
# queue in order to load it as soon as possible (default: `false`)
|
||||||
@@ -16,7 +16,7 @@ class_name QueueResourceCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[],
|
[],
|
||||||
[null, false]
|
[null, false]
|
||||||
)
|
)
|
||||||
@@ -26,7 +26,7 @@ func configure() -> ESCCommandArgumentDescriptor:
|
|||||||
func validate(arguments: Array) -> bool:
|
func validate(arguments: Array) -> bool:
|
||||||
if not ResourceLoader.exists(arguments[0]):
|
if not ResourceLoader.exists(arguments[0]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"queue_resource: Invalid resource",
|
"queue_resource: Invalid resource",
|
||||||
["Resource %s was not found" % arguments[0]]
|
["Resource %s was not found" % arguments[0]]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class_name RandGlobalCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_INT],
|
[TYPE_STRING, TYPE_INT],
|
||||||
[null, 1]
|
[null, 1]
|
||||||
)
|
)
|
||||||
@@ -47,7 +47,7 @@ func run(command_params: Array) -> int:
|
|||||||
randomize()
|
randomize()
|
||||||
var rnd = randi() % command_params[1]
|
var rnd = randi() % command_params[1]
|
||||||
escoria.globals_manager.set_global(
|
escoria.globals_manager.set_global(
|
||||||
command_params[0],
|
command_params[0],
|
||||||
rnd
|
rnd
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# `repeat`
|
# `repeat`
|
||||||
#
|
#
|
||||||
# Restarts the execution of the current scope at the start. A scope can be a
|
# Restarts the execution of the current scope at the start. A scope can be a
|
||||||
# group or an event.
|
# group or an event.
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name RepeatCommand
|
class_name RepeatCommand
|
||||||
@@ -11,7 +11,7 @@ class_name RepeatCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
0,
|
0,
|
||||||
[],
|
[],
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
# `say player text [type]`
|
# `say player text [type]`
|
||||||
#
|
#
|
||||||
# Displays the specified string as dialog spoken by the player. Blocks execution
|
# Displays the specified string as dialog spoken by the player. Blocks execution
|
||||||
# until the dialog has finished playing.
|
# until the dialog has finished playing.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *player*: Global ID of the `ESCPlayer` or `ESCItem` object that is active
|
# - *player*: Global ID of the `ESCPlayer` or `ESCItem` object that is active
|
||||||
# - *text*: Text to display
|
# - *text*: Text to display
|
||||||
# - *type*: Dialog type to use. One of `floating` or `avatar`
|
# - *type*: Dialog type to use. One of `floating` or `avatar`
|
||||||
# (default: the value set in the setting "Escoria/UI/Default Dialog Type")
|
# (default: the value set in the setting "Escoria/UI/Default Dialog Type")
|
||||||
#
|
#
|
||||||
# The text supports translation keys by prepending the key followed by
|
# The text supports translation keys by prepending the key followed by
|
||||||
# a colon (`:`) to the text.
|
# a colon (`:`) to the text.
|
||||||
#
|
#
|
||||||
# Example: `say player ROOM1_PICTURE:"Picture's looking good."`
|
# Example: `say player ROOM1_PICTURE:"Picture's looking good."`
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
@@ -23,11 +23,11 @@ class_name SayCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_STRING],
|
[TYPE_STRING, TYPE_STRING, TYPE_STRING],
|
||||||
[
|
[
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
""
|
""
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -36,8 +36,8 @@ func configure() -> ESCCommandArgumentDescriptor:
|
|||||||
true
|
true
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if not escoria.object_manager.objects.has(arguments[0]):
|
if not escoria.object_manager.objects.has(arguments[0]):
|
||||||
@@ -51,35 +51,35 @@ func validate(arguments: Array):
|
|||||||
if ProjectSettings.get_setting("escoria/ui/default_dialog_type") == "" \
|
if ProjectSettings.get_setting("escoria/ui/default_dialog_type") == "" \
|
||||||
and arguments[2] == "":
|
and arguments[2] == "":
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"say()",
|
"say()",
|
||||||
[
|
[
|
||||||
"Project setting 'escoria/ui/default_dialog_type' is not set.",
|
"Project setting 'escoria/ui/default_dialog_type' is not set.",
|
||||||
"Please set a default dialog type."
|
"Please set a default dialog type."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
|
|
||||||
var dict: Dictionary
|
var dict: Dictionary
|
||||||
|
|
||||||
escoria.current_state = escoria.GAME_STATE.DIALOG
|
escoria.current_state = escoria.GAME_STATE.DIALOG
|
||||||
|
|
||||||
if !escoria.dialog_player:
|
if !escoria.dialog_player:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"No dialog player registered",
|
"No dialog player registered",
|
||||||
[
|
[
|
||||||
"No dialog player was registered and the say command was" +
|
"No dialog player was registered and the say command was" +
|
||||||
"encountered."
|
"encountered."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_ERROR
|
return ESCExecution.RC_ERROR
|
||||||
|
|
||||||
escoria.dialog_player.say(
|
escoria.dialog_player.say(
|
||||||
command_params[0],
|
command_params[0],
|
||||||
command_params[2],
|
command_params[2],
|
||||||
command_params[1]
|
command_params[1]
|
||||||
)
|
)
|
||||||
yield(escoria.dialog_player, "say_finished")
|
yield(escoria.dialog_player, "say_finished")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# `sched_event time object event`
|
# `sched_event time object event`
|
||||||
#
|
#
|
||||||
# Schedules the execution to run at a later time.
|
# Schedules the execution to run at a later time.
|
||||||
#
|
#
|
||||||
# If another event is already running when the scheduled
|
# If another event is already running when the scheduled
|
||||||
# event is to start, execution of the scheduled event
|
# event is to start, execution of the scheduled event
|
||||||
# begins when the already-running event ends.
|
# begins when the already-running event ends.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -20,7 +20,7 @@ class_name SchedEventCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
3,
|
3,
|
||||||
[TYPE_INT, TYPE_STRING, TYPE_STRING],
|
[TYPE_INT, TYPE_STRING, TYPE_STRING],
|
||||||
[null, null, null]
|
[null, null, null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# `set_active object active`
|
# `set_active object active`
|
||||||
#
|
#
|
||||||
# Changes the "active" state of the object. `active` can be `true` or `false`.
|
# Changes the "active" state of the object. `active` can be `true` or `false`.
|
||||||
# Inactive objects are invisible in the room.
|
# Inactive objects are invisible in the room.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -16,11 +16,11 @@ class_name SetActiveCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_BOOL],
|
[TYPE_STRING, TYPE_BOOL],
|
||||||
[null, null]
|
[null, null]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
# - *object*: Global ID of the object to turn
|
# - *object*: Global ID of the object to turn
|
||||||
# - *degrees*: Number of degrees by which `object` is to be turned
|
# - *degrees*: Number of degrees by which `object` is to be turned
|
||||||
# - *wait*: Number of seconds to wait for each animation occurring between the
|
# - *wait*: Number of seconds to wait for each animation occurring between the
|
||||||
# current angle of `object` and the angle specified. A value of `0` will
|
# current angle of `object` and the angle specified. A value of `0` will
|
||||||
# complete the turn immediately (default: `0`)
|
# complete the turn immediately (default: `0`)
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
@@ -18,11 +18,11 @@ class_name SetAngleCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_INT, TYPE_REAL],
|
[TYPE_STRING, TYPE_INT, TYPE_REAL],
|
||||||
[null, null, 0.0]
|
[null, null, 0.0]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
@@ -44,8 +44,8 @@ func run(command_params: Array) -> int:
|
|||||||
# 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(
|
.set_angle(
|
||||||
wrapi(int(command_params[1]) + 90, 0, 360),
|
wrapi(int(command_params[1]) + 90, 0, 360),
|
||||||
command_params[2]
|
command_params[2]
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class_name SetAnimationsCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING],
|
[TYPE_STRING, TYPE_STRING],
|
||||||
[null, null]
|
[null, null]
|
||||||
)
|
)
|
||||||
@@ -40,7 +40,7 @@ func validate(arguments: Array):
|
|||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
@@ -64,4 +64,4 @@ func run(command_params: Array) -> int:
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class_name SetGlobalCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, [TYPE_INT, TYPE_BOOL, TYPE_STRING]],
|
[TYPE_STRING, [TYPE_INT, TYPE_BOOL, TYPE_STRING]],
|
||||||
[null, null]
|
[null, null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `set_globals pattern value`
|
# `set_globals pattern value`
|
||||||
#
|
#
|
||||||
# Changes the value of multiple globals using a wildcard pattern, where `*`
|
# Changes the value of multiple globals using a wildcard pattern, where `*`
|
||||||
# matches zero or more arbitrary characters and `?` matches any single
|
# matches zero or more arbitrary characters and `?` matches any single
|
||||||
# character except a period (".").
|
# character except a period (".").
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -17,7 +17,7 @@ class_name SetGlobalsCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, [TYPE_BOOL, TYPE_STRING, TYPE_INT]],
|
[TYPE_STRING, [TYPE_BOOL, TYPE_STRING, TYPE_INT]],
|
||||||
[null, null]
|
[null, null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class_name SetGuiVisibleCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[TYPE_BOOL],
|
[TYPE_BOOL],
|
||||||
[null]
|
[null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ class_name SetInteractiveCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_BOOL],
|
[TYPE_STRING, TYPE_BOOL],
|
||||||
[null, null]
|
[null, null]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class_name SetSpeedCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_INT],
|
[TYPE_STRING, TYPE_INT],
|
||||||
[null, null]
|
[null, null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
#
|
#
|
||||||
# Changes the state of `object` to the one specified.
|
# Changes the state of `object` to the one specified.
|
||||||
#
|
#
|
||||||
# If the specified object's associated animation player has an animation
|
# If the specified object's associated animation player has an animation
|
||||||
# with the same name, that that animation is also played.
|
# with the same name, that that animation is also played.
|
||||||
#
|
#
|
||||||
# Can be used to change the appearance of an item or player
|
# Can be used to change the appearance of an item or player
|
||||||
# character. See https://docs.escoria-framework.org/states for details.
|
# character. See https://docs.escoria-framework.org/states for details.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -22,11 +22,11 @@ class_name SetStateCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_BOOL],
|
[TYPE_STRING, TYPE_STRING, TYPE_BOOL],
|
||||||
[null, null, false]
|
[null, null, false]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# `show_menu menu_type [enable_automatic_transition]`
|
# `show_menu menu_type [enable_automatic_transition]`
|
||||||
#
|
#
|
||||||
# Shows either the main menu or the pause menu.
|
# Shows either the main menu or the pause menu.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
@@ -15,7 +15,7 @@ class_name ShowMenuCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
0,
|
0,
|
||||||
[TYPE_STRING, TYPE_BOOL],
|
[TYPE_STRING, TYPE_BOOL],
|
||||||
["main", false]
|
["main", false]
|
||||||
)
|
)
|
||||||
@@ -38,37 +38,37 @@ func validate(arguments: Array):
|
|||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
if not escoria.game_scene.is_inside_tree():
|
if not escoria.game_scene.is_inside_tree():
|
||||||
escoria.add_child(escoria.game_scene)
|
escoria.add_child(escoria.game_scene)
|
||||||
|
|
||||||
if command_params[1]:
|
if command_params[1]:
|
||||||
# Transition out from current scene
|
# Transition out from current scene
|
||||||
var transition_id = escoria.main.scene_transition.transition(
|
var transition_id = escoria.main.scene_transition.transition(
|
||||||
"",
|
"",
|
||||||
ESCTransitionPlayer.TRANSITION_MODE.OUT
|
ESCTransitionPlayer.TRANSITION_MODE.OUT
|
||||||
)
|
)
|
||||||
while yield(
|
while yield(
|
||||||
escoria.main.scene_transition,
|
escoria.main.scene_transition,
|
||||||
"transition_done"
|
"transition_done"
|
||||||
) != transition_id:
|
) != transition_id:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if command_params[0] == "main":
|
if command_params[0] == "main":
|
||||||
escoria.game_scene.show_main_menu()
|
escoria.game_scene.show_main_menu()
|
||||||
elif command_params[0] == "pause":
|
elif command_params[0] == "pause":
|
||||||
escoria.game_scene.pause_game()
|
escoria.game_scene.pause_game()
|
||||||
|
|
||||||
# Transition in to menu
|
# Transition in to menu
|
||||||
transition_id = escoria.main.scene_transition.transition()
|
transition_id = escoria.main.scene_transition.transition()
|
||||||
|
|
||||||
while yield(
|
while yield(
|
||||||
escoria.main.scene_transition,
|
escoria.main.scene_transition,
|
||||||
"transition_done"
|
"transition_done"
|
||||||
) != transition_id:
|
) != transition_id:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if command_params[0] == "main":
|
if command_params[0] == "main":
|
||||||
escoria.game_scene.show_main_menu()
|
escoria.game_scene.show_main_menu()
|
||||||
elif command_params[0] == "pause":
|
elif command_params[0] == "pause":
|
||||||
escoria.game_scene.pause_game()
|
escoria.game_scene.pause_game()
|
||||||
|
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `slide object target [speed]`
|
# `slide object target [speed]`
|
||||||
#
|
#
|
||||||
# Moves `object` towards the position of `target`. This command is
|
# Moves `object` towards the position of `target`. This command is
|
||||||
# non-blocking.
|
# non-blocking.
|
||||||
#
|
#
|
||||||
# - *object*: Global ID of the object to move
|
# - *object*: Global ID of the object to move
|
||||||
# - *target*: Global ID of the target object
|
# - *target*: Global ID of the target object
|
||||||
@@ -22,7 +22,7 @@ var _tweens: Dictionary
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_INT],
|
[TYPE_STRING, TYPE_STRING, TYPE_INT],
|
||||||
[null, null, -1]
|
[null, null, -1]
|
||||||
)
|
)
|
||||||
@@ -37,7 +37,7 @@ func validate(arguments: Array):
|
|||||||
"Object with global id %s not found" % arguments[0]
|
"Object with global id %s not found" % arguments[0]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
if not escoria.object_manager.objects.has(arguments[1]):
|
if not escoria.object_manager.objects.has(arguments[1]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"slide: invalid second object",
|
"slide: invalid second object",
|
||||||
@@ -55,30 +55,30 @@ func validate(arguments: Array):
|
|||||||
#
|
#
|
||||||
# - source: The item to slide
|
# - source: The item to slide
|
||||||
# - destination: The destination item to slide to
|
# - destination: The destination item to slide to
|
||||||
# - speed: The speed at which to slide (will default to the
|
# - speed: The speed at which to slide (will default to the
|
||||||
#
|
#
|
||||||
# **Returns** The generated (and started) tween
|
# **Returns** The generated (and started) tween
|
||||||
func _slide_object(
|
func _slide_object(
|
||||||
source: ESCObject,
|
source: ESCObject,
|
||||||
destination: ESCObject,
|
destination: ESCObject,
|
||||||
speed: int = -1
|
speed: int = -1
|
||||||
) -> Tween:
|
) -> Tween:
|
||||||
if speed == -1:
|
if speed == -1:
|
||||||
speed = source.node.speed
|
speed = source.node.speed
|
||||||
|
|
||||||
if _tweens.has(source.global_id):
|
if _tweens.has(source.global_id):
|
||||||
var tween = (_tweens.get(source.global_id) as Tween)
|
var tween = (_tweens.get(source.global_id) as Tween)
|
||||||
tween.stop_all()
|
tween.stop_all()
|
||||||
if (escoria.main as Node).has_node(tween.name):
|
if (escoria.main as Node).has_node(tween.name):
|
||||||
(escoria.main as Node).remove_child(tween)
|
(escoria.main as Node).remove_child(tween)
|
||||||
|
|
||||||
var tween = Tween.new()
|
var tween = Tween.new()
|
||||||
(escoria.main as Node).add_child(tween)
|
(escoria.main as Node).add_child(tween)
|
||||||
|
|
||||||
var duration = source.node.position.distance_to(
|
var duration = source.node.position.distance_to(
|
||||||
destination.node.position
|
destination.node.position
|
||||||
) / speed
|
) / speed
|
||||||
|
|
||||||
tween.interpolate_property(
|
tween.interpolate_property(
|
||||||
source.node,
|
source.node,
|
||||||
"global_position",
|
"global_position",
|
||||||
@@ -86,13 +86,13 @@ func _slide_object(
|
|||||||
destination.node.global_position,
|
destination.node.global_position,
|
||||||
duration
|
duration
|
||||||
)
|
)
|
||||||
|
|
||||||
tween.start()
|
tween.start()
|
||||||
|
|
||||||
_tweens[source.global_id] = tween
|
_tweens[source.global_id] = tween
|
||||||
|
|
||||||
return tween
|
return tween
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `slide_block object target [speed]`
|
# `slide_block object target [speed]`
|
||||||
#
|
#
|
||||||
# Moves `object` towards the position of `target`. This command is
|
# Moves `object` towards the position of `target`. This command is
|
||||||
# blocking.
|
# blocking.
|
||||||
#
|
#
|
||||||
# - *object*: Global ID of the object to move
|
# - *object*: Global ID of the object to move
|
||||||
# - *target*: Global ID of the target object
|
# - *target*: Global ID of the target object
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class_name SpawnCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_BOOL, TYPE_STRING],
|
[TYPE_STRING, TYPE_STRING, TYPE_BOOL, TYPE_STRING],
|
||||||
[null, null, true, null]
|
[null, null, true, null]
|
||||||
)
|
)
|
||||||
@@ -57,7 +57,7 @@ func validate(arguments: Array):
|
|||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
var res_scene = escoria.resource_cache.get_resource(command_params[1])
|
var res_scene = escoria.resource_cache.get_resource(command_params[1])
|
||||||
|
|
||||||
# Load room scene
|
# Load room scene
|
||||||
var scene = res_scene.instance()
|
var scene = res_scene.instance()
|
||||||
if scene:
|
if scene:
|
||||||
@@ -66,7 +66,7 @@ func run(command_params: Array) -> int:
|
|||||||
var obj = escoria.object_manager.get_object(command_params[3])
|
var obj = escoria.object_manager.get_object(command_params[3])
|
||||||
scene.set_position(obj.get_global_position())
|
scene.set_position(obj.get_global_position())
|
||||||
escoria.inputs_manager.hotspot_focused = ""
|
escoria.inputs_manager.hotspot_focused = ""
|
||||||
|
|
||||||
escoria.object_manager.register_object(
|
escoria.object_manager.register_object(
|
||||||
ESCObject.new(
|
ESCObject.new(
|
||||||
command_params[0],
|
command_params[0],
|
||||||
@@ -74,13 +74,13 @@ func run(command_params: Array) -> int:
|
|||||||
),
|
),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
escoria.object_manager.get_object(command_params[0]).active = \
|
escoria.object_manager.get_object(command_params[0]).active = \
|
||||||
command_params[2]
|
command_params[2]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"spawn: Invalid scene",
|
"spawn: Invalid scene",
|
||||||
[
|
[
|
||||||
"Failed loading scene %s" % command_params[1]
|
"Failed loading scene %s" % command_params[1]
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `stop`
|
# `stop`
|
||||||
#
|
#
|
||||||
# Stops the current event's execution.
|
# Stops the current event's execution.
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name StopCommand
|
class_name StopCommand
|
||||||
@@ -10,7 +10,7 @@ class_name StopCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
0,
|
0,
|
||||||
[],
|
[],
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# `stop_snd [player]`
|
# `stop_snd [player]`
|
||||||
#
|
#
|
||||||
# Stops the given sound player's stream.
|
# Stops the given sound player's stream.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -16,11 +16,11 @@ class_name StopSndCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
0,
|
0,
|
||||||
[TYPE_STRING],
|
[TYPE_STRING],
|
||||||
["_music"]
|
["_music"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
@@ -31,7 +31,7 @@ func validate(arguments: Array):
|
|||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ class_name TeleportCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING],
|
[TYPE_STRING, TYPE_STRING],
|
||||||
[null, null]
|
[null, null]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if not escoria.object_manager.objects.has(arguments[0]):
|
if not escoria.object_manager.objects.has(arguments[0]):
|
||||||
@@ -30,7 +30,7 @@ func validate(arguments: Array):
|
|||||||
"Object with global id %s not found" % arguments[0]
|
"Object with global id %s not found" % arguments[0]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
if not escoria.object_manager.objects.has(arguments[1]):
|
if not escoria.object_manager.objects.has(arguments[1]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"teleport: invalid second object",
|
"teleport: invalid second object",
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ class_name TeleportPosCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_INT, TYPE_INT],
|
[TYPE_STRING, TYPE_INT, TYPE_INT],
|
||||||
[null, null, null]
|
[null, null, null]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if not escoria.object_manager.objects.has(arguments[0]):
|
if not escoria.object_manager.objects.has(arguments[0]):
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# `transition transition_name mode [delay]`
|
# `transition transition_name mode [delay]`
|
||||||
#
|
#
|
||||||
# Performs a transition into or out of a room programmatically.
|
# Performs a transition into or out of a room programmatically.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *transition_name*: Name of the transition shader from one of the transition
|
# - *transition_name*: Name of the transition shader from one of the transition
|
||||||
# directories
|
# directories
|
||||||
# - *mode*: Set to `in` to transition into or `out` to transition out of the room
|
# - *mode*: Set to `in` to transition into or `out` to transition out of the room
|
||||||
# - *delay*: Delay in seconds before starting the transition (default: `1`)
|
# - *delay*: Delay in seconds before starting the transition (default: `1`)
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name TransitionCommand
|
class_name TransitionCommand
|
||||||
@@ -17,12 +17,12 @@ class_name TransitionCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_REAL],
|
[TYPE_STRING, TYPE_STRING, TYPE_REAL],
|
||||||
[null, null, 1.0]
|
[null, null, 1.0]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if not escoria.main.scene_transition.has_transition(arguments[0]):
|
if not escoria.main.scene_transition.has_transition(arguments[0]):
|
||||||
@@ -52,13 +52,13 @@ func run(command_params: Array) -> int:
|
|||||||
else ESCTransitionPlayer.TRANSITION_MODE.IN,
|
else ESCTransitionPlayer.TRANSITION_MODE.IN,
|
||||||
command_params[2]
|
command_params[2]
|
||||||
)
|
)
|
||||||
escoria.logger.debug("Starting transition #%s [%s, %s]"
|
escoria.logger.debug("Starting transition #%s [%s, %s]"
|
||||||
% [transition_id, command_params[0], command_params[1]])
|
% [transition_id, command_params[0], command_params[1]])
|
||||||
while yield(
|
while yield(
|
||||||
escoria.main.scene_transition,
|
escoria.main.scene_transition,
|
||||||
"transition_done"
|
"transition_done"
|
||||||
) != transition_id:
|
) != transition_id:
|
||||||
pass
|
pass
|
||||||
escoria.logger.debug("Ending transition #%s [%s, %s]"
|
escoria.logger.debug("Ending transition #%s [%s, %s]"
|
||||||
% [transition_id, command_params[0], command_params[1]])
|
% [transition_id, command_params[0], command_params[1]])
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# `turn_to object object_to_face [wait]`
|
# `turn_to object object_to_face [wait]`
|
||||||
#
|
#
|
||||||
# Turns `object` to face another object.
|
# Turns `object` to face another object.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *object*: Global ID of the object to be turned
|
# - *object*: Global ID of the object to be turned
|
||||||
# - *object_to_face*: Global ID of the object to turn towards
|
# - *object_to_face*: Global ID of the object to turn towards
|
||||||
# - *wait*: Length of time to wait in seconds for each intermediate angle.
|
# - *wait*: Length of time to wait in seconds for each intermediate angle.
|
||||||
# If set to 0, the turnaround is immediate (default: `0`)
|
# If set to 0, the turnaround is immediate (default: `0`)
|
||||||
##
|
##
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name TurnToCommand
|
class_name TurnToCommand
|
||||||
@@ -17,11 +17,11 @@ class_name TurnToCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_REAL],
|
[TYPE_STRING, TYPE_STRING, TYPE_REAL],
|
||||||
[null, null, 0.0]
|
[null, null, 0.0]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class_name WaitCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
1,
|
1,
|
||||||
[[TYPE_INT, TYPE_REAL]],
|
[[TYPE_INT, TYPE_REAL]],
|
||||||
[null]
|
[null]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# - *object*: Global ID of the object to move
|
# - *object*: Global ID of the object to move
|
||||||
# - *target*: Global ID of the target object
|
# - *target*: Global ID of the target object
|
||||||
# - *speed*: Walking speed to use (default: `object`'s default speed)
|
# - *speed*: Walking speed to use (default: `object`'s default speed)
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name WalkCommand
|
class_name WalkCommand
|
||||||
@@ -17,7 +17,7 @@ class_name WalkCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_INT],
|
[TYPE_STRING, TYPE_STRING, TYPE_INT],
|
||||||
[null, null, null]
|
[null, null, null]
|
||||||
)
|
)
|
||||||
@@ -32,7 +32,7 @@ func validate(arguments: Array):
|
|||||||
"Object with global id %s not found" % arguments[0]
|
"Object with global id %s not found" % arguments[0]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
if not escoria.object_manager.objects.has(arguments[1]):
|
if not escoria.object_manager.objects.has(arguments[1]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"walk: invalid second object",
|
"walk: invalid second object",
|
||||||
@@ -47,7 +47,7 @@ func validate(arguments: Array):
|
|||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
escoria.action_manager.do(
|
escoria.action_manager.do(
|
||||||
escoria.action_manager.ACTION.BACKGROUND_CLICK,
|
escoria.action_manager.ACTION.BACKGROUND_CLICK,
|
||||||
command_params
|
command_params
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# `walk_block object target [speed]`
|
# `walk_block object target [speed]`
|
||||||
#
|
#
|
||||||
# Moves the specified `ESCPlayer` or movable `ESCItem` to `target`
|
# Moves the specified `ESCPlayer` or movable `ESCItem` to `target`
|
||||||
# while playing `object`'s walking animation. This command is blocking.
|
# while playing `object`'s walking animation. This command is blocking.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
# - *object*: Global ID of the object to move
|
# - *object*: Global ID of the object to move
|
||||||
# - *target*: Global ID of the target object
|
# - *target*: Global ID of the target object
|
||||||
# - *speed*: Walking speed to use (default: `object`'s default speed)
|
# - *speed*: Walking speed to use (default: `object`'s default speed)
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name WalkBlockCommand
|
class_name WalkBlockCommand
|
||||||
@@ -17,7 +17,7 @@ class_name WalkBlockCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING, TYPE_INT],
|
[TYPE_STRING, TYPE_STRING, TYPE_INT],
|
||||||
[null, null, null]
|
[null, null, null]
|
||||||
)
|
)
|
||||||
@@ -32,7 +32,7 @@ func validate(arguments: Array):
|
|||||||
"Object with global id %s not found" % arguments[0]
|
"Object with global id %s not found" % arguments[0]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
if not escoria.object_manager.objects.has(arguments[1]):
|
if not escoria.object_manager.objects.has(arguments[1]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"walk_block: invalid second object",
|
"walk_block: invalid second object",
|
||||||
@@ -47,11 +47,11 @@ func validate(arguments: Array):
|
|||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
escoria.action_manager.do(
|
escoria.action_manager.do(
|
||||||
escoria.action_manager.ACTION.BACKGROUND_CLICK,
|
escoria.action_manager.ACTION.BACKGROUND_CLICK,
|
||||||
command_params
|
command_params
|
||||||
)
|
)
|
||||||
yield(
|
yield(
|
||||||
(escoria.object_manager.objects[command_params[0]].node as ESCItem),
|
(escoria.object_manager.objects[command_params[0]].node as ESCItem),
|
||||||
"arrived"
|
"arrived"
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `walk_to_pos object x y`
|
# `walk_to_pos object x y`
|
||||||
#
|
#
|
||||||
# Moves the specified `ESCPlayer` or movable `ESCItem` to the target
|
# Moves the specified `ESCPlayer` or movable `ESCItem` to the target
|
||||||
# position while playing `object`'s walking animation.
|
# position while playing `object`'s walking animation.
|
||||||
# This command is non-blocking.
|
# This command is non-blocking.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
# - *object*: Global ID of the object to move
|
# - *object*: Global ID of the object to move
|
||||||
# - *x*: X-coordinate of target position
|
# - *x*: X-coordinate of target position
|
||||||
# - *y*: Y-coordinate of target position
|
# - *y*: Y-coordinate of target position
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name WalkToPosCommand
|
class_name WalkToPosCommand
|
||||||
@@ -18,7 +18,7 @@ class_name WalkToPosCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
3,
|
3,
|
||||||
[TYPE_STRING, TYPE_INT, TYPE_INT],
|
[TYPE_STRING, TYPE_INT, TYPE_INT],
|
||||||
[null, null, null]
|
[null, null, null]
|
||||||
)
|
)
|
||||||
@@ -33,7 +33,7 @@ func validate(arguments: Array):
|
|||||||
"Object with global id %s not found" % arguments[0]
|
"Object with global id %s not found" % arguments[0]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# `walk_to_pos_block object x y`
|
# `walk_to_pos_block object x y`
|
||||||
#
|
#
|
||||||
# Moves the specified `ESCPlayer` or movable `ESCItem` to the target
|
# Moves the specified `ESCPlayer` or movable `ESCItem` to the target
|
||||||
# position while playing `object`'s walking animation.
|
# position while playing `object`'s walking animation.
|
||||||
# This command is blocking.
|
# This command is blocking.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
# - *object*: Global ID of the object to move
|
# - *object*: Global ID of the object to move
|
||||||
# - *x*: X-coordinate of target position
|
# - *x*: X-coordinate of target position
|
||||||
# - *y*: Y-coordinate of target position
|
# - *y*: Y-coordinate of target position
|
||||||
#
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name WalkToPosBlockCommand
|
class_name WalkToPosBlockCommand
|
||||||
@@ -18,7 +18,7 @@ class_name WalkToPosBlockCommand
|
|||||||
# Return the descriptor of the arguments of this command
|
# Return the descriptor of the arguments of this command
|
||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
3,
|
3,
|
||||||
[TYPE_STRING, TYPE_INT, TYPE_INT],
|
[TYPE_STRING, TYPE_INT, TYPE_INT],
|
||||||
[null, null, null]
|
[null, null, null]
|
||||||
)
|
)
|
||||||
@@ -33,7 +33,7 @@ func validate(arguments: Array):
|
|||||||
"Object with global id %s not found" % arguments[0]
|
"Object with global id %s not found" % arguments[0]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
return .validate(arguments)
|
return .validate(arguments)
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ func run(command_params: Array) -> int:
|
|||||||
Vector2(command_params[1], command_params[2])
|
Vector2(command_params[1], command_params[2])
|
||||||
])
|
])
|
||||||
yield(
|
yield(
|
||||||
(escoria.object_manager.objects[command_params[0]].node as ESCItem),
|
(escoria.object_manager.objects[command_params[0]].node as ESCItem),
|
||||||
"arrived"
|
"arrived"
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ var action_state = ACTION_INPUT_STATE.AWAITING_VERB_OR_ITEM \
|
|||||||
#
|
#
|
||||||
# - action: type of the action to run
|
# - action: type of the action to run
|
||||||
# - params: Parameters for the action
|
# - params: Parameters for the action
|
||||||
# - can_interrupt: if true, this command will interrupt any ongoing event
|
# - can_interrupt: if true, this command will interrupt any ongoing event
|
||||||
# before it is finished
|
# before it is finished
|
||||||
func do(action: int, params: Array = [], can_interrupt: bool = false) -> void:
|
func do(action: int, params: Array = [], can_interrupt: bool = false) -> void:
|
||||||
if escoria.current_state == escoria.GAME_STATE.DEFAULT:
|
if escoria.current_state == escoria.GAME_STATE.DEFAULT:
|
||||||
@@ -83,13 +83,13 @@ func do(action: int, params: Array = [], can_interrupt: bool = false) -> void:
|
|||||||
ACTION.BACKGROUND_CLICK:
|
ACTION.BACKGROUND_CLICK:
|
||||||
if can_interrupt:
|
if can_interrupt:
|
||||||
escoria.event_manager.interrupt_running_event()
|
escoria.event_manager.interrupt_running_event()
|
||||||
|
|
||||||
self.clear_current_action()
|
self.clear_current_action()
|
||||||
|
|
||||||
var walk_fast = false
|
var walk_fast = false
|
||||||
if params.size() > 2:
|
if params.size() > 2:
|
||||||
walk_fast = true if params[2] else false
|
walk_fast = true if params[2] else false
|
||||||
|
|
||||||
# Check moving object.
|
# Check moving object.
|
||||||
if not escoria.object_manager.has(params[0]):
|
if not escoria.object_manager.has(params[0]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
@@ -100,10 +100,10 @@ func do(action: int, params: Array = [], can_interrupt: bool = false) -> void:
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
var moving_obj = escoria.object_manager.get_object(params[0])
|
var moving_obj = escoria.object_manager.get_object(params[0])
|
||||||
var target
|
var target
|
||||||
|
|
||||||
if params[1] is String:
|
if params[1] is String:
|
||||||
if not escoria.object_manager.has(params[1]):
|
if not escoria.object_manager.has(params[1]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
@@ -114,39 +114,39 @@ func do(action: int, params: Array = [], can_interrupt: bool = false) -> void:
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
target = escoria.object_manager.get_object(params[1])
|
target = escoria.object_manager.get_object(params[1])
|
||||||
elif params[1] is Vector2:
|
elif params[1] is Vector2:
|
||||||
target = params[1]
|
target = params[1]
|
||||||
|
|
||||||
self.perform_walk(moving_obj, target, walk_fast)
|
self.perform_walk(moving_obj, target, walk_fast)
|
||||||
|
|
||||||
ACTION.ITEM_LEFT_CLICK:
|
ACTION.ITEM_LEFT_CLICK:
|
||||||
if params[0] is String:
|
if params[0] is String:
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
"esc_action_manager.do(): item_left_click on item ",
|
"esc_action_manager.do(): item_left_click on item ",
|
||||||
[params[0]]
|
[params[0]]
|
||||||
)
|
)
|
||||||
|
|
||||||
if can_interrupt:
|
if can_interrupt:
|
||||||
escoria.event_manager.interrupt_running_event()
|
escoria.event_manager.interrupt_running_event()
|
||||||
|
|
||||||
var item = escoria.object_manager.get_object(params[0])
|
var item = escoria.object_manager.get_object(params[0])
|
||||||
self.perform_inputevent_on_object(item, params[1])
|
self.perform_inputevent_on_object(item, params[1])
|
||||||
|
|
||||||
ACTION.ITEM_RIGHT_CLICK:
|
ACTION.ITEM_RIGHT_CLICK:
|
||||||
if params[0] is String:
|
if params[0] is String:
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
"esc_action_manager.do(): item_right_click on item ",
|
"esc_action_manager.do(): item_right_click on item ",
|
||||||
[params[0]]
|
[params[0]]
|
||||||
)
|
)
|
||||||
|
|
||||||
if can_interrupt:
|
if can_interrupt:
|
||||||
escoria.event_manager.interrupt_running_event()
|
escoria.event_manager.interrupt_running_event()
|
||||||
|
|
||||||
var item = escoria.object_manager.get_object(params[0])
|
var item = escoria.object_manager.get_object(params[0])
|
||||||
self.perform_inputevent_on_object(item, params[1], true)
|
self.perform_inputevent_on_object(item, params[1], true)
|
||||||
|
|
||||||
ACTION.TRIGGER_IN:
|
ACTION.TRIGGER_IN:
|
||||||
var trigger_id = params[0]
|
var trigger_id = params[0]
|
||||||
var object_id = params[1]
|
var object_id = params[1]
|
||||||
@@ -160,7 +160,7 @@ func do(action: int, params: Array = [], can_interrupt: bool = false) -> void:
|
|||||||
trigger_in_verb
|
trigger_in_verb
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
ACTION.TRIGGER_OUT:
|
ACTION.TRIGGER_OUT:
|
||||||
var trigger_id = params[0]
|
var trigger_id = params[0]
|
||||||
var object_id = params[1]
|
var object_id = params[1]
|
||||||
@@ -174,7 +174,7 @@ func do(action: int, params: Array = [], can_interrupt: bool = false) -> void:
|
|||||||
trigger_out_verb
|
trigger_out_verb
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
_:
|
_:
|
||||||
escoria.logger.report_warnings("esc_action_manager.gd:do()",
|
escoria.logger.report_warnings("esc_action_manager.gd:do()",
|
||||||
["Action received:", action, "with params ", params])
|
["Action received:", action, "with params ", params])
|
||||||
@@ -198,14 +198,14 @@ func set_action_input_state(p_state):
|
|||||||
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()
|
||||||
|
|
||||||
current_action = action
|
current_action = action
|
||||||
|
|
||||||
if action_state == ACTION_INPUT_STATE.AWAITING_VERB_OR_ITEM:
|
if action_state == ACTION_INPUT_STATE.AWAITING_VERB_OR_ITEM:
|
||||||
set_action_input_state(ACTION_INPUT_STATE.AWAITING_ITEM)
|
set_action_input_state(ACTION_INPUT_STATE.AWAITING_ITEM)
|
||||||
elif action_state == ACTION_INPUT_STATE.AWAITING_VERB:
|
elif action_state == ACTION_INPUT_STATE.AWAITING_VERB:
|
||||||
set_action_input_state(ACTION_INPUT_STATE.AWAITING_VERB_CONFIRM)
|
set_action_input_state(ACTION_INPUT_STATE.AWAITING_VERB_CONFIRM)
|
||||||
|
|
||||||
emit_signal("action_changed")
|
emit_signal("action_changed")
|
||||||
|
|
||||||
|
|
||||||
@@ -235,12 +235,12 @@ func clear_current_tool():
|
|||||||
# - target: Target ESC object
|
# - target: Target ESC object
|
||||||
# - combine_with: ESC object to combine with
|
# - combine_with: ESC object to combine with
|
||||||
func _activate(
|
func _activate(
|
||||||
action: String,
|
action: String,
|
||||||
target: ESCObject,
|
target: ESCObject,
|
||||||
combine_with: ESCObject = null
|
combine_with: ESCObject = null
|
||||||
) -> int:
|
) -> int:
|
||||||
escoria.logger.info("Activated action %s on %s" % [action, target])
|
escoria.logger.info("Activated action %s on %s" % [action, target])
|
||||||
|
|
||||||
# If we're using an action which item requires to combine
|
# If we're using an action which item requires to combine
|
||||||
if target.node is ESCItem\
|
if target.node is ESCItem\
|
||||||
and action in target.node.combine_when_selected_action_is_in:
|
and action in target.node.combine_when_selected_action_is_in:
|
||||||
@@ -256,14 +256,14 @@ func _activate(
|
|||||||
combine_with.global_id
|
combine_with.global_id
|
||||||
):
|
):
|
||||||
do_combine = false
|
do_combine = false
|
||||||
|
|
||||||
if do_combine:
|
if do_combine:
|
||||||
var target_event = "%s %s" % [
|
var target_event = "%s %s" % [
|
||||||
action,
|
action,
|
||||||
combine_with.global_id
|
combine_with.global_id
|
||||||
]
|
]
|
||||||
var combine_with_event = "%s %s" % [
|
var combine_with_event = "%s %s" % [
|
||||||
action,
|
action,
|
||||||
target.global_id
|
target.global_id
|
||||||
]
|
]
|
||||||
if target.events.has(target_event):
|
if target.events.has(target_event):
|
||||||
@@ -271,12 +271,12 @@ func _activate(
|
|||||||
target_event
|
target_event
|
||||||
])
|
])
|
||||||
var event_returned = yield(
|
var event_returned = yield(
|
||||||
escoria.event_manager,
|
escoria.event_manager,
|
||||||
"event_finished"
|
"event_finished"
|
||||||
)
|
)
|
||||||
while event_returned[1] != target_event:
|
while event_returned[1] != target_event:
|
||||||
event_returned = yield(
|
event_returned = yield(
|
||||||
escoria.event_manager,
|
escoria.event_manager,
|
||||||
"event_finished"
|
"event_finished"
|
||||||
)
|
)
|
||||||
if event_returned[0] == ESCExecution.RC_OK:
|
if event_returned[0] == ESCExecution.RC_OK:
|
||||||
@@ -291,12 +291,12 @@ func _activate(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
var event_returned = yield(
|
var event_returned = yield(
|
||||||
escoria.event_manager,
|
escoria.event_manager,
|
||||||
"event_finished"
|
"event_finished"
|
||||||
)
|
)
|
||||||
while event_returned[1] != combine_with_event:
|
while event_returned[1] != combine_with_event:
|
||||||
event_returned = yield(
|
event_returned = yield(
|
||||||
escoria.event_manager,
|
escoria.event_manager,
|
||||||
"event_finished"
|
"event_finished"
|
||||||
)
|
)
|
||||||
if event_returned[0] == ESCExecution.RC_OK:
|
if event_returned[0] == ESCExecution.RC_OK:
|
||||||
@@ -317,14 +317,14 @@ func _activate(
|
|||||||
"is one-way.") % combine_with.global_id
|
"is one-way.") % combine_with.global_id
|
||||||
)
|
)
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"ESCActionManager.activate: Invalid action",
|
"ESCActionManager.activate: Invalid action",
|
||||||
errors
|
errors
|
||||||
)
|
)
|
||||||
emit_signal("action_finished")
|
emit_signal("action_finished")
|
||||||
return ESCExecution.RC_ERROR
|
return ESCExecution.RC_ERROR
|
||||||
else:
|
else:
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"ESCActionManager.activate: Invalid action on item",
|
"ESCActionManager.activate: Invalid action on item",
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
"Trying to combine object %s with %s, "+
|
"Trying to combine object %s with %s, "+
|
||||||
@@ -345,9 +345,9 @@ func _activate(
|
|||||||
ACTION_INPUT_STATE.AWAITING_TARGET_ITEM
|
ACTION_INPUT_STATE.AWAITING_TARGET_ITEM
|
||||||
)
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
else:
|
else:
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"ESCActionManager.activate: Invalid action on item",
|
"ESCActionManager.activate: Invalid action on item",
|
||||||
[
|
[
|
||||||
"Trying to run %s on object %s, " %
|
"Trying to run %s on object %s, " %
|
||||||
[
|
[
|
||||||
@@ -356,17 +356,17 @@ func _activate(
|
|||||||
]
|
]
|
||||||
+ "but item must be in inventory."
|
+ "but item must be in inventory."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
if target.events.has(action):
|
if target.events.has(action):
|
||||||
escoria.event_manager.queue_event(target.events[action])
|
escoria.event_manager.queue_event(target.events[action])
|
||||||
var event_returned = yield(
|
var event_returned = yield(
|
||||||
escoria.event_manager,
|
escoria.event_manager,
|
||||||
"event_finished"
|
"event_finished"
|
||||||
)
|
)
|
||||||
while event_returned[1] != action:
|
while event_returned[1] != action:
|
||||||
event_returned = yield(
|
event_returned = yield(
|
||||||
escoria.event_manager,
|
escoria.event_manager,
|
||||||
"event_finished"
|
"event_finished"
|
||||||
)
|
)
|
||||||
if event_returned[0] == ESCExecution.RC_OK:
|
if event_returned[0] == ESCExecution.RC_OK:
|
||||||
@@ -375,7 +375,7 @@ func _activate(
|
|||||||
return event_returned[0]
|
return event_returned[0]
|
||||||
else:
|
else:
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"ESCActionManager.activate: Invalid action",
|
"ESCActionManager.activate: Invalid action",
|
||||||
[
|
[
|
||||||
"Event for action %s on object %s not found." % [
|
"Event for action %s on object %s not found." % [
|
||||||
action,
|
action,
|
||||||
@@ -397,8 +397,8 @@ func _activate(
|
|||||||
# - is_fast: if true, the walk is performed at fast speed (defined in the moving
|
# - is_fast: if true, the walk is performed at fast speed (defined in the moving
|
||||||
# object.
|
# object.
|
||||||
func perform_walk(
|
func perform_walk(
|
||||||
moving_obj: ESCObject,
|
moving_obj: ESCObject,
|
||||||
destination,
|
destination,
|
||||||
is_fast: bool = false
|
is_fast: bool = false
|
||||||
):
|
):
|
||||||
# Walk to Position2D.
|
# Walk to Position2D.
|
||||||
@@ -408,9 +408,9 @@ func perform_walk(
|
|||||||
destination,
|
destination,
|
||||||
is_fast,
|
is_fast,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
moving_obj.node.walk_to(destination, walk_context)
|
moving_obj.node.walk_to(destination, walk_context)
|
||||||
|
|
||||||
# Walk to object
|
# Walk to object
|
||||||
elif destination is ESCObject:
|
elif destination is ESCObject:
|
||||||
if destination.node:
|
if destination.node:
|
||||||
@@ -419,16 +419,16 @@ func perform_walk(
|
|||||||
target_position = destination.node.global_position
|
target_position = destination.node.global_position
|
||||||
else:
|
else:
|
||||||
target_position = destination.node.get_interact_position()
|
target_position = destination.node.get_interact_position()
|
||||||
|
|
||||||
var walk_context = ESCWalkContext.new(
|
var walk_context = ESCWalkContext.new(
|
||||||
destination,
|
destination,
|
||||||
target_position,
|
target_position,
|
||||||
is_fast,
|
is_fast,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
moving_obj.node.walk_to(target_position, walk_context)
|
moving_obj.node.walk_to(target_position, walk_context)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"esc_controller.gd:perform_walk()",
|
"esc_controller.gd:perform_walk()",
|
||||||
@@ -448,20 +448,20 @@ func perform_walk(
|
|||||||
# - event: Input event that was received
|
# - event: Input event that was received
|
||||||
# - default_action: if true, run the inventory default action
|
# - default_action: if true, run the inventory default action
|
||||||
func perform_inputevent_on_object(
|
func perform_inputevent_on_object(
|
||||||
obj: ESCObject,
|
obj: ESCObject,
|
||||||
event: InputEvent,
|
event: InputEvent,
|
||||||
default_action: bool = false
|
default_action: bool = false
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
This algorithm:
|
This algorithm:
|
||||||
- makes the player move to the clicked object location, if needed
|
- makes the player move to the clicked object location, if needed
|
||||||
(if it is located in the room for example) and wait for reaching.
|
(if it is located in the room for example) and wait for reaching.
|
||||||
- when reached, performs an action depending on current defined action
|
- when reached, performs an action depending on current defined action
|
||||||
* no current action defined: do nothing else
|
* no current action defined: do nothing else
|
||||||
* current action defined:
|
* current action defined:
|
||||||
* item requires no combination: perform the current action
|
* item requires no combination: perform the current action
|
||||||
on the item
|
on the item
|
||||||
* item requires combination: check the status of the combination
|
* item requires combination: check the status of the combination
|
||||||
A combination requires 3 elements to fulfill:
|
A combination requires 3 elements to fulfill:
|
||||||
1/ a verb action
|
1/ a verb action
|
||||||
2/ a first "tool" (item to use)
|
2/ a first "tool" (item to use)
|
||||||
@@ -473,25 +473,25 @@ func perform_inputevent_on_object(
|
|||||||
* else do nothing, except if default_action is requested.
|
* else do nothing, except if default_action is requested.
|
||||||
In this case, perform the default_action on the item.
|
In this case, perform the default_action on the item.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
escoria.logger.info("%s left-clicked with event " % obj.global_id, [event])
|
escoria.logger.info("%s left-clicked with event " % obj.global_id, [event])
|
||||||
|
|
||||||
var event_flags = 0
|
var event_flags = 0
|
||||||
var has_current_action: bool = false
|
var has_current_action: bool = false
|
||||||
if obj.events.has(current_action):
|
if obj.events.has(current_action):
|
||||||
event_flags = obj.events[current_action].flags
|
event_flags = obj.events[current_action].flags
|
||||||
has_current_action = true
|
has_current_action = true
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
# We need to have the new action input state BEFORE initiating the player
|
# We need to have the new action input state BEFORE initiating the player
|
||||||
# move so we determine now if the object clicked will require a combination
|
# move so we determine now if the object clicked will require a combination
|
||||||
# depending on the used action verb.
|
# depending on the used action verb.
|
||||||
var tool_just_set = _set_tool_and_action(obj, default_action)
|
var tool_just_set = _set_tool_and_action(obj, default_action)
|
||||||
var need_combine = _check_item_needs_combine()
|
var need_combine = _check_item_needs_combine()
|
||||||
|
|
||||||
# If the current tool was not set, this is our first item, make it tool
|
# If the current tool was not set, this is our first item, make it tool
|
||||||
if not current_tool or (current_tool and not need_combine):
|
if not current_tool or (current_tool and not need_combine):
|
||||||
current_tool = obj
|
current_tool = obj
|
||||||
@@ -499,7 +499,7 @@ func perform_inputevent_on_object(
|
|||||||
# make it target.
|
# make it target.
|
||||||
elif need_combine and not tool_just_set:
|
elif need_combine and not tool_just_set:
|
||||||
current_target = obj
|
current_target = obj
|
||||||
|
|
||||||
# Update the action input state
|
# Update the action input state
|
||||||
if action_state == ACTION_INPUT_STATE.AWAITING_TARGET_ITEM and current_target:
|
if action_state == ACTION_INPUT_STATE.AWAITING_TARGET_ITEM and current_target:
|
||||||
set_action_input_state(ACTION_INPUT_STATE.COMPLETED)
|
set_action_input_state(ACTION_INPUT_STATE.COMPLETED)
|
||||||
@@ -512,36 +512,36 @@ func perform_inputevent_on_object(
|
|||||||
if escoria.main.current_scene.player:
|
if escoria.main.current_scene.player:
|
||||||
var destination_position: Vector2 = escoria.main.current_scene.player.\
|
var destination_position: Vector2 = escoria.main.current_scene.player.\
|
||||||
global_position
|
global_position
|
||||||
|
|
||||||
# If clicked object not in inventory, player walks towards it
|
# If clicked object not in inventory, player walks towards it
|
||||||
if not obj.node is ESCPlayer and \
|
if not obj.node is ESCPlayer and \
|
||||||
not escoria.inventory_manager.inventory_has(obj.global_id) and \
|
not escoria.inventory_manager.inventory_has(obj.global_id) and \
|
||||||
(not has_current_action or not event_flags & ESCEvent.FLAG_TK):
|
(not has_current_action or not event_flags & ESCEvent.FLAG_TK):
|
||||||
var context = _walk_towards_object(
|
var context = _walk_towards_object(
|
||||||
obj,
|
obj,
|
||||||
event.position,
|
event.position,
|
||||||
event.doubleclick
|
event.doubleclick
|
||||||
)
|
)
|
||||||
if context is GDScriptFunctionState:
|
if context is GDScriptFunctionState:
|
||||||
context = yield(_walk_towards_object(
|
context = yield(_walk_towards_object(
|
||||||
obj,
|
obj,
|
||||||
event.position,
|
event.position,
|
||||||
event.doubleclick
|
event.doubleclick
|
||||||
), "completed")
|
), "completed")
|
||||||
destination_position = context.target_position
|
destination_position = context.target_position
|
||||||
dont_interact = context.dont_interact_on_arrival
|
dont_interact = context.dont_interact_on_arrival
|
||||||
|
|
||||||
var player_global_pos = escoria.main.current_scene.player.global_position
|
var player_global_pos = escoria.main.current_scene.player.global_position
|
||||||
var clicked_position = event.position
|
var clicked_position = event.position
|
||||||
|
|
||||||
if not player_global_pos.is_equal_approx(destination_position):
|
if not player_global_pos.is_equal_approx(destination_position):
|
||||||
dont_interact = true
|
dont_interact = true
|
||||||
|
|
||||||
# If no interaction should happen after player has arrived, leave
|
# If no interaction should happen after player has arrived, leave
|
||||||
# immediately.
|
# immediately.
|
||||||
if dont_interact:
|
if dont_interact:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Manage exits
|
# Manage exits
|
||||||
if obj.node.is_exit and current_action in ["", ACTION_WALK]:
|
if obj.node.is_exit and current_action in ["", ACTION_WALK]:
|
||||||
_activate(ACTION_EXIT_SCENE, obj)
|
_activate(ACTION_EXIT_SCENE, obj)
|
||||||
@@ -558,7 +558,7 @@ func perform_inputevent_on_object(
|
|||||||
current_tool,
|
current_tool,
|
||||||
current_target
|
current_target
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
_activate(
|
_activate(
|
||||||
current_action,
|
current_action,
|
||||||
@@ -566,9 +566,9 @@ func perform_inputevent_on_object(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Prepare the "obj" object for current_action: if required, set the object as
|
# Prepare the "obj" object for current_action: if required, set the object as
|
||||||
# current tool.
|
# current tool.
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - obj: the ESCObject to prepare
|
# - obj: the ESCObject to prepare
|
||||||
@@ -594,17 +594,17 @@ func _set_tool_and_action(obj: ESCObject, default_action: bool):
|
|||||||
return tool_just_set
|
return tool_just_set
|
||||||
|
|
||||||
|
|
||||||
# Checks if object requires a combination with another, according to
|
# Checks if object requires a combination with another, according to
|
||||||
# currently selected action verb (or check with default action of the item).
|
# currently selected action verb (or check with default action of the item).
|
||||||
#
|
#
|
||||||
# *Returns* True if current action on "obj" requires a combination
|
# *Returns* True if current action on "obj" requires a combination
|
||||||
func _check_item_needs_combine() -> bool:
|
func _check_item_needs_combine() -> bool:
|
||||||
return current_action \
|
return current_action \
|
||||||
and current_tool \
|
and current_tool \
|
||||||
and current_action in current_tool.node.combine_when_selected_action_is_in
|
and current_action in current_tool.node.combine_when_selected_action_is_in
|
||||||
|
|
||||||
|
|
||||||
# Makes the player character walk towards the clicked item.
|
# Makes the player character walk towards the clicked item.
|
||||||
# Returns the resulting walk context.
|
# Returns the resulting walk context.
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
@@ -613,7 +613,7 @@ func _check_item_needs_combine() -> bool:
|
|||||||
# - clicked_position: the Position2D of the input click
|
# - clicked_position: the Position2D of the input click
|
||||||
# - walk_fast: if true, the player will walk fast to the object
|
# - walk_fast: if true, the player will walk fast to the object
|
||||||
func _walk_towards_object(
|
func _walk_towards_object(
|
||||||
obj: ESCObject,
|
obj: ESCObject,
|
||||||
clicked_position: Vector2,
|
clicked_position: Vector2,
|
||||||
walk_fast: bool
|
walk_fast: bool
|
||||||
) -> ESCWalkContext:
|
) -> ESCWalkContext:
|
||||||
@@ -629,32 +629,32 @@ func _walk_towards_object(
|
|||||||
else:
|
else:
|
||||||
destination_position = clicked_position
|
destination_position = clicked_position
|
||||||
dont_interact = true
|
dont_interact = true
|
||||||
|
|
||||||
# Create walk context
|
# Create walk context
|
||||||
var walk_context = ESCWalkContext.new(
|
var walk_context = ESCWalkContext.new(
|
||||||
obj,
|
obj,
|
||||||
destination_position,
|
destination_position,
|
||||||
walk_fast,
|
walk_fast,
|
||||||
dont_interact
|
dont_interact
|
||||||
)
|
)
|
||||||
|
|
||||||
# Walk towards the clicked object
|
# Walk towards the clicked object
|
||||||
escoria.main.current_scene.player.walk_to(destination_position,
|
escoria.main.current_scene.player.walk_to(destination_position,
|
||||||
walk_context)
|
walk_context)
|
||||||
|
|
||||||
# Wait for the player to arrive before continuing with action.
|
# Wait for the player to arrive before continuing with action.
|
||||||
var context: ESCWalkContext = yield(
|
var context: ESCWalkContext = yield(
|
||||||
escoria.main.current_scene.player,
|
escoria.main.current_scene.player,
|
||||||
"arrived"
|
"arrived"
|
||||||
)
|
)
|
||||||
escoria.logger.info("Context arrived: %s" % context)
|
escoria.logger.info("Context arrived: %s" % context)
|
||||||
|
|
||||||
# Confirm that reached item was the one user clicked in the first place.
|
# Confirm that reached item was the one user clicked in the first place.
|
||||||
# Don't interact if that is not the case.
|
# Don't interact if that is not the case.
|
||||||
if (context.target_object and context.target_object.\
|
if (context.target_object and context.target_object.\
|
||||||
global_id != walk_context.\
|
global_id != walk_context.\
|
||||||
target_object.global_id) or \
|
target_object.global_id) or \
|
||||||
(context.target_position != walk_context.target_position):
|
(context.target_position != walk_context.target_position):
|
||||||
walk_context.dont_interact_on_arrival = true
|
walk_context.dont_interact_on_arrival = true
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ func load_command(command_name: String) -> ESCBaseCommand:
|
|||||||
if ResourceLoader.exists("%s/%s.gd" % [command_directory, command_name]):
|
if ResourceLoader.exists("%s/%s.gd" % [command_directory, command_name]):
|
||||||
registry[command_name] = load(
|
registry[command_name] = load(
|
||||||
"%s/%s.gd" % [
|
"%s/%s.gd" % [
|
||||||
command_directory.trim_suffix("/"),
|
command_directory.trim_suffix("/"),
|
||||||
command_name
|
command_name
|
||||||
]
|
]
|
||||||
).new()
|
).new()
|
||||||
return registry[command_name]
|
return registry[command_name]
|
||||||
|
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"ESCCommandRegistry.load_command: Command not found",
|
"ESCCommandRegistry.load_command: Command not found",
|
||||||
[
|
[
|
||||||
@@ -38,7 +38,7 @@ func load_command(command_name: String) -> ESCBaseCommand:
|
|||||||
|
|
||||||
|
|
||||||
# Retrieve a command from the command registry
|
# Retrieve a command from the command registry
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - command_name: The name of the command
|
# - command_name: The name of the command
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func _init():
|
|||||||
"type": TYPE_STRING_ARRAY
|
"type": TYPE_STRING_ARRAY
|
||||||
}
|
}
|
||||||
ProjectSettings.add_property_info(property_info)
|
ProjectSettings.add_property_info(property_info)
|
||||||
|
|
||||||
# Compile all regex objects just once
|
# Compile all regex objects just once
|
||||||
_comment_regex = RegEx.new()
|
_comment_regex = RegEx.new()
|
||||||
_comment_regex.compile(COMMENT_REGEX)
|
_comment_regex.compile(COMMENT_REGEX)
|
||||||
@@ -66,7 +66,7 @@ func _init():
|
|||||||
_empty_regex.compile(EMPTY_REGEX)
|
_empty_regex.compile(EMPTY_REGEX)
|
||||||
_indent_regex = RegEx.new()
|
_indent_regex = RegEx.new()
|
||||||
_indent_regex.compile(INDENT_REGEX)
|
_indent_regex.compile(INDENT_REGEX)
|
||||||
|
|
||||||
_event_regex = RegEx.new()
|
_event_regex = RegEx.new()
|
||||||
_event_regex.compile(ESCEvent.REGEX)
|
_event_regex.compile(ESCEvent.REGEX)
|
||||||
_command_regex = RegEx.new()
|
_command_regex = RegEx.new()
|
||||||
@@ -108,14 +108,14 @@ func compile(lines: Array) -> ESCScript:
|
|||||||
var events = self._compile(lines)
|
var events = self._compile(lines)
|
||||||
for event in events:
|
for event in events:
|
||||||
script.events[event.name] = event
|
script.events[event.name] = event
|
||||||
|
|
||||||
return script
|
return script
|
||||||
|
|
||||||
|
|
||||||
# Compile an array of ESC script lines into an array of ESC objects
|
# Compile an array of ESC script lines into an array of ESC objects
|
||||||
func _compile(lines: Array) -> Array:
|
func _compile(lines: Array) -> Array:
|
||||||
var returned = []
|
var returned = []
|
||||||
|
|
||||||
while lines.size() > 0:
|
while lines.size() > 0:
|
||||||
var line = lines.pop_front()
|
var line = lines.pop_front()
|
||||||
escoria.logger.trace("Parsing line %s" % line)
|
escoria.logger.trace("Parsing line %s" % line)
|
||||||
@@ -125,10 +125,10 @@ func _compile(lines: Array) -> Array:
|
|||||||
continue
|
continue
|
||||||
var indent = \
|
var indent = \
|
||||||
escoria.utils.get_re_group(
|
escoria.utils.get_re_group(
|
||||||
_indent_regex.search(line),
|
_indent_regex.search(line),
|
||||||
INDENT_REGEX_GROUP
|
INDENT_REGEX_GROUP
|
||||||
).length()
|
).length()
|
||||||
|
|
||||||
if _event_regex.search(line):
|
if _event_regex.search(line):
|
||||||
var event = ESCEvent.new(line)
|
var event = ESCEvent.new(line)
|
||||||
escoria.logger.trace("Line is the event %s" % event.name)
|
escoria.logger.trace("Line is the event %s" % event.name)
|
||||||
@@ -158,7 +158,7 @@ func _compile(lines: Array) -> Array:
|
|||||||
continue
|
continue
|
||||||
var next_line_indent = \
|
var next_line_indent = \
|
||||||
escoria.utils.get_re_group(
|
escoria.utils.get_re_group(
|
||||||
_indent_regex.search(next_line),
|
_indent_regex.search(next_line),
|
||||||
INDENT_REGEX_GROUP
|
INDENT_REGEX_GROUP
|
||||||
).length()
|
).length()
|
||||||
if next_line_indent > indent:
|
if next_line_indent > indent:
|
||||||
@@ -186,7 +186,7 @@ func _compile(lines: Array) -> Array:
|
|||||||
var end_line = _dialog_end_regex.search(next_line)
|
var end_line = _dialog_end_regex.search(next_line)
|
||||||
if end_line and \
|
if end_line and \
|
||||||
escoria.utils.get_re_group(
|
escoria.utils.get_re_group(
|
||||||
end_line,
|
end_line,
|
||||||
INDENT_REGEX_GROUP
|
INDENT_REGEX_GROUP
|
||||||
).length() == indent:
|
).length() == indent:
|
||||||
break
|
break
|
||||||
@@ -216,7 +216,7 @@ func _compile(lines: Array) -> Array:
|
|||||||
continue
|
continue
|
||||||
var next_line_indent = \
|
var next_line_indent = \
|
||||||
escoria.utils.get_re_group(
|
escoria.utils.get_re_group(
|
||||||
_indent_regex.search(next_line),
|
_indent_regex.search(next_line),
|
||||||
INDENT_REGEX_GROUP
|
INDENT_REGEX_GROUP
|
||||||
).length()
|
).length()
|
||||||
if next_line_indent > indent:
|
if next_line_indent > indent:
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ var _channels_state: Dictionary = {}
|
|||||||
# Make sure to stop when pausing the game
|
# Make sure to stop when pausing the game
|
||||||
func _ready():
|
func _ready():
|
||||||
self.pause_mode = Node.PAUSE_MODE_STOP
|
self.pause_mode = Node.PAUSE_MODE_STOP
|
||||||
|
|
||||||
|
|
||||||
# Handle the events queue and scheduled events
|
# Handle the events queue and scheduled events
|
||||||
#
|
#
|
||||||
@@ -82,8 +82,8 @@ func _process(delta: float) -> void:
|
|||||||
"finished", self, "_on_event_finished"
|
"finished", self, "_on_event_finished"
|
||||||
):
|
):
|
||||||
_running_events[channel_name].connect(
|
_running_events[channel_name].connect(
|
||||||
"finished",
|
"finished",
|
||||||
self,
|
self,
|
||||||
"_on_event_finished",
|
"_on_event_finished",
|
||||||
[channel_name],
|
[channel_name],
|
||||||
CONNECT_ONESHOT
|
CONNECT_ONESHOT
|
||||||
@@ -92,13 +92,13 @@ func _process(delta: float) -> void:
|
|||||||
"interrupted", self, "_on_event_finished"
|
"interrupted", self, "_on_event_finished"
|
||||||
):
|
):
|
||||||
_running_events[channel_name].connect(
|
_running_events[channel_name].connect(
|
||||||
"interrupted",
|
"interrupted",
|
||||||
self,
|
self,
|
||||||
"_on_event_finished",
|
"_on_event_finished",
|
||||||
[channel_name],
|
[channel_name],
|
||||||
CONNECT_ONESHOT
|
CONNECT_ONESHOT
|
||||||
)
|
)
|
||||||
|
|
||||||
if channel_name == CHANNEL_FRONT:
|
if channel_name == CHANNEL_FRONT:
|
||||||
emit_signal(
|
emit_signal(
|
||||||
"event_started",
|
"event_started",
|
||||||
@@ -106,21 +106,21 @@ func _process(delta: float) -> void:
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
emit_signal(
|
emit_signal(
|
||||||
"background_event_started",
|
"background_event_started",
|
||||||
channel_name,
|
channel_name,
|
||||||
_running_events[channel_name].name
|
_running_events[channel_name].name
|
||||||
)
|
)
|
||||||
|
|
||||||
var event_flags = _running_events[channel_name].flags
|
var event_flags = _running_events[channel_name].flags
|
||||||
if event_flags & ESCEvent.FLAG_NO_TT:
|
if event_flags & ESCEvent.FLAG_NO_TT:
|
||||||
escoria.main.current_scene.game.tooltip_node.hide()
|
escoria.main.current_scene.game.tooltip_node.hide()
|
||||||
|
|
||||||
if event_flags & ESCEvent.FLAG_NO_UI:
|
if event_flags & ESCEvent.FLAG_NO_UI:
|
||||||
escoria.main.current_scene.game.hide_ui()
|
escoria.main.current_scene.game.hide_ui()
|
||||||
|
|
||||||
if event_flags & ESCEvent.FLAG_NO_SAVE:
|
if event_flags & ESCEvent.FLAG_NO_SAVE:
|
||||||
escoria.save_manager.save_enabled = false
|
escoria.save_manager.save_enabled = false
|
||||||
|
|
||||||
_running_events[channel_name].run()
|
_running_events[channel_name].run()
|
||||||
for event in self.scheduled_events:
|
for event in self.scheduled_events:
|
||||||
(event as ESCScheduledEvent).timeout -= delta
|
(event as ESCScheduledEvent).timeout -= delta
|
||||||
@@ -140,7 +140,7 @@ func _process(delta: float) -> void:
|
|||||||
# (default: `false`)
|
# (default: `false`)
|
||||||
#
|
#
|
||||||
# **Returns** indicator of success/status
|
# **Returns** indicator of success/status
|
||||||
func queue_event_from_esc(script_object: ESCScript, event: String,
|
func queue_event_from_esc(script_object: ESCScript, event: String,
|
||||||
channel: String, block: bool) -> int:
|
channel: String, block: bool) -> int:
|
||||||
|
|
||||||
if channel == CHANNEL_FRONT:
|
if channel == CHANNEL_FRONT:
|
||||||
@@ -158,7 +158,7 @@ func queue_event_from_esc(script_object: ESCScript, event: String,
|
|||||||
return rc
|
return rc
|
||||||
else:
|
else:
|
||||||
var rc = yield(
|
var rc = yield(
|
||||||
escoria.event_manager,
|
escoria.event_manager,
|
||||||
"background_event_finished"
|
"background_event_finished"
|
||||||
)
|
)
|
||||||
while rc[1] != event and rc[2] != channel:
|
while rc[1] != event and rc[2] != channel:
|
||||||
@@ -167,7 +167,7 @@ func queue_event_from_esc(script_object: ESCScript, event: String,
|
|||||||
"background_event_finished"
|
"background_event_finished"
|
||||||
)
|
)
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ func schedule_event(event: ESCEvent, timeout: float) -> void:
|
|||||||
func queue_background_event(channel_name: String, event: ESCEvent) -> void:
|
func queue_background_event(channel_name: String, event: ESCEvent) -> void:
|
||||||
if not channel_name in events_queue:
|
if not channel_name in events_queue:
|
||||||
events_queue[channel_name] = []
|
events_queue[channel_name] = []
|
||||||
|
|
||||||
events_queue[channel_name].append(event)
|
events_queue[channel_name].append(event)
|
||||||
|
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ func interrupt_running_event():
|
|||||||
func clear_event_queue():
|
func clear_event_queue():
|
||||||
for channel_name in events_queue.keys():
|
for channel_name in events_queue.keys():
|
||||||
events_queue[channel_name].clear()
|
events_queue[channel_name].clear()
|
||||||
|
|
||||||
|
|
||||||
# Check wether a channel is free to run more events
|
# Check wether a channel is free to run more events
|
||||||
#
|
#
|
||||||
@@ -250,37 +250,37 @@ func _on_event_finished(finished_statement: ESCStatement, return_code: int, chan
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
escoria.logger.debug(
|
escoria.logger.debug(
|
||||||
"Event %s ended with return code %d" % [event.name, return_code]
|
"Event %s ended with return code %d" % [event.name, return_code]
|
||||||
)
|
)
|
||||||
|
|
||||||
var event_flags = event.flags
|
var event_flags = event.flags
|
||||||
if event_flags & ESCEvent.FLAG_NO_TT:
|
if event_flags & ESCEvent.FLAG_NO_TT:
|
||||||
escoria.main.current_scene.game.tooltip_node.show()
|
escoria.main.current_scene.game.tooltip_node.show()
|
||||||
|
|
||||||
if event_flags & ESCEvent.FLAG_NO_UI:
|
if event_flags & ESCEvent.FLAG_NO_UI:
|
||||||
escoria.main.current_scene.game.show_ui()
|
escoria.main.current_scene.game.show_ui()
|
||||||
|
|
||||||
if event_flags & ESCEvent.FLAG_NO_SAVE:
|
if event_flags & ESCEvent.FLAG_NO_SAVE:
|
||||||
escoria.save_manager.save_enabled = true
|
escoria.save_manager.save_enabled = true
|
||||||
|
|
||||||
if return_code == ESCExecution.RC_CANCEL:
|
if return_code == ESCExecution.RC_CANCEL:
|
||||||
return_code = ESCExecution.RC_OK
|
return_code = ESCExecution.RC_OK
|
||||||
|
|
||||||
_running_events[channel_name] = null
|
_running_events[channel_name] = null
|
||||||
_channels_state[channel_name] = true
|
_channels_state[channel_name] = true
|
||||||
|
|
||||||
if channel_name == CHANNEL_FRONT:
|
if channel_name == CHANNEL_FRONT:
|
||||||
emit_signal(
|
emit_signal(
|
||||||
"event_finished",
|
"event_finished",
|
||||||
return_code,
|
return_code,
|
||||||
event.name
|
event.name
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
emit_signal(
|
emit_signal(
|
||||||
"background_event_finished",
|
"background_event_finished",
|
||||||
return_code,
|
return_code,
|
||||||
event.name,
|
event.name,
|
||||||
channel_name
|
channel_name
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ func register_reserved_global(key: String, value = null) -> void:
|
|||||||
var old_value = _globals[key] if _globals.has(key) else ""
|
var old_value = _globals[key] if _globals.has(key) else ""
|
||||||
_reserved_globals[key] = value
|
_reserved_globals[key] = value
|
||||||
_globals[key] = value
|
_globals[key] = value
|
||||||
|
|
||||||
if value != null:
|
if value != null:
|
||||||
emit_signal("global_changed", key, old_value, _globals[key])
|
emit_signal("global_changed", key, old_value, _globals[key])
|
||||||
|
|
||||||
|
|
||||||
# Get the current value of a global
|
# Get the current value of a global
|
||||||
#
|
#
|
||||||
@@ -59,8 +59,8 @@ func get_global(key: String):
|
|||||||
if _globals.has(key):
|
if _globals.has(key):
|
||||||
return _globals[key]
|
return _globals[key]
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
# Filter the globals and return all matching keys and their values as
|
# Filter the globals and return all matching keys and their values as
|
||||||
# a dictionary
|
# a dictionary
|
||||||
# Check out [the Godot docs](https://docs.godotengine.org/en/stable/classes/class_string.html#class-string-method-match)
|
# Check out [the Godot docs](https://docs.godotengine.org/en/stable/classes/class_string.html#class-string-method-match)
|
||||||
@@ -93,19 +93,19 @@ func set_global(key: String, value, ignore_reserved: bool = false) -> void:
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
emit_signal(
|
emit_signal(
|
||||||
"global_changed",
|
"global_changed",
|
||||||
key,
|
key,
|
||||||
_globals[key] if _globals.has(key) else null,
|
_globals[key] if _globals.has(key) else null,
|
||||||
value
|
value
|
||||||
)
|
)
|
||||||
_globals[key] = value
|
_globals[key] = value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Set all globals that match the pattern to the value
|
# Set all globals that match the pattern to the value
|
||||||
# Check out [the Godot docs](https://docs.godotengine.org/en/stable/classes/class_string.html#class-string-method-match)
|
# Check out [the Godot docs](https://docs.godotengine.org/en/stable/classes/class_string.html#class-string-method-match)
|
||||||
# for the pattern format
|
# for the pattern format
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - pattern: The wildcard pattern to match
|
# - pattern: The wildcard pattern to match
|
||||||
|
|||||||
@@ -41,45 +41,45 @@ func register_object(object: ESCObject, force: bool = false) -> void:
|
|||||||
"esc_object_manager.gd:register_object()",
|
"esc_object_manager.gd:register_object()",
|
||||||
[
|
[
|
||||||
"Registering object with empty global_id.",
|
"Registering object with empty global_id.",
|
||||||
"Using node's full path as global_id: %s"
|
"Using node's full path as global_id: %s"
|
||||||
% object.node.global_id
|
% object.node.global_id
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if objects.has(object.global_id) and not force:
|
if objects.has(object.global_id) and not force:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"ESCObjectManager.register_object: Object already registered",
|
"ESCObjectManager.register_object: Object already registered",
|
||||||
[
|
[
|
||||||
"Object with global id %s already registered" %
|
"Object with global id %s already registered" %
|
||||||
object.global_id
|
object.global_id
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if not object.node.is_connected(
|
if not object.node.is_connected(
|
||||||
"tree_exited",
|
"tree_exited",
|
||||||
self,
|
self,
|
||||||
"unregister_object"
|
"unregister_object"
|
||||||
):
|
):
|
||||||
object.node.connect(
|
object.node.connect(
|
||||||
"tree_exited",
|
"tree_exited",
|
||||||
self,
|
self,
|
||||||
"unregister_object",
|
"unregister_object",
|
||||||
[object]
|
[object]
|
||||||
)
|
)
|
||||||
|
|
||||||
if "is_interactive" in object.node and object.node.is_interactive:
|
if "is_interactive" in object.node and object.node.is_interactive:
|
||||||
object.interactive = true
|
object.interactive = true
|
||||||
|
|
||||||
if "esc_script" in object.node and not object.node.esc_script.empty():
|
if "esc_script" in object.node and not object.node.esc_script.empty():
|
||||||
var script = escoria.esc_compiler.load_esc_file(
|
var script = escoria.esc_compiler.load_esc_file(
|
||||||
object.node.esc_script
|
object.node.esc_script
|
||||||
)
|
)
|
||||||
object.events = script.events
|
object.events = script.events
|
||||||
|
|
||||||
objects[object.global_id] = object
|
objects[object.global_id] = object
|
||||||
|
|
||||||
|
|
||||||
# Check wether an object was registered
|
# Check wether an object was registered
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
@@ -95,7 +95,7 @@ func has(global_id: String) -> bool:
|
|||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - global_id: The global id of the object to retrieve
|
# - global_id: The global id of the object to retrieve
|
||||||
# **Returns** The retrieved object, or null if not found
|
# **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]
|
||||||
@@ -108,8 +108,8 @@ func get_object(global_id: String) -> ESCObject:
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
# Remove an object from the registry
|
# Remove an object from the registry
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
|
|||||||
@@ -38,28 +38,28 @@ func _init() -> void:
|
|||||||
func register_reserved_globals() -> void:
|
func register_reserved_globals() -> void:
|
||||||
for key in RESERVED_GLOBALS:
|
for key in RESERVED_GLOBALS:
|
||||||
escoria.globals_manager.register_reserved_global( \
|
escoria.globals_manager.register_reserved_global( \
|
||||||
key,
|
key,
|
||||||
RESERVED_GLOBALS[key])
|
RESERVED_GLOBALS[key])
|
||||||
|
|
||||||
|
|
||||||
# Performs the actions needed in order to change the current scene to the one
|
# Performs the actions needed in order to change the current scene to the one
|
||||||
# specified by room_path.
|
# specified by room_path.
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - room_path: Node path to the room that is to become the new current room.
|
# - room_path: Node path to the room that is to become the new current room.
|
||||||
# - enable_automatic_transitions: Whether to play the transition between rooms
|
# - enable_automatic_transitions: Whether to play the transition between rooms
|
||||||
# automatically or to leave the responsibility to the developer.
|
# automatically or to leave the responsibility to the developer.
|
||||||
func change_scene(room_path: String, enable_automatic_transitions: bool) -> void:
|
func change_scene(room_path: String, enable_automatic_transitions: bool) -> void:
|
||||||
# Clear the event queue to remove other events (there could be duplicate
|
# Clear the event queue to remove other events (there could be duplicate
|
||||||
# events in there so we avoid running these multiple times)
|
# events in there so we avoid running these multiple times)
|
||||||
escoria.event_manager.clear_event_queue()
|
escoria.event_manager.clear_event_queue()
|
||||||
|
|
||||||
var exited_previous_room = false
|
var exited_previous_room = false
|
||||||
|
|
||||||
# If auto transition is enabled, try to determine whether we just exited a
|
# If auto transition is enabled, try to determine whether we just exited a
|
||||||
# room previously, so that we must play the auto transition out or not.
|
# room previously, so that we must play the auto transition out or not.
|
||||||
# This must happen if ESC_LAST_SCENE is set, or if we're running an
|
# This must happen if ESC_LAST_SCENE is set, or if we're running an
|
||||||
# exit_scene event. Also room selector actions require the transition.
|
# exit_scene event. Also room selector actions require the transition.
|
||||||
if enable_automatic_transitions and (
|
if enable_automatic_transitions and (
|
||||||
not escoria.globals_manager.get_global( \
|
not escoria.globals_manager.get_global( \
|
||||||
@@ -68,8 +68,8 @@ func change_scene(room_path: String, enable_automatic_transitions: bool) -> void
|
|||||||
escoria.event_manager.get_running_event(escoria.event_manager.CHANNEL_FRONT) != null \
|
escoria.event_manager.get_running_event(escoria.event_manager.CHANNEL_FRONT) != null \
|
||||||
and escoria.event_manager.get_running_event(escoria.event_manager.CHANNEL_FRONT).name \
|
and escoria.event_manager.get_running_event(escoria.event_manager.CHANNEL_FRONT).name \
|
||||||
in [
|
in [
|
||||||
escoria.event_manager.EVENT_NEW_GAME,
|
escoria.event_manager.EVENT_NEW_GAME,
|
||||||
escoria.event_manager.EVENT_EXIT_SCENE,
|
escoria.event_manager.EVENT_EXIT_SCENE,
|
||||||
escoria.event_manager.EVENT_ROOM_SELECTOR
|
escoria.event_manager.EVENT_ROOM_SELECTOR
|
||||||
]
|
]
|
||||||
and escoria.globals_manager.get_global(
|
and escoria.globals_manager.get_global(
|
||||||
@@ -77,20 +77,20 @@ func change_scene(room_path: String, enable_automatic_transitions: bool) -> void
|
|||||||
).empty()
|
).empty()
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
|
|
||||||
exited_previous_room = true
|
exited_previous_room = true
|
||||||
|
|
||||||
var transition_id = escoria.main.scene_transition.transition(
|
var transition_id = escoria.main.scene_transition.transition(
|
||||||
"",
|
"",
|
||||||
ESCTransitionPlayer.TRANSITION_MODE.OUT
|
ESCTransitionPlayer.TRANSITION_MODE.OUT
|
||||||
)
|
)
|
||||||
|
|
||||||
escoria.logger.debug(
|
escoria.logger.debug(
|
||||||
"Awaiting transition %s (out) to be finished." % str(transition_id)
|
"Awaiting transition %s (out) to be finished." % str(transition_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
yield(escoria.main.scene_transition, "transition_done")
|
yield(escoria.main.scene_transition, "transition_done")
|
||||||
|
|
||||||
# Hide main and pause menus
|
# Hide main and pause menus
|
||||||
escoria.game_scene.hide_main_menu()
|
escoria.game_scene.hide_main_menu()
|
||||||
escoria.game_scene.unpause_game()
|
escoria.game_scene.unpause_game()
|
||||||
@@ -100,23 +100,23 @@ func change_scene(room_path: String, enable_automatic_transitions: bool) -> void
|
|||||||
GLOBAL_FORCE_LAST_SCENE_NULL):
|
GLOBAL_FORCE_LAST_SCENE_NULL):
|
||||||
|
|
||||||
escoria.globals_manager.set_global(
|
escoria.globals_manager.set_global(
|
||||||
GLOBAL_LAST_SCENE,
|
GLOBAL_LAST_SCENE,
|
||||||
null,
|
null,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
elif escoria.main.current_scene:
|
elif escoria.main.current_scene:
|
||||||
# If FORCE_LAST_SCENE_NULL is false, set ESC_LAST_SCENE = current roomid
|
# If FORCE_LAST_SCENE_NULL is false, set ESC_LAST_SCENE = current roomid
|
||||||
escoria.globals_manager.set_global(
|
escoria.globals_manager.set_global(
|
||||||
GLOBAL_LAST_SCENE,
|
GLOBAL_LAST_SCENE,
|
||||||
escoria.main.current_scene.global_id,
|
escoria.main.current_scene.global_id,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
if escoria.dialog_player:
|
if escoria.dialog_player:
|
||||||
escoria.dialog_player.interrupt()
|
escoria.dialog_player.interrupt()
|
||||||
|
|
||||||
escoria.inputs_manager.clear_stack()
|
escoria.inputs_manager.clear_stack()
|
||||||
|
|
||||||
# Check if game scene was loaded
|
# Check if game scene was loaded
|
||||||
if not escoria.game_scene:
|
if not escoria.game_scene:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
@@ -135,7 +135,7 @@ func change_scene(room_path: String, enable_automatic_transitions: bool) -> void
|
|||||||
|
|
||||||
# Load room scene
|
# Load room scene
|
||||||
var res_room = escoria.resource_cache.get_resource(room_path)
|
var res_room = escoria.resource_cache.get_resource(room_path)
|
||||||
|
|
||||||
var room_scene = res_room.instance()
|
var room_scene = res_room.instance()
|
||||||
if room_scene:
|
if room_scene:
|
||||||
if enable_automatic_transitions \
|
if enable_automatic_transitions \
|
||||||
@@ -147,34 +147,34 @@ func change_scene(room_path: String, enable_automatic_transitions: bool) -> void
|
|||||||
room_scene.enabled_automatic_transitions = enable_automatic_transitions
|
room_scene.enabled_automatic_transitions = enable_automatic_transitions
|
||||||
|
|
||||||
room_scene.exited_previous_room = exited_previous_room
|
room_scene.exited_previous_room = exited_previous_room
|
||||||
|
|
||||||
# If the game scene is already in the tree but not a child of the room
|
# If the game scene is already in the tree but not a child of the room
|
||||||
# we remove it
|
# we remove it
|
||||||
if escoria.game_scene.is_inside_tree() \
|
if escoria.game_scene.is_inside_tree() \
|
||||||
and escoria.game_scene.get_parent() != room_scene:
|
and escoria.game_scene.get_parent() != room_scene:
|
||||||
var game_parent = escoria.game_scene.get_parent()
|
var game_parent = escoria.game_scene.get_parent()
|
||||||
game_parent.remove_child(escoria.game_scene)
|
game_parent.remove_child(escoria.game_scene)
|
||||||
|
|
||||||
room_scene.add_child(escoria.game_scene)
|
room_scene.add_child(escoria.game_scene)
|
||||||
room_scene.move_child(escoria.game_scene, 0)
|
room_scene.move_child(escoria.game_scene, 0)
|
||||||
room_scene.game = escoria.game_scene
|
room_scene.game = escoria.game_scene
|
||||||
escoria.main.set_scene(room_scene)
|
escoria.main.set_scene(room_scene)
|
||||||
|
|
||||||
# We know the scene has been loaded. Make its global ID available for
|
# We know the scene has been loaded. Make its global ID available for
|
||||||
# use by ESC script.
|
# use by ESC script.
|
||||||
escoria.globals_manager.set_global(
|
escoria.globals_manager.set_global(
|
||||||
escoria.room_manager.GLOBAL_CURRENT_SCENE,
|
escoria.room_manager.GLOBAL_CURRENT_SCENE,
|
||||||
room_scene.global_id,
|
room_scene.global_id,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
# Clear queued resources
|
# Clear queued resources
|
||||||
escoria.resource_cache.clear()
|
escoria.resource_cache.clear()
|
||||||
|
|
||||||
escoria.inputs_manager.hotspot_focused = ""
|
escoria.inputs_manager.hotspot_focused = ""
|
||||||
else:
|
else:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"ESCRoomManager.change_scene: Failed loading room scene",
|
"ESCRoomManager.change_scene: Failed loading room scene",
|
||||||
[
|
[
|
||||||
"Failed loading scene %s" % room_path
|
"Failed loading scene %s" % room_path
|
||||||
]
|
]
|
||||||
@@ -195,7 +195,7 @@ func init_room(room: ESCRoom) -> void:
|
|||||||
"No valid room was specified for initialization."
|
"No valid room was specified for initialization."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
if room.camera_limits.empty():
|
if room.camera_limits.empty():
|
||||||
room.camera_limits.push_back(Rect2())
|
room.camera_limits.push_back(Rect2())
|
||||||
|
|
||||||
@@ -204,10 +204,10 @@ func init_room(room: ESCRoom) -> void:
|
|||||||
if child is ESCBackground:
|
if child is ESCBackground:
|
||||||
room.camera_limits[0] = \
|
room.camera_limits[0] = \
|
||||||
Rect2(0, 0, child.rect_size.x, child.rect_size.y)
|
Rect2(0, 0, child.rect_size.x, child.rect_size.y)
|
||||||
|
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
|
|
||||||
if room.has_node("game"):
|
if room.has_node("game"):
|
||||||
room.game = room.get_node("game")
|
room.game = room.get_node("game")
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ func init_room(room: ESCRoom) -> void:
|
|||||||
room.game = escoria.game_scene
|
room.game = escoria.game_scene
|
||||||
room.add_child(room.game)
|
room.add_child(room.game)
|
||||||
room.move_child(room.game, 0)
|
room.move_child(room.game, 0)
|
||||||
|
|
||||||
# Determine whether this room was run from change_scene or directly
|
# Determine whether this room was run from change_scene or directly
|
||||||
if escoria.main.has_node(room.name):
|
if escoria.main.has_node(room.name):
|
||||||
room.is_run_directly = false
|
room.is_run_directly = false
|
||||||
@@ -223,7 +223,7 @@ func init_room(room: ESCRoom) -> void:
|
|||||||
room.is_run_directly = true
|
room.is_run_directly = true
|
||||||
if escoria.main.current_scene == null:
|
if escoria.main.current_scene == null:
|
||||||
escoria.main.set_scene(room)
|
escoria.main.set_scene(room)
|
||||||
|
|
||||||
if room.player_scene:
|
if room.player_scene:
|
||||||
room.player = room.player_scene.instance()
|
room.player = room.player_scene.instance()
|
||||||
room.add_child(room.player)
|
room.add_child(room.player)
|
||||||
@@ -240,7 +240,7 @@ func init_room(room: ESCRoom) -> void:
|
|||||||
var animations = escoria.globals_manager.get_global(
|
var animations = escoria.globals_manager.get_global(
|
||||||
escoria.room_manager.GLOBAL_ANIMATION_RESOURCES
|
escoria.room_manager.GLOBAL_ANIMATION_RESOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
if room.player.global_id in animations and \
|
if room.player.global_id in animations and \
|
||||||
ResourceLoader.exists(animations[room.player.global_id]):
|
ResourceLoader.exists(animations[room.player.global_id]):
|
||||||
room.player.animations = ResourceLoader.load(
|
room.player.animations = ResourceLoader.load(
|
||||||
@@ -248,15 +248,15 @@ func init_room(room: ESCRoom) -> void:
|
|||||||
)
|
)
|
||||||
room.player.update_idle()
|
room.player.update_idle()
|
||||||
escoria.object_manager.get_object(escoria.object_manager.CAMERA).node.set_target(room.player)
|
escoria.object_manager.get_object(escoria.object_manager.CAMERA).node.set_target(room.player)
|
||||||
|
|
||||||
if room.global_id.empty():
|
if room.global_id.empty():
|
||||||
room.global_id = room.name
|
room.global_id = room.name
|
||||||
|
|
||||||
# Manage player location at room start
|
# Manage player location at room start
|
||||||
if room.player != null \
|
if room.player != null \
|
||||||
and escoria.object_manager.get_start_location() != null:
|
and escoria.object_manager.get_start_location() != null:
|
||||||
room.player.teleport(escoria.object_manager.get_start_location().node)
|
room.player.teleport(escoria.object_manager.get_start_location().node)
|
||||||
|
|
||||||
_perform_script_events(room)
|
_perform_script_events(room)
|
||||||
|
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ func _perform_script_events(room: ESCRoom):
|
|||||||
escoria.event_manager.CHANNEL_FRONT
|
escoria.event_manager.CHANNEL_FRONT
|
||||||
).name == escoria.event_manager.EVENT_LOAD
|
).name == escoria.event_manager.EVENT_LOAD
|
||||||
):
|
):
|
||||||
|
|
||||||
# If the room was loaded from change_scene and automatic transitions
|
# If the room was loaded from change_scene and automatic transitions
|
||||||
# are not disabled, do the transition out now
|
# are not disabled, do the transition out now
|
||||||
if room.enabled_automatic_transitions \
|
if room.enabled_automatic_transitions \
|
||||||
@@ -282,7 +282,7 @@ func _perform_script_events(room: ESCRoom):
|
|||||||
and not room.exited_previous_room:
|
and not room.exited_previous_room:
|
||||||
var script_transition_out = escoria.esc_compiler.compile([
|
var script_transition_out = escoria.esc_compiler.compile([
|
||||||
"%s%s" % [ESCEvent.PREFIX, escoria.event_manager.EVENT_TRANSITION_OUT],
|
"%s%s" % [ESCEvent.PREFIX, escoria.event_manager.EVENT_TRANSITION_OUT],
|
||||||
"%s %s out" %
|
"%s %s out" %
|
||||||
[
|
[
|
||||||
_transition.get_command_name(),
|
_transition.get_command_name(),
|
||||||
escoria.project_settings_manager.get_setting(
|
escoria.project_settings_manager.get_setting(
|
||||||
@@ -294,24 +294,24 @@ func _perform_script_events(room: ESCRoom):
|
|||||||
escoria.event_manager.queue_event(
|
escoria.event_manager.queue_event(
|
||||||
script_transition_out.events[escoria.event_manager.EVENT_TRANSITION_OUT]
|
script_transition_out.events[escoria.event_manager.EVENT_TRANSITION_OUT]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Unpause the game if it was
|
# Unpause the game if it was
|
||||||
escoria.set_game_paused(false)
|
escoria.set_game_paused(false)
|
||||||
|
|
||||||
# Wait for transition_out event to be done
|
# Wait for transition_out event to be done
|
||||||
var rc = yield(escoria.event_manager, "event_finished")
|
var rc = yield(escoria.event_manager, "event_finished")
|
||||||
while rc[1] != escoria.event_manager.EVENT_TRANSITION_OUT:
|
while rc[1] != escoria.event_manager.EVENT_TRANSITION_OUT:
|
||||||
rc = yield(escoria.event_manager, "event_finished")
|
rc = yield(escoria.event_manager, "event_finished")
|
||||||
if rc[0] != ESCExecution.RC_OK:
|
if rc[0] != ESCExecution.RC_OK:
|
||||||
return rc[0]
|
return rc[0]
|
||||||
|
|
||||||
# Hide main and pause menus
|
# Hide main and pause menus
|
||||||
escoria.game_scene.hide_main_menu()
|
escoria.game_scene.hide_main_menu()
|
||||||
escoria.game_scene.unpause_game()
|
escoria.game_scene.unpause_game()
|
||||||
|
|
||||||
# Run the setup event
|
# Run the setup event
|
||||||
_run_script_event(escoria.event_manager.EVENT_SETUP, room)
|
_run_script_event(escoria.event_manager.EVENT_SETUP, room)
|
||||||
|
|
||||||
if room.enabled_automatic_transitions \
|
if room.enabled_automatic_transitions \
|
||||||
or (
|
or (
|
||||||
not room.enabled_automatic_transitions \
|
not room.enabled_automatic_transitions \
|
||||||
@@ -320,23 +320,23 @@ func _perform_script_events(room: ESCRoom):
|
|||||||
):
|
):
|
||||||
var script_transition_in = escoria.esc_compiler.compile([
|
var script_transition_in = escoria.esc_compiler.compile([
|
||||||
"%s%s" % [ESCEvent.PREFIX, escoria.event_manager.EVENT_TRANSITION_IN],
|
"%s%s" % [ESCEvent.PREFIX, escoria.event_manager.EVENT_TRANSITION_IN],
|
||||||
"%s %s in" %
|
"%s %s in" %
|
||||||
[
|
[
|
||||||
_transition.get_command_name(),
|
_transition.get_command_name(),
|
||||||
escoria.project_settings_manager.get_setting(
|
escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.DEFAULT_TRANISITION
|
escoria.project_settings_manager.DEFAULT_TRANISITION
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
"%s 0.1" % _wait.get_command_name()
|
"%s 0.1" % _wait.get_command_name()
|
||||||
])
|
])
|
||||||
escoria.event_manager.queue_event(
|
escoria.event_manager.queue_event(
|
||||||
script_transition_in.events[escoria.event_manager.EVENT_TRANSITION_IN]
|
script_transition_in.events[escoria.event_manager.EVENT_TRANSITION_IN]
|
||||||
)
|
)
|
||||||
|
|
||||||
var ready_event_added: bool = false
|
var ready_event_added: bool = false
|
||||||
# Run the ready event, if there is one.
|
# Run the ready event, if there is one.
|
||||||
ready_event_added = _run_script_event(escoria.event_manager.EVENT_READY, room)
|
ready_event_added = _run_script_event(escoria.event_manager.EVENT_READY, room)
|
||||||
|
|
||||||
if ready_event_added:
|
if ready_event_added:
|
||||||
# Wait for ready event to be done
|
# Wait for ready event to be done
|
||||||
var rc = yield(escoria.event_manager, "event_finished")
|
var rc = yield(escoria.event_manager, "event_finished")
|
||||||
@@ -344,29 +344,29 @@ func _perform_script_events(room: ESCRoom):
|
|||||||
rc = yield(escoria.event_manager, "event_finished")
|
rc = yield(escoria.event_manager, "event_finished")
|
||||||
if rc[0] != ESCExecution.RC_OK:
|
if rc[0] != ESCExecution.RC_OK:
|
||||||
return rc[0]
|
return rc[0]
|
||||||
|
|
||||||
# Now that :ready is finished, if FORCE_LAST_SCENE_NULL was true, reset it
|
# Now that :ready is finished, if FORCE_LAST_SCENE_NULL was true, reset it
|
||||||
# to false
|
# to false
|
||||||
if escoria.globals_manager.get_global( \
|
if escoria.globals_manager.get_global( \
|
||||||
escoria.room_manager.GLOBAL_FORCE_LAST_SCENE_NULL):
|
escoria.room_manager.GLOBAL_FORCE_LAST_SCENE_NULL):
|
||||||
|
|
||||||
escoria.globals_manager.set_global(
|
escoria.globals_manager.set_global(
|
||||||
escoria.room_manager.GLOBAL_FORCE_LAST_SCENE_NULL,
|
escoria.room_manager.GLOBAL_FORCE_LAST_SCENE_NULL,
|
||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
escoria.globals_manager.set_global(
|
escoria.globals_manager.set_global(
|
||||||
escoria.room_manager.GLOBAL_LAST_SCENE,
|
escoria.room_manager.GLOBAL_LAST_SCENE,
|
||||||
escoria.main.current_scene.global_id \
|
escoria.main.current_scene.global_id \
|
||||||
if escoria.main.current_scene != null else "",
|
if escoria.main.current_scene != null else "",
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
# Make the room's global ID available for use in ESC script.
|
# Make the room's global ID available for use in ESC script.
|
||||||
escoria.globals_manager.set_global(
|
escoria.globals_manager.set_global(
|
||||||
escoria.room_manager.GLOBAL_CURRENT_SCENE,
|
escoria.room_manager.GLOBAL_CURRENT_SCENE,
|
||||||
escoria.main.current_scene.global_id \
|
escoria.main.current_scene.global_id \
|
||||||
if escoria.main.current_scene != null else "",
|
if escoria.main.current_scene != null else "",
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -386,13 +386,13 @@ func _run_script_event(event_name: String, room: ESCRoom):
|
|||||||
if room.compiled_script == null:
|
if room.compiled_script == null:
|
||||||
room.compiled_script = \
|
room.compiled_script = \
|
||||||
escoria.esc_compiler.load_esc_file(room.esc_script)
|
escoria.esc_compiler.load_esc_file(room.esc_script)
|
||||||
|
|
||||||
if room.compiled_script.events.has(event_name):
|
if room.compiled_script.events.has(event_name):
|
||||||
escoria.logger.debug(
|
escoria.logger.debug(
|
||||||
"esc_room:_run_script_event",
|
"esc_room:_run_script_event",
|
||||||
[
|
[
|
||||||
"Queuing room script event %s" % event_name,
|
"Queuing room script event %s" % event_name,
|
||||||
"Composed of %s statements" %
|
"Composed of %s statements" %
|
||||||
str(room.compiled_script.events[event_name].statements.size())
|
str(room.compiled_script.events[event_name].statements.size())
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ extends Node
|
|||||||
class_name ESCBaseCommand
|
class_name ESCBaseCommand
|
||||||
|
|
||||||
|
|
||||||
# Regex for creating command name based on the script's filename, including
|
# Regex for creating command name based on the script's filename, including
|
||||||
# named groups
|
# named groups
|
||||||
const PATH_REGEX_GROUP = "path"
|
const PATH_REGEX_GROUP = "path"
|
||||||
const FILE_REGEX_GROUP = "file"
|
const FILE_REGEX_GROUP = "file"
|
||||||
@@ -24,7 +24,7 @@ func _init() -> void:
|
|||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
escoria.logger.error("Command %s did not override configure." % get_class())
|
escoria.logger.error("Command %s did not override configure." % get_class())
|
||||||
return ESCCommandArgumentDescriptor.new()
|
return ESCCommandArgumentDescriptor.new()
|
||||||
|
|
||||||
|
|
||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array) -> bool:
|
func validate(arguments: Array) -> bool:
|
||||||
|
|||||||
@@ -24,20 +24,20 @@ var conditions: Array = []
|
|||||||
func _init(command_string):
|
func _init(command_string):
|
||||||
var command_regex = RegEx.new()
|
var command_regex = RegEx.new()
|
||||||
command_regex.compile(REGEX)
|
command_regex.compile(REGEX)
|
||||||
|
|
||||||
if command_regex.search(command_string):
|
if command_regex.search(command_string):
|
||||||
for result in command_regex.search_all(command_string):
|
for result in command_regex.search_all(command_string):
|
||||||
if "name" in result.names:
|
if "name" in result.names:
|
||||||
self.name = escoria.utils.get_re_group(result, "name")
|
self.name = escoria.utils.get_re_group(result, "name")
|
||||||
if "parameters" in result.names:
|
if "parameters" in result.names:
|
||||||
# Split parameters by whitespace but allow quoted
|
# Split parameters by whitespace but allow quoted
|
||||||
# parameters
|
# parameters
|
||||||
var quote_open = false
|
var quote_open = false
|
||||||
var parameter_values = PoolStringArray([])
|
var parameter_values = PoolStringArray([])
|
||||||
var parsed_parameters = \
|
var parsed_parameters = \
|
||||||
escoria.utils.sanitize_whitespace(
|
escoria.utils.sanitize_whitespace(
|
||||||
escoria.utils.get_re_group(
|
escoria.utils.get_re_group(
|
||||||
result,
|
result,
|
||||||
"parameters"
|
"parameters"
|
||||||
).strip_edges()
|
).strip_edges()
|
||||||
)
|
)
|
||||||
@@ -65,7 +65,7 @@ func _init(command_string):
|
|||||||
parameters.append(parameter)
|
parameters.append(parameter)
|
||||||
if "conditions" in result.names:
|
if "conditions" in result.names:
|
||||||
for condition in escoria.utils.get_re_group(
|
for condition in escoria.utils.get_re_group(
|
||||||
result,
|
result,
|
||||||
"conditions"
|
"conditions"
|
||||||
).split(","):
|
).split(","):
|
||||||
self.conditions.append(
|
self.conditions.append(
|
||||||
@@ -90,7 +90,7 @@ func is_valid() -> bool:
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return .is_valid()
|
return .is_valid()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ var strip_quotes: Array = []
|
|||||||
|
|
||||||
# Initialize the descriptor
|
# Initialize the descriptor
|
||||||
func _init(
|
func _init(
|
||||||
p_min_args: int = 0,
|
p_min_args: int = 0,
|
||||||
p_types: Array = [],
|
p_types: Array = [],
|
||||||
p_defaults: Array = [],
|
p_defaults: Array = [],
|
||||||
p_strip_quotes: Array = [true]
|
p_strip_quotes: Array = [true]
|
||||||
):
|
):
|
||||||
@@ -34,7 +34,7 @@ func _init(
|
|||||||
# Combine the default argument values with the given arguments
|
# Combine the default argument values with the given arguments
|
||||||
func prepare_arguments(arguments: Array) -> Array:
|
func prepare_arguments(arguments: Array) -> Array:
|
||||||
var complete_arguments = defaults
|
var complete_arguments = defaults
|
||||||
|
|
||||||
for index in range(arguments.size()):
|
for index in range(arguments.size()):
|
||||||
complete_arguments[index] = escoria.utils.get_typed_value(
|
complete_arguments[index] = escoria.utils.get_typed_value(
|
||||||
arguments[index],
|
arguments[index],
|
||||||
@@ -43,13 +43,13 @@ func prepare_arguments(arguments: Array) -> Array:
|
|||||||
var strip = strip_quotes[0]
|
var strip = strip_quotes[0]
|
||||||
if strip_quotes.size() == complete_arguments.size():
|
if strip_quotes.size() == complete_arguments.size():
|
||||||
strip = strip_quotes[index]
|
strip = strip_quotes[index]
|
||||||
|
|
||||||
if strip and typeof(complete_arguments[index]) == TYPE_STRING:
|
if strip and typeof(complete_arguments[index]) == TYPE_STRING:
|
||||||
complete_arguments[index] = complete_arguments[index].replace(
|
complete_arguments[index] = complete_arguments[index].replace(
|
||||||
'"',
|
'"',
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
|
|
||||||
return complete_arguments
|
return complete_arguments
|
||||||
|
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ func validate(command: String, arguments: Array) -> bool:
|
|||||||
arguments
|
arguments
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
for index in range(arguments.size()):
|
for index in range(arguments.size()):
|
||||||
if arguments[index] == null:
|
if arguments[index] == null:
|
||||||
# No type checking for null values
|
# No type checking for null values
|
||||||
@@ -78,10 +78,10 @@ func validate(command: String, arguments: Array) -> bool:
|
|||||||
for type in self.types[types_index]:
|
for type in self.types[types_index]:
|
||||||
if not correct:
|
if not correct:
|
||||||
correct = self._is_type(arguments[index], type)
|
correct = self._is_type(arguments[index], type)
|
||||||
|
|
||||||
if not correct:
|
if not correct:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"Argument type did not match descriptor for command %s" %
|
"Argument type did not match descriptor for command %s" %
|
||||||
command,
|
command,
|
||||||
[
|
[
|
||||||
"Argument %d is of type %d. Expected %s" % [
|
"Argument %d is of type %d. Expected %s" % [
|
||||||
@@ -93,7 +93,7 @@ func validate(command: String, arguments: Array) -> bool:
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
@@ -106,4 +106,4 @@ func validate(command: String, arguments: Array) -> bool:
|
|||||||
# *Returns* Wether the argument is of the given type
|
# *Returns* Wether the argument is of the given type
|
||||||
func _is_type(argument, type: int) -> bool:
|
func _is_type(argument, type: int) -> bool:
|
||||||
return typeof(argument) == type
|
return typeof(argument) == type
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ class_name ESCCondition
|
|||||||
|
|
||||||
# Valid comparison types
|
# Valid comparison types
|
||||||
enum {
|
enum {
|
||||||
COMPARISON_NONE,
|
COMPARISON_NONE,
|
||||||
COMPARISON_EQ,
|
COMPARISON_EQ,
|
||||||
COMPARISON_GT,
|
COMPARISON_GT,
|
||||||
COMPARISON_LT,
|
COMPARISON_LT,
|
||||||
COMPARISON_ACTIVITY
|
COMPARISON_ACTIVITY
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ func _init(comparison_string: String):
|
|||||||
comparison_regex.compile(
|
comparison_regex.compile(
|
||||||
REGEX
|
REGEX
|
||||||
)
|
)
|
||||||
|
|
||||||
if comparison_regex.search(comparison_string):
|
if comparison_regex.search(comparison_string):
|
||||||
for result in comparison_regex.search_all(comparison_string):
|
for result in comparison_regex.search_all(comparison_string):
|
||||||
if "is_negated" in result.names:
|
if "is_negated" in result.names:
|
||||||
@@ -61,12 +61,12 @@ func _init(comparison_string: String):
|
|||||||
"gt": self.comparison = COMPARISON_GT
|
"gt": self.comparison = COMPARISON_GT
|
||||||
"lt": self.comparison = COMPARISON_LT
|
"lt": self.comparison = COMPARISON_LT
|
||||||
_: escoria.logger.report_errors(
|
_: escoria.logger.report_errors(
|
||||||
"Invalid comparison type detected: %s" %
|
"Invalid comparison type detected: %s" %
|
||||||
comparison_string,
|
comparison_string,
|
||||||
[
|
[
|
||||||
"Comparison type %s unknown" %
|
"Comparison type %s unknown" %
|
||||||
escoria.utils.get_re_group(
|
escoria.utils.get_re_group(
|
||||||
result,
|
result,
|
||||||
"comparison"
|
"comparison"
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@@ -74,7 +74,7 @@ func _init(comparison_string: String):
|
|||||||
if "comparison_value" in result.names:
|
if "comparison_value" in result.names:
|
||||||
self.comparison_value = escoria.utils.get_typed_value(
|
self.comparison_value = escoria.utils.get_typed_value(
|
||||||
escoria.utils.get_re_group(
|
escoria.utils.get_re_group(
|
||||||
result,
|
result,
|
||||||
"comparison_value"
|
"comparison_value"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -91,7 +91,7 @@ func _init(comparison_string: String):
|
|||||||
"Comparison regexp didn't match"
|
"Comparison regexp didn't match"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Run this comparison against the globals
|
# Run this comparison against the globals
|
||||||
func run() -> bool:
|
func run() -> bool:
|
||||||
@@ -106,12 +106,12 @@ func run() -> bool:
|
|||||||
else self.comparison_value
|
else self.comparison_value
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.inventory:
|
if self.inventory:
|
||||||
global_name = "i/%s" % flag
|
global_name = "i/%s" % flag
|
||||||
|
|
||||||
var return_value = false
|
var return_value = false
|
||||||
|
|
||||||
if self.comparison == COMPARISON_NONE and \
|
if self.comparison == COMPARISON_NONE and \
|
||||||
escoria.globals_manager.has(global_name) and \
|
escoria.globals_manager.has(global_name) and \
|
||||||
escoria.globals_manager.get_global(global_name) is bool and \
|
escoria.globals_manager.get_global(global_name) is bool and \
|
||||||
@@ -133,12 +133,12 @@ func run() -> bool:
|
|||||||
escoria.object_manager.has(global_name) and \
|
escoria.object_manager.has(global_name) and \
|
||||||
escoria.object_manager.get_object(global_name).active:
|
escoria.object_manager.get_object(global_name).active:
|
||||||
return_value = true
|
return_value = true
|
||||||
|
|
||||||
if self.negated:
|
if self.negated:
|
||||||
return_value = not return_value
|
return_value = not return_value
|
||||||
|
|
||||||
escoria.logger.debug(
|
escoria.logger.debug(
|
||||||
"It is" if return_value else "It isn't"
|
"It is" if return_value else "It isn't"
|
||||||
)
|
)
|
||||||
|
|
||||||
return return_value
|
return return_value
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ var options: Array
|
|||||||
func load_string(dialog_string: String):
|
func load_string(dialog_string: String):
|
||||||
var dialog_regex = RegEx.new()
|
var dialog_regex = RegEx.new()
|
||||||
dialog_regex.compile(REGEX)
|
dialog_regex.compile(REGEX)
|
||||||
|
|
||||||
if dialog_regex.search(dialog_string):
|
if dialog_regex.search(dialog_string):
|
||||||
for result in dialog_regex.search_all(dialog_string):
|
for result in dialog_regex.search_all(dialog_string):
|
||||||
if "avatar" in result.names:
|
if "avatar" in result.names:
|
||||||
@@ -71,7 +71,7 @@ func is_valid() -> bool:
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ func run():
|
|||||||
)
|
)
|
||||||
escoria.dialog_player.start_dialog_choices(self)
|
escoria.dialog_player.start_dialog_choices(self)
|
||||||
var option = yield(
|
var option = yield(
|
||||||
escoria.dialog_player,
|
escoria.dialog_player,
|
||||||
"option_chosen"
|
"option_chosen"
|
||||||
) as ESCDialogOption
|
) as ESCDialogOption
|
||||||
var rc = option.run()
|
var rc = option.run()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ var conditions: Array = []
|
|||||||
func load_string(option_string: String):
|
func load_string(option_string: String):
|
||||||
var option_regex = RegEx.new()
|
var option_regex = RegEx.new()
|
||||||
option_regex.compile(REGEX)
|
option_regex.compile(REGEX)
|
||||||
|
|
||||||
if option_regex.search(option_string):
|
if option_regex.search(option_string):
|
||||||
for result in option_regex.search_all(option_string):
|
for result in option_regex.search_all(option_string):
|
||||||
if "option" in result.names:
|
if "option" in result.names:
|
||||||
@@ -37,7 +37,7 @@ func load_string(option_string: String):
|
|||||||
]
|
]
|
||||||
if "conditions" in result.names:
|
if "conditions" in result.names:
|
||||||
for condition_text in escoria.utils.get_re_group(
|
for condition_text in escoria.utils.get_re_group(
|
||||||
result,
|
result,
|
||||||
"conditions"
|
"conditions"
|
||||||
).split(","):
|
).split(","):
|
||||||
self.conditions.append(
|
self.conditions.append(
|
||||||
|
|||||||
@@ -21,20 +21,20 @@ const PREFIX = ":"
|
|||||||
|
|
||||||
|
|
||||||
# Valid event flags
|
# Valid event flags
|
||||||
# * TK: stands for "telekinetic". It means the player won't walk over to
|
# * TK: stands for "telekinetic". It means the player won't walk over to
|
||||||
# the item to say the line.
|
# the item to say the line.
|
||||||
# * NO_TT: stands for "No tooltip". It hides the tooltip for the duration of
|
# * NO_TT: stands for "No tooltip". It hides the tooltip for the duration of
|
||||||
# the event. Probably not very useful, because events having multiple
|
# the event. Probably not very useful, because events having multiple
|
||||||
# say commands in them are automatically hidden.
|
# say commands in them are automatically hidden.
|
||||||
# * NO_UI: stands for "No User Inteface". It hides the UI for the duration of
|
# * NO_UI: stands for "No User Inteface". It hides the UI for the duration of
|
||||||
# the event. Useful when you want something to look like a cut scene but not
|
# the event. Useful when you want something to look like a cut scene but not
|
||||||
# disable input for skipping dialog.
|
# disable input for skipping dialog.
|
||||||
# * NO_SAVE: disables saving. Use this in cut scenes and anywhere a
|
# * NO_SAVE: disables saving. Use this in cut scenes and anywhere a
|
||||||
# badly-timed autosave would leave your game in a messed-up state.
|
# badly-timed autosave would leave your game in a messed-up state.
|
||||||
enum {
|
enum {
|
||||||
FLAG_TK = 1,
|
FLAG_TK = 1,
|
||||||
FLAG_NO_TT = 2,
|
FLAG_NO_TT = 2,
|
||||||
FLAG_NO_UI = 4,
|
FLAG_NO_UI = 4,
|
||||||
FLAG_NO_SAVE = 8
|
FLAG_NO_SAVE = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ var flags: int = 0
|
|||||||
func _init(event_string: String):
|
func _init(event_string: String):
|
||||||
var event_regex = RegEx.new()
|
var event_regex = RegEx.new()
|
||||||
event_regex.compile(REGEX)
|
event_regex.compile(REGEX)
|
||||||
|
|
||||||
if event_regex.search(event_string):
|
if event_regex.search(event_string):
|
||||||
for result in event_regex.search_all(event_string):
|
for result in event_regex.search_all(event_string):
|
||||||
if "name" in result.names:
|
if "name" in result.names:
|
||||||
@@ -58,7 +58,7 @@ func _init(event_string: String):
|
|||||||
.strip_edges()
|
.strip_edges()
|
||||||
if "flags" in result.names:
|
if "flags" in result.names:
|
||||||
var _flags = escoria.utils.get_re_group(
|
var _flags = escoria.utils.get_re_group(
|
||||||
result,
|
result,
|
||||||
"flags"
|
"flags"
|
||||||
).strip_edges().split(" ")
|
).strip_edges().split(" ")
|
||||||
if "TK" in _flags:
|
if "TK" in _flags:
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ var conditions: Array = []
|
|||||||
func _init(group_string: String):
|
func _init(group_string: String):
|
||||||
var group_regex = RegEx.new()
|
var group_regex = RegEx.new()
|
||||||
group_regex.compile(REGEX)
|
group_regex.compile(REGEX)
|
||||||
|
|
||||||
if group_regex.search(group_string):
|
if group_regex.search(group_string):
|
||||||
for result in group_regex.search_all(group_string):
|
for result in group_regex.search_all(group_string):
|
||||||
if "conditions" in result.names:
|
if "conditions" in result.names:
|
||||||
for condition in escoria.utils.get_re_group(
|
for condition in escoria.utils.get_re_group(
|
||||||
result,
|
result,
|
||||||
"conditions"
|
"conditions"
|
||||||
).split(","):
|
).split(","):
|
||||||
self.conditions.append(
|
self.conditions.append(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ var active: bool = true setget _set_active
|
|||||||
# Wether the object is interactive (clickable by the player)
|
# Wether the object is interactive (clickable by the player)
|
||||||
var interactive: bool = true setget _set_interactive, _get_interactive
|
var interactive: bool = true setget _set_interactive, _get_interactive
|
||||||
|
|
||||||
# The state of the object. If the object has a respective animation,
|
# The state of the object. If the object has a respective animation,
|
||||||
# it will be played
|
# it will be played
|
||||||
var state: String = "default"
|
var state: String = "default"
|
||||||
|
|
||||||
@@ -36,10 +36,10 @@ func _init(p_global_id: String, p_node: Node):
|
|||||||
# - immediate: If true, skip directly to the end
|
# - immediate: If true, skip directly to the end
|
||||||
func set_state(p_state: String, immediate: bool = false):
|
func set_state(p_state: String, immediate: bool = false):
|
||||||
state = p_state
|
state = p_state
|
||||||
|
|
||||||
if node.has_method("get_animation_player"):
|
if node.has_method("get_animation_player"):
|
||||||
var animation_node: ESCAnimationPlayer = node.get_animation_player()
|
var animation_node: ESCAnimationPlayer = node.get_animation_player()
|
||||||
|
|
||||||
if animation_node != null and animation_node.is_valid():
|
if animation_node != null and animation_node.is_valid():
|
||||||
animation_node.stop()
|
animation_node.stop()
|
||||||
var actual_animator
|
var actual_animator
|
||||||
@@ -98,9 +98,9 @@ func _set_interactive(value: bool):
|
|||||||
# Return the data of the object to be inserted in a savegame file.
|
# Return the data of the object to be inserted in a savegame file.
|
||||||
#
|
#
|
||||||
# **Returns**
|
# **Returns**
|
||||||
# A dictionary containing the data to be saved for this object.
|
# A dictionary containing the data to be saved for this object.
|
||||||
func get_save_data() -> Dictionary:
|
func get_save_data() -> Dictionary:
|
||||||
var save_data: Dictionary = {}
|
var save_data: Dictionary = {}
|
||||||
save_data["active"] = self.active
|
save_data["active"] = self.active
|
||||||
save_data["interactive"] = self.interactive
|
save_data["interactive"] = self.interactive
|
||||||
save_data["state"] = self.state
|
save_data["state"] = self.state
|
||||||
@@ -110,9 +110,9 @@ func get_save_data() -> Dictionary:
|
|||||||
save_data["global_transform"] = self.node.global_transform
|
save_data["global_transform"] = self.node.global_transform
|
||||||
save_data["last_deg"] = wrapi(self.node._movable._get_angle() + 1, 0, 360)
|
save_data["last_deg"] = wrapi(self.node._movable._get_angle() + 1, 0, 360)
|
||||||
save_data["last_dir"] = self.node._movable.last_dir
|
save_data["last_dir"] = self.node._movable.last_dir
|
||||||
|
|
||||||
if (self.global_id == "_music" or self.global_id == "_sound") \
|
if (self.global_id == "_music" or self.global_id == "_sound") \
|
||||||
and self.node.get("state"):
|
and self.node.get("state"):
|
||||||
save_data["state"] = self.node.get("state")
|
save_data["state"] = self.node.get("state")
|
||||||
|
|
||||||
return save_data
|
return save_data
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ func is_valid() -> bool:
|
|||||||
if not (condition as ESCCondition).run():
|
if not (condition as ESCCondition).run():
|
||||||
return false
|
return false
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
# Execute this statement and return its return code
|
# Execute this statement and return its return code
|
||||||
func run() -> int:
|
func run() -> int:
|
||||||
var final_rc = ESCExecution.RC_OK
|
var final_rc = ESCExecution.RC_OK
|
||||||
@@ -35,14 +35,14 @@ func run() -> int:
|
|||||||
final_rc = ESCExecution.RC_CANCEL
|
final_rc = ESCExecution.RC_CANCEL
|
||||||
emit_signal("interrupted", final_rc)
|
emit_signal("interrupted", final_rc)
|
||||||
return final_rc
|
return final_rc
|
||||||
|
|
||||||
if statement.is_valid():
|
if statement.is_valid():
|
||||||
var rc = statement.run()
|
var rc = statement.run()
|
||||||
if rc is GDScriptFunctionState:
|
if rc is GDScriptFunctionState:
|
||||||
rc = yield(rc, "completed")
|
rc = yield(rc, "completed")
|
||||||
escoria.logger.debug(
|
escoria.logger.debug(
|
||||||
"esc_statement",
|
"esc_statement",
|
||||||
["Statement (%s) was completed."
|
["Statement (%s) was completed."
|
||||||
% statement]
|
% statement]
|
||||||
)
|
)
|
||||||
statement.is_finished = true
|
statement.is_finished = true
|
||||||
@@ -53,7 +53,7 @@ func run() -> int:
|
|||||||
elif rc != ESCExecution.RC_OK:
|
elif rc != ESCExecution.RC_OK:
|
||||||
final_rc = rc
|
final_rc = rc
|
||||||
break
|
break
|
||||||
|
|
||||||
emit_signal("finished", self, final_rc)
|
emit_signal("finished", self, final_rc)
|
||||||
return final_rc
|
return final_rc
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ func interrupt():
|
|||||||
var name = statement.name if "name" in statement else "group"
|
var name = statement.name if "name" in statement else "group"
|
||||||
escoria.logger.debug(
|
escoria.logger.debug(
|
||||||
"event manager",
|
"event manager",
|
||||||
["Event %s (%s) is already finished. Won't interrupt."
|
["Event %s (%s) is already finished. Won't interrupt."
|
||||||
% [name, str(statement)]]
|
% [name, str(statement)]]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ func play(name: String, backwards: bool = false):
|
|||||||
_animated_sprite.play(name, true)
|
_animated_sprite.play(name, true)
|
||||||
else:
|
else:
|
||||||
_player_node.play(name)
|
_player_node.play(name)
|
||||||
|
|
||||||
|
|
||||||
# Play the given animation backwards
|
# Play the given animation backwards
|
||||||
#
|
#
|
||||||
@@ -156,7 +156,7 @@ func get_length(name: String) -> float:
|
|||||||
|
|
||||||
# Return true if the ESCAnimationPlayer node is valid, ie. it has a valid player
|
# Return true if the ESCAnimationPlayer node is valid, ie. it has a valid player
|
||||||
# node.
|
# node.
|
||||||
# **Returns: true if the ESCAnimationPlayer has a valid player node,
|
# **Returns: true if the ESCAnimationPlayer has a valid player node,
|
||||||
# else false**
|
# else false**
|
||||||
func is_valid() -> bool:
|
func is_valid() -> bool:
|
||||||
return _player_node != null and _player_node is Node
|
return _player_node != null and _player_node is Node
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# ESCBackground's purpose is to display a background image and receive input
|
# ESCBackground's purpose is to display a background image and receive input
|
||||||
# events on the background. More precisely, the TextureRect under ESCBackground
|
# events on the background. More precisely, the TextureRect under ESCBackground
|
||||||
# does not receive events itself - if it did, it would also eat all events like
|
# does not receive events itself - if it did, it would also eat all events like
|
||||||
# hotspot focusing and such. Instead, we set the TextureRect mouse filter to
|
# hotspot focusing and such. Instead, we set the TextureRect mouse filter to
|
||||||
# MOUSE_FILTER_IGNORE, and we use an Area2D node to receive the input events.
|
# MOUSE_FILTER_IGNORE, and we use an Area2D node to receive the input events.
|
||||||
#
|
#
|
||||||
# If ESCBackground doesn't contain a texture, it is important that its rect_size
|
# If ESCBackground doesn't contain a texture, it is important that its rect_size
|
||||||
# is set over the whole scene, because its rect_size is then used to create the
|
# is set over the whole scene, because its rect_size is then used to create the
|
||||||
# Area2D node under it. If the rect_size is wrongly set, the background may
|
# Area2D node under it. If the rect_size is wrongly set, the background may
|
||||||
# receive no input.
|
# receive no input.
|
||||||
tool
|
tool
|
||||||
extends TextureRect
|
extends TextureRect
|
||||||
@@ -66,14 +66,14 @@ func _enter_tree():
|
|||||||
# Set extents of RectangleShape2D to cover entire TextureRect
|
# Set extents of RectangleShape2D to cover entire TextureRect
|
||||||
shape.set_extents(size / 2)
|
shape.set_extents(size / 2)
|
||||||
area.shape_owner_add_shape(sid, shape)
|
area.shape_owner_add_shape(sid, shape)
|
||||||
|
|
||||||
add_child(area)
|
add_child(area)
|
||||||
|
|
||||||
# Disable mouse filter events and connect our own events to the ESC input
|
# Disable mouse filter events and connect our own events to the ESC input
|
||||||
# manager
|
# manager
|
||||||
func _ready():
|
func _ready():
|
||||||
mouse_filter = MOUSE_FILTER_IGNORE
|
mouse_filter = MOUSE_FILTER_IGNORE
|
||||||
|
|
||||||
if !Engine.is_editor_hint():
|
if !Engine.is_editor_hint():
|
||||||
escoria.inputs_manager.register_background(self)
|
escoria.inputs_manager.register_background(self)
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ func get_full_area_rect2() -> Rect2:
|
|||||||
size = get_texture().get_size()
|
size = get_texture().get_size()
|
||||||
else:
|
else:
|
||||||
size = rect_size
|
size = rect_size
|
||||||
|
|
||||||
if rect_scale.x != 1 or rect_scale.y != 1:
|
if rect_scale.x != 1 or rect_scale.y != 1:
|
||||||
size.x *= rect_scale.x
|
size.x *= rect_scale.x
|
||||||
size.y *= rect_scale.y
|
size.y *= rect_scale.y
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func _enter_tree():
|
|||||||
func _ready():
|
func _ready():
|
||||||
_play_snd = PlaySndCommand.new()
|
_play_snd = PlaySndCommand.new()
|
||||||
_change_scene = ChangeSceneCommand.new()
|
_change_scene = ChangeSceneCommand.new()
|
||||||
|
|
||||||
call_deferred("_register_event")
|
call_deferred("_register_event")
|
||||||
|
|
||||||
|
|
||||||
@@ -35,16 +35,16 @@ func _register_event():
|
|||||||
var exit_scene_event_script = [
|
var exit_scene_event_script = [
|
||||||
"%s%s" % [ESCEvent.PREFIX, escoria.event_manager.EVENT_EXIT_SCENE]
|
"%s%s" % [ESCEvent.PREFIX, escoria.event_manager.EVENT_EXIT_SCENE]
|
||||||
]
|
]
|
||||||
|
|
||||||
if switch_sound != "":
|
if switch_sound != "":
|
||||||
exit_scene_event_script.append(
|
exit_scene_event_script.append(
|
||||||
"%s %s" % [_play_snd.get_command_name(), switch_sound]
|
"%s %s" % [_play_snd.get_command_name(), switch_sound]
|
||||||
)
|
)
|
||||||
|
|
||||||
exit_scene_event_script.append(
|
exit_scene_event_script.append(
|
||||||
"%s %s" % [_change_scene.get_command_name(), target_scene]
|
"%s %s" % [_change_scene.get_command_name(), target_scene]
|
||||||
)
|
)
|
||||||
|
|
||||||
var exit_scene_event = escoria.esc_compiler.compile(
|
var exit_scene_event = escoria.esc_compiler.compile(
|
||||||
exit_scene_event_script
|
exit_scene_event_script
|
||||||
).events[escoria.event_manager.EVENT_EXIT_SCENE]
|
).events[escoria.event_manager.EVENT_EXIT_SCENE]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ signal crash_popup_confirmed
|
|||||||
# NONE - No debugging
|
# NONE - No debugging
|
||||||
# MOUSE_TOOLTIP_LIMITS - Visualize the tooltip limits
|
# MOUSE_TOOLTIP_LIMITS - Visualize the tooltip limits
|
||||||
enum EDITOR_GAME_DEBUG_DISPLAY {
|
enum EDITOR_GAME_DEBUG_DISPLAY {
|
||||||
NONE,
|
NONE,
|
||||||
MOUSE_TOOLTIP_LIMITS
|
MOUSE_TOOLTIP_LIMITS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,13 +39,13 @@ var tooltip_node: Object
|
|||||||
# Function called when ESCGame enters the scene tree.
|
# Function called when ESCGame enters the scene tree.
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
escoria.event_manager.connect(
|
escoria.event_manager.connect(
|
||||||
"event_finished",
|
"event_finished",
|
||||||
self,
|
self,
|
||||||
"_on_event_done"
|
"_on_event_done"
|
||||||
)
|
)
|
||||||
escoria.action_manager.connect(
|
escoria.action_manager.connect(
|
||||||
"action_finished",
|
"action_finished",
|
||||||
self,
|
self,
|
||||||
"_on_action_finished"
|
"_on_action_finished"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -53,13 +53,13 @@ func _enter_tree():
|
|||||||
# Function called when ESCGame exits the scene tree.
|
# Function called when ESCGame exits the scene tree.
|
||||||
func _exit_tree():
|
func _exit_tree():
|
||||||
escoria.action_manager.disconnect(
|
escoria.action_manager.disconnect(
|
||||||
"event_finished",
|
"event_finished",
|
||||||
self,
|
self,
|
||||||
"_on_event_done"
|
"_on_event_done"
|
||||||
)
|
)
|
||||||
escoria.action_manager.disconnect(
|
escoria.action_manager.disconnect(
|
||||||
"action_finished",
|
"action_finished",
|
||||||
self,
|
self,
|
||||||
"_on_action_finished"
|
"_on_action_finished"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -77,13 +77,13 @@ func _draw():
|
|||||||
return
|
return
|
||||||
if editor_debug_mode == EDITOR_GAME_DEBUG_DISPLAY.NONE:
|
if editor_debug_mode == EDITOR_GAME_DEBUG_DISPLAY.NONE:
|
||||||
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(
|
var mouse_limits: Rect2 = get_viewport_rect().grow(
|
||||||
-mouse_tooltip_margin
|
-mouse_tooltip_margin
|
||||||
)
|
)
|
||||||
print(mouse_limits)
|
print(mouse_limits)
|
||||||
|
|
||||||
# Draw lines for tooltip limits
|
# Draw lines for tooltip limits
|
||||||
draw_rect(mouse_limits, ColorN("red"), false, 10.0)
|
draw_rect(mouse_limits, ColorN("red"), false, 10.0)
|
||||||
|
|
||||||
@@ -94,18 +94,18 @@ func _draw():
|
|||||||
#
|
#
|
||||||
# - destination: Destination to walk to
|
# - destination: Destination to walk to
|
||||||
# - params: Parameters for the action
|
# - params: Parameters for the action
|
||||||
# - can_interrupt: if true, this command will interrupt any ongoing event
|
# - can_interrupt: if true, this command will interrupt any ongoing event
|
||||||
func do_walk(destination, params: Array = [], can_interrupt: bool = false) -> void:
|
func do_walk(destination, params: Array = [], can_interrupt: bool = false) -> void:
|
||||||
if can_interrupt:
|
if can_interrupt:
|
||||||
escoria.event_manager.interrupt_running_event()
|
escoria.event_manager.interrupt_running_event()
|
||||||
|
|
||||||
escoria.action_manager.clear_current_action()
|
escoria.action_manager.clear_current_action()
|
||||||
|
|
||||||
var walk_fast = false
|
var walk_fast = false
|
||||||
|
|
||||||
if params.size() > 1:
|
if params.size() > 1:
|
||||||
walk_fast = true if params[1] else false
|
walk_fast = true if params[1] else false
|
||||||
|
|
||||||
# Check moving object.
|
# Check moving object.
|
||||||
if not escoria.object_manager.has(params[0]):
|
if not escoria.object_manager.has(params[0]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
@@ -116,10 +116,10 @@ func do_walk(destination, params: Array = [], can_interrupt: bool = false) -> vo
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
var moving_obj = escoria.object_manager.get_object(params[0])
|
var moving_obj = escoria.object_manager.get_object(params[0])
|
||||||
var target
|
var target
|
||||||
|
|
||||||
if destination is String:
|
if destination is String:
|
||||||
if not escoria.object_manager.has(destination):
|
if not escoria.object_manager.has(destination):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
@@ -130,17 +130,17 @@ func do_walk(destination, params: Array = [], can_interrupt: bool = false) -> vo
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
target = escoria.object_manager.get_object(destination)
|
target = escoria.object_manager.get_object(destination)
|
||||||
elif destination is Vector2:
|
elif destination is Vector2:
|
||||||
target = destination
|
target = destination
|
||||||
|
|
||||||
escoria.action_manager.perform_walk(moving_obj, target, walk_fast)
|
escoria.action_manager.perform_walk(moving_obj, target, walk_fast)
|
||||||
|
|
||||||
|
|
||||||
# Called when the player left clicks on the background
|
# Called when the player left clicks on the background
|
||||||
# (Needs to be overridden, if supported)
|
# (Needs to be overridden, if supported)
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - position: Position clicked
|
# - position: Position clicked
|
||||||
@@ -154,10 +154,10 @@ func left_click_on_bg(position: Vector2) -> void:
|
|||||||
|
|
||||||
# Called when the player right clicks on the background
|
# Called when the player right clicks on the background
|
||||||
# (Needs to be overridden, if supported)
|
# (Needs to be overridden, if supported)
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - position: Position clicked
|
# - position: Position clicked
|
||||||
func right_click_on_bg(position: Vector2) -> void:
|
func right_click_on_bg(position: Vector2) -> void:
|
||||||
do_walk(
|
do_walk(
|
||||||
position,
|
position,
|
||||||
@@ -168,7 +168,7 @@ func right_click_on_bg(position: Vector2) -> void:
|
|||||||
|
|
||||||
# Called when the player double clicks on the background
|
# Called when the player double clicks on the background
|
||||||
# (Needs to be overridden, if supported)
|
# (Needs to be overridden, if supported)
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - position: Position clicked
|
# - position: Position clicked
|
||||||
@@ -233,14 +233,14 @@ func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
|||||||
# - item_global_id: Global id of the item that was clicked
|
# - item_global_id: Global id of the item that was clicked
|
||||||
# - event: The received input event
|
# - event: The received input event
|
||||||
func left_double_click_on_item(
|
func left_double_click_on_item(
|
||||||
item_global_id: String,
|
item_global_id: String,
|
||||||
event: InputEvent
|
event: InputEvent
|
||||||
) -> void:
|
) -> void:
|
||||||
escoria.action_manager.do(
|
escoria.action_manager.do(
|
||||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||||
[item_global_id, event],
|
[item_global_id, event],
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Called when an inventory item was left clicked
|
# Called when an inventory item was left clicked
|
||||||
@@ -251,7 +251,7 @@ func left_double_click_on_item(
|
|||||||
# - inventory_item_global_id: Global id of the inventory item was clicked
|
# - inventory_item_global_id: Global id of the inventory item was clicked
|
||||||
# - event: The received input event
|
# - event: The received input event
|
||||||
func left_click_on_inventory_item(
|
func left_click_on_inventory_item(
|
||||||
inventory_item_global_id: String,
|
inventory_item_global_id: String,
|
||||||
event: InputEvent
|
event: InputEvent
|
||||||
) -> void:
|
) -> void:
|
||||||
pass
|
pass
|
||||||
@@ -265,7 +265,7 @@ func left_click_on_inventory_item(
|
|||||||
# - inventory_item_global_id: Global id of the inventory item was clicked
|
# - inventory_item_global_id: Global id of the inventory item was clicked
|
||||||
# - event: The received input event
|
# - event: The received input event
|
||||||
func right_click_on_inventory_item(
|
func right_click_on_inventory_item(
|
||||||
inventory_item_global_id: String,
|
inventory_item_global_id: String,
|
||||||
event: InputEvent
|
event: InputEvent
|
||||||
) -> void:
|
) -> void:
|
||||||
pass
|
pass
|
||||||
@@ -311,7 +311,7 @@ func open_inventory():
|
|||||||
# (Needs to be overridden, if supported)
|
# (Needs to be overridden, if supported)
|
||||||
func close_inventory():
|
func close_inventory():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Called when the mousewheel was used
|
# Called when the mousewheel was used
|
||||||
# (Needs to be overridden, if supported)
|
# (Needs to be overridden, if supported)
|
||||||
@@ -327,7 +327,7 @@ func mousewheel_action(direction: int):
|
|||||||
# (Needs to be overridden, if supported)
|
# (Needs to be overridden, if supported)
|
||||||
func hide_ui():
|
func hide_ui():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Called when the UI should be shown
|
# Called when the UI should be shown
|
||||||
# (Needs to be overridden, if supported)
|
# (Needs to be overridden, if supported)
|
||||||
@@ -339,15 +339,15 @@ func show_ui():
|
|||||||
#
|
#
|
||||||
# #### Parameter
|
# #### Parameter
|
||||||
#
|
#
|
||||||
# - p_editor_debug_mode: EDITOR_GAME_DEBUG_DISPLAY enum (int) value
|
# - p_editor_debug_mode: EDITOR_GAME_DEBUG_DISPLAY enum (int) value
|
||||||
# corresponding to the desired editor debug mode
|
# corresponding to the desired 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()
|
||||||
|
|
||||||
|
|
||||||
# Automatically called whenever an event is finished. Can be used to reset some
|
# Automatically called whenever an event is finished. Can be used to reset some
|
||||||
# UI elements to their default/empty state. This function can be called before
|
# UI elements to their default/empty state. This function can be called before
|
||||||
# _on_action_finished() if the player input started an event.
|
# _on_action_finished() if the player input started an event.
|
||||||
# Reimplement to performed desired actions.
|
# Reimplement to performed desired actions.
|
||||||
#
|
#
|
||||||
@@ -359,8 +359,8 @@ func _on_event_done(_return_code: int, _event_name: String) -> void:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Automatically called whenever an action initiated by the player is finished.
|
# Automatically called whenever an action initiated by the player is finished.
|
||||||
# Can be used to reset some UI elements to their default/empty state.
|
# Can be used to reset some UI elements to their default/empty state.
|
||||||
# Reimplement to performed desired actions.
|
# Reimplement to performed desired actions.
|
||||||
func _on_action_finished() -> void:
|
func _on_action_finished() -> void:
|
||||||
pass
|
pass
|
||||||
@@ -386,16 +386,16 @@ func hide_main_menu():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Custom function that is meant to apply custom settings. Called right after
|
# Custom function that is meant to apply custom settings. Called right after
|
||||||
# Escoria settings file was loaded.
|
# Escoria settings file was loaded.
|
||||||
func apply_custom_settings(custom_settings: Dictionary):
|
func apply_custom_settings(custom_settings: Dictionary):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Custom function automatically called when save game is created.
|
# Custom function automatically called when save game is created.
|
||||||
#
|
#
|
||||||
# *Returns* A Dictionary containing the custom data to be saved within the
|
# *Returns* A Dictionary containing the custom data to be saved within the
|
||||||
# game file.
|
# game file.
|
||||||
func get_custom_data() -> Dictionary:
|
func get_custom_data() -> Dictionary:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export(String, FILE, "*.esc") var esc_script
|
|||||||
export(bool) var is_exit
|
export(bool) var is_exit
|
||||||
|
|
||||||
# If true, object is considered as trigger. Allows using :trigger_in and
|
# If true, object is considered as trigger. Allows using :trigger_in and
|
||||||
# :trigger_out verbs in ESC scripts.
|
# :trigger_out verbs in ESC scripts.
|
||||||
export(bool) var is_trigger
|
export(bool) var is_trigger
|
||||||
|
|
||||||
# The verb used for the trigger in ESC events
|
# The verb used for the trigger in ESC events
|
||||||
@@ -89,8 +89,8 @@ export(String) var default_action
|
|||||||
# Default action to use if object is in the inventory
|
# Default action to use if object is in the inventory
|
||||||
export(String) var default_action_inventory
|
export(String) var default_action_inventory
|
||||||
|
|
||||||
# If action used by player is in this list, the game will wait for a second
|
# If action used by player is in this list, the game will wait for a second
|
||||||
# click on another item to combine objects together (typical
|
# click on another item to combine objects together (typical
|
||||||
# `USE <X> WITH <Y>`, `GIVE <X> TO <Y>`)
|
# `USE <X> WITH <Y>`, `GIVE <X> TO <Y>`)
|
||||||
export(PoolStringArray) var combine_when_selected_action_is_in = []
|
export(PoolStringArray) var combine_when_selected_action_is_in = []
|
||||||
|
|
||||||
@@ -156,33 +156,33 @@ var _animation_player: ESCAnimationPlayer = null
|
|||||||
# and register this item
|
# and register this item
|
||||||
func _ready():
|
func _ready():
|
||||||
self.pause_mode = Node.PAUSE_MODE_STOP
|
self.pause_mode = Node.PAUSE_MODE_STOP
|
||||||
|
|
||||||
_detect_children()
|
_detect_children()
|
||||||
|
|
||||||
if not self.is_connected("mouse_entered", self, "_on_mouse_entered"):
|
if not self.is_connected("mouse_entered", self, "_on_mouse_entered"):
|
||||||
connect("mouse_entered", self, "_on_mouse_entered")
|
connect("mouse_entered", self, "_on_mouse_entered")
|
||||||
if not self.is_connected("mouse_exited", self, "_on_mouse_exited"):
|
if not self.is_connected("mouse_exited", self, "_on_mouse_exited"):
|
||||||
connect("mouse_exited", self, "_on_mouse_exited")
|
connect("mouse_exited", self, "_on_mouse_exited")
|
||||||
|
|
||||||
# Register and connect all elements to Escoria backoffice.
|
# Register and connect all elements to Escoria backoffice.
|
||||||
if not Engine.is_editor_hint():
|
if not Engine.is_editor_hint():
|
||||||
|
|
||||||
if is_movable:
|
if is_movable:
|
||||||
_movable = ESCMovable.new()
|
_movable = ESCMovable.new()
|
||||||
|
|
||||||
add_child(_movable)
|
add_child(_movable)
|
||||||
|
|
||||||
if not escoria.event_manager.is_connected(
|
if not escoria.event_manager.is_connected(
|
||||||
"event_finished",
|
"event_finished",
|
||||||
self,
|
self,
|
||||||
"_update_terrain"
|
"_update_terrain"
|
||||||
):
|
):
|
||||||
escoria.event_manager.connect(
|
escoria.event_manager.connect(
|
||||||
"event_finished",
|
"event_finished",
|
||||||
self,
|
self,
|
||||||
"_update_terrain"
|
"_update_terrain"
|
||||||
)
|
)
|
||||||
|
|
||||||
escoria.object_manager.register_object(
|
escoria.object_manager.register_object(
|
||||||
ESCObject.new(
|
ESCObject.new(
|
||||||
global_id,
|
global_id,
|
||||||
@@ -190,58 +190,58 @@ func _ready():
|
|||||||
),
|
),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
terrain = escoria.room_terrain
|
terrain = escoria.room_terrain
|
||||||
|
|
||||||
if !is_trigger:
|
if !is_trigger:
|
||||||
if not self.is_connected(
|
if not self.is_connected(
|
||||||
"mouse_entered_item",
|
"mouse_entered_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_entered_item"
|
"_on_mouse_entered_item"
|
||||||
):
|
):
|
||||||
connect(
|
connect(
|
||||||
"mouse_entered_item",
|
"mouse_entered_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_entered_item"
|
"_on_mouse_entered_item"
|
||||||
)
|
)
|
||||||
if not self.is_connected(
|
if not self.is_connected(
|
||||||
"mouse_exited_item",
|
"mouse_exited_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_exited_item"
|
"_on_mouse_exited_item"
|
||||||
):
|
):
|
||||||
connect(
|
connect(
|
||||||
"mouse_exited_item",
|
"mouse_exited_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_exited_item"
|
"_on_mouse_exited_item"
|
||||||
)
|
)
|
||||||
if not self.is_connected(
|
if not self.is_connected(
|
||||||
"mouse_left_clicked_item",
|
"mouse_left_clicked_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_left_clicked_item"
|
"_on_mouse_left_clicked_item"
|
||||||
):
|
):
|
||||||
connect(
|
connect(
|
||||||
"mouse_left_clicked_item",
|
"mouse_left_clicked_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_left_clicked_item"
|
"_on_mouse_left_clicked_item"
|
||||||
)
|
)
|
||||||
if not self.is_connected(
|
if not self.is_connected(
|
||||||
"mouse_double_left_clicked_item",
|
"mouse_double_left_clicked_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_left_double_clicked_item"
|
"_on_mouse_left_double_clicked_item"
|
||||||
):
|
):
|
||||||
connect(
|
connect(
|
||||||
"mouse_double_left_clicked_item",
|
"mouse_double_left_clicked_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_left_double_clicked_item"
|
"_on_mouse_left_double_clicked_item"
|
||||||
)
|
)
|
||||||
if not self.is_connected(
|
if not self.is_connected(
|
||||||
"mouse_right_clicked_item",
|
"mouse_right_clicked_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_right_clicked_item"
|
"_on_mouse_right_clicked_item"
|
||||||
):
|
):
|
||||||
connect(
|
connect(
|
||||||
"mouse_right_clicked_item",
|
"mouse_right_clicked_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_right_clicked_item"
|
"_on_mouse_right_clicked_item"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -253,12 +253,12 @@ func _ready():
|
|||||||
connect("body_entered", self, "element_entered")
|
connect("body_entered", self, "element_entered")
|
||||||
if not self.is_connected("body_exited", self, "element_exited"):
|
if not self.is_connected("body_exited", self, "element_exited"):
|
||||||
connect("body_exited", self, "element_exited")
|
connect("body_exited", self, "element_exited")
|
||||||
|
|
||||||
# If object can be in the inventory, set default_action_inventory to same as
|
# If object can be in the inventory, set default_action_inventory to same as
|
||||||
# default_action, if default_action_inventory is not set
|
# default_action, if default_action_inventory is not set
|
||||||
if use_from_inventory_only and default_action_inventory.empty():
|
if use_from_inventory_only and default_action_inventory.empty():
|
||||||
default_action_inventory = default_action
|
default_action_inventory = default_action
|
||||||
|
|
||||||
# Perform a first terrain scaling if we have to.
|
# Perform a first terrain scaling if we have to.
|
||||||
if (!is_exit or dont_apply_terrain_scaling) and is_movable:
|
if (!is_exit or dont_apply_terrain_scaling) and is_movable:
|
||||||
_movable.last_scale = scale
|
_movable.last_scale = scale
|
||||||
@@ -278,8 +278,8 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||||||
var mouse_in_shape: bool = false
|
var mouse_in_shape: bool = false
|
||||||
var colliders = get_world_2d().direct_space_state.intersect_point(
|
var colliders = get_world_2d().direct_space_state.intersect_point(
|
||||||
p,
|
p,
|
||||||
32,
|
32,
|
||||||
[],
|
[],
|
||||||
2147483647,
|
2147483647,
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
@@ -331,10 +331,10 @@ func get_interact_position() -> Vector2:
|
|||||||
for c in get_children():
|
for c in get_children():
|
||||||
if c is Position2D:
|
if c is Position2D:
|
||||||
interact_position = c.global_position
|
interact_position = c.global_position
|
||||||
|
|
||||||
if interact_position == null and collision != null:
|
if interact_position == null and collision != null:
|
||||||
interact_position = collision.global_position
|
interact_position = collision.global_position
|
||||||
|
|
||||||
return interact_position
|
return interact_position
|
||||||
|
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ func _on_mouse_exited():
|
|||||||
|
|
||||||
|
|
||||||
# Another item (e.g. the player) has entered this item
|
# Another item (e.g. the player) has entered this item
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - body: Other object that has entered the item
|
# - body: Other object that has entered the item
|
||||||
@@ -357,7 +357,7 @@ func element_entered(body):
|
|||||||
if body is ESCBackground or body.get_parent() is ESCBackground:
|
if body is ESCBackground or body.get_parent() is ESCBackground:
|
||||||
return
|
return
|
||||||
escoria.action_manager.do(
|
escoria.action_manager.do(
|
||||||
escoria.action_manager.ACTION.TRIGGER_IN,
|
escoria.action_manager.ACTION.TRIGGER_IN,
|
||||||
[global_id, body.global_id, trigger_in_verb]
|
[global_id, body.global_id, trigger_in_verb]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ func element_exited(body):
|
|||||||
if body is ESCBackground or body.get_parent() is ESCBackground:
|
if body is ESCBackground or body.get_parent() is ESCBackground:
|
||||||
return
|
return
|
||||||
escoria.action_manager.do(
|
escoria.action_manager.do(
|
||||||
escoria.action_manager.ACTION.TRIGGER_OUT,
|
escoria.action_manager.ACTION.TRIGGER_OUT,
|
||||||
[global_id, body.global_id, trigger_out_verb]
|
[global_id, body.global_id, trigger_out_verb]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ func teleport(target: Node) -> void:
|
|||||||
# - target: Vector2 position to teleport to
|
# - target: Vector2 position to teleport to
|
||||||
func teleport_to(target: Vector2) -> void:
|
func teleport_to(target: Vector2) -> void:
|
||||||
_movable.teleport_to(target)
|
_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
|
||||||
#
|
#
|
||||||
@@ -410,7 +410,7 @@ func walk_to(pos: Vector2, p_walk_context: ESCWalkContext = null) -> void:
|
|||||||
# - 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
|
||||||
|
|
||||||
|
|
||||||
# Check wether this item moved
|
# Check wether this item moved
|
||||||
func has_moved() -> bool:
|
func has_moved() -> bool:
|
||||||
@@ -527,18 +527,18 @@ func _get_property_list():
|
|||||||
func _set_animation_player_node(node_path: NodePath):
|
func _set_animation_player_node(node_path: NodePath):
|
||||||
if not Engine.is_editor_hint():
|
if not Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
|
|
||||||
if node_path == "":
|
if node_path == "":
|
||||||
animation_player_node = node_path
|
animation_player_node = node_path
|
||||||
return
|
return
|
||||||
|
|
||||||
assert(has_node(node_path), "Node with path %s not found" % node_path)
|
assert(has_node(node_path), "Node with path %s not found" % node_path)
|
||||||
assert(
|
assert(
|
||||||
get_node(node_path) is AnimatedSprite or \
|
get_node(node_path) is AnimatedSprite or \
|
||||||
get_node(node_path) is AnimationPlayer,
|
get_node(node_path) is AnimationPlayer,
|
||||||
"Selected node has to be an AnimatedSprite or AnimationPlayer node"
|
"Selected node has to be an AnimatedSprite or AnimationPlayer node"
|
||||||
)
|
)
|
||||||
|
|
||||||
animation_player_node = node_path
|
animation_player_node = node_path
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export(bool) var is_start_location = false
|
|||||||
# player character arrives.
|
# player character arrives.
|
||||||
export(bool) var player_orients_on_arrival = true
|
export(bool) var player_orients_on_arrival = true
|
||||||
|
|
||||||
# Let the player turn to this direction when the player arrives
|
# Let the player turn to this direction when the player arrives
|
||||||
# at the item
|
# at the item
|
||||||
export(int) var interaction_direction
|
export(int) var interaction_direction
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ func start():
|
|||||||
thread = Thread.new()
|
thread = Thread.new()
|
||||||
thread.start(self, "thread_func", 0)
|
thread.start(self, "thread_func", 0)
|
||||||
|
|
||||||
|
|
||||||
## Uncomment these for debug, or wait for someone to implement log levels
|
## Uncomment these for debug, or wait for someone to implement log levels
|
||||||
# connect("resource_loading_progress", self, "print_progress")
|
# connect("resource_loading_progress", self, "print_progress")
|
||||||
# connect("resource_loading_done", self, "res_loaded")
|
# connect("resource_loading_done", self, "res_loaded")
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class_name ESCRoom, "res://addons/escoria-core/design/esc_room.svg"
|
|||||||
# NONE: No debug display
|
# NONE: No debug display
|
||||||
# CAMERA_LIMITS: Display the camera limits
|
# CAMERA_LIMITS: Display the camera limits
|
||||||
enum EditorRoomDebugDisplay {
|
enum EditorRoomDebugDisplay {
|
||||||
NONE,
|
NONE,
|
||||||
CAMERA_LIMITS
|
CAMERA_LIMITS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,22 +68,22 @@ func _draw():
|
|||||||
return
|
return
|
||||||
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")
|
||||||
]
|
]
|
||||||
|
|
||||||
# If there are more camera limits than colors defined for them, add more.
|
# If there are more camera limits than colors defined for them, add more.
|
||||||
if camera_limits.size() > camera_limits_colors.size():
|
if camera_limits.size() > camera_limits_colors.size():
|
||||||
for i in camera_limits.size() - camera_limits_colors.size():
|
for i in camera_limits.size() - camera_limits_colors.size():
|
||||||
camera_limits_colors.push_back(Color(randf(), randf(), randf(), 1.0))
|
camera_limits_colors.push_back(Color(randf(), randf(), randf(), 1.0))
|
||||||
|
|
||||||
# Draw lines for camera limits
|
# Draw lines for camera limits
|
||||||
for i in camera_limits.size():
|
for i in camera_limits.size():
|
||||||
draw_rect(camera_limits[i], camera_limits_colors[i], false, 10.0)
|
draw_rect(camera_limits[i], camera_limits_colors[i], false, 10.0)
|
||||||
var default_font = Control.new().get_font("font")
|
var default_font = Control.new().get_font("font")
|
||||||
|
|
||||||
draw_string(default_font, Vector2(camera_limits[i].position.x + 30,
|
draw_string(default_font, Vector2(camera_limits[i].position.x + 30,
|
||||||
camera_limits[i].position.y + 30), str(i), camera_limits_colors[i])
|
camera_limits[i].position.y + 30), str(i), camera_limits_colors[i])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export(Texture) var lightmap setget _set_lightmap
|
|||||||
export(Vector2) var bitmaps_scale = Vector2(1,1) setget _set_bm_scale
|
export(Vector2) var bitmaps_scale = Vector2(1,1) setget _set_bm_scale
|
||||||
|
|
||||||
# Multiplier applied to the player speed on this terrain
|
# Multiplier applied to the player speed on this terrain
|
||||||
export(float) var player_speed_multiplier = 1.0
|
export(float) var player_speed_multiplier = 1.0
|
||||||
|
|
||||||
# Multiplier how much faster the player will walk when fast mode is on
|
# Multiplier how much faster the player will walk when fast mode is on
|
||||||
# (double clicked)
|
# (double clicked)
|
||||||
@@ -65,7 +65,7 @@ func _ready():
|
|||||||
if n.enabled:
|
if n.enabled:
|
||||||
if navigation_enabled_found:
|
if navigation_enabled_found:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"ESCTerrain:_ready()",
|
"ESCTerrain:_ready()",
|
||||||
[
|
[
|
||||||
"Multiple NavigationPolygonInstances enabled " + \
|
"Multiple NavigationPolygonInstances enabled " + \
|
||||||
"at the same time."
|
"at the same time."
|
||||||
@@ -73,8 +73,8 @@ 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()
|
||||||
@@ -212,7 +212,7 @@ func _draw():
|
|||||||
if current_active_navigation_instance:
|
if current_active_navigation_instance:
|
||||||
current_active_navigation_instance.visible = true
|
current_active_navigation_instance.visible = true
|
||||||
return
|
return
|
||||||
|
|
||||||
var scale_vect = bitmaps_scale
|
var scale_vect = bitmaps_scale
|
||||||
|
|
||||||
if current_active_navigation_instance:
|
if current_active_navigation_instance:
|
||||||
@@ -220,9 +220,9 @@ func _draw():
|
|||||||
|
|
||||||
var src = Rect2(0, 0, _texture.get_width(), _texture.get_height())
|
var src = Rect2(0, 0, _texture.get_width(), _texture.get_height())
|
||||||
var dst = Rect2(
|
var dst = Rect2(
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
_texture.get_width() * scale_vect.x,
|
_texture.get_width() * scale_vect.x,
|
||||||
_texture.get_height() * scale_vect.y
|
_texture.get_height() * scale_vect.y
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# A tooltip displaying <verb> <item1> [<item2>]
|
# A tooltip displaying <verb> <item1> [<item2>]
|
||||||
tool
|
tool
|
||||||
extends RichTextLabel
|
extends RichTextLabel
|
||||||
class_name ESCTooltip
|
class_name ESCTooltip
|
||||||
@@ -50,8 +50,8 @@ var debug_texturerect_node: TextureRect
|
|||||||
func _ready():
|
func _ready():
|
||||||
escoria.main.connect("room_ready", self, "_on_room_ready")
|
escoria.main.connect("room_ready", self, "_on_room_ready")
|
||||||
escoria.action_manager.connect("action_changed", self, "_on_action_selected")
|
escoria.action_manager.connect("action_changed", self, "_on_action_selected")
|
||||||
|
|
||||||
|
|
||||||
# Set the color of the label
|
# Set the color of the label
|
||||||
#
|
#
|
||||||
# ## Parameters
|
# ## Parameters
|
||||||
@@ -61,9 +61,9 @@ func set_color(p_color: Color):
|
|||||||
update_tooltip_text()
|
update_tooltip_text()
|
||||||
|
|
||||||
|
|
||||||
# Enable/disable debug mode of the label. If enabled, the label is displayed
|
# Enable/disable debug mode of the label. If enabled, the label is displayed
|
||||||
# with a white background.
|
# with a white background.
|
||||||
#
|
#
|
||||||
# ## Parameters
|
# ## Parameters
|
||||||
# - p_debug_mode: if true, enable debug mode. False to disable
|
# - p_debug_mode: if true, enable debug mode. False to disable
|
||||||
func set_debug_mode(p_debug_mode: bool):
|
func set_debug_mode(p_debug_mode: bool):
|
||||||
@@ -85,7 +85,7 @@ func set_debug_mode(p_debug_mode: bool):
|
|||||||
else:
|
else:
|
||||||
if debug_texturerect_node:
|
if debug_texturerect_node:
|
||||||
remove_child(debug_texturerect_node)
|
remove_child(debug_texturerect_node)
|
||||||
|
|
||||||
|
|
||||||
# Set the first target of the label.
|
# Set the first target of the label.
|
||||||
#
|
#
|
||||||
@@ -126,7 +126,7 @@ func update_size():
|
|||||||
var content_height = get_content_height()
|
var content_height = get_content_height()
|
||||||
var nb_visible_characters = visible_characters
|
var nb_visible_characters = visible_characters
|
||||||
var nb_visible_lines = get_visible_line_count()
|
var nb_visible_lines = get_visible_line_count()
|
||||||
|
|
||||||
# if text is too long and is wrapped
|
# if text is too long and is wrapped
|
||||||
var nblines = nb_visible_lines
|
var nblines = nb_visible_lines
|
||||||
if nblines >= 1:
|
if nblines >= 1:
|
||||||
@@ -135,19 +135,19 @@ func update_size():
|
|||||||
text_height = MAX_HEIGHT
|
text_height = MAX_HEIGHT
|
||||||
if text_height <= MIN_HEIGHT:
|
if text_height <= MIN_HEIGHT:
|
||||||
text_height = MIN_HEIGHT
|
text_height = MIN_HEIGHT
|
||||||
|
|
||||||
var parent_width = rect_size.x
|
var parent_width = rect_size.x
|
||||||
|
|
||||||
# first, try to increase width until it goes above max_width
|
# first, try to increase width until it goes above max_width
|
||||||
while parent_width < MAX_WIDTH && float(text_height) / float(ONE_LINE_HEIGHT) > 1.0:
|
while parent_width < MAX_WIDTH && float(text_height) / float(ONE_LINE_HEIGHT) > 1.0:
|
||||||
rect_size.x += 1
|
rect_size.x += 1
|
||||||
parent_width = rect_size.x
|
parent_width = rect_size.x
|
||||||
|
|
||||||
rect_size.y = text_height
|
rect_size.y = text_height
|
||||||
|
|
||||||
if rect_size.x >= MAX_WIDTH:
|
if rect_size.x >= MAX_WIDTH:
|
||||||
rect_size.x = MAX_WIDTH
|
rect_size.x = MAX_WIDTH
|
||||||
|
|
||||||
## END RECT_SIZE ##
|
## END RECT_SIZE ##
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
@@ -156,7 +156,7 @@ func update_size():
|
|||||||
|
|
||||||
|
|
||||||
# Calculate the offset of the label depending on its position.
|
# Calculate the offset of the label depending on its position.
|
||||||
#
|
#
|
||||||
# ## Parameters
|
# ## Parameters
|
||||||
# - position: the position to test
|
# - position: the position to test
|
||||||
#
|
#
|
||||||
@@ -165,10 +165,10 @@ func update_size():
|
|||||||
func _offset(position: Vector2) -> Vector2:
|
func _offset(position: Vector2) -> Vector2:
|
||||||
var center_offset_x = rect_size.x / 2
|
var center_offset_x = rect_size.x / 2
|
||||||
var offset_y = 5
|
var offset_y = 5
|
||||||
|
|
||||||
position.x -= center_offset_x
|
position.x -= center_offset_x
|
||||||
position.y += offset_y
|
position.y += offset_y
|
||||||
|
|
||||||
return position
|
return position
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ var dont_interact_on_arrival: bool
|
|||||||
|
|
||||||
|
|
||||||
func _init(
|
func _init(
|
||||||
p_target_object: ESCObject,
|
p_target_object: ESCObject,
|
||||||
p_target_position: Vector2,
|
p_target_position: Vector2,
|
||||||
p_fast: bool,
|
p_fast: bool,
|
||||||
p_dont_interact_on_arrival: bool
|
p_dont_interact_on_arrival: bool
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ var _level_map: Dictionary = {
|
|||||||
func _init():
|
func _init():
|
||||||
# Open logfile in write mode
|
# Open logfile in write mode
|
||||||
log_file = File.new()
|
log_file = File.new()
|
||||||
|
|
||||||
# this is left alone as this constructor is called from escoria.gd's own
|
# this is left alone as this constructor is called from escoria.gd's own
|
||||||
# constructor
|
# constructor
|
||||||
var log_file_path = ProjectSettings.get_setting(
|
var log_file_path = ProjectSettings.get_setting(
|
||||||
@@ -50,7 +50,7 @@ func _init():
|
|||||||
str(date["hour"]) + str(date["minute"]) + str(date["second"])
|
str(date["hour"]) + str(date["minute"]) + str(date["second"])
|
||||||
])
|
])
|
||||||
log_file.open(
|
log_file.open(
|
||||||
log_file_path,
|
log_file_path,
|
||||||
File.WRITE
|
File.WRITE
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ func _init():
|
|||||||
# Log a trace message
|
# Log a trace message
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * string: Text to log
|
# * string: Text to log
|
||||||
# * args: Additional information
|
# * args: Additional information
|
||||||
func trace(string: String, args = []):
|
func trace(string: String, args = []):
|
||||||
@@ -70,7 +70,7 @@ func trace(string: String, args = []):
|
|||||||
# Log a debug message
|
# Log a debug message
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * string: Text to log
|
# * string: Text to log
|
||||||
# * args: Additional information
|
# * args: Additional information
|
||||||
func debug(string: String, args = []):
|
func debug(string: String, args = []):
|
||||||
@@ -82,7 +82,7 @@ func debug(string: String, args = []):
|
|||||||
# Log an info message
|
# Log an info message
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * string: Text to log
|
# * string: Text to log
|
||||||
# * args: Additional information
|
# * args: Additional information
|
||||||
func info(string: String, args = []):
|
func info(string: String, args = []):
|
||||||
@@ -101,44 +101,44 @@ func info(string: String, args = []):
|
|||||||
# Log a warning message
|
# Log a warning message
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * 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 and !crashed:
|
if _get_log_level() >= LOG_WARNING and !crashed:
|
||||||
var argsstr = str(args) if !args.empty() else ""
|
var argsstr = str(args) if !args.empty() else ""
|
||||||
_log("(W)\t" + string + " \t" + argsstr, true)
|
_log("(W)\t" + string + " \t" + argsstr, true)
|
||||||
|
|
||||||
if escoria.project_settings_manager.get_setting(
|
if escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.TERMINATE_ON_WARNINGS
|
escoria.project_settings_manager.TERMINATE_ON_WARNINGS
|
||||||
):
|
):
|
||||||
_perform_stack_trace_log()
|
_perform_stack_trace_log()
|
||||||
crashed = true
|
crashed = true
|
||||||
|
|
||||||
var files = "- %s" % log_file.get_path_absolute()
|
var files = "- %s" % log_file.get_path_absolute()
|
||||||
var message = escoria.project_settings_manager.get_setting(
|
var message = escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.CRASH_MESSAGE
|
escoria.project_settings_manager.CRASH_MESSAGE
|
||||||
) % files
|
) % files
|
||||||
|
|
||||||
_log(message, true)
|
_log(message, true)
|
||||||
escoria.set_game_paused(true)
|
escoria.set_game_paused(true)
|
||||||
escoria.main.current_scene.game.show_crash_popup(
|
escoria.main.current_scene.game.show_crash_popup(
|
||||||
[log_file.get_path_absolute()]
|
[log_file.get_path_absolute()]
|
||||||
)
|
)
|
||||||
assert(false)
|
assert(false)
|
||||||
|
|
||||||
|
|
||||||
# Log an error message
|
# Log an error message
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * string: Text to log
|
# * string: Text to log
|
||||||
# * args: Additional information
|
# * args: Additional information
|
||||||
func error(string: String, args = [], do_savegame: bool = true):
|
func error(string: String, args = [], do_savegame: bool = true):
|
||||||
if _get_log_level() >= LOG_ERROR and !crashed:
|
if _get_log_level() >= LOG_ERROR and !crashed:
|
||||||
var argsstr = str(args) if !args.empty() else ""
|
var argsstr = str(args) if !args.empty() else ""
|
||||||
_log("(E)\t" + string + " \t" + argsstr, true)
|
_log("(E)\t" + string + " \t" + argsstr, true)
|
||||||
|
|
||||||
if escoria.project_settings_manager.get_setting(
|
if escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.TERMINATE_ON_ERRORS
|
escoria.project_settings_manager.TERMINATE_ON_ERRORS
|
||||||
):
|
):
|
||||||
@@ -146,19 +146,19 @@ func error(string: String, args = [], do_savegame: bool = true):
|
|||||||
crashed = true
|
crashed = true
|
||||||
if do_savegame:
|
if do_savegame:
|
||||||
_perform_save_game_log()
|
_perform_save_game_log()
|
||||||
|
|
||||||
var files_to_send: Array = [
|
var files_to_send: Array = [
|
||||||
log_file.get_path_absolute().get_base_dir().plus_file(
|
log_file.get_path_absolute().get_base_dir().plus_file(
|
||||||
escoria.save_manager.crash_savegame_filename.get_file()
|
escoria.save_manager.crash_savegame_filename.get_file()
|
||||||
),
|
),
|
||||||
log_file.get_path_absolute()
|
log_file.get_path_absolute()
|
||||||
]
|
]
|
||||||
|
|
||||||
var files = "- %s\n- %s" % files_to_send
|
var files = "- %s\n- %s" % files_to_send
|
||||||
var message = escoria.project_settings_manager.get_setting(
|
var message = escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.CRASH_MESSAGE
|
escoria.project_settings_manager.CRASH_MESSAGE
|
||||||
) % files
|
) % files
|
||||||
|
|
||||||
_log(message, true)
|
_log(message, true)
|
||||||
escoria.set_game_paused(true)
|
escoria.set_game_paused(true)
|
||||||
escoria.main.current_scene.game.show_crash_popup(files_to_send)
|
escoria.main.current_scene.game.show_crash_popup(files_to_send)
|
||||||
@@ -168,7 +168,7 @@ func error(string: String, args = [], do_savegame: bool = true):
|
|||||||
# Log a warning message about an ESC file
|
# Log a warning message about an ESC file
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * 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
|
||||||
@@ -176,7 +176,7 @@ func report_warnings(p_path: String, warnings: Array, report_once = false) -> vo
|
|||||||
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
|
||||||
|
|
||||||
if !warning_is_reported:
|
if !warning_is_reported:
|
||||||
var text = "Warnings in file "+p_path+"\n"
|
var text = "Warnings in file "+p_path+"\n"
|
||||||
for w in warnings:
|
for w in warnings:
|
||||||
@@ -185,7 +185,7 @@ func report_warnings(p_path: String, warnings: Array, report_once = false) -> vo
|
|||||||
else:
|
else:
|
||||||
text += w+"\n"
|
text += w+"\n"
|
||||||
warning(text)
|
warning(text)
|
||||||
|
|
||||||
if report_once:
|
if report_once:
|
||||||
warning_is_reported = true
|
warning_is_reported = true
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ func report_warnings(p_path: String, warnings: Array, report_once = false) -> vo
|
|||||||
# Log an error message about an ESC file
|
# Log an error message about an ESC file
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * 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:
|
||||||
@@ -211,7 +211,7 @@ func report_errors(p_path: String, errors: Array) -> void:
|
|||||||
# - in stdout, or stderr if err is true.
|
# - in stdout, or stderr if err is true.
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * message: Message to log
|
# * message: Message to log
|
||||||
# * err: if true, write in stderr
|
# * err: if true, write in stderr
|
||||||
func _log(message:String, err: bool = false):
|
func _log(message:String, err: bool = false):
|
||||||
@@ -259,7 +259,7 @@ func _perform_stack_trace_log():
|
|||||||
# Write a message in the output logfile
|
# Write a message in the output logfile
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# * message: Message to write
|
# * message: Message to write
|
||||||
func _write_logfile(message: String) -> void:
|
func _write_logfile(message: String) -> void:
|
||||||
if log_file.is_open():
|
if log_file.is_open():
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ var _savegame: ESCSaveGame
|
|||||||
# - savegame: Savegame to modify
|
# - savegame: Savegame to modify
|
||||||
func set_savegame(savegame: ESCSaveGame):
|
func set_savegame(savegame: ESCSaveGame):
|
||||||
_savegame = savegame
|
_savegame = savegame
|
||||||
|
|
||||||
|
|
||||||
# Get the savegame
|
# Get the savegame
|
||||||
# **Returns** Savegame
|
# **Returns** Savegame
|
||||||
func get_savegame():
|
func get_savegame():
|
||||||
return _savegame
|
return _savegame
|
||||||
|
|
||||||
|
|
||||||
# Override this function in the version script with
|
# Override this function in the version script with
|
||||||
# the things that need to be applied to the savegame
|
# the things that need to be applied to the savegame
|
||||||
|
|||||||
@@ -24,19 +24,19 @@ func _init() -> void:
|
|||||||
#
|
#
|
||||||
# Each migration will return a modified version of the given savegame
|
# Each migration will return a modified version of the given savegame
|
||||||
func migrate(
|
func migrate(
|
||||||
savegame: ESCSaveGame,
|
savegame: ESCSaveGame,
|
||||||
from: String,
|
from: String,
|
||||||
to: String,
|
to: String,
|
||||||
versions_directory: String
|
versions_directory: String
|
||||||
) -> ESCSaveGame:
|
) -> ESCSaveGame:
|
||||||
escoria.logger.info("Migrating from version %s to %s" % [
|
escoria.logger.info("Migrating from version %s to %s" % [
|
||||||
from,
|
from,
|
||||||
to
|
to
|
||||||
])
|
])
|
||||||
|
|
||||||
var from_info = version_regex.search(from)
|
var from_info = version_regex.search(from)
|
||||||
var to_info = version_regex.search(to)
|
var to_info = version_regex.search(to)
|
||||||
|
|
||||||
var wrong_version: bool = false
|
var wrong_version: bool = false
|
||||||
if from_info.get_string("major") > to_info.get_string("major"):
|
if from_info.get_string("major") > to_info.get_string("major"):
|
||||||
wrong_version = true
|
wrong_version = true
|
||||||
@@ -47,7 +47,7 @@ func migrate(
|
|||||||
from_info.get_string("minor") == to_info.get_string("minor") and\
|
from_info.get_string("minor") == to_info.get_string("minor") and\
|
||||||
from_info.get_string("patch") > to_info.get_string("patch"):
|
from_info.get_string("patch") > to_info.get_string("patch"):
|
||||||
wrong_version = true
|
wrong_version = true
|
||||||
|
|
||||||
if wrong_version:
|
if wrong_version:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"esc_migration_manager:migrate",
|
"esc_migration_manager:migrate",
|
||||||
@@ -58,12 +58,12 @@ func migrate(
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
var versions = _find_versions(versions_directory, from, to)
|
var versions = _find_versions(versions_directory, from, to)
|
||||||
versions.sort_custom(self, "_compare_version")
|
versions.sort_custom(self, "_compare_version")
|
||||||
if versions[0].get_file().get_basename() == from:
|
if versions[0].get_file().get_basename() == from:
|
||||||
versions.pop_front()
|
versions.pop_front()
|
||||||
|
|
||||||
for version in versions:
|
for version in versions:
|
||||||
var migration_script = load(version).new()
|
var migration_script = load(version).new()
|
||||||
if not migration_script is ESCMigration:
|
if not migration_script is ESCMigration:
|
||||||
@@ -77,7 +77,7 @@ func migrate(
|
|||||||
(migration_script as ESCMigration).set_savegame(savegame)
|
(migration_script as ESCMigration).set_savegame(savegame)
|
||||||
(migration_script as ESCMigration).migrate()
|
(migration_script as ESCMigration).migrate()
|
||||||
savegame = (migration_script as ESCMigration).get_savegame()
|
savegame = (migration_script as ESCMigration).get_savegame()
|
||||||
|
|
||||||
return savegame
|
return savegame
|
||||||
|
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ func _version_between(version: String, from: String, to: String) -> bool:
|
|||||||
var version_info = version_regex.search(version)
|
var version_info = version_regex.search(version)
|
||||||
var from_info = version_regex.search(from)
|
var from_info = version_regex.search(from)
|
||||||
var to_info = version_regex.search(to)
|
var to_info = version_regex.search(to)
|
||||||
|
|
||||||
if from_info.get_string("major") < version_info.get_string("major") and \
|
if from_info.get_string("major") < version_info.get_string("major") and \
|
||||||
version_info.get_string("major") < to_info.get_string("major"):
|
version_info.get_string("major") < to_info.get_string("major"):
|
||||||
return true
|
return true
|
||||||
@@ -144,12 +144,12 @@ func _version_between(version: String, from: String, to: String) -> bool:
|
|||||||
to_info.get_string("minor") == version_info.get_string("minor") and\
|
to_info.get_string("minor") == version_info.get_string("minor") and\
|
||||||
to_info.get_string("patch") > version_info.get_string("patch"):
|
to_info.get_string("patch") > version_info.get_string("patch"):
|
||||||
return true
|
return true
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
# Compare to version strings
|
# Compare to version strings
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
# - version_a: First version to compare
|
# - version_a: First version to compare
|
||||||
# - version_b: Second version to compare
|
# - version_b: Second version to compare
|
||||||
@@ -157,7 +157,7 @@ func _version_between(version: String, from: String, to: String) -> bool:
|
|||||||
func _compare_version(version_a: String, version_b: String) -> bool:
|
func _compare_version(version_a: String, version_b: String) -> bool:
|
||||||
var a_info = version_regex.search(version_a.get_file().get_basename())
|
var a_info = version_regex.search(version_a.get_file().get_basename())
|
||||||
var b_info = version_regex.search(version_b.get_file().get_basename())
|
var b_info = version_regex.search(version_b.get_file().get_basename())
|
||||||
|
|
||||||
if a_info.get_string("major") < b_info.get_string("major"):
|
if a_info.get_string("major") < b_info.get_string("major"):
|
||||||
return true
|
return true
|
||||||
elif a_info.get_string("major") == b_info.get_string("major") and \
|
elif a_info.get_string("major") == b_info.get_string("major") and \
|
||||||
@@ -167,6 +167,6 @@ func _compare_version(version_a: String, version_b: String) -> bool:
|
|||||||
a_info.get_string("minor") == b_info.get_string("minor") and \
|
a_info.get_string("minor") == b_info.get_string("minor") and \
|
||||||
a_info.get_string("patch") < b_info.get_string("patch"):
|
a_info.get_string("patch") < b_info.get_string("patch"):
|
||||||
return true
|
return true
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Resource containing all defined animations and angles for
|
# Resource containing all defined animations and angles for
|
||||||
# characters movement.
|
# characters movement.
|
||||||
tool
|
tool
|
||||||
extends Resource
|
extends Resource
|
||||||
@@ -13,18 +13,18 @@ class_name ESCAnimationResource
|
|||||||
export(Array, Resource) var dir_angles: Array = []
|
export(Array, Resource) var dir_angles: Array = []
|
||||||
|
|
||||||
# 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
|
# [animation_name, scale]: scale parameter can be set to -1 to mirror
|
||||||
# the animation
|
# the animation
|
||||||
export(Array, Resource) var directions: Array = []
|
export(Array, Resource) var directions: Array = []
|
||||||
|
|
||||||
|
|
||||||
# Array containing the idle animations for each direction (in the
|
# Array containing the idle animations for each direction (in the
|
||||||
# order defined by dir_angles): scale parameter can be set to -1 to mirror
|
# order defined by dir_angles): scale parameter can be set to -1 to mirror
|
||||||
# the animation
|
# the animation
|
||||||
export(Array, Resource) var idles: Array = []
|
export(Array, Resource) var idles: Array = []
|
||||||
|
|
||||||
# Array containing the speak animations for each direction (in the
|
# Array containing the speak animations for each direction (in the
|
||||||
# order defined by dir_angles): scale parameter can be set to -1 to mirror
|
# order defined by dir_angles): scale parameter can be set to -1 to mirror
|
||||||
# the animation
|
# the animation
|
||||||
export(Array, Resource) var speaks: Array = []
|
export(Array, Resource) var speaks: Array = []
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class_name ESCDirectionAngle
|
|||||||
|
|
||||||
|
|
||||||
# Start angle of the directional angle.
|
# Start angle of the directional angle.
|
||||||
export(int) var angle_start: int
|
export(int) var angle_start: int
|
||||||
|
|
||||||
# Size of the angle
|
# Size of the angle
|
||||||
export(int) var angle_size: int
|
export(int) var angle_size: int
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func _init():
|
|||||||
_play_snd = PlaySndCommand.new()
|
_play_snd = PlaySndCommand.new()
|
||||||
|
|
||||||
|
|
||||||
# Return a list of savegames metadata (id, date, name and game version)
|
# Return a list of savegames metadata (id, date, name and game version)
|
||||||
func get_saves_list() -> Dictionary:
|
func get_saves_list() -> Dictionary:
|
||||||
var regex = RegEx.new()
|
var regex = RegEx.new()
|
||||||
regex.compile("save_(?<slotnumber>[0-9]{3})\\.tres")
|
regex.compile("save_(?<slotnumber>[0-9]{3})\\.tres")
|
||||||
@@ -70,7 +70,7 @@ func get_saves_list() -> Dictionary:
|
|||||||
var save_path = save_folder.plus_file(nextfile)
|
var save_path = save_folder.plus_file(nextfile)
|
||||||
var file: File = File.new()
|
var file: File = File.new()
|
||||||
var save_game_res: Resource = load(save_path)
|
var save_game_res: Resource = load(save_path)
|
||||||
|
|
||||||
if save_game_res == null:
|
if save_game_res == null:
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"esc_save_manager.gd",
|
"esc_save_manager.gd",
|
||||||
@@ -90,7 +90,7 @@ func get_saves_list() -> Dictionary:
|
|||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"esc_save_manager.gd",
|
"esc_save_manager.gd",
|
||||||
[
|
[
|
||||||
"Savegame file %s contains valid data but doesn't match filename format %s. Skipping."
|
"Savegame file %s contains valid data but doesn't match filename format %s. Skipping."
|
||||||
% [save_path, regex.get_pattern()]
|
% [save_path, regex.get_pattern()]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -154,9 +154,9 @@ func save_game_crash():
|
|||||||
)
|
)
|
||||||
crash_savegame_filename = save_file_path.plus_file(
|
crash_savegame_filename = save_file_path.plus_file(
|
||||||
CRASH_SAVE_NAME_TEMPLATE % [
|
CRASH_SAVE_NAME_TEMPLATE % [
|
||||||
str(datetime["year"]) + str(datetime["month"])
|
str(datetime["year"]) + str(datetime["month"])
|
||||||
+ str(datetime["day"]),
|
+ str(datetime["day"]),
|
||||||
str(datetime["hour"]) + str(datetime["minute"])
|
str(datetime["hour"]) + str(datetime["minute"])
|
||||||
+ str(datetime["second"])
|
+ str(datetime["second"])
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -165,22 +165,22 @@ func save_game_crash():
|
|||||||
if error != OK:
|
if error != OK:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"esc_save_manager.gd",
|
"esc_save_manager.gd",
|
||||||
["There was an issue writing the crash save to %s"
|
["There was an issue writing the crash save to %s"
|
||||||
% crash_savegame_filename])
|
% crash_savegame_filename])
|
||||||
return error
|
return error
|
||||||
|
|
||||||
|
|
||||||
# Actual savegame function.
|
# Actual savegame function.
|
||||||
#
|
#
|
||||||
# ## Parameters
|
# ## Parameters
|
||||||
# - p_savename: name of the savegame
|
# - p_savename: name of the savegame
|
||||||
func _do_save_game(p_savename: String) -> ESCSaveGame:
|
func _do_save_game(p_savename: String) -> ESCSaveGame:
|
||||||
var save_game = ESCSaveGame.new()
|
var save_game = ESCSaveGame.new()
|
||||||
|
|
||||||
var plugin_config = ConfigFile.new()
|
var plugin_config = ConfigFile.new()
|
||||||
plugin_config.load("res://addons/escoria-core/plugin.cfg")
|
plugin_config.load("res://addons/escoria-core/plugin.cfg")
|
||||||
save_game.escoria_version = plugin_config.get_value("plugin", "version")
|
save_game.escoria_version = plugin_config.get_value("plugin", "version")
|
||||||
|
|
||||||
save_game.game_version = escoria.project_settings_manager.get_setting(
|
save_game.game_version = escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.GAME_VERSION
|
escoria.project_settings_manager.GAME_VERSION
|
||||||
)
|
)
|
||||||
@@ -200,7 +200,7 @@ func _do_save_game(p_savename: String) -> ESCSaveGame:
|
|||||||
escoria.object_manager.save_game(save_game)
|
escoria.object_manager.save_game(save_game)
|
||||||
escoria.main.save_game(save_game)
|
escoria.main.save_game(save_game)
|
||||||
save_game.custom_data = escoria.game_scene.get_custom_data()
|
save_game.custom_data = escoria.game_scene.get_custom_data()
|
||||||
|
|
||||||
return save_game
|
return save_game
|
||||||
|
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ func load_game(id: int):
|
|||||||
escoria_version,
|
escoria_version,
|
||||||
"res://addons/escoria-core/game/core-scripts/migrations/versions"
|
"res://addons/escoria-core/game/core-scripts/migrations/versions"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Migrate savegame through game versions
|
# Migrate savegame through game versions
|
||||||
if escoria.project_settings_manager.get_setting(
|
if escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.GAME_VERSION
|
escoria.project_settings_manager.GAME_VERSION
|
||||||
@@ -291,7 +291,7 @@ func load_game(id: int):
|
|||||||
load_statements.append(
|
load_statements.append(
|
||||||
ESCCommand.new("%s %s false" %
|
ESCCommand.new("%s %s false" %
|
||||||
[
|
[
|
||||||
_change_scene.get_command_name(),
|
_change_scene.get_command_name(),
|
||||||
save_game.main["current_scene_filename"]
|
save_game.main["current_scene_filename"]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -303,8 +303,8 @@ func load_game(id: int):
|
|||||||
save_game.objects[object_global_id].has("active"):
|
save_game.objects[object_global_id].has("active"):
|
||||||
load_statements.append(ESCCommand.new("%s %s %s" \
|
load_statements.append(ESCCommand.new("%s %s %s" \
|
||||||
% [
|
% [
|
||||||
_set_active.get_command_name(),
|
_set_active.get_command_name(),
|
||||||
object_global_id,
|
object_global_id,
|
||||||
save_game.objects[object_global_id]["active"]
|
save_game.objects[object_global_id]["active"]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -313,7 +313,7 @@ func load_game(id: int):
|
|||||||
if save_game.objects[object_global_id].has("interactive"):
|
if save_game.objects[object_global_id].has("interactive"):
|
||||||
load_statements.append(ESCCommand.new("%s %s %s" \
|
load_statements.append(ESCCommand.new("%s %s %s" \
|
||||||
% [
|
% [
|
||||||
_set_interactive.get_command_name(),
|
_set_interactive.get_command_name(),
|
||||||
object_global_id,
|
object_global_id,
|
||||||
save_game.objects[object_global_id]["interactive"]
|
save_game.objects[object_global_id]["interactive"]
|
||||||
]
|
]
|
||||||
@@ -334,7 +334,7 @@ func load_game(id: int):
|
|||||||
load_statements.append(ESCCommand.new("%s %s %s %s" \
|
load_statements.append(ESCCommand.new("%s %s %s %s" \
|
||||||
% [
|
% [
|
||||||
_teleport_pos.get_command_name(),
|
_teleport_pos.get_command_name(),
|
||||||
object_global_id,
|
object_global_id,
|
||||||
int(save_game.objects[object_global_id] \
|
int(save_game.objects[object_global_id] \
|
||||||
["global_transform"].origin.x),
|
["global_transform"].origin.x),
|
||||||
int(save_game.objects[object_global_id] \
|
int(save_game.objects[object_global_id] \
|
||||||
@@ -345,18 +345,18 @@ func load_game(id: int):
|
|||||||
load_statements.append(ESCCommand.new("%s %s %s" \
|
load_statements.append(ESCCommand.new("%s %s %s" \
|
||||||
% [
|
% [
|
||||||
_set_angle.get_command_name(),
|
_set_angle.get_command_name(),
|
||||||
object_global_id,
|
object_global_id,
|
||||||
save_game.objects[object_global_id]["last_deg"]
|
save_game.objects[object_global_id]["last_deg"]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if object_global_id in [
|
if object_global_id in [
|
||||||
escoria.object_manager.MUSIC,
|
escoria.object_manager.MUSIC,
|
||||||
escoria.object_manager.SOUND, escoria.object_manager.SPEECH
|
escoria.object_manager.SOUND, escoria.object_manager.SPEECH
|
||||||
]:
|
]:
|
||||||
if save_game.objects[object_global_id]["state"] in [
|
if save_game.objects[object_global_id]["state"] in [
|
||||||
"default",
|
"default",
|
||||||
"off"
|
"off"
|
||||||
]:
|
]:
|
||||||
load_statements.append(
|
load_statements.append(
|
||||||
@@ -400,7 +400,7 @@ func save_settings():
|
|||||||
var settings_res := ESCSaveSettings.new()
|
var settings_res := ESCSaveSettings.new()
|
||||||
var plugin_config = ConfigFile.new()
|
var plugin_config = ConfigFile.new()
|
||||||
plugin_config.load("res://addons/escoria-core/plugin.cfg")
|
plugin_config.load("res://addons/escoria-core/plugin.cfg")
|
||||||
|
|
||||||
settings_res.escoria_version = plugin_config.get_value("plugin", "version")
|
settings_res.escoria_version = plugin_config.get_value("plugin", "version")
|
||||||
settings_res.text_lang = escoria.settings.text_lang
|
settings_res.text_lang = escoria.settings.text_lang
|
||||||
settings_res.voice_lang = escoria.settings.voice_lang
|
settings_res.voice_lang = escoria.settings.voice_lang
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ export var date: String = ""
|
|||||||
# Main data to be saved
|
# Main data to be saved
|
||||||
export var main: Dictionary = {}
|
export var main: Dictionary = {}
|
||||||
|
|
||||||
# Escoria Global variables exported from ESCGlobalsManager
|
# Escoria Global variables exported from ESCGlobalsManager
|
||||||
export var globals: Dictionary = {}
|
export var globals: Dictionary = {}
|
||||||
|
|
||||||
# Escoria objects exported from ESCObjectsManager
|
# Escoria objects exported from ESCObjectsManager
|
||||||
export var objects: Dictionary = {}
|
export var objects: Dictionary = {}
|
||||||
|
|
||||||
# Custom data
|
# Custom data
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ class_name ESCUtils
|
|||||||
|
|
||||||
|
|
||||||
# Convert radians to degrees
|
# Convert radians to degrees
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - 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):
|
||||||
@@ -46,7 +46,7 @@ func get_typed_value(value: String, type_hint = []):
|
|||||||
regex_float.compile("^[0-9]+\\.[0-9]+$")
|
regex_float.compile("^[0-9]+\\.[0-9]+$")
|
||||||
var regex_int = RegEx.new()
|
var regex_int = RegEx.new()
|
||||||
regex_int.compile("^[0-9]+$")
|
regex_int.compile("^[0-9]+$")
|
||||||
|
|
||||||
if regex_float.search(value):
|
if regex_float.search(value):
|
||||||
return float(value)
|
return float(value)
|
||||||
elif regex_int.search(value):
|
elif regex_int.search(value):
|
||||||
@@ -74,7 +74,7 @@ func sanitize_whitespace(value: String) -> String:
|
|||||||
var double_regex = RegEx.new()
|
var double_regex = RegEx.new()
|
||||||
double_regex.compile("\\s\\s+")
|
double_regex.compile("\\s\\s+")
|
||||||
return double_regex.sub(
|
return double_regex.sub(
|
||||||
tab_regex.sub(value, " "),
|
tab_regex.sub(value, " "),
|
||||||
" ",
|
" ",
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ var save_manager: ESCSaveManager
|
|||||||
# The game scene loaded
|
# The game scene loaded
|
||||||
var game_scene: ESCGame
|
var game_scene: ESCGame
|
||||||
|
|
||||||
# The compiled start script loaded from ProjectSettings
|
# The compiled start script loaded from ProjectSettings
|
||||||
# escoria/main/game_start_script
|
# escoria/main/game_start_script
|
||||||
var start_script: ESCScript
|
var start_script: ESCScript
|
||||||
|
|
||||||
@@ -120,11 +120,11 @@ func _init():
|
|||||||
self.inputs_manager = ESCInputsManager.new()
|
self.inputs_manager = ESCInputsManager.new()
|
||||||
self.room_manager = ESCRoomManager.new()
|
self.room_manager = ESCRoomManager.new()
|
||||||
self.project_settings_manager = ESCProjectSettingsManager.new()
|
self.project_settings_manager = ESCProjectSettingsManager.new()
|
||||||
|
|
||||||
settings = ESCSaveSettings.new()
|
settings = ESCSaveSettings.new()
|
||||||
|
|
||||||
if self.project_settings_manager.get_setting(self.project_settings_manager.GAME_SCENE) == "":
|
if self.project_settings_manager.get_setting(self.project_settings_manager.GAME_SCENE) == "":
|
||||||
logger.report_errors("escoria.gd",
|
logger.report_errors("escoria.gd",
|
||||||
["Project setting '%s' is not set!" % self.project_settings_manager.GAME_SCENE]
|
["Project setting '%s' is not set!" % self.project_settings_manager.GAME_SCENE]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -132,7 +132,7 @@ func _init():
|
|||||||
self.project_settings_manager.get_setting(self.project_settings_manager.GAME_SCENE)
|
self.project_settings_manager.get_setting(self.project_settings_manager.GAME_SCENE)
|
||||||
).instance()
|
).instance()
|
||||||
|
|
||||||
print(get_script().get_path())
|
print(get_script().get_path())
|
||||||
|
|
||||||
|
|
||||||
# Load settings
|
# Load settings
|
||||||
@@ -142,7 +142,7 @@ func _ready():
|
|||||||
room_manager.register_reserved_globals()
|
room_manager.register_reserved_globals()
|
||||||
inputs_manager.register_core()
|
inputs_manager.register_core()
|
||||||
if self.project_settings_manager.get_setting(self.project_settings_manager.GAME_START_SCRIPT).empty():
|
if self.project_settings_manager.get_setting(self.project_settings_manager.GAME_START_SCRIPT).empty():
|
||||||
logger.report_errors("escoria.gd",
|
logger.report_errors("escoria.gd",
|
||||||
[
|
[
|
||||||
"Project setting '%s' is not set!" % self.project_settings_manager.GAME_START_SCRIPT
|
"Project setting '%s' is not set!" % self.project_settings_manager.GAME_START_SCRIPT
|
||||||
])
|
])
|
||||||
@@ -186,7 +186,7 @@ func apply_settings(p_settings: ESCSaveSettings) -> void:
|
|||||||
settings = ESCSaveSettings.new()
|
settings = ESCSaveSettings.new()
|
||||||
|
|
||||||
AudioServer.set_bus_volume_db(
|
AudioServer.set_bus_volume_db(
|
||||||
AudioServer.get_bus_index(BUS_MASTER),
|
AudioServer.get_bus_index(BUS_MASTER),
|
||||||
linear2db(settings.master_volume)
|
linear2db(settings.master_volume)
|
||||||
)
|
)
|
||||||
AudioServer.set_bus_volume_db(
|
AudioServer.set_bus_volume_db(
|
||||||
@@ -194,15 +194,15 @@ func apply_settings(p_settings: ESCSaveSettings) -> void:
|
|||||||
linear2db(settings.sfx_volume)
|
linear2db(settings.sfx_volume)
|
||||||
)
|
)
|
||||||
AudioServer.set_bus_volume_db(
|
AudioServer.set_bus_volume_db(
|
||||||
AudioServer.get_bus_index(BUS_MUSIC),
|
AudioServer.get_bus_index(BUS_MUSIC),
|
||||||
linear2db(settings.music_volume)
|
linear2db(settings.music_volume)
|
||||||
)
|
)
|
||||||
AudioServer.set_bus_volume_db(
|
AudioServer.set_bus_volume_db(
|
||||||
AudioServer.get_bus_index(BUS_SPEECH),
|
AudioServer.get_bus_index(BUS_SPEECH),
|
||||||
linear2db(settings.speech_volume)
|
linear2db(settings.speech_volume)
|
||||||
)
|
)
|
||||||
TranslationServer.set_locale(settings.text_lang)
|
TranslationServer.set_locale(settings.text_lang)
|
||||||
|
|
||||||
game_scene.apply_custom_settings(settings.custom_settings)
|
game_scene.apply_custom_settings(settings.custom_settings)
|
||||||
|
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ func _input(event):
|
|||||||
|
|
||||||
if event.is_action_pressed("ui_cancel"):
|
if event.is_action_pressed("ui_cancel"):
|
||||||
emit_signal("request_pause_menu")
|
emit_signal("request_pause_menu")
|
||||||
|
|
||||||
|
|
||||||
# Pauses or unpause the game
|
# Pauses or unpause the game
|
||||||
#
|
#
|
||||||
@@ -231,13 +231,13 @@ func set_game_paused(p_paused: bool):
|
|||||||
# Runs the event "event_name" from the "script" ESC script.
|
# Runs the event "event_name" from the "script" ESC script.
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
# - script: ESC script containing the event to run. The script must have been
|
# - script: ESC script containing the event to run. The script must have been
|
||||||
# loaded.
|
# loaded.
|
||||||
# - event_name: Name of the event to run
|
# - event_name: Name of the event to run
|
||||||
func run_event_from_script(script: ESCScript, event_name: String):
|
func run_event_from_script(script: ESCScript, event_name: String):
|
||||||
if script == null:
|
if script == null:
|
||||||
logger.report_errors(
|
logger.report_errors(
|
||||||
"escoria.gd:run_event_from_script()",
|
"escoria.gd:run_event_from_script()",
|
||||||
["Requested action %s on unloaded script %s" % [event_name, script],
|
["Requested action %s on unloaded script %s" % [event_name, script],
|
||||||
"Please load the ESC script using esc_compiler.load_esc_file()."]
|
"Please load the ESC script using esc_compiler.load_esc_file()."]
|
||||||
)
|
)
|
||||||
@@ -279,7 +279,7 @@ func register_ui(game_scene: String):
|
|||||||
escoria.project_settings_manager.GAME_SCENE,
|
escoria.project_settings_manager.GAME_SCENE,
|
||||||
game_scene
|
game_scene
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Deregister a user interface
|
# Deregister a user interface
|
||||||
#
|
#
|
||||||
@@ -304,7 +304,7 @@ func deregister_ui(game_scene: String):
|
|||||||
escoria.project_settings_manager.GAME_SCENE,
|
escoria.project_settings_manager.GAME_SCENE,
|
||||||
""
|
""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Register a dialog manager addon. This should be called in a deferred way
|
# Register a dialog manager addon. This should be called in a deferred way
|
||||||
# from the addon's _enter_tree.
|
# from the addon's _enter_tree.
|
||||||
@@ -315,12 +315,12 @@ func register_dialog_manager(manager_class: String):
|
|||||||
var dialog_managers: Array = escoria.project_settings_manager.get_setting(
|
var dialog_managers: Array = escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.DIALOG_MANAGERS
|
escoria.project_settings_manager.DIALOG_MANAGERS
|
||||||
)
|
)
|
||||||
|
|
||||||
if manager_class in dialog_managers:
|
if manager_class in dialog_managers:
|
||||||
return
|
return
|
||||||
|
|
||||||
dialog_managers.push_back(manager_class)
|
dialog_managers.push_back(manager_class)
|
||||||
|
|
||||||
escoria.project_settings_manager.set_setting(
|
escoria.project_settings_manager.set_setting(
|
||||||
escoria.project_settings_manager.DIALOG_MANAGERS,
|
escoria.project_settings_manager.DIALOG_MANAGERS,
|
||||||
dialog_managers
|
dialog_managers
|
||||||
@@ -335,7 +335,7 @@ func deregister_dialog_manager(manager_class: String):
|
|||||||
var dialog_managers: Array = escoria.project_settings_manager.get_setting(
|
var dialog_managers: Array = escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.DIALOG_MANAGERS
|
escoria.project_settings_manager.DIALOG_MANAGERS
|
||||||
)
|
)
|
||||||
|
|
||||||
if not manager_class in dialog_managers:
|
if not manager_class in dialog_managers:
|
||||||
logger.report_warnings(
|
logger.report_warnings(
|
||||||
"escoria.gd:deregister_dialog_manager()",
|
"escoria.gd:deregister_dialog_manager()",
|
||||||
@@ -344,9 +344,9 @@ func deregister_dialog_manager(manager_class: String):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
dialog_managers.erase(manager_class)
|
dialog_managers.erase(manager_class)
|
||||||
|
|
||||||
escoria.project_settings_manager.set_setting(
|
escoria.project_settings_manager.set_setting(
|
||||||
escoria.project_settings_manager.DIALOG_MANAGERS,
|
escoria.project_settings_manager.DIALOG_MANAGERS,
|
||||||
dialog_managers
|
dialog_managers
|
||||||
|
|||||||
@@ -44,47 +44,47 @@ func register_core():
|
|||||||
# Connect the item signals to the local methods
|
# Connect the item signals to the local methods
|
||||||
func register_inventory_item(item: Node):
|
func register_inventory_item(item: Node):
|
||||||
item.connect(
|
item.connect(
|
||||||
"mouse_left_inventory_item",
|
"mouse_left_inventory_item",
|
||||||
self,
|
self,
|
||||||
"_on_mouse_left_click_inventory_item"
|
"_on_mouse_left_click_inventory_item"
|
||||||
)
|
)
|
||||||
item.connect(
|
item.connect(
|
||||||
"mouse_double_left_inventory_item",
|
"mouse_double_left_inventory_item",
|
||||||
self,
|
self,
|
||||||
"_on_mouse_double_left_click_inventory_item"
|
"_on_mouse_double_left_click_inventory_item"
|
||||||
)
|
)
|
||||||
item.connect(
|
item.connect(
|
||||||
"mouse_right_inventory_item",
|
"mouse_right_inventory_item",
|
||||||
self,
|
self,
|
||||||
"_on_mouse_right_click_inventory_item"
|
"_on_mouse_right_click_inventory_item"
|
||||||
)
|
)
|
||||||
|
|
||||||
item.connect(
|
item.connect(
|
||||||
"inventory_item_focused",
|
"inventory_item_focused",
|
||||||
self,
|
self,
|
||||||
"_on_mouse_entered_inventory_item"
|
"_on_mouse_entered_inventory_item"
|
||||||
)
|
)
|
||||||
item.connect(
|
item.connect(
|
||||||
"inventory_item_unfocused",
|
"inventory_item_unfocused",
|
||||||
self,
|
self,
|
||||||
"_on_mouse_exited_inventory_item"
|
"_on_mouse_exited_inventory_item"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func register_background(background: ESCBackground):
|
func register_background(background: ESCBackground):
|
||||||
background.connect(
|
background.connect(
|
||||||
"left_click_on_bg",
|
"left_click_on_bg",
|
||||||
self,
|
self,
|
||||||
"_on_left_click_on_bg"
|
"_on_left_click_on_bg"
|
||||||
)
|
)
|
||||||
background.connect(
|
background.connect(
|
||||||
"right_click_on_bg",
|
"right_click_on_bg",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_right_click_on_bg"
|
"_on_right_click_on_bg"
|
||||||
)
|
)
|
||||||
background.connect(
|
background.connect(
|
||||||
"double_left_click_on_bg",
|
"double_left_click_on_bg",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_double_left_click_on_bg"
|
"_on_double_left_click_on_bg"
|
||||||
)
|
)
|
||||||
background.connect(
|
background.connect(
|
||||||
@@ -99,8 +99,8 @@ func register_background(background: ESCBackground):
|
|||||||
"_on_mousewheel_action",
|
"_on_mousewheel_action",
|
||||||
[-1]
|
[-1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Clear the stack of hovered items
|
# Clear the stack of hovered items
|
||||||
func clear_stack():
|
func clear_stack():
|
||||||
hover_stack = []
|
hover_stack = []
|
||||||
@@ -144,18 +144,18 @@ func _on_right_click_on_bg(position: Vector2) -> void:
|
|||||||
# An inventory item was clicked with the LMB
|
# An inventory item was clicked with the LMB
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - inventory_item_global_id: The global id of the clicked inventory item
|
# - inventory_item_global_id: The global id of the clicked inventory item
|
||||||
# - event: The input event received
|
# - event: The input event received
|
||||||
func _on_mouse_left_click_inventory_item(
|
func _on_mouse_left_click_inventory_item(
|
||||||
inventory_item_global_id: String,
|
inventory_item_global_id: String,
|
||||||
event: InputEvent
|
event: InputEvent
|
||||||
) -> void:
|
) -> void:
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
"Inventory item left clicked %s " % inventory_item_global_id
|
"Inventory item left clicked %s " % inventory_item_global_id
|
||||||
)
|
)
|
||||||
escoria.main.current_scene.game.left_click_on_inventory_item(
|
escoria.main.current_scene.game.left_click_on_inventory_item(
|
||||||
inventory_item_global_id,
|
inventory_item_global_id,
|
||||||
event
|
event
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ func _on_mouse_left_click_inventory_item(
|
|||||||
# - inventory_item_global_id: The global id of the clicked inventory item
|
# - inventory_item_global_id: The global id of the clicked inventory item
|
||||||
# - event: The input event received
|
# - event: The input event received
|
||||||
func _on_mouse_right_click_inventory_item(
|
func _on_mouse_right_click_inventory_item(
|
||||||
inventory_item_global_id: String,
|
inventory_item_global_id: String,
|
||||||
event: InputEvent
|
event: InputEvent
|
||||||
) -> void:
|
) -> void:
|
||||||
if input_mode == INPUT_ALL:
|
if input_mode == INPUT_ALL:
|
||||||
@@ -175,7 +175,7 @@ func _on_mouse_right_click_inventory_item(
|
|||||||
"Inventory item right clicked %s" % inventory_item_global_id
|
"Inventory item right clicked %s" % inventory_item_global_id
|
||||||
)
|
)
|
||||||
escoria.main.current_scene.game.right_click_on_inventory_item(
|
escoria.main.current_scene.game.right_click_on_inventory_item(
|
||||||
inventory_item_global_id,
|
inventory_item_global_id,
|
||||||
event
|
event
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -183,11 +183,11 @@ func _on_mouse_right_click_inventory_item(
|
|||||||
# An inventory item was doublce-clicked with the LMB
|
# An inventory item was doublce-clicked with the LMB
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - inventory_item_global_id: The global id of the clicked inventory item
|
# - inventory_item_global_id: The global id of the clicked inventory item
|
||||||
# - event: The input event received
|
# - event: The input event received
|
||||||
func _on_mouse_double_left_click_inventory_item(
|
func _on_mouse_double_left_click_inventory_item(
|
||||||
inventory_item_global_id: String,
|
inventory_item_global_id: String,
|
||||||
event: InputEvent
|
event: InputEvent
|
||||||
) -> void:
|
) -> void:
|
||||||
if input_mode == INPUT_ALL:
|
if input_mode == INPUT_ALL:
|
||||||
@@ -195,7 +195,7 @@ func _on_mouse_double_left_click_inventory_item(
|
|||||||
"Inventory item double left clicked %s" % inventory_item_global_id
|
"Inventory item double left clicked %s" % inventory_item_global_id
|
||||||
)
|
)
|
||||||
escoria.main.current_scene.game.left_double_click_on_inventory_item(
|
escoria.main.current_scene.game.left_double_click_on_inventory_item(
|
||||||
inventory_item_global_id,
|
inventory_item_global_id,
|
||||||
event
|
event
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ func _on_mouse_double_left_click_inventory_item(
|
|||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
#
|
#
|
||||||
# - inventory_item_global_id: The global id of the inventory item
|
# - inventory_item_global_id: The global id of the inventory item
|
||||||
# that is hovered
|
# that is hovered
|
||||||
func _on_mouse_entered_inventory_item(inventory_item_global_id: String) -> void:
|
func _on_mouse_entered_inventory_item(inventory_item_global_id: String) -> void:
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
@@ -229,7 +229,7 @@ func _on_mouse_exited_inventory_item() -> void:
|
|||||||
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 not hover_stack.empty():
|
if not hover_stack.empty():
|
||||||
if item.z_index < hover_stack.back().z_index:
|
if item.z_index < hover_stack.back().z_index:
|
||||||
hover_stack.insert(hover_stack.size() - 1, item)
|
hover_stack.insert(hover_stack.size() - 1, item)
|
||||||
@@ -237,7 +237,7 @@ func _on_mouse_entered_item(item: ESCItem) -> void:
|
|||||||
hover_stack.push_back(item)
|
hover_stack.push_back(item)
|
||||||
else:
|
else:
|
||||||
hover_stack.push_back(item)
|
hover_stack.push_back(item)
|
||||||
|
|
||||||
hotspot_focused = hover_stack.back().global_id
|
hotspot_focused = hover_stack.back().global_id
|
||||||
escoria.main.current_scene.game.element_focused(item.global_id)
|
escoria.main.current_scene.game.element_focused(item.global_id)
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ func _on_mouse_exited_item(item: ESCItem) -> void:
|
|||||||
else:
|
else:
|
||||||
hotspot_focused = hover_stack.back().global_id
|
hotspot_focused = hover_stack.back().global_id
|
||||||
escoria.main.current_scene.game.element_focused(hotspot_focused)
|
escoria.main.current_scene.game.element_focused(hotspot_focused)
|
||||||
|
|
||||||
|
|
||||||
# An Escoria item was clicked with the LMB
|
# An Escoria item was clicked with the LMB
|
||||||
#
|
#
|
||||||
@@ -270,7 +270,7 @@ func _on_mouse_left_clicked_item(item: ESCItem, event: InputEvent) -> void:
|
|||||||
escoria.logger.info("Item left clicked", [item.global_id, event])
|
escoria.logger.info("Item left clicked", [item.global_id, event])
|
||||||
hotspot_focused = item.global_id
|
hotspot_focused = item.global_id
|
||||||
escoria.main.current_scene.game.left_click_on_item(
|
escoria.main.current_scene.game.left_click_on_item(
|
||||||
item.global_id,
|
item.global_id,
|
||||||
event
|
event
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ func _on_mouse_left_double_clicked_item(
|
|||||||
escoria.logger.info("Item left double clicked", [item.global_id, event])
|
escoria.logger.info("Item left double clicked", [item.global_id, event])
|
||||||
hotspot_focused = item.global_id
|
hotspot_focused = item.global_id
|
||||||
escoria.main.current_scene.game.left_double_click_on_item(
|
escoria.main.current_scene.game.left_double_click_on_item(
|
||||||
item.global_id,
|
item.global_id,
|
||||||
event
|
event
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ 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])
|
||||||
hotspot_focused = item.global_id
|
hotspot_focused = item.global_id
|
||||||
escoria.main.current_scene.game.right_click_on_item(
|
escoria.main.current_scene.game.right_click_on_item(
|
||||||
item.global_id,
|
item.global_id,
|
||||||
event
|
event
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ func _on_mouse_right_clicked_item(item: ESCItem, event: InputEvent) -> void:
|
|||||||
# The mousewheel was turned
|
# The mousewheel was turned
|
||||||
#
|
#
|
||||||
# #### 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)
|
||||||
|
|||||||
@@ -36,18 +36,18 @@ func _ready() -> void:
|
|||||||
func set_scene(p_scene: Node) -> void:
|
func set_scene(p_scene: Node) -> void:
|
||||||
if !p_scene:
|
if !p_scene:
|
||||||
escoria.logger.report_errors("main", ["Trying to set empty scene"])
|
escoria.logger.report_errors("main", ["Trying to set empty scene"])
|
||||||
|
|
||||||
if current_scene != null:
|
if current_scene != null:
|
||||||
clear_scene()
|
clear_scene()
|
||||||
|
|
||||||
if not p_scene.is_inside_tree():
|
if not p_scene.is_inside_tree():
|
||||||
add_child(p_scene)
|
add_child(p_scene)
|
||||||
move_child(p_scene, 0)
|
move_child(p_scene, 0)
|
||||||
current_scene = p_scene
|
current_scene = p_scene
|
||||||
check_game_scene_methods()
|
check_game_scene_methods()
|
||||||
|
|
||||||
set_camera_limits()
|
set_camera_limits()
|
||||||
|
|
||||||
emit_signal("room_ready")
|
emit_signal("room_ready")
|
||||||
|
|
||||||
|
|
||||||
@@ -58,12 +58,12 @@ func clear_scene() -> void:
|
|||||||
|
|
||||||
escoria.action_manager.clear_current_action()
|
escoria.action_manager.clear_current_action()
|
||||||
escoria.action_manager.clear_current_tool()
|
escoria.action_manager.clear_current_tool()
|
||||||
|
|
||||||
if escoria.game_scene.get_parent() == current_scene:
|
if escoria.game_scene.get_parent() == current_scene:
|
||||||
current_scene.remove_child(escoria.game_scene)
|
current_scene.remove_child(escoria.game_scene)
|
||||||
|
|
||||||
current_scene.get_parent().remove_child(current_scene)
|
current_scene.get_parent().remove_child(current_scene)
|
||||||
|
|
||||||
current_scene.queue_free()
|
current_scene.queue_free()
|
||||||
current_scene = null
|
current_scene = null
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ func set_camera_limits(camera_limit_id: int = 0) -> void:
|
|||||||
area = child.get_full_area_rect2()
|
area = child.get_full_area_rect2()
|
||||||
break
|
break
|
||||||
|
|
||||||
# if the background is smaller than the viewport, we want the camera
|
# if the background is smaller than the viewport, we want the camera
|
||||||
# to stick centered on the background
|
# to stick centered on the background
|
||||||
if area.size.x == 0 or area.size.y == 0 \
|
if area.size.x == 0 or area.size.y == 0 \
|
||||||
or area.size < get_viewport().size:
|
or area.size < get_viewport().size:
|
||||||
@@ -117,7 +117,7 @@ func set_camera_limits(camera_limit_id: int = 0) -> void:
|
|||||||
scene_camera_limits.size.y
|
scene_camera_limits.size.y
|
||||||
)
|
)
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
"Setting camera limits from parameter ",
|
"Setting camera limits from parameter ",
|
||||||
[scene_camera_limits]
|
[scene_camera_limits]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -142,27 +142,27 @@ func check_game_scene_methods():
|
|||||||
assert(current_scene.game.has_method("left_click_on_bg"))
|
assert(current_scene.game.has_method("left_click_on_bg"))
|
||||||
assert(current_scene.game.has_method("right_click_on_bg"))
|
assert(current_scene.game.has_method("right_click_on_bg"))
|
||||||
assert(current_scene.game.has_method("left_double_click_on_bg"))
|
assert(current_scene.game.has_method("left_double_click_on_bg"))
|
||||||
|
|
||||||
assert(current_scene.game.has_method("element_focused"))
|
assert(current_scene.game.has_method("element_focused"))
|
||||||
assert(current_scene.game.has_method("element_unfocused"))
|
assert(current_scene.game.has_method("element_unfocused"))
|
||||||
|
|
||||||
assert(current_scene.game.has_method("left_click_on_item"))
|
assert(current_scene.game.has_method("left_click_on_item"))
|
||||||
assert(current_scene.game.has_method("right_click_on_item"))
|
assert(current_scene.game.has_method("right_click_on_item"))
|
||||||
assert(current_scene.game.has_method("left_double_click_on_item"))
|
assert(current_scene.game.has_method("left_double_click_on_item"))
|
||||||
|
|
||||||
assert(current_scene.game.has_method("open_inventory"))
|
assert(current_scene.game.has_method("open_inventory"))
|
||||||
assert(current_scene.game.has_method("close_inventory"))
|
assert(current_scene.game.has_method("close_inventory"))
|
||||||
|
|
||||||
assert(current_scene.game.has_method("left_click_on_inventory_item"))
|
assert(current_scene.game.has_method("left_click_on_inventory_item"))
|
||||||
assert(current_scene.game.has_method("right_click_on_inventory_item"))
|
assert(current_scene.game.has_method("right_click_on_inventory_item"))
|
||||||
assert(current_scene.game.has_method("left_double_click_on_inventory_item"))
|
assert(current_scene.game.has_method("left_double_click_on_inventory_item"))
|
||||||
|
|
||||||
assert(current_scene.game.has_method("inventory_item_focused"))
|
assert(current_scene.game.has_method("inventory_item_focused"))
|
||||||
assert(current_scene.game.has_method("inventory_item_unfocused"))
|
assert(current_scene.game.has_method("inventory_item_unfocused"))
|
||||||
|
|
||||||
assert(current_scene.game.has_method("mousewheel_action"))
|
assert(current_scene.game.has_method("mousewheel_action"))
|
||||||
|
|
||||||
assert(current_scene.game.has_method("hide_ui"))
|
assert(current_scene.game.has_method("hide_ui"))
|
||||||
assert(current_scene.game.has_method("show_ui"))
|
assert(current_scene.game.has_method("show_ui"))
|
||||||
assert(current_scene.game.has_method("_on_event_done"))
|
assert(current_scene.game.has_method("_on_event_done"))
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Main_scene is the entry point for Godot Engine.
|
# Main_scene is the entry point for Godot Engine.
|
||||||
# This scene sets up the main menu scene to load.
|
# This scene sets up the main menu scene to load.
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
@@ -6,4 +6,4 @@ extends Node
|
|||||||
# Start the main menu
|
# Start the main menu
|
||||||
func _ready():
|
func _ready():
|
||||||
escoria.init()
|
escoria.init()
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ func register_setting(name: String, default, info: Dictionary) -> void:
|
|||||||
# *Returns* the value of the project setting located with key.
|
# *Returns* the value of the project setting located with key.
|
||||||
func get_setting(key: String):
|
func get_setting(key: String):
|
||||||
if not ProjectSettings.has_setting(key):
|
if not ProjectSettings.has_setting(key):
|
||||||
escoria.logger.report_errors("project_settings_manager.gd",
|
escoria.logger.report_errors("project_settings_manager.gd",
|
||||||
["Parameter %s is not set!" % key]
|
["Parameter %s is not set!" % key]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -56,10 +56,10 @@ func _resolve_target_and_zoom(p_target) -> void:
|
|||||||
_target = Vector2()
|
_target = Vector2()
|
||||||
_zoom_target = Vector2()
|
_zoom_target = Vector2()
|
||||||
_follow_target = null
|
_follow_target = null
|
||||||
|
|
||||||
if p_target is Node and "is_movable" in p_target and p_target.is_movable:
|
if p_target is Node and "is_movable" in p_target and p_target.is_movable:
|
||||||
_follow_target = p_target
|
_follow_target = p_target
|
||||||
|
|
||||||
if p_target is Vector2:
|
if p_target is Vector2:
|
||||||
_target = p_target
|
_target = p_target
|
||||||
elif p_target is Array and p_target.size() > 0:
|
elif p_target is Array and p_target.size() > 0:
|
||||||
@@ -90,9 +90,9 @@ func set_drag_margin_enabled(p_dm_h_enabled, p_dm_v_enabled):
|
|||||||
# - p_speed: Number of seconds for the camera to reach the target
|
# - p_speed: Number of seconds for the camera to reach the target
|
||||||
func set_target(p_target, p_speed : float = 0.0):
|
func set_target(p_target, p_speed : float = 0.0):
|
||||||
var speed = p_speed
|
var speed = p_speed
|
||||||
|
|
||||||
_resolve_target_and_zoom(p_target)
|
_resolve_target_and_zoom(p_target)
|
||||||
|
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
"Current camera position = %s " % str(self.global_position)
|
"Current camera position = %s " % str(self.global_position)
|
||||||
)
|
)
|
||||||
@@ -104,7 +104,7 @@ func set_target(p_target, p_speed : float = 0.0):
|
|||||||
|
|
||||||
if _tween.is_active():
|
if _tween.is_active():
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"esc_camera.gd:set_target()",
|
"esc_camera.gd:set_target()",
|
||||||
[
|
[
|
||||||
"Tween is still active: %f/%f" % [
|
"Tween is still active: %f/%f" % [
|
||||||
_tween.tell(),
|
_tween.tell(),
|
||||||
@@ -115,12 +115,12 @@ func set_target(p_target, p_speed : float = 0.0):
|
|||||||
_tween.emit_signal("tween_completed")
|
_tween.emit_signal("tween_completed")
|
||||||
|
|
||||||
_tween.interpolate_property(
|
_tween.interpolate_property(
|
||||||
self,
|
self,
|
||||||
"global_position",
|
"global_position",
|
||||||
self.global_position,
|
self.global_position,
|
||||||
_target,
|
_target,
|
||||||
time,
|
time,
|
||||||
Tween.TRANS_LINEAR,
|
Tween.TRANS_LINEAR,
|
||||||
Tween.EASE_IN_OUT
|
Tween.EASE_IN_OUT
|
||||||
)
|
)
|
||||||
_tween.start()
|
_tween.start()
|
||||||
@@ -134,7 +134,7 @@ func set_target(p_target, p_speed : float = 0.0):
|
|||||||
func set_camera_zoom(p_zoom_level: float, p_time: float):
|
func set_camera_zoom(p_zoom_level: float, p_time: float):
|
||||||
if p_zoom_level <= 0.0:
|
if p_zoom_level <= 0.0:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"esc_camera.gd:set_camera_zoom()",
|
"esc_camera.gd:set_camera_zoom()",
|
||||||
["Tried to set negative or zero zoom level"]
|
["Tried to set negative or zero zoom level"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ func set_camera_zoom(p_zoom_level: float, p_time: float):
|
|||||||
else:
|
else:
|
||||||
if _tween.is_active():
|
if _tween.is_active():
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"esc_camera.gd:set_camera_zoom()",
|
"esc_camera.gd:set_camera_zoom()",
|
||||||
[
|
[
|
||||||
"Tween is still active: %f/%f" % [
|
"Tween is still active: %f/%f" % [
|
||||||
_tween.tell(),
|
_tween.tell(),
|
||||||
@@ -156,12 +156,12 @@ func set_camera_zoom(p_zoom_level: float, p_time: float):
|
|||||||
_tween.emit_signal("tween_completed")
|
_tween.emit_signal("tween_completed")
|
||||||
|
|
||||||
_tween.interpolate_property(
|
_tween.interpolate_property(
|
||||||
self,
|
self,
|
||||||
"zoom",
|
"zoom",
|
||||||
self.zoom,
|
self.zoom,
|
||||||
_zoom_target,
|
_zoom_target,
|
||||||
p_time,
|
p_time,
|
||||||
Tween.TRANS_LINEAR,
|
Tween.TRANS_LINEAR,
|
||||||
Tween.EASE_IN_OUT
|
Tween.EASE_IN_OUT
|
||||||
)
|
)
|
||||||
_tween.start()
|
_tween.start()
|
||||||
@@ -169,18 +169,18 @@ func set_camera_zoom(p_zoom_level: float, p_time: float):
|
|||||||
|
|
||||||
# Push the camera towards the target in terms of position and zoom level
|
# Push the camera towards the target in terms of position and zoom level
|
||||||
# using a given transition type and time.
|
# using a given transition type and time.
|
||||||
# See
|
# See
|
||||||
# https://docs.godotengine.org/en/stable/classes/class_tween.html#enumerations
|
# https://docs.godotengine.org/en/stable/classes/class_tween.html#enumerations
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
# - p_target: Target to push to
|
# - p_target: Target to push to
|
||||||
# - p_time: Number of seconds for the transition to take
|
# - p_time: Number of seconds for the transition to take
|
||||||
# - p_type: Tween transition type
|
# - p_type: Tween transition type
|
||||||
func push(p_target, p_time: float = 0.0, p_type: int = 0):
|
func push(p_target, p_time: float = 0.0, p_type: int = 0):
|
||||||
_resolve_target_and_zoom(p_target)
|
_resolve_target_and_zoom(p_target)
|
||||||
|
|
||||||
var push_target = null
|
var push_target = null
|
||||||
|
|
||||||
if _follow_target != null:
|
if _follow_target != null:
|
||||||
push_target = p_target.position
|
push_target = p_target.position
|
||||||
else:
|
else:
|
||||||
@@ -193,7 +193,7 @@ func push(p_target, p_time: float = 0.0, p_type: int = 0):
|
|||||||
else:
|
else:
|
||||||
if _tween.is_active():
|
if _tween.is_active():
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"esc_camera.gd:push()",
|
"esc_camera.gd:push()",
|
||||||
[
|
[
|
||||||
"Tween is still active:" % [
|
"Tween is still active:" % [
|
||||||
_tween.tell(),
|
_tween.tell(),
|
||||||
@@ -205,32 +205,32 @@ func push(p_target, p_time: float = 0.0, p_type: int = 0):
|
|||||||
|
|
||||||
if _zoom_target != Vector2():
|
if _zoom_target != Vector2():
|
||||||
_tween.interpolate_property(
|
_tween.interpolate_property(
|
||||||
self,
|
self,
|
||||||
"zoom",
|
"zoom",
|
||||||
self.zoom,
|
self.zoom,
|
||||||
_zoom_target,
|
_zoom_target,
|
||||||
p_time,
|
p_time,
|
||||||
p_type,
|
p_type,
|
||||||
Tween.EASE_IN_OUT
|
Tween.EASE_IN_OUT
|
||||||
)
|
)
|
||||||
|
|
||||||
_tween.interpolate_property(
|
_tween.interpolate_property(
|
||||||
self,
|
self,
|
||||||
"global_position",
|
"global_position",
|
||||||
self.global_position,
|
self.global_position,
|
||||||
push_target,
|
push_target,
|
||||||
p_time,
|
p_time,
|
||||||
p_type,
|
p_type,
|
||||||
Tween.EASE_IN_OUT
|
Tween.EASE_IN_OUT
|
||||||
)
|
)
|
||||||
|
|
||||||
_tween.start()
|
_tween.start()
|
||||||
|
|
||||||
|
|
||||||
# Shift the camera by the given vector in a given time and using a specific
|
# Shift the camera by the given vector in a given time and using a specific
|
||||||
# Tween transition type.
|
# Tween transition type.
|
||||||
#
|
#
|
||||||
# See
|
# See
|
||||||
# https://docs.godotengine.org/en/stable/classes/class_tween.html#enumerations
|
# https://docs.godotengine.org/en/stable/classes/class_tween.html#enumerations
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
@@ -245,7 +245,7 @@ func shift(p_target: Vector2, p_time: float, p_type: int):
|
|||||||
|
|
||||||
if _tween.is_active():
|
if _tween.is_active():
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"esc_camera.gd:set_camera_zoom()",
|
"esc_camera.gd:set_camera_zoom()",
|
||||||
[
|
[
|
||||||
"Tween is still active: %f/%f" % [
|
"Tween is still active: %f/%f" % [
|
||||||
_tween.tell(),
|
_tween.tell(),
|
||||||
@@ -254,14 +254,14 @@ func shift(p_target: Vector2, p_time: float, p_type: int):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
_tween.emit_signal("tween_completed")
|
_tween.emit_signal("tween_completed")
|
||||||
|
|
||||||
_tween.interpolate_property(
|
_tween.interpolate_property(
|
||||||
self,
|
self,
|
||||||
"global_position",
|
"global_position",
|
||||||
self.global_position,
|
self.global_position,
|
||||||
new_pos,
|
new_pos,
|
||||||
p_time,
|
p_time,
|
||||||
p_type,
|
p_type,
|
||||||
Tween.EASE_IN_OUT
|
Tween.EASE_IN_OUT
|
||||||
)
|
)
|
||||||
_tween.start()
|
_tween.start()
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ var limit_bottom: int = 10000
|
|||||||
|
|
||||||
|
|
||||||
func _init(
|
func _init(
|
||||||
left: int,
|
left: int,
|
||||||
right: int,
|
right: int,
|
||||||
top: int,
|
top: int,
|
||||||
bottom: int
|
bottom: int
|
||||||
):
|
):
|
||||||
limit_left = left
|
limit_left = left
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class_name ESCDialogManager
|
|||||||
# Emitted when the say function has completed showing the text
|
# Emitted when the say function has completed showing the text
|
||||||
signal say_finished
|
signal say_finished
|
||||||
|
|
||||||
# Emitted when the player has chosen an option
|
# Emitted when the player has chosen an option
|
||||||
signal option_chosen(option)
|
signal option_chosen(option)
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ signal option_chosen(option)
|
|||||||
# *Returns* Wether the type is supported or not
|
# *Returns* Wether the type is supported or not
|
||||||
func has_type(type: String) -> bool:
|
func has_type(type: String) -> bool:
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
# Check wether a specific chooser type is supported by the
|
# Check wether a specific chooser type is supported by the
|
||||||
# dialog plugin
|
# dialog plugin
|
||||||
@@ -56,7 +56,7 @@ func choose(dialog_player: Node, dialog: ESCDialog):
|
|||||||
# Trigger running the dialog faster
|
# Trigger running the dialog faster
|
||||||
func speedup():
|
func speedup():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# The say command has been interrupted, cancel the dialog display
|
# The say command has been interrupted, cancel the dialog display
|
||||||
func interrupt():
|
func interrupt():
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const KEYTEXT_REGEX = "^((?<key>[^:]+):)?\"(?<text>.+)\""
|
|||||||
|
|
||||||
|
|
||||||
# Emitted when an answer as chosem
|
# Emitted when an answer as chosem
|
||||||
#
|
#
|
||||||
# ##### Parameters
|
# ##### Parameters
|
||||||
#
|
#
|
||||||
# - option: The dialog option that was chosen
|
# - option: The dialog option that was chosen
|
||||||
@@ -46,7 +46,7 @@ func _input(event):
|
|||||||
if event is InputEventMouseButton and event.pressed and is_speaking:
|
if event is InputEventMouseButton and event.pressed and is_speaking:
|
||||||
speedup()
|
speedup()
|
||||||
get_tree().set_input_as_handled()
|
get_tree().set_input_as_handled()
|
||||||
|
|
||||||
|
|
||||||
# Find the matching voice output file for the given key
|
# Find the matching voice output file for the given key
|
||||||
#
|
#
|
||||||
@@ -57,7 +57,7 @@ func _input(event):
|
|||||||
#
|
#
|
||||||
# *Returns* The path to the matching voice file
|
# *Returns* The path to the matching voice file
|
||||||
func _get_voice_file(key: String, start: String = "") -> String:
|
func _get_voice_file(key: String, start: String = "") -> String:
|
||||||
if start == "":
|
if start == "":
|
||||||
start = escoria.project_settings_manager.get_setting(
|
start = escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.SPEECH_FOLDER
|
escoria.project_settings_manager.SPEECH_FOLDER
|
||||||
)
|
)
|
||||||
@@ -68,14 +68,14 @@ func _get_voice_file(key: String, start: String = "") -> String:
|
|||||||
while file_name != "":
|
while file_name != "":
|
||||||
if _dir.current_is_dir():
|
if _dir.current_is_dir():
|
||||||
var _voice_file = _get_voice_file(
|
var _voice_file = _get_voice_file(
|
||||||
key,
|
key,
|
||||||
start.plus_file(file_name)
|
start.plus_file(file_name)
|
||||||
)
|
)
|
||||||
if _voice_file != "":
|
if _voice_file != "":
|
||||||
return _voice_file
|
return _voice_file
|
||||||
else:
|
else:
|
||||||
if file_name == "%s.%s.import" % [
|
if file_name == "%s.%s.import" % [
|
||||||
key,
|
key,
|
||||||
escoria.project_settings_manager.get_setting(
|
escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.SPEECH_EXTENSION
|
escoria.project_settings_manager.SPEECH_EXTENSION
|
||||||
)
|
)
|
||||||
@@ -93,11 +93,11 @@ func _get_voice_file(key: String, start: String = "") -> String:
|
|||||||
# - type: UI to use for the dialog
|
# - type: UI to use for the dialog
|
||||||
# - text: Text to say
|
# - text: Text to say
|
||||||
func say(character: String, type: String, text: String) -> void:
|
func say(character: String, type: String, text: String) -> void:
|
||||||
if type == "":
|
if type == "":
|
||||||
type = escoria.project_settings_manager.get_setting(
|
type = escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.DEFAULT_DIALOG_TYPE
|
escoria.project_settings_manager.DEFAULT_DIALOG_TYPE
|
||||||
)
|
)
|
||||||
is_speaking = true
|
is_speaking = true
|
||||||
for _manager_class in escoria.project_settings_manager.get_setting(
|
for _manager_class in escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.DIALOG_MANAGERS
|
escoria.project_settings_manager.DIALOG_MANAGERS
|
||||||
):
|
):
|
||||||
@@ -105,7 +105,7 @@ func say(character: String, type: String, text: String) -> void:
|
|||||||
var _manager: ESCDialogManager = load(_manager_class).new()
|
var _manager: ESCDialogManager = load(_manager_class).new()
|
||||||
if _manager.has_type(type):
|
if _manager.has_type(type):
|
||||||
_dialog_manager = _manager
|
_dialog_manager = _manager
|
||||||
|
|
||||||
if _dialog_manager == null:
|
if _dialog_manager == null:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"esc_dialog_player.gd:say",
|
"esc_dialog_player.gd:say",
|
||||||
@@ -113,9 +113,9 @@ func say(character: String, type: String, text: String) -> void:
|
|||||||
"No dialog manager supports the type %s" % type
|
"No dialog manager supports the type %s" % type
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
_dialog_manager.connect("say_finished", self, "_on_say_finished", [], CONNECT_ONESHOT)
|
_dialog_manager.connect("say_finished", self, "_on_say_finished", [], CONNECT_ONESHOT)
|
||||||
|
|
||||||
var matches = _keytext_regex.search(text)
|
var matches = _keytext_regex.search(text)
|
||||||
if not matches:
|
if not matches:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
@@ -137,7 +137,7 @@ func say(character: String, type: String, text: String) -> void:
|
|||||||
text = tr(matches.get_string("key"))
|
text = tr(matches.get_string("key"))
|
||||||
else:
|
else:
|
||||||
text = matches.get_string("text")
|
text = matches.get_string("text")
|
||||||
|
|
||||||
_dialog_manager.say(self, character, text, type)
|
_dialog_manager.say(self, character, text, type)
|
||||||
|
|
||||||
|
|
||||||
@@ -163,12 +163,12 @@ func speedup() -> void:
|
|||||||
func start_dialog_choices(dialog: ESCDialog, type: String = "simple"):
|
func start_dialog_choices(dialog: ESCDialog, type: String = "simple"):
|
||||||
if dialog.options.empty():
|
if dialog.options.empty():
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"esc_dialog_player.gd:start_dialog_choices()",
|
"esc_dialog_player.gd:start_dialog_choices()",
|
||||||
["Received answers array was empty."]
|
["Received answers array was empty."]
|
||||||
)
|
)
|
||||||
|
|
||||||
var _dialog_chooser_ui: ESCDialogManager = null
|
var _dialog_chooser_ui: ESCDialogManager = null
|
||||||
|
|
||||||
for _manager_class in escoria.project_settings_manager.get_setting(
|
for _manager_class in escoria.project_settings_manager.get_setting(
|
||||||
escoria.project_settings_manager.DIALOG_MANAGERS
|
escoria.project_settings_manager.DIALOG_MANAGERS
|
||||||
):
|
):
|
||||||
@@ -176,7 +176,7 @@ func start_dialog_choices(dialog: ESCDialog, type: String = "simple"):
|
|||||||
var _manager: ESCDialogManager = load(_manager_class).new()
|
var _manager: ESCDialogManager = load(_manager_class).new()
|
||||||
if _manager.has_chooser_type(type):
|
if _manager.has_chooser_type(type):
|
||||||
_dialog_chooser_ui = _manager
|
_dialog_chooser_ui = _manager
|
||||||
|
|
||||||
if _dialog_chooser_ui == null:
|
if _dialog_chooser_ui == null:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"esc_dialog_player.gd: Unknown chooser type",
|
"esc_dialog_player.gd: Unknown chooser type",
|
||||||
@@ -184,7 +184,7 @@ func start_dialog_choices(dialog: ESCDialog, type: String = "simple"):
|
|||||||
"No dialog manager supports the chooser type %s" % type
|
"No dialog manager supports the chooser type %s" % type
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
_dialog_chooser_ui.choose(self, dialog)
|
_dialog_chooser_ui.choose(self, dialog)
|
||||||
var option = yield(_dialog_chooser_ui, "option_chosen")
|
var option = yield(_dialog_chooser_ui, "option_chosen")
|
||||||
emit_signal("option_chosen", option)
|
emit_signal("option_chosen", option)
|
||||||
|
|||||||
@@ -24,18 +24,18 @@ func _ready() -> void:
|
|||||||
func _on_command_text_entered(p_command_str : String):
|
func _on_command_text_entered(p_command_str : String):
|
||||||
if p_command_str.empty():
|
if p_command_str.empty():
|
||||||
return
|
return
|
||||||
|
|
||||||
command.text = ""
|
command.text = ""
|
||||||
past_actions.text += "\n"
|
past_actions.text += "\n"
|
||||||
past_actions.text += "# " + p_command_str
|
past_actions.text += "# " + p_command_str
|
||||||
past_actions.text += "\n"
|
past_actions.text += "\n"
|
||||||
|
|
||||||
var errors = []
|
var errors = []
|
||||||
var script = escoria.esc_compiler.compile([
|
var script = escoria.esc_compiler.compile([
|
||||||
"%s%s" % [ESCEvent.PREFIX, _debug.get_command_name()],
|
"%s%s" % [ESCEvent.PREFIX, _debug.get_command_name()],
|
||||||
p_command_str
|
p_command_str
|
||||||
])
|
])
|
||||||
|
|
||||||
if script:
|
if script:
|
||||||
escoria.event_manager.queue_event(script.events[escoria.event_manager.EVENT_DEBUG])
|
escoria.event_manager.queue_event(script.events[escoria.event_manager.EVENT_DEBUG])
|
||||||
var ret = yield(escoria.event_manager, "event_finished")
|
var ret = yield(escoria.event_manager, "event_finished")
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ extends Control
|
|||||||
class_name ESCInventory
|
class_name ESCInventory
|
||||||
|
|
||||||
|
|
||||||
# Define the actual container node to add items as children of.
|
# Define the actual container node to add items as children of.
|
||||||
# Should be a Container.
|
# Should be a Container.
|
||||||
export(NodePath) var inventory_ui_container
|
export(NodePath) var inventory_ui_container
|
||||||
|
|
||||||
@@ -18,19 +18,19 @@ var items_ids_in_inventory: Dictionary = {}
|
|||||||
func _ready():
|
func _ready():
|
||||||
if inventory_ui_container == null or inventory_ui_container.is_empty():
|
if inventory_ui_container == null or inventory_ui_container.is_empty():
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
self.get_path(),
|
self.get_path(),
|
||||||
["Items container is empty."]
|
["Items container is empty."]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
for item_id in escoria.inventory_manager.items_in_inventory():
|
for item_id in escoria.inventory_manager.items_in_inventory():
|
||||||
call_deferred("add_new_item_by_id", item_id)
|
call_deferred("add_new_item_by_id", item_id)
|
||||||
|
|
||||||
escoria.inventory = self
|
escoria.inventory = self
|
||||||
|
|
||||||
escoria.globals_manager.connect(
|
escoria.globals_manager.connect(
|
||||||
"global_changed", #
|
"global_changed", #
|
||||||
self,
|
self,
|
||||||
"_on_escoria_global_changed"
|
"_on_escoria_global_changed"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -63,25 +63,25 @@ func add_new_item_by_id(item_id: String) -> void:
|
|||||||
"Item global id '%s' does not exist." % item_id
|
"Item global id '%s' does not exist." % item_id
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
var inventory_item = ESCInventoryItem.new(
|
var inventory_item = ESCInventoryItem.new(
|
||||||
escoria.object_manager.get_object(item_id).node
|
escoria.object_manager.get_object(item_id).node
|
||||||
)
|
)
|
||||||
var inventory_item_button = get_node(
|
var inventory_item_button = get_node(
|
||||||
inventory_ui_container
|
inventory_ui_container
|
||||||
).add_item(inventory_item)
|
).add_item(inventory_item)
|
||||||
|
|
||||||
items_ids_in_inventory[item_id] = inventory_item
|
items_ids_in_inventory[item_id] = inventory_item
|
||||||
|
|
||||||
if not escoria.object_manager.has(item_id):
|
if not escoria.object_manager.has(item_id):
|
||||||
escoria.object_manager.register_object(
|
escoria.object_manager.register_object(
|
||||||
ESCObject.new(
|
ESCObject.new(
|
||||||
item_id,
|
item_id,
|
||||||
inventory_item_button
|
inventory_item_button
|
||||||
),
|
),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
escoria.inputs_manager.register_inventory_item(inventory_item_button)
|
escoria.inputs_manager.register_inventory_item(inventory_item_button)
|
||||||
|
|
||||||
|
|
||||||
@@ -89,58 +89,58 @@ func add_new_item_by_id(item_id: String) -> void:
|
|||||||
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]
|
||||||
|
|
||||||
if item_inventory_button.is_connected(
|
if item_inventory_button.is_connected(
|
||||||
"mouse_left_inventory_item",
|
"mouse_left_inventory_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_left_click_inventory_item"
|
"_on_mouse_left_click_inventory_item"
|
||||||
):
|
):
|
||||||
item_inventory_button.disconnect(
|
item_inventory_button.disconnect(
|
||||||
"mouse_left_inventory_item",
|
"mouse_left_inventory_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_left_click_inventory_item"
|
"_on_mouse_left_click_inventory_item"
|
||||||
)
|
)
|
||||||
if item_inventory_button.is_connected(
|
if item_inventory_button.is_connected(
|
||||||
"mouse_double_left_inventory_item",
|
"mouse_double_left_inventory_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_double_left_click_inventory_item"
|
"_on_mouse_double_left_click_inventory_item"
|
||||||
):
|
):
|
||||||
item_inventory_button.disconnect(
|
item_inventory_button.disconnect(
|
||||||
"mouse_double_left_inventory_item",
|
"mouse_double_left_inventory_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_double_left_click_inventory_item"
|
"_on_mouse_double_left_click_inventory_item"
|
||||||
)
|
)
|
||||||
if item_inventory_button.is_connected(
|
if item_inventory_button.is_connected(
|
||||||
"mouse_right_inventory_item",
|
"mouse_right_inventory_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_right_click_inventory_item"
|
"_on_mouse_right_click_inventory_item"
|
||||||
):
|
):
|
||||||
item_inventory_button.disconnect(
|
item_inventory_button.disconnect(
|
||||||
"mouse_right_inventory_item",
|
"mouse_right_inventory_item",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_right_click_inventory_item"
|
"_on_mouse_right_click_inventory_item"
|
||||||
)
|
)
|
||||||
if item_inventory_button.is_connected(
|
if item_inventory_button.is_connected(
|
||||||
"inventory_item_focused",
|
"inventory_item_focused",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_entered_inventory_item"
|
"_on_mouse_entered_inventory_item"
|
||||||
):
|
):
|
||||||
item_inventory_button.disconnect(
|
item_inventory_button.disconnect(
|
||||||
"inventory_item_focused",
|
"inventory_item_focused",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_entered_inventory_item"
|
"_on_mouse_entered_inventory_item"
|
||||||
)
|
)
|
||||||
if item_inventory_button.is_connected(
|
if item_inventory_button.is_connected(
|
||||||
"inventory_item_unfocused",
|
"inventory_item_unfocused",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_exited_inventory_item"
|
"_on_mouse_exited_inventory_item"
|
||||||
):
|
):
|
||||||
item_inventory_button.disconnect(
|
item_inventory_button.disconnect(
|
||||||
"inventory_item_unfocused",
|
"inventory_item_unfocused",
|
||||||
escoria.inputs_manager,
|
escoria.inputs_manager,
|
||||||
"_on_mouse_exited_inventory_item"
|
"_on_mouse_exited_inventory_item"
|
||||||
)
|
)
|
||||||
|
|
||||||
get_node(inventory_ui_container).remove_item(item_inventory_button)
|
get_node(inventory_ui_container).remove_item(item_inventory_button)
|
||||||
items_ids_in_inventory.erase(item_id)
|
items_ids_in_inventory.erase(item_id)
|
||||||
|
|
||||||
@@ -148,7 +148,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)
|
||||||
if item.size() == 1:
|
if item.size() == 1:
|
||||||
if new_value:
|
if new_value:
|
||||||
@@ -157,9 +157,9 @@ func _on_escoria_global_changed(global: String, old_value, new_value) -> void:
|
|||||||
remove_item_by_id(item[0])
|
remove_item_by_id(item[0])
|
||||||
else:
|
else:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.report_errors(
|
||||||
"inventory_ui.gd:_on_escoria_global_changed()",
|
"inventory_ui.gd:_on_escoria_global_changed()",
|
||||||
[
|
[
|
||||||
"Global must contain only one item name.",
|
"Global must contain only one item name.",
|
||||||
"(received: %s)" % global
|
"(received: %s)" % global
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user