show proper error message when add entity

This commit is contained in:
Nitwel 2024-05-06 11:45:43 +02:00
parent dc32cac1e2
commit 927521419f
2 changed files with 6 additions and 3 deletions

View File

@ -174,7 +174,7 @@ func create_entity(entity_id: String, entity_position: Vector3, type=null):
var room = find_room_at(entity_position) var room = find_room_at(entity_position)
if room == null: if room == null:
return null return false
var entity = EntityFactory.create_entity(entity_id, type) var entity = EntityFactory.create_entity(entity_id, type)
@ -192,7 +192,7 @@ func create_entity_in(entity_id: String, room_name: String, type=null):
var room = find_room(room_name) var room = find_room(room_name)
if room == null: if room == null:
return null return false
var entity = EntityFactory.create_entity(entity_id, type) var entity = EntityFactory.create_entity(entity_id, type)

View File

@ -21,8 +21,11 @@ func _ready():
var entity=House.body.create_entity(entity_name, global_position) var entity=House.body.create_entity(entity_name, global_position)
if entity == null: if entity == false:
EventSystem.notify("Entity is not in Room", EventNotify.Type.INFO) EventSystem.notify("Entity is not in Room", EventNotify.Type.INFO)
if entity == null:
EventSystem.notify("This Entity is not supported yet", EventNotify.Type.INFO)
) )
entities_page.on_back.connect(func(): entities_page.on_back.connect(func():