48 lines
950 B
GDScript
48 lines
950 B
GDScript
extends GameObject
|
|
|
|
class_name Door
|
|
|
|
var place_id: int
|
|
|
|
var lookup_door_to_room = []
|
|
|
|
var lookup_door_to_tile = {}
|
|
|
|
var direction = null
|
|
|
|
var placement = GameObject.PLACEMENTS.DOOR
|
|
|
|
var map_point: int
|
|
|
|
func save():
|
|
|
|
var room_ids: Array
|
|
var door_to_tile: Dictionary
|
|
var door_to_tile_direction: Dictionary = {}
|
|
|
|
for i in lookup_door_to_room:
|
|
room_ids.append(i.get_instance_id())
|
|
|
|
for i in lookup_door_to_tile.keys():
|
|
var id = i.get_instance_id()
|
|
door_to_tile[lookup_door_to_tile[i]] = id
|
|
door_to_tile_direction[id] = i.face_dict.find_key(self)
|
|
|
|
var save_data = {
|
|
#Basics
|
|
"id": self.get_instance_id(),
|
|
"type": "Door",
|
|
"scene_file_path": scene_file_path,
|
|
"parent": get_parent().get_path(),
|
|
#Connections
|
|
"place_id": place_id,
|
|
"room_ids": room_ids,
|
|
"door_to_tile": door_to_tile,
|
|
"door_to_tile_direction": door_to_tile_direction,
|
|
#Data
|
|
"position": position,
|
|
"rotation_degrees": rotation_degrees
|
|
}
|
|
|
|
return save_data
|