63 lines
1.0 KiB
GDScript
63 lines
1.0 KiB
GDScript
class_name Item
|
|
|
|
enum Type {
|
|
POTION,
|
|
ONION
|
|
};
|
|
|
|
enum Category {
|
|
MEDICINE,
|
|
KEY_ITEM,
|
|
INGREDIENT
|
|
};
|
|
|
|
static func isStackable(itemType:Type) -> bool:
|
|
match itemType:
|
|
|
|
_:
|
|
return true
|
|
|
|
static func getName(itemType:Type, count:int = 1) -> String:
|
|
match itemType:
|
|
Type.POTION:
|
|
if count != 1:
|
|
return "Potions"
|
|
return "Potion"
|
|
|
|
Type.ONION:
|
|
if count != 1:
|
|
return "Onions"
|
|
return "Onion"
|
|
|
|
_:
|
|
assert(false, "Invalid item type")
|
|
return ""
|
|
|
|
# func getName() -> String:
|
|
# push_error("getName() must be overridden in derived classes");
|
|
# return "";
|
|
|
|
# func isStackable() -> bool:
|
|
# return true;
|
|
|
|
# func isDroppable() -> bool:
|
|
# return true;
|
|
|
|
# func isSellable() -> bool:
|
|
# return true;
|
|
|
|
# func getSellPrice() -> int:
|
|
# return 0;
|
|
|
|
# func getBuyPrice() -> int:
|
|
# return 0;
|
|
|
|
# func isConsumable() -> bool:
|
|
# return false;
|
|
|
|
# func consume() -> void:
|
|
# pass
|
|
|
|
# func getCategory() -> ItemCategory:
|
|
# push_error("getCategory() must be overriden in derived class");
|
|
# return ItemCategory.MEDICINE; |