Fix transitions not happening if the ESCRoom has no ESC script (#485)

Fixes godot-escoria/escoria-issues#95
This commit is contained in:
Julian Murgia
2022-01-17 09:48:25 +01:00
committed by GitHub
parent c281fa2755
commit 3e6db46ec6
7 changed files with 209 additions and 15 deletions

View File

@@ -251,7 +251,7 @@ func init_room(room: ESCRoom) -> void:
#
# - room: The ESCRoom to be initialized for use.
func _perform_script_events(room: ESCRoom):
if room.esc_script and escoria.event_manager.is_channel_free("_front") \
if escoria.event_manager.is_channel_free("_front") \
or (
not escoria.event_manager.is_channel_free("_front") and \
not escoria.event_manager.get_running_event(
@@ -290,7 +290,8 @@ func _perform_script_events(room: ESCRoom):
escoria.game_scene.unpause_game()
# Run the setup event
_run_script_event("setup", room)
if room.esc_script:
_run_script_event("setup", room)
if room.enabled_automatic_transitions \
or (
@@ -309,17 +310,18 @@ func _perform_script_events(room: ESCRoom):
script_transition_in.events['transition_in']
)
var ready_event_added: bool = false
# Run the ready event, if there is one.
ready_event_added = _run_script_event("ready", room)
if room.esc_script:
var ready_event_added: bool = false
# Run the ready event, if there is one.
ready_event_added = _run_script_event("ready", room)
if ready_event_added:
# Wait for ready event to be done
var rc = yield(escoria.event_manager, "event_finished")
while rc[1] != "ready":
rc = yield(escoria.event_manager, "event_finished")
if rc[0] != ESCExecution.RC_OK:
return rc[0]
if ready_event_added:
# Wait for ready event to be done
var rc = yield(escoria.event_manager, "event_finished")
while rc[1] != "ready":
rc = yield(escoria.event_manager, "event_finished")
if rc[0] != ESCExecution.RC_OK:
return rc[0]
# Now that :ready is finished, if FORCE_LAST_SCENE_NULL was true, reset it
# to false

View File

@@ -0,0 +1,3 @@
:exit_scene
play_snd res://game/sfx/sounds/doorOpen_2.ogg
change_scene "res://game/rooms/room17/room17.tscn"

View File

@@ -6,3 +6,11 @@
set_angle player 90
stop
> [eq ESC_LAST_SCENE room17]
teleport player r16_r_exit
# Set player look down
set_angle player 180
stop

View File

@@ -68,8 +68,8 @@ script = ExtResource( 5 )
global_id = "r12_l_exit"
[node name="r_door" parent="Hotspots" instance=ExtResource( 8 )]
global_id = ""
esc_script = ""
global_id = "r16_r_exit"
esc_script = "res://game/rooms/room16/esc/right_exit.esc"
[node name="ESCLocation" type="Position2D" parent="Hotspots/r_door"]
position = Vector2( 1231.78, 360.624 )

View File

@@ -0,0 +1,3 @@
:exit_scene
play_snd res://game/sfx/sounds/doorOpen_2.ogg
change_scene "res://game/rooms/room16/room16.tscn"

View File

@@ -0,0 +1,81 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_terrain.gd" type="Script" id=1]
[ext_resource path="res://game/rooms/room14/background.tscn" type="PackedScene" id=2]
[ext_resource path="res://game/fonts/caslonantique.tres" type="DynamicFont" id=3]
[ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_location.gd" type="Script" id=5]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=6]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=7]
[ext_resource path="res://game/rooms/room14/r_door.tscn" type="PackedScene" id=8]
[sub_resource type="NavigationPolygon" id=1]
vertices = PoolVector2Array( 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.872, 1275.03, 799.721, 864.626, 613.518, 1143.08, 613.35, -9.16094, 803.802, 386.666, 618.012, 129.634, 615.792, 84.5821, 654.06, -6.44019, 711.297, 3.15687, 646.051, 59.2201, 628.698 )
polygons = [ PoolIntArray( 0, 1, 2, 3 ), PoolIntArray( 4, 5, 0, 3, 6, 7 ), PoolIntArray( 8, 7, 6, 9 ), PoolIntArray( 9, 6, 10, 11, 12 ) ]
outlines = [ PoolVector2Array( -6.44019, 711.297, 3.15687, 646.051, 59.2201, 628.698, 84.5821, 654.06, 129.634, 615.792, 386.666, 618.012, 864.626, 613.518, 1143.08, 613.35, 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.872, 1275.03, 799.721, -9.16094, 803.802 ) ]
[node name="room17" type="Node2D"]
script = ExtResource( 6 )
__meta__ = {
"_edit_vertical_guides_": [ ]
}
global_id = "room17"
player_scene = ExtResource( 4 )
camera_limits = [ Rect2( 0, 0, 1289, 555 ) ]
[node name="background" parent="." instance=ExtResource( 2 )]
[node name="room_label" type="Label" parent="background"]
margin_right = 92.0
margin_bottom = 21.0
custom_fonts/font = ExtResource( 3 )
text = "ROOM 17"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="walkable_area" type="Navigation2D" parent="."]
script = ExtResource( 1 )
[node name="platform" type="NavigationPolygonInstance" parent="walkable_area"]
position = Vector2( 6.73163, -264.779 )
navpoly = SubResource( 1 )
__meta__ = {
"_editor_description_": ""
}
[node name="Hotspots" type="Node" parent="."]
[node name="l_door" type="Area2D" parent="Hotspots"]
pause_mode = 1
script = ExtResource( 7 )
global_id = "r16_l_exit"
esc_script = "res://game/rooms/room17/esc/left_exit.esc"
is_exit = true
tooltip_name = "Left exit"
default_action = "walk"
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/l_door"]
polygon = PoolVector2Array( 0.328762, 440.897, 1.85199, 119.926, 85.9517, 74.6212, 87.1409, 377.869 )
[node name="Position2D" type="Position2D" parent="Hotspots/l_door"]
position = Vector2( 37.4521, 392.045 )
script = ExtResource( 5 )
global_id = "r12_l_exit"
[node name="r_door" parent="Hotspots" instance=ExtResource( 8 )]
global_id = ""
esc_script = ""
[node name="ESCLocation" type="Position2D" parent="Hotspots/r_door"]
position = Vector2( 1231.78, 360.624 )
script = ExtResource( 5 )
[node name="start" type="Position2D" parent="Hotspots"]
position = Vector2( 243.677, 455.569 )
script = ExtResource( 5 )
global_id = "start"
is_start_location = true
interaction_direction = 180

97
saves/save_003.tres Normal file
View File

@@ -0,0 +1,97 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/save_data/esc_savegame.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
escoria_version = "0.1.0"
game_version = "0.1.0"
name = "custom data"
date = "13/01/2022 08:09"
main = {
"current_scene_filename": "res://game/rooms/room01/room01.tscn",
"last_scene_global_id": ""
}
globals = {
"ANIMATION_RESOURCES": {
},
"ESC_CURRENT_SCENE": "room1",
"ESC_LAST_SCENE": "",
"FORCE_LAST_SCENE_NULL": false,
"dialog_advance": 0,
"dialog_popup_advance": 0,
"room1_visited": true
}
objects = {
"_camera": {
"active": true,
"interactive": true,
"state": "default"
},
"_music": {
"active": true,
"interactive": true,
"state": "res://game/sfx/contemplation.ogg"
},
"_sound": {
"active": true,
"interactive": true,
"state": "default"
},
"_speech": {
"active": true,
"interactive": true,
"state": "default"
},
"player": {
"active": true,
"global_transform": Transform2D( 1, 0, 0, 1, 490, 488 ),
"interactive": true,
"last_deg": 111,
"last_dir": 3,
"state": "default"
},
"r1_destination_point": {
"active": true,
"interactive": true,
"state": "default"
},
"r1_destination_point2": {
"active": true,
"interactive": true,
"state": "default"
},
"r1_destination_point3": {
"active": true,
"interactive": true,
"state": "default"
},
"r1_r_exit": {
"active": true,
"interactive": true,
"state": "default"
},
"r1_start": {
"active": true,
"interactive": true,
"state": "default"
},
"r1_wall_item1": {
"active": true,
"interactive": true,
"state": "default"
},
"r1_wall_item2": {
"active": true,
"interactive": true,
"state": "default"
},
"trigger_talk": {
"active": true,
"interactive": true,
"state": "default"
}
}
custom_data = {
"ui_type": "9verbs"
}