Make Main, Settings, ChooseScene, and gameplay run in Godot 4.6
Catch-all commit for everything the --convert-3to4 tool missed during a
manual playtest of the game. All errors raised by clicking through Main
-> Puzzles -> level were fixed.
GDScript:
- PackedScene.instance() -> instantiate() (ChooseScene.gd)
- String(x) constructor doesn't exist -> str(x) (MBase, MScene,
MLevel, Animation, Levels)
- 'x as int/String/bool' doesn't parse strings -> explicit
int()/str()/bool(int()) (MScene, MLevel, MSetting)
- BaseButton.pressed (property) -> button_pressed; set_pressed() ->
direct assignment (Settings.gd)
- AnimationPlayer.add_animation() removed -> go through
AnimationLibrary (Levels.gd)
- PhysicsDirectSpaceState3D.intersect_ray(from, to, ...) ->
PhysicsRayQueryParameters3D.create() (Levels.gd)
- @export with type-hint-in-comment ('# (String, ...)') -> explicit
@export_enum (candle.gd)
- Get effective material with get_active_material() instead of
get_surface_override_material(), with null guard (Levels.gd)
- get_node() -> get_node_or_null() so missing items from ahog.json
(e.g. sm_super_dager in Home) don't crash (Levels.gd)
Scenes/resources:
- Remove 14 Tween nodes from WarCraft.tscn — Tween is no longer a
Node in Godot 4. Rewrite Animation.start_dissolve to use
create_tween().tween_method().
- Rename property material/N -> surface_material_override/N in every
.tscn (10 files) — Godot 3 -> 4 rename that --convert-3to4 missed.
Without this, MeshInstance3D.get_active_material(0) returned the
glTF-imported StandardMaterial3D instead of the project's custom
dissolve ShaderMaterial.
Shaders:
- One-shot scripts/migrate_shaders.gd walks every .material under
assets/ and fixes Godot 3 -> 4 shader code in-place. Fixed 17
materials: depth_draw_alpha_prepass -> depth_prepass_alpha,
hint_color -> source_color, NORMALMAP -> NORMAL_MAP.
Result: Main, Settings, ChooseScene, and the WarCraft level all run
without script or shader errors. Remaining noise is non-blocking
(visual_shader graph in text_outline.material, baked lightmap binary
format from Godot 3, and empty animation tracks).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -6,6 +6,6 @@ func _get_data(datas, index):
|
||||
return datas[index].get_data()
|
||||
|
||||
func _set_data(prop_id, row_id, data):
|
||||
table.edit_data(prop_id, row_id, String(data))
|
||||
table.edit_data(prop_id, row_id, str(data))
|
||||
Global.database.save_db()
|
||||
return data
|
||||
|
||||
+10
-10
@@ -15,12 +15,12 @@ func _init(row_idx):
|
||||
|
||||
func object_to_find():
|
||||
var count = 0
|
||||
var datas = _scenes().get_data_by_prop_name_and_data("level", String(m_level))
|
||||
|
||||
var datas = _scenes().get_data_by_prop_name_and_data("level", str(m_level))
|
||||
|
||||
if datas.size() != 0:
|
||||
count = datas.size()
|
||||
|
||||
return count as String
|
||||
|
||||
return str(count)
|
||||
|
||||
func reset():
|
||||
var scene_detail = null
|
||||
@@ -36,12 +36,12 @@ func _scenes():
|
||||
|
||||
func object_finding():
|
||||
var count = 0
|
||||
|
||||
for datas in _scenes().get_dictionary_by_prop_name_and_data("level", String(m_level)):
|
||||
|
||||
for datas in _scenes().get_dictionary_by_prop_name_and_data("level", str(m_level)):
|
||||
if int(datas['lock']) == 1:
|
||||
count = count + 1
|
||||
|
||||
return count as String
|
||||
|
||||
return str(count)
|
||||
|
||||
func name():
|
||||
return m_name
|
||||
@@ -51,7 +51,7 @@ func thumbnail():
|
||||
|
||||
## PRIVATE
|
||||
func _get_name(datas):
|
||||
return _get_data(datas, 0) as String
|
||||
return str(_get_data(datas, 0))
|
||||
|
||||
func _get_thumb(datas):
|
||||
return _get_data(datas, 1) as String
|
||||
return str(_get_data(datas, 1))
|
||||
|
||||
+7
-7
@@ -78,22 +78,22 @@ func counter():
|
||||
|
||||
## PRIVATE
|
||||
func _get_lock(datas):
|
||||
return int(_get_data(datas, LOCK_ID)) as bool
|
||||
return bool(int(_get_data(datas, LOCK_ID)))
|
||||
|
||||
func _get_label(datas):
|
||||
return _get_data(datas, LABEL_ID) as String
|
||||
return str(_get_data(datas, LABEL_ID))
|
||||
|
||||
func _get_key(datas):
|
||||
return _get_data(datas, KEY_ID) as String
|
||||
return str(_get_data(datas, KEY_ID))
|
||||
|
||||
func _get_level(datas):
|
||||
return _get_data(datas, LEVEL_ID) as int
|
||||
return int(_get_data(datas, LEVEL_ID))
|
||||
|
||||
func _get_mesh(datas):
|
||||
return "HiddenObjectsItems/" + String(_get_data(datas, MESH_ID))
|
||||
return "HiddenObjectsItems/" + str(_get_data(datas, MESH_ID))
|
||||
|
||||
func _get_label_counter(datas):
|
||||
return _get_data(datas, LABEL_COUNTER) as String
|
||||
return str(_get_data(datas, LABEL_COUNTER))
|
||||
|
||||
func _get_counter(datas):
|
||||
return _get_data(datas, COUNTER_ID) as int
|
||||
return int(_get_data(datas, COUNTER_ID))
|
||||
|
||||
+5
-5
@@ -27,22 +27,22 @@ func _init():
|
||||
m_version = _get_data(datas, VERSION)
|
||||
|
||||
func get_langue():
|
||||
return m_langue as int
|
||||
return int(m_langue)
|
||||
|
||||
func get_gyroscope():
|
||||
return int(m_gyroscope) as bool
|
||||
return bool(int(m_gyroscope))
|
||||
|
||||
func get_ambient_sound():
|
||||
return int(m_ambient_sound) as bool
|
||||
return bool(int(m_ambient_sound))
|
||||
|
||||
func get_resolution():
|
||||
return m_resolution.split(" x ")
|
||||
|
||||
func get_fullscreen():
|
||||
return int(m_fullscreen) as bool
|
||||
return bool(int(m_fullscreen))
|
||||
|
||||
func get_version():
|
||||
return "v"+String(m_version)
|
||||
return "v" + str(m_version)
|
||||
|
||||
func set_langue(value):
|
||||
m_langue = _set_data(LANGUE_ID, ROW_ID, value)
|
||||
|
||||
+1
-39
@@ -1,39 +1 @@
|
||||
{
|
||||
"GDDB_ver":"2.0",
|
||||
"db_name":"ahog",
|
||||
"tables":[
|
||||
{
|
||||
"table_name":"settings",
|
||||
"props":[
|
||||
{"name":"langue","type":"1","auto_increment":"0"},
|
||||
{"name":"gyroscope","type":"0","auto_increment":"0"},
|
||||
{"name":"ambient_sound","type":"0","auto_increment":"0"},
|
||||
{"name":"resolution","type":"3","auto_increment":"0"},
|
||||
{"name":"fullscreen","type":"0","auto_increment":"0"},
|
||||
{"name":"version","type":"0","auto_increment":"0"}
|
||||
],
|
||||
"data":["0","0","0","1280 x 720","0","1.0.0"]
|
||||
},
|
||||
{
|
||||
"table_name":"levels",
|
||||
"props":[
|
||||
{"name":"name","type":"3","auto_increment":"0"},
|
||||
{"name":"thumb","type":"4","auto_increment":"0"}
|
||||
],
|
||||
"data":["WarCraft","res://assets/levels/warcraft.jpg","Home","res://assets/levels/home.jpg"]
|
||||
},
|
||||
{
|
||||
"table_name":"scenes",
|
||||
"props":[
|
||||
{"name":"lock","type":"0","auto_increment":"0"},
|
||||
{"name":"label","type":"3","auto_increment":"0"},
|
||||
{"name":"key","type":"3","auto_increment":"0"},
|
||||
{"name":"level","type":"table","table_name":"levels","auto_increment":"0"},
|
||||
{"name":"mesh","type":"3","auto_increment":"0"},
|
||||
{"name":"label_counter","type":"1","auto_increment":"0"},
|
||||
{"name":"counter","type":"1","auto_increment":"0"}
|
||||
],
|
||||
"data":["0","Dagger","Dagger","0","Dagger","0","1","0","Fiole","Fiole1","0","Fioles/Fiole1","1","3","0","Fiole","Fiole2","0","Fioles/Fiole2","1","3","0","Fiole","Fiole3","0","Fioles/FioleSocle/Fiole3","1","3","0","Spyglass","Spyglass","0","Spyglass","2","1","0","Coins","Coin1","0","Coins/Coin1","3","3","0","Coins","Coin2","0","Coins/Coin2","3","3","0","Coins","Coin3","0","Coins/Coin3","3","3","0","Weapon Gun","Weapon","0","Weapon","4","1","0","Apple","Apple1","0","Apples/Apple1","5","4","0","Apple","Apple2","0","Apples/Apple2","5","4","0","Apple","Apple3","0","Apples/Apple3","5","4","0","Apple","Apple4","0","Apples/Apple4","5","4","0","Beer","Beer","0","Beer","6","1","0","SuperDagger","Gadder","1","sm_super_dager","0","1"]
|
||||
}
|
||||
]
|
||||
}
|
||||
{"GDDB_ver":"2.0","db_name":"ahog","tables":[{"data":["0","0","0","1280 x 720","0","1.0.0"],"props":[{"auto_increment":"0","name":"langue","type":"1"},{"auto_increment":"0","name":"gyroscope","type":"0"},{"auto_increment":"0","name":"ambient_sound","type":"0"},{"auto_increment":"0","name":"resolution","type":"3"},{"auto_increment":"0","name":"fullscreen","type":"0"},{"auto_increment":"0","name":"version","type":"0"}],"table_name":"settings"},{"data":["WarCraft","res://assets/levels/warcraft.jpg","Home","res://assets/levels/home.jpg"],"props":[{"auto_increment":"0","name":"name","type":"3"},{"auto_increment":"0","name":"thumb","type":"4"}],"table_name":"levels"},{"data":["0","Dagger","Dagger","0","Dagger","0","1","0","Fiole","Fiole1","0","Fioles/Fiole1","1","3","0","Fiole","Fiole2","0","Fioles/Fiole2","1","3","1","Fiole","Fiole3","0","Fioles/FioleSocle/Fiole3","1","3","1","Spyglass","Spyglass","0","Spyglass","2","1","0","Coins","Coin1","0","Coins/Coin1","3","3","1","Coins","Coin2","0","Coins/Coin2","3","3","0","Coins","Coin3","0","Coins/Coin3","3","3","1","Weapon Gun","Weapon","0","Weapon","4","1","0","Apple","Apple1","0","Apples/Apple1","5","4","0","Apple","Apple2","0","Apples/Apple2","5","4","0","Apple","Apple3","0","Apples/Apple3","5","4","0","Apple","Apple4","0","Apples/Apple4","5","4","1","Beer","Beer","0","Beer","6","1","0","SuperDagger","Gadder","1","sm_super_dager","0","1"],"props":[{"auto_increment":"0","name":"lock","type":"0"},{"auto_increment":"0","name":"label","type":"3"},{"auto_increment":"0","name":"key","type":"3"},{"auto_increment":"0","name":"level","table_name":"levels","type":"table"},{"auto_increment":"0","name":"mesh","type":"3"},{"auto_increment":"0","name":"label_counter","type":"1"},{"auto_increment":"0","name":"counter","type":"1"}],"table_name":"scenes"}]}
|
||||
Reference in New Issue
Block a user