immersive-home/app/lib/stores/house.gd

33 lines
638 B
GDScript3
Raw Normal View History

2024-01-25 17:29:33 +02:00
extends StoreClass
2024-03-17 01:14:31 +02:00
## Stores information about the house, its rooms and entities
2024-01-25 17:29:33 +02:00
2024-03-17 01:14:31 +02:00
const StoreClass = preload ("./store.gd")
2024-01-25 17:29:33 +02:00
func _init():
_save_path = "user://house.json"
2024-04-09 18:11:24 +03:00
self.state = R.store({
## Type Room
## name: String
## corners: Vec2[]
## height: float
"rooms": [],
## Type Entity
## id: String
## position: Vec3
## rotation: Vec3
## room: String
"entities": [],
"align_position1": Vector3(),
"align_position2": Vector3()
})
2024-01-25 17:29:33 +02:00
func clear():
2024-04-09 18:11:24 +03:00
self.state.rooms = []
self.state.entities = []
2024-01-25 17:29:33 +02:00
func get_room(name):
2024-04-09 18:11:24 +03:00
for room in self.state.rooms:
2024-01-25 17:29:33 +02:00
if room.name == name:
return room
return null