mirror of
https://codeberg.org/sunder/sunder.git
synced 2026-07-13 13:04:34 +00:00
38 lines
894 B
GDScript
38 lines
894 B
GDScript
@tool
|
|
class_name Profile extends Resource
|
|
|
|
@export var name: String
|
|
|
|
var _loadouts:Array[Loadout] = []:
|
|
set(value):
|
|
_loadouts = value
|
|
_loadouts.resize(3)
|
|
notify_property_list_changed()
|
|
|
|
func _init() -> void:
|
|
_loadouts.resize(3)
|
|
notify_property_list_changed()
|
|
|
|
func _get_property_list() -> Array:
|
|
var properties := []
|
|
for i in range(_loadouts.size()):
|
|
properties.append({
|
|
"name": "loadout_%d" % (i + 1),
|
|
"type": TYPE_OBJECT,
|
|
"hint": PROPERTY_HINT_RESOURCE_TYPE,
|
|
"hint_string": "Loadout",
|
|
})
|
|
return properties
|
|
|
|
func _get(prop:StringName) -> Variant:
|
|
if prop.begins_with("loadout_"):
|
|
var index := prop.get_slice("_", 1).to_int() - 1
|
|
return _loadouts[index]
|
|
return null
|
|
|
|
func _set(prop:StringName, value:Variant) -> bool:
|
|
if prop.begins_with("loadout_"):
|
|
var index := prop.get_slice("_", 1).to_int() - 1
|
|
_loadouts[index] = value
|
|
return true
|
|
return false
|