Fix return value + add type checks
This commit is contained in:
parent
1bd0f1ca44
commit
517e36e95d
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue