mirror of
https://codeberg.org/sunder/sunder.git
synced 2026-07-16 06:24:36 +00:00
first commit 🎉
This commit is contained in:
commit
6e724f67fe
805 changed files with 62098 additions and 0 deletions
38
scenes/entities/player/scripts/info.gd
Normal file
38
scenes/entities/player/scripts/info.gd
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
@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
|
||||
Loading…
Add table
Add a link
Reference in a new issue