PopochiuIRoom
Inherits: Node
Description
Provides access to PopochiuRoom instances through the singleton R
(for example: R.House.get_prop("Drawer")).
Use this interface to access props, hotspots, regions and walkable areas in the current room, or to query data from other rooms.
Capabilities include:
-
Access objects inside the current room.
-
Read or store the state of any room.
-
Change the current room.
Use examples:
R.get_prop("Scissors").enabled = true # Get Scissors prop and make it visible
R.Outside.state.is_raining # Access the is_raining property in the *Outside* room
Properties
| Type | Name | Default |
|---|---|---|
| PopochiuRoom | current | null |
| Variant | rooms_states | {} |
Methods
| Return Type | Method |
|---|---|
| void | clear_instances() |
| PopochiuHotspot | get_hotspot(hotspot_name: String) |
| Array | get_hotspots() |
| PopochiuRoom | get_instance(script_name: String) |
| Marker2D | get_marker(marker_name: String) |
| Vector2 | get_marker_position(marker_name: String) |
| Array | get_markers() |
| PopochiuProp | get_prop(prop_name: String) |
| Array | get_props() |
| PopochiuRegion | get_region(region_name: String) |
| Array | get_regions() |
| PopochiuRoom | get_runtime_room(script_name: String) |
| PopochiuWalkableArea | get_walkable_area(walkable_area_name: String) |
| Array | get_walkable_areas() |
| void | goto_room(script_name = "", use_transition = true, store_state = true, ignore_change = false) |
| void | room_readied(room: PopochiuRoom) |
| void | set_current(value: PopochiuRoom) |
| void | store_states() |
Property Descriptions
current
var current : PopochiuRoom = null
- Setter:
set_current
Provides access to the current PopochiuRoom.
rooms_states
var rooms_states = {}
Stores the state of each PopochiuRoom in the game. The key of each room is its
script_name, and each value is a Dictionary with its properties and the
data of all its PopochiuProps, PopochiuHotspots, PopochiuWalkableAreas, PopochiuRegions,
and some data related with the PopochiuCharacters in it. For more info about the data stored,
check the documentation for PopochiuRoomData.
Method Descriptions
clear_instances
func clear_instances() -> void
Clears all the PopochiuRoom instances to free memory and orphan children.
get_hotspot
func get_hotspot(hotspot_name: String) -> PopochiuHotspot
Retrieves the PopochiuHotspot with a script_name matching
hotspot_name.
get_hotspots
func get_hotspots() -> Array
Returns all the PopochiuHotspots in the room.
get_instance
func get_instance(script_name: String) -> PopochiuRoom
Instantiates and returns the PopochiuRoom resource referenced by script_name from
project data. Logs an error and returns null if not found.
get_marker
func get_marker(marker_name: String) -> Marker2D
Retrieves the Marker2D with a Node.name matching marker_name.
get_marker_position
func get_marker_position(marker_name: String) -> Vector2
Retrieves the global position of the Marker2D with a Node.name matching
marker_name.
get_markers
func get_markers() -> Array
Returns all the Marker2Ds in the room.
get_prop
func get_prop(prop_name: String) -> PopochiuProp
Retrieves the PopochiuProp with a script_name matching
prop_name.
get_props
func get_props() -> Array
Returns all the PopochiuProps in the room.
get_region
func get_region(region_name: String) -> PopochiuRegion
Retrieves the PopochiuRegion with a script_name matching
region_name.
get_regions
func get_regions() -> Array
Returns all the PopochiuRegions in the room.
get_runtime_room
func get_runtime_room(script_name: String) -> PopochiuRoom
Returns the runtime instance of the PopochiuRoom identified by script_name, or
null if it cannot be found.
Used by res://game/autoloads/r.gd to instantiate room variables at runtime for autocompletion.
get_walkable_area
func get_walkable_area(walkable_area_name: String) -> PopochiuWalkableArea
Retrieves the PopochiuWalkableArea with a script_name matching
walkable_area_name.
get_walkable_areas
func get_walkable_areas() -> Array
Returns all the PopochiuWalkableAreas in the room.
goto_room
func goto_room(script_name = "", use_transition = true, store_state = true, ignore_change = false) -> void
Loads the room identified by script_name.
use_transition triggers a fade out before loading and a fade in after the room is ready.
The actual transition may be different from fading and is defined in project settings.
If store_state is true, the current room state will be stored in memory.
ignore_change is used internally to skip the scene change (e.g. when initializing in the
editor). Don't use it unless you know what you are doing.
room_readied
func room_readied(room: PopochiuRoom) -> void
Called when the loaded room is ready (_ready()).
set_current
func set_current(value: PopochiuRoom) -> void
store_states
func store_states() -> void
Stores the default states of all rooms defined in project data.