Fix return value + add type checks

This commit is contained in:
JeremyStar™ 2024-04-03 20:04:11 +02:00
parent 1bd0f1ca44
commit 517e36e95d
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -56,7 +56,10 @@ func add_scene(sname: String, sclass: Node, type: CoreTypes.SceneType) -> bool:
logger.verbf("sms", "Adding scene \"" + sname + "\" of type " + str(type)) logger.verbf("sms", "Adding scene \"" + sname + "\" of type " + str(type))
if exists(sname) != CoreTypes.SceneType.NONE: if exists(sname) != CoreTypes.SceneType.NONE:
logger.errorf("sms", "Scene with name \"" + sname + "\" already exists") logger.errorf("sms", "Scene with name \"" + sname + "\" already exists")
return true return false
if typeof(sclass) != TYPE_OBJECT or !sclass.is_class("Node"):
logger.errorf("sms", "Scene class \"" + sname + "\" is not of type Node"
return false
sclass.name = sname sclass.name = sname
match(type): match(type):
CoreTypes.SceneType.DEBUG: scenes_debug.add_child(sclass) CoreTypes.SceneType.DEBUG: scenes_debug.add_child(sclass)