khanat-client/ressources/scripts/items/inventory.gd

19 lines
569 B
GDScript3
Raw Permalink Normal View History

2020-04-01 19:02:49 +00:00
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 )