mirror of
https://codeberg.org/sunder/sunder.git
synced 2026-03-24 11:09:08 +00:00
38 lines
910 B
GDScript
38 lines
910 B
GDScript
@tool
|
|
class_name Loadout extends Resource
|
|
|
|
@export_enum("Light", "Medium", "Heavy") var armor_type: int = 0
|
|
|
|
var weapons:Array[PackedScene] = []:
|
|
set(value):
|
|
weapons = value
|
|
weapons.resize(3)
|
|
notify_property_list_changed()
|
|
|
|
func _init() -> void:
|
|
weapons.resize(3)
|
|
notify_property_list_changed()
|
|
|
|
func _get_property_list() -> Array:
|
|
var properties := []
|
|
for i in range(weapons.size()):
|
|
properties.append({
|
|
"name": "weapon_%d" % i,
|
|
"type": TYPE_OBJECT,
|
|
"hint": PROPERTY_HINT_RESOURCE_TYPE,
|
|
"hint_string": "PackedScene"
|
|
})
|
|
return properties
|
|
|
|
func _get(prop:StringName) -> Variant:
|
|
if prop.begins_with("weapon_"):
|
|
var index := prop.get_slice("_", 1).to_int()
|
|
return weapons[index]
|
|
return null
|
|
|
|
func _set(prop:StringName, value:Variant) -> bool:
|
|
if prop.begins_with("weapon_"):
|
|
var index := prop.get_slice("_", 1).to_int()
|
|
weapons[index] = value
|
|
return true
|
|
return false
|