Database API
This commit is contained in:
parent
679a3187f7
commit
b13764f9a5
3 changed files with 25 additions and 1 deletions
|
|
@ -2,7 +2,11 @@ extends Node
|
|||
|
||||
class_name Game
|
||||
|
||||
enum ITEM_TYPE {VALUABLE, WEAPON, MODULE}
|
||||
enum ITEM_TYPE {VALUABLE, WEAPON, MODULE, AMMUNITION}
|
||||
enum AMMO_TYPE {NULL, LASER_ENERGY, ROCKETS}
|
||||
|
||||
const DEFAULT_ITEM = preload("res://items/test_item.tres")
|
||||
const DEFAULT_WEAPON = preload("res://scenes/weapons/presets/SingleLaserMk1.tscn")
|
||||
|
||||
static var gameversion = "Ictar 1.1"
|
||||
|
||||
|
|
@ -62,3 +66,21 @@ static func profile_load(profile_name):
|
|||
print(meta, ": ", profile_meta[meta])
|
||||
print(profile_meta[meta].keys())
|
||||
return profile_meta
|
||||
|
||||
static func get_item(id : String):
|
||||
var path_name = id.to_lower().replace(" ", "_")
|
||||
var path = "res://items/{name}.tres".format({"name": path_name})
|
||||
var res = load(path)
|
||||
if res != null:
|
||||
return res.duplicate()
|
||||
else:
|
||||
return DEFAULT_ITEM.duplicate()
|
||||
|
||||
static func get_weapon(id : String):
|
||||
var path_name = id.replace(" ", "")
|
||||
var path = "res://weapons/presets/{name}.tscn".format({"name": path_name})
|
||||
var res = load(path)
|
||||
if res != null:
|
||||
return res
|
||||
else:
|
||||
return DEFAULT_WEAPON
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue