Files
Dawn-Godot/scripts/Item/Item.gd

38 lines
810 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 getTranslationContext() -> 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