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,55 @@
|
||||
@tool
|
||||
class_name GameDefinition
|
||||
extends Resource
|
||||
|
||||
|
||||
@export var game_id: StringName = &""
|
||||
@export var display_name: String = ""
|
||||
|
||||
@export var scene: PackedScene
|
||||
|
||||
@export var required_capabilities: Array[StringName] = []
|
||||
@export var optional_capabilities: Array[StringName] = []
|
||||
## Require every common capability, plus every capability in at least one alternative.
|
||||
@export var control_alternatives: Array[PackedStringArray] = []
|
||||
|
||||
@export_group("Events")
|
||||
@export var events: Array[GameEventDefinition] = []
|
||||
|
||||
|
||||
func can_run_on(
|
||||
cabinet: CabinetProfile
|
||||
) -> bool:
|
||||
|
||||
for capability in required_capabilities:
|
||||
if not cabinet.has_capability(capability):
|
||||
return false
|
||||
|
||||
if control_alternatives.is_empty(): return true
|
||||
for alternative in control_alternatives:
|
||||
var supported := true
|
||||
for capability in alternative:
|
||||
if not cabinet.has_capability(StringName(capability)): supported = false
|
||||
if supported: return true
|
||||
return false
|
||||
|
||||
|
||||
func get_event(
|
||||
event_id: StringName
|
||||
) -> GameEventDefinition:
|
||||
|
||||
for event in events:
|
||||
if event == null:
|
||||
continue
|
||||
|
||||
if event.event_id == event_id:
|
||||
return event
|
||||
|
||||
return null
|
||||
|
||||
|
||||
func has_event(
|
||||
event_id: StringName
|
||||
) -> bool:
|
||||
|
||||
return get_event(event_id) != null
|
||||
Reference in new issue
Block a user