diff --git a/scenes/Maps/TestMap/TestMap.tscn b/scenes/Maps/TestMap/TestMap.tscn index 6c8cdc3..c689cb2 100644 --- a/scenes/Maps/TestMap/TestMap.tscn +++ b/scenes/Maps/TestMap/TestMap.tscn @@ -38,14 +38,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.19857, 0.684572, 0.968477) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.68747, 0.459578, -0.399262) interactEvent = NodePath("../Events/TestConversation") -[node name="ItemOnGround" parent="." instance=ExtResource("4_ejcqv")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.09634, 0.190375, -4.64262) -script = null - -[node name="ItemOnGround2" parent="." instance=ExtResource("4_ejcqv")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.75248, 0.159876, -4.57086) -script = null - [node name="Sign" parent="." node_paths=PackedStringArray("interactEvent") instance=ExtResource("9_xfqoe")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.36525, 0.136824, 2.58137) interactEvent = NodePath("../Events/TestConversation") @@ -92,3 +84,6 @@ text = "Thanks for closing the quest menu" [node name="EventConversation" type="Node" parent="Events"] script = ExtResource("5_cg1ph") metadata/_custom_type_script = "uid://tkfc88q8m86f" + +[node name="ItemOnGround" parent="." instance=ExtResource("4_ejcqv")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.651626, 0.136824, -2.4978) diff --git a/scripts/Entity/ItemOnGround.gd b/scripts/Entity/ItemOnGround.gd index 17db318..1e337df 100644 --- a/scripts/Entity/ItemOnGround.gd +++ b/scripts/Entity/ItemOnGround.gd @@ -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 diff --git a/scripts/Event/Item/EventGetItem.gd b/scripts/Event/Item/EventGetItem.gd new file mode 100644 index 0000000..bcbe259 --- /dev/null +++ b/scripts/Event/Item/EventGetItem.gd @@ -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. \ No newline at end of file diff --git a/scripts/Item/Item.gd b/scripts/Item/Item.gd index f55fbcb..3e01ae3 100644 --- a/scripts/Item/Item.gd +++ b/scripts/Item/Item.gd @@ -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; \ No newline at end of file +# func getCategory() -> ItemCategory: +# push_error("getCategory() must be overriden in derived class"); +# return ItemCategory.MEDICINE; \ No newline at end of file diff --git a/scripts/Item/ItemType.gd b/scripts/Item/ItemType.gd deleted file mode 100644 index e69de29..0000000