38 lines
804 B
GDScript
38 lines
804 B
GDScript
class_name Item extends Node
|
|
|
|
enum Type {
|
|
# Items
|
|
POTION = 1,
|
|
|
|
# Ingredients
|
|
ONION = 2,
|
|
SWEET_POTATO = 3,
|
|
|
|
# Recipe outputs
|
|
BAKED_SWEET_POTATO = 4,
|
|
};
|
|
|
|
enum Category {
|
|
MEDICINE,
|
|
KEY_ITEM,
|
|
INGREDIENT,
|
|
FOOD
|
|
};
|
|
|
|
static func getCategoryTitleKey(cat:Category) -> String:
|
|
return "item.category." + str(cat).to_lower() + ".title"
|
|
|
|
@export var title:String = ""
|
|
@export var description_text:String = ""
|
|
@export var type:Type = Type.POTION
|
|
@export var category:Category = Category.INGREDIENT
|
|
@export var stackable:bool = true
|
|
|
|
func getTransContext() -> TransContext:
|
|
var ctx:TransContext = TransContext.new()
|
|
ctx.addTransPlural("title", title)
|
|
ctx.addTrans("description", description_text)
|
|
ctx.addTrans("category", getCategoryTitleKey(category))
|
|
ctx.addBool("stackable", stackable)
|
|
return ctx
|