Switch most relative node paths to scene-unique

This commit is contained in:
Luke Hubmayer-Werner 2024-03-23 19:41:34 +10:30
parent e2cb6e2bbc
commit a0bda98a23
11 changed files with 83 additions and 78 deletions

View File

@ -1,6 +1,5 @@
extends Control extends Control
export var mainMenuPath := @'MainMenu' onready var mainMenu := $'%mainMenu'
onready var mainMenu := get_node(mainMenuPath)
const touchGamePath := 'res://scenes/RadialGame.tscn' const touchGamePath := 'res://scenes/RadialGame.tscn'
const stepGamePath := 'res://scenes/StepGame.tscn' const stepGamePath := 'res://scenes/StepGame.tscn'

View File

@ -15,7 +15,8 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="MainMenu" parent="." instance=ExtResource( 1 )] [node name="mainMenu" parent="." instance=ExtResource( 1 )]
unique_name_in_owner = true
[node name="OptionPanel" parent="." instance=ExtResource( 13 )] [node name="OptionPanel" parent="." instance=ExtResource( 13 )]
anchor_left = 1.0 anchor_left = 1.0
@ -35,5 +36,5 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[connection signal="start_stepgame" from="MainMenu" to="." method="_on_MainMenu_start_stepgame"] [connection signal="start_stepgame" from="mainMenu" to="." method="_on_MainMenu_start_stepgame"]
[connection signal="start_touchgame" from="MainMenu" to="." method="_on_MainMenu_start_touchgame"] [connection signal="start_touchgame" from="mainMenu" to="." method="_on_MainMenu_start_touchgame"]

View File

@ -84,11 +84,12 @@ _data = [ Vector2( -1, -1 ), 0.0, 0.0, 0, 0, Vector2( 0, 0 ), 2.0, 2.0, 1, 1, Ve
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
[node name="Square" type="Control" parent="."] [node name="square" type="Control" parent="."]
unique_name_in_owner = true
margin_right = 1080.0 margin_right = 1080.0
margin_bottom = 1080.0 margin_bottom = 1080.0
[node name="video" type="TextureRect" parent="Square" groups=["VideoTexRects"]] [node name="video" type="TextureRect" parent="square" groups=["VideoTexRects"]]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
@ -101,7 +102,7 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="ScreenFilter" type="ColorRect" parent="Square"] [node name="ScreenFilter" type="ColorRect" parent="square"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
color = Color( 0, 0, 0, 1 ) color = Color( 0, 0, 0, 1 )
@ -110,7 +111,8 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Receptors" type="Control" parent="Square"] [node name="receptors" type="Control" parent="square"]
unique_name_in_owner = true
material = SubResource( 1 ) material = SubResource( 1 )
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -119,35 +121,38 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="NoteHandler" type="Control" parent="Square"] [node name="noteHandler" type="Control" parent="square"]
unique_name_in_owner = true
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 6 ) script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Viewport" type="Viewport" parent="Square/NoteHandler"] [node name="viewport" type="Viewport" parent="square/noteHandler"]
unique_name_in_owner = true
size = Vector2( 1080, 1080 ) size = Vector2( 1080, 1080 )
transparent_bg = true transparent_bg = true
render_target_v_flip = true render_target_v_flip = true
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Center" type="Node2D" parent="Square/NoteHandler/Viewport"] [node name="Center" type="Node2D" parent="square/noteHandler/viewport"]
position = Vector2( 540, 540 ) position = Vector2( 540, 540 )
[node name="SlideTrailHandler" type="Node2D" parent="Square/NoteHandler/Viewport/Center"] [node name="slideTrailHandler" type="Node2D" parent="square/noteHandler/viewport/Center"]
unique_name_in_owner = true
[node name="JudgeText" type="MeshInstance2D" parent="Square/NoteHandler/Viewport/Center"] [node name="judgeText" type="MeshInstance2D" parent="square/noteHandler/viewport/Center"]
unique_name_in_owner = true
texture = ExtResource( 2 ) texture = ExtResource( 2 )
[node name="meshinstance" type="MeshInstance2D" parent="Square/NoteHandler/Viewport/Center"] [node name="meshinstance" type="MeshInstance2D" parent="square/noteHandler/viewport/Center"]
unique_name_in_owner = true
material = SubResource( 2 ) material = SubResource( 2 )
[node name="notelines" type="MeshInstance2D" parent="Square/NoteHandler/Viewport/Center"] [node name="notelines" type="MeshInstance2D" parent="square/noteHandler/viewport/Center"]
unique_name_in_owner = true
material = SubResource( 3 ) material = SubResource( 3 )
[node name="lbl_combo" type="Label" parent="Square/NoteHandler"] [node name="lbl_combo" type="Label" parent="square/noteHandler"]
visible = false visible = false
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@ -168,21 +173,17 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Painter" type="Control" parent="Square"] [node name="painter" type="Control" parent="square"]
unique_name_in_owner = true
material = SubResource( 6 ) material = SubResource( 6 )
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 3 ) script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Menu" parent="Square" instance=ExtResource( 10 )] [node name="Menu" parent="square" instance=ExtResource( 10 )]
noteHandlerPath = NodePath("../NoteHandler")
receptorsPath = NodePath("../Receptors")
ease_curve = SubResource( 7 ) ease_curve = SubResource( 7 )
[node name="Bezel" type="Control" parent="Square"] [node name="Bezel" type="Control" parent="square"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 5 ) script = ExtResource( 5 )
@ -190,7 +191,7 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="InputHandler" type="Control" parent="Square"] [node name="InputHandler" type="Control" parent="square"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 4 ) script = ExtResource( 4 )
@ -198,7 +199,7 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[connection signal="combo_changed" from="Square/NoteHandler" to="Square/NoteHandler/lbl_combo" method="_on_NoteHandler_combo_changed"] [connection signal="combo_changed" from="square/noteHandler" to="square/noteHandler/lbl_combo" method="_on_NoteHandler_combo_changed"]
[connection signal="finished_song" from="Square/NoteHandler" to="Square/NoteHandler/lbl_combo" method="_on_NoteHandler_finished_song"] [connection signal="finished_song" from="square/noteHandler" to="square/noteHandler/lbl_combo" method="_on_NoteHandler_finished_song"]
[connection signal="column_pressed" from="Square/InputHandler" to="Square/NoteHandler" method="_on_InputHandler_column_pressed"] [connection signal="column_pressed" from="square/InputHandler" to="square/noteHandler" method="_on_InputHandler_column_pressed"]
[connection signal="column_released" from="Square/InputHandler" to="Square/NoteHandler" method="_on_InputHandler_column_released"] [connection signal="column_released" from="square/InputHandler" to="square/noteHandler" method="_on_InputHandler_column_released"]

View File

@ -85,49 +85,49 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Receptors" type="Control" parent="."] [node name="receptors" type="Control" parent="."]
unique_name_in_owner = true
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="TextureRect" type="TextureRect" parent="Receptors"] [node name="TextureRect" type="TextureRect" parent="receptors"]
margin_right = 1080.0 margin_right = 1080.0
margin_bottom = 1080.0 margin_bottom = 1080.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="NoteHandler" type="Control" parent="."] [node name="noteHandler" type="Control" parent="."]
unique_name_in_owner = true
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 6 ) script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Viewport" type="Viewport" parent="NoteHandler"] [node name="viewport" type="Viewport" parent="noteHandler"]
unique_name_in_owner = true
size = Vector2( 1080, 1080 ) size = Vector2( 1080, 1080 )
transparent_bg = true transparent_bg = true
render_target_v_flip = true render_target_v_flip = true
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Center" type="Node2D" parent="NoteHandler/Viewport"] [node name="Center" type="Node2D" parent="noteHandler/viewport"]
position = Vector2( 540, 540 ) position = Vector2( 540, 540 )
[node name="SlideTrailHandler" type="Node2D" parent="NoteHandler/Viewport/Center"] [node name="SlideTrailHandler" type="Node2D" parent="noteHandler/viewport/Center"]
[node name="JudgeText" type="MeshInstance2D" parent="NoteHandler/Viewport/Center"] [node name="JudgeText" type="MeshInstance2D" parent="noteHandler/viewport/Center"]
texture = ExtResource( 2 ) texture = ExtResource( 2 )
[node name="meshinstance" type="MeshInstance2D" parent="NoteHandler/Viewport/Center"] [node name="meshinstance" type="MeshInstance2D" parent="noteHandler/viewport/Center"]
material = SubResource( 2 ) material = SubResource( 2 )
[node name="notelines" type="MeshInstance2D" parent="NoteHandler/Viewport/Center"] [node name="notelines" type="MeshInstance2D" parent="noteHandler/viewport/Center"]
material = SubResource( 3 ) material = SubResource( 3 )
[node name="lbl_combo" type="Label" parent="NoteHandler"] [node name="lbl_combo" type="Label" parent="noteHandler"]
visible = false visible = false
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@ -148,15 +148,12 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Painter" type="Control" parent="NoteHandler"] [node name="painter" type="Control" parent="noteHandler"]
unique_name_in_owner = true
material = SubResource( 6 ) material = SubResource( 6 )
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 3 ) script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
viewportPath = NodePath("../Viewport")
[node name="StepMenu" parent="." instance=ExtResource( 5 )] [node name="StepMenu" parent="." instance=ExtResource( 5 )]
@ -168,7 +165,7 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[connection signal="combo_changed" from="NoteHandler" to="NoteHandler/lbl_combo" method="_on_NoteHandler_combo_changed"] [connection signal="combo_changed" from="noteHandler" to="noteHandler/lbl_combo" method="_on_NoteHandler_combo_changed"]
[connection signal="finished_song" from="NoteHandler" to="NoteHandler/lbl_combo" method="_on_NoteHandler_finished_song"] [connection signal="finished_song" from="noteHandler" to="noteHandler/lbl_combo" method="_on_NoteHandler_finished_song"]
[connection signal="column_pressed" from="InputHandler" to="NoteHandler" method="_on_InputHandler_column_pressed"] [connection signal="column_pressed" from="InputHandler" to="noteHandler" method="_on_InputHandler_column_pressed"]
[connection signal="column_released" from="InputHandler" to="NoteHandler" method="_on_InputHandler_column_released"] [connection signal="column_released" from="InputHandler" to="noteHandler" method="_on_InputHandler_column_released"]

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://scripts/ScoreText.gd" type="Script" id=1] [ext_resource path="res://scripts/ScoreText.gd" type="Script" id=1]
[ext_resource path="res://scripts/StepMenu.gd" type="Script" id=2] [ext_resource path="res://scripts/StepMenu.gd" type="Script" id=2]
[ext_resource path="res://shaders/menu.tres" type="Material" id=3] [ext_resource path="res://shaders/menu.tres" type="Material" id=3]
[ext_resource path="res://shaders/scoretext.tres" type="Material" id=4] [ext_resource path="res://shaders/scoretext.tres" type="Material" id=4]
[ext_resource path="res://scenes/JoypadMonitor6Btn.tscn" type="PackedScene" id=5]
[sub_resource type="Curve" id=1] [sub_resource type="Curve" id=1]
min_value = -1.0 min_value = -1.0
@ -15,9 +16,6 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
rect_clip_content = true rect_clip_content = true
script = ExtResource( 2 ) script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
ease_curve = SubResource( 1 ) ease_curve = SubResource( 1 )
[node name="ScoreText" type="Node2D" parent="."] [node name="ScoreText" type="Node2D" parent="."]
@ -26,3 +24,15 @@ script = ExtResource( 1 )
[node name="PVMusic" type="AudioStreamPlayer" parent="."] [node name="PVMusic" type="AudioStreamPlayer" parent="."]
bus = "Preview" bus = "Preview"
[node name="JoypadMonitor" parent="." instance=ExtResource( 5 )]
[node name="JoypadMonitor2" parent="." instance=ExtResource( 5 )]
margin_left = 200.0
joypad_index = 1
[node name="JoypadMonitor3" parent="." instance=ExtResource( 5 )]
margin_left = 400.0
margin_right = 200.0
margin_bottom = 238.0
joypad_index = 1

View File

@ -12,11 +12,11 @@ var song_key = ''
onready var musicPlayer := SoundPlayer.music_player onready var musicPlayer := SoundPlayer.music_player
onready var videoPlayer := Video.video onready var videoPlayer := Video.video
onready var painter = $'../Painter' onready var painter = $'%painter'
onready var slideTrailHandler = $'Viewport/Center/SlideTrailHandler' onready var slideTrailHandler = $'%slideTrailHandler'
onready var judgeText = $'Viewport/Center/JudgeText' onready var judgeText = $'%judgeText'
onready var notelines = $'Viewport/Center/notelines' onready var notelines = $'%notelines'
onready var meshinstance = $'Viewport/Center/meshinstance' onready var meshinstance = $'%meshinstance'
onready var lbl_combo = $lbl_combo onready var lbl_combo = $lbl_combo
var time_zero_msec: int = 0 var time_zero_msec: int = 0

View File

@ -1,7 +1,6 @@
extends Control extends Control
export var viewportPath := @'../NoteHandler/Viewport' onready var viewport := $'%viewport'
onready var viewport := get_node(viewportPath)
func _draw(): func _draw():
draw_texture_rect(viewport.get_texture(), Rect2(Vector2.ZERO, rect_size), false) draw_texture_rect(viewport.get_texture(), Rect2(Vector2.ZERO, rect_size), false)

View File

@ -1,7 +1,6 @@
extends Viewport extends Viewport
export var squarePath := @'../../' onready var square := $'%square'
onready var square := get_node(squarePath)
onready var root := $'/root' onready var root := $'/root'
onready var base_height = 1080.0 onready var base_height = 1080.0

View File

@ -1,10 +1,8 @@
#tool #tool
extends Control extends Control
export var noteHandlerPath := @'../NoteHandler' onready var noteHandler := $'%noteHandler'
export var receptorsPath := @'../Receptors' onready var receptors := $'%receptors'
onready var noteHandler := get_node(noteHandlerPath)
onready var receptors := get_node(receptorsPath)
onready var scoreText := $ScoreText onready var scoreText := $ScoreText
onready var PVMusic := SoundPlayer.music_player_pv onready var PVMusic := SoundPlayer.music_player_pv

View File

@ -1,10 +1,8 @@
#tool #tool
extends Control extends Control
export var noteHandlerPath := @'../Center/NoteHandler' onready var noteHandler := $'%noteHandler'
export var receptorsPath := @'../Center/Receptors' onready var receptors := $'%receptors'
onready var noteHandler := get_node(noteHandlerPath)
onready var receptors := get_node(receptorsPath)
onready var scoreText := $ScoreText onready var scoreText := $ScoreText
onready var PVMusic := SoundPlayer.music_player_pv onready var PVMusic := SoundPlayer.music_player_pv
@ -49,7 +47,10 @@ func get_song_idx() -> int:
return int(round(self.target_song_idx + target_song_delta)) return int(round(self.target_song_idx + target_song_delta))
func get_song_key() -> String: func get_song_key() -> String:
var songslist = genres[genres.keys()[selected_genre]] var keys = genres.keys()
if len(keys) <= selected_difficulty:
return 'N/A'
var songslist = genres[keys[selected_genre]]
return songslist[int(round(self.target_song_idx)) % len(songslist)] return songslist[int(round(self.target_song_idx)) % len(songslist)]
var scorescreen_song_key := '' var scorescreen_song_key := ''

View File

@ -11,7 +11,7 @@ const NOT_FOUND := ''
const default_difficulty_keys = ['Z', 'B', 'A', 'E', 'M', 'R'] const default_difficulty_keys = ['Z', 'B', 'A', 'E', 'M', 'R']
var userroot := OS.get_user_data_dir().rstrip('/')+'/' if OS.get_name() != 'Android' else '/storage/emulated/0/RhythmGame/' var userroot := OS.get_user_data_dir().rstrip('/')+'/' if OS.get_name() != 'Android' else '/storage/emulated/0/RhythmGame/'
var PATHS := PoolStringArray([userroot, '/media/fridge-q/Games/RTG/slow_userdir/']) # Temporary hardcoded testing var PATHS := PoolStringArray([userroot, '/home/luke/RTG/']) # Temporary hardcoded testing
# The following would probably work. One huge caveat is that permission needs to be manually granted by the user in app settings as we can't use OS.request_permission('WRITE_EXTERNAL_STORAGE') # The following would probably work. One huge caveat is that permission needs to be manually granted by the user in app settings as we can't use OS.request_permission('WRITE_EXTERNAL_STORAGE')
# '/storage/emulated/0/Android/data/au.ufeff.rhythmgame/' # '/storage/emulated/0/Android/data/au.ufeff.rhythmgame/'
# '/sdcard/Android/data/au.ufeff.rhythmgame/' # '/sdcard/Android/data/au.ufeff.rhythmgame/'