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

43 lines
872 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
2024-04-11 17:51:30 +03:00
## name: String
## corners: Vec2[]
## height: float
2024-04-09 18:11:24 +03:00
"rooms": [],
## Type Entity
## id: String
2024-04-11 17:51:30 +03:00
## position: Vec3
## rotation: Vec3
## room: String
## interface: String
2024-04-09 18:11:24 +03:00
"entities": [],
2024-04-28 21:13:09 +03:00
## Type Door
## id: int
## room1: String
## room2: String
## room1_position1: Vec3
## room1_position2: Vec3
## room2_position1: Vec3
## room2_position2: Vec3
"doors": [],
2024-04-09 18:11:24 +03:00
"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