mirror of
https://codeberg.org/sunder/sunder.git
synced 2026-07-16 06:24:36 +00:00
fix tests and move scripts
This commit is contained in:
parent
3ca9d4ec59
commit
a99473a35d
24 changed files with 128 additions and 128 deletions
38
scripts/entities/components/loadout.gd
Normal file
38
scripts/entities/components/loadout.gd
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
@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
|
||||
Loading…
Add table
Add a link
Reference in a new issue