Skip to content

Commit

Permalink
fix: Correctly get inventory objects registered in other rooms (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Piovanelli authored Jul 14, 2022
1 parent 2a85e04 commit 324ef5f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addons/escoria-core/game/core-scripts/esc/esc_object_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,17 @@ func get_object(global_id: String, room: ESCRoom = null) -> ESCObject:
"Object with global id %s in room instance (%s, %s) not found."
% [global_id, room_key.room_global_id, room_key.room_instance_id]
)
if escoria.inventory_manager.inventory_has(global_id):
# item is in the inventory and may be registered to a different room
for single_room in room_objects:
# these are arrays of the objects still registered for each room
if single_room.objects.has(global_id):
escoria.logger.info(
self,
"Object with global id %s found in room instance (%s, %s) through the inventory."
% [global_id, room_key.room_global_id, room_key.room_instance_id]
)
return single_room.objects[global_id]
return null


Expand Down

0 comments on commit 324ef5f

Please sign in to comment.