immersive-home/app/lib/stores/house.gd
2024-04-09 17:11:24 +02:00

33 lines
638 B
GDScript

extends StoreClass
## Stores information about the house, its rooms and entities
const StoreClass = preload ("./store.gd")
func _init():
_save_path = "user://house.json"
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()
})
func clear():
self.state.rooms = []
self.state.entities = []
func get_room(name):
for room in self.state.rooms:
if room.name == name:
return room
return null