Added Glitch Room Source code to Gitty
This commit is contained in:
commit
1ac9eb5644
505 files changed
+28504
No files matched your search
@@ -0,0 +1,86 @@
|
||||
@tool
|
||||
class_name RoomDefinition
|
||||
extends Resource
|
||||
|
||||
|
||||
@export var room_id: StringName = &""
|
||||
@export var display_name: String = ""
|
||||
|
||||
@export var cabinet_placements: Array[CabinetPlacement] = []
|
||||
@export var devices: Array[RoomDeviceDefinition] = []
|
||||
@export var bindings: Array[RoomDeviceBinding] = []
|
||||
|
||||
@export_group("Geometry")
|
||||
@export var boundary_points: PackedVector2Array = PackedVector2Array()
|
||||
@export var walls: Array[RoomWallDefinition] = []
|
||||
|
||||
@export_group("Logic")
|
||||
|
||||
@export var logic_rules: Array[RoomLogicRule] = []
|
||||
|
||||
func get_device(
|
||||
device_id: StringName
|
||||
) -> RoomDeviceDefinition:
|
||||
|
||||
for device in devices:
|
||||
if device == null:
|
||||
continue
|
||||
|
||||
if device.device_id == device_id:
|
||||
return device
|
||||
|
||||
return null
|
||||
|
||||
|
||||
func get_cabinet_placement(
|
||||
cabinet_id: StringName
|
||||
) -> CabinetPlacement:
|
||||
|
||||
for placement in cabinet_placements:
|
||||
if placement == null:
|
||||
continue
|
||||
|
||||
if placement.cabinet_id == cabinet_id:
|
||||
return placement
|
||||
|
||||
return null
|
||||
|
||||
|
||||
func get_device_for_action(
|
||||
cabinet_id: StringName,
|
||||
action_id: StringName
|
||||
) -> RoomDeviceDefinition:
|
||||
|
||||
for binding in bindings:
|
||||
if binding == null:
|
||||
continue
|
||||
|
||||
if (
|
||||
binding.cabinet_id == cabinet_id
|
||||
and
|
||||
binding.hardware_action_id == action_id
|
||||
):
|
||||
return get_device(binding.device_id)
|
||||
|
||||
return null
|
||||
|
||||
func get_wall(
|
||||
wall_id: StringName
|
||||
) -> RoomWallDefinition:
|
||||
|
||||
for wall in walls:
|
||||
if wall == null:
|
||||
continue
|
||||
|
||||
if wall.wall_id == wall_id:
|
||||
return wall
|
||||
|
||||
return null
|
||||
|
||||
func has_wall(
|
||||
wall_id: StringName
|
||||
) -> bool:
|
||||
|
||||
return get_wall(
|
||||
wall_id
|
||||
) != null
|
||||
Reference in new issue
Block a user