khanat-client/ressources/scripts/items/inventory.gd
2020-04-01 21:02:49 +02:00

18 lines
569 B
GDScript

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 )