item again

This commit is contained in:
2025-05-18 22:51:20 -05:00
parent 930463fc2c
commit dd783174e8
5 changed files with 49 additions and 36 deletions

View File

@@ -1,5 +1,9 @@
class_name ItemOnGround extends StaticBody3D
@export var itemType:Item.ItemType = Item.ItemType.POTION;
@export var quantity:int = 1;
@export var inventory:Inventory = null
func _ready() -> void:
$Entity/EntityInteractable.onInteract.connect(
self.onEntityInteract

View File

@@ -0,0 +1,9 @@
class_name EventGetItem extends Event
@export var itemType:Item.ItemType = Item.ItemType.POTION
@export var quantity:int = 1
@export var inventory:Inventory = null
func start() -> void:
super.start()
ITEM.

View File

@@ -1,36 +1,41 @@
class_name Item
enum ItemType {
POTION,
ONION
};
enum ItemCategory {
MEDICINE,
KEY_ITEM,
INGREDIENT
};
# 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 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;
# func getCategory() -> ItemCategory:
# push_error("getCategory() must be overriden in derived class");
# return ItemCategory.MEDICINE;