carenalgas/popochiu

get_prop function fails

Closed this issue · 1 comments

Bug description

I'm trying to run the following code
var FacePosition = R.LockerRoom.get_prop("Shower").position

This fails with the following error on line 304 of popochiu_room.gd:

Cannot call method 'get_nodes_in_group' on a null value.

image

What appears to be happening is that the get_LockerRoom() function in r.gd is calling get_instance in i_room.gd which runs

return load(load(tres_path).scene).instantiate()

The scene it instantiates isn't in the tree so get_nodes_in_group fails.

I'm confused why it's trying to instantiate the scene though as the scene is already instantiated and running.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create a prop (e.g. duck)
  2. Create a region in your room
  3. In its "_on_character_entered" function put a get_prop similar to
    var FacePosition = R.LockerRoom.get_prop("Shower").position
  4. Run the room and enter the region

Expected vs observed behavior

The prop should be returned.

Environment information (please complete):

  • Windows 10
  • 4.4 dev 3
  • Popochiu 2.0.1

Additional context

Hi. Thanks for reporting this! I'm gonna work on a fix right now.