19 lines
569 B
GDScript3
19 lines
569 B
GDScript3
|
extends Node
|
||
|
class_name Inventory
|
||
|
|
||
|
var items = []
|
||
|
|
||
|
func from_dict( datas ):
|
||
|
|
||
|
for item in datas:
|
||
|
var extension = item.get_extension()
|
||
|
|
||
|
if extension == "equippable":
|
||
|
var new_item = Equippable.new()
|
||
|
var file = File.new()
|
||
|
if file.open( "res://ressources/files/items/equippables/" + item, File.READ) == OK:
|
||
|
var json = JSON.parse( file.get_as_text() )
|
||
|
if json.result:
|
||
|
new_item.from_dict( json.result )
|
||
|
self.items.push_back( new_item )
|