item again
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								scripts/Event/Item/EventGetItem.gd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								scripts/Event/Item/EventGetItem.gd
									
									
									
									
									
										Normal 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.
 | 
			
		||||
@@ -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;
 | 
			
		||||
		Reference in New Issue
	
	Block a user