onion test 0
This commit is contained in:
41
scenes/Entities/OnionSprig.tscn
Normal file
41
scenes/Entities/OnionSprig.tscn
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://bes5p6ckw6d58"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://0nn3ix2nwk3f" path="res://scripts/Entity/OnionSprig.gd" id="1_pnyp6"]
|
||||||
|
[ext_resource type="Script" uid="uid://dtjjqp2atjyhr" path="res://scripts/Entity/Entity.gd" id="2_crfvs"]
|
||||||
|
[ext_resource type="Script" uid="uid://03dqknw7v4mr" path="res://scripts/Entity/Component/EntityInteractable.gd" id="3_7clu1"]
|
||||||
|
[ext_resource type="Shader" uid="uid://7h2axb2tsh17" path="res://shaders/NPC Shader.gdshader" id="4_w0eam"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cofrgefp8e617" path="res://textures/human.png" id="5_5uma8"]
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_cpa1u"]
|
||||||
|
|
||||||
|
[sub_resource type="QuadMesh" id="QuadMesh_dyaax"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fegux"]
|
||||||
|
render_priority = 0
|
||||||
|
shader = ExtResource("4_w0eam")
|
||||||
|
shader_parameter/npcTexture = ExtResource("5_5uma8")
|
||||||
|
shader_parameter/color = Color(0.77816, 0.965494, 0.746061, 1)
|
||||||
|
shader_parameter/frame = 0
|
||||||
|
shader_parameter/direction = 2
|
||||||
|
|
||||||
|
[node name="OnionSprig" type="StaticBody3D"]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 258
|
||||||
|
script = ExtResource("1_pnyp6")
|
||||||
|
|
||||||
|
[node name="Entity" type="Node" parent="."]
|
||||||
|
script = ExtResource("2_crfvs")
|
||||||
|
metadata/_custom_type_script = "uid://dtjjqp2atjyhr"
|
||||||
|
|
||||||
|
[node name="EntityInteractable" type="Node" parent="Entity" node_paths=PackedStringArray("entity")]
|
||||||
|
script = ExtResource("3_7clu1")
|
||||||
|
entity = NodePath("..")
|
||||||
|
metadata/_custom_type_script = "uid://03dqknw7v4mr"
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
shape = SubResource("BoxShape3D_cpa1u")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.173648, 0.984808, 0, -0.984808, 0.173648, 0, 0, 0)
|
||||||
|
mesh = SubResource("QuadMesh_dyaax")
|
||||||
|
surface_material_override/0 = SubResource("ShaderMaterial_fegux")
|
@@ -28,11 +28,9 @@ metadata/_custom_type_script = "uid://bitykguiignfu"
|
|||||||
script = ExtResource("2_obj4d")
|
script = ExtResource("2_obj4d")
|
||||||
metadata/_custom_type_script = "uid://dtjjqp2atjyhr"
|
metadata/_custom_type_script = "uid://dtjjqp2atjyhr"
|
||||||
|
|
||||||
[node name="EntityInteractable" type="Node" parent="Entity" node_paths=PackedStringArray("entityDirection", "entity", "characterBody")]
|
[node name="EntityInteractable" type="Node" parent="Entity" node_paths=PackedStringArray("entity")]
|
||||||
script = ExtResource("3_cpa1u")
|
script = ExtResource("3_cpa1u")
|
||||||
entityDirection = NodePath("")
|
|
||||||
entity = NodePath("..")
|
entity = NodePath("..")
|
||||||
characterBody = NodePath("")
|
|
||||||
metadata/_custom_type_script = "uid://03dqknw7v4mr"
|
metadata/_custom_type_script = "uid://03dqknw7v4mr"
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
[gd_scene load_steps=13 format=3 uid="uid://dx6fv8n4jl5ku"]
|
[gd_scene load_steps=14 format=3 uid="uid://dx6fv8n4jl5ku"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://yhtpoum3eek7" path="res://scenes/Entities/Rosa.tscn" id="1_7b7hx"]
|
[ext_resource type="PackedScene" uid="uid://yhtpoum3eek7" path="res://scenes/Entities/Rosa.tscn" id="1_7b7hx"]
|
||||||
[ext_resource type="Script" uid="uid://c37crdel0m5mw" path="res://scripts/Map/Map.gd" id="1_ru75d"]
|
[ext_resource type="Script" uid="uid://c37crdel0m5mw" path="res://scripts/Map/Map.gd" id="1_ru75d"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dr4b2pmsknuhc" path="res://scenes/Entities/TestNPC.tscn" id="2_cg1ph"]
|
[ext_resource type="PackedScene" uid="uid://dr4b2pmsknuhc" path="res://scenes/Entities/TestNPC.tscn" id="2_cg1ph"]
|
||||||
[ext_resource type="PackedScene" uid="uid://lh713g04d3bg" path="res://scenes/Maps/TestMap/TestMapGround.tscn" id="3_gxq5o"]
|
[ext_resource type="PackedScene" uid="uid://lh713g04d3bg" path="res://scenes/Maps/TestMap/TestMapGround.tscn" id="3_gxq5o"]
|
||||||
[ext_resource type="PackedScene" uid="uid://boj5o4fx41rv8" path="res://scenes/Maps/TestMap/TestMapBuilding.tscn" id="4_brp0k"]
|
[ext_resource type="PackedScene" uid="uid://boj5o4fx41rv8" path="res://scenes/Maps/TestMap/TestMapBuilding.tscn" id="4_brp0k"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bes5p6ckw6d58" path="res://scenes/Entities/OnionSprig.tscn" id="4_ejcqv"]
|
||||||
[ext_resource type="Script" uid="uid://tkfc88q8m86f" path="res://scripts/Event/EventConversation.gd" id="5_cg1ph"]
|
[ext_resource type="Script" uid="uid://tkfc88q8m86f" path="res://scripts/Event/EventConversation.gd" id="5_cg1ph"]
|
||||||
[ext_resource type="Script" uid="uid://y7ckj1tn5cro" path="res://scripts/Event/EventTextbox.gd" id="6_gxq5o"]
|
[ext_resource type="Script" uid="uid://y7ckj1tn5cro" path="res://scripts/Event/EventTextbox.gd" id="6_gxq5o"]
|
||||||
[ext_resource type="Script" uid="uid://c4d7nithqnx5y" path="res://scripts/Event/Quest/EventStartQuest.gd" id="7_brp0k"]
|
[ext_resource type="Script" uid="uid://c4d7nithqnx5y" path="res://scripts/Event/Quest/EventStartQuest.gd" id="7_brp0k"]
|
||||||
@@ -37,6 +38,12 @@ 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)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.68747, 0.459578, -0.399262)
|
||||||
interactEvent = NodePath("../Events/TestConversation")
|
interactEvent = NodePath("../Events/TestConversation")
|
||||||
|
|
||||||
|
[node name="OnionSprig2" parent="." instance=ExtResource("4_ejcqv")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.09634, 0.190375, -4.64262)
|
||||||
|
|
||||||
|
[node name="OnionSprig" parent="." instance=ExtResource("4_ejcqv")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.75248, 0.159876, -4.57086)
|
||||||
|
|
||||||
[node name="Sign" parent="." node_paths=PackedStringArray("interactEvent") instance=ExtResource("9_xfqoe")]
|
[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)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.36525, 0.136824, 2.58137)
|
||||||
interactEvent = NodePath("../Events/TestConversation")
|
interactEvent = NodePath("../Events/TestConversation")
|
||||||
@@ -79,3 +86,7 @@ metadata/_custom_type_script = "uid://c4d7nithqnx5y"
|
|||||||
[node name="Text 1" type="Node" parent="Events/TestConversation"]
|
[node name="Text 1" type="Node" parent="Events/TestConversation"]
|
||||||
script = ExtResource("6_gxq5o")
|
script = ExtResource("6_gxq5o")
|
||||||
text = "Thanks for closing the quest menu"
|
text = "Thanks for closing the quest menu"
|
||||||
|
|
||||||
|
[node name="EventConversation" type="Node" parent="Events"]
|
||||||
|
script = ExtResource("5_cg1ph")
|
||||||
|
metadata/_custom_type_script = "uid://tkfc88q8m86f"
|
||||||
|
23
scripts/Entity/OnionSprig.gd
Normal file
23
scripts/Entity/OnionSprig.gd
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
class_name OnionSprig extends StaticBody3D
|
||||||
|
|
||||||
|
@export var itemType:ItemType = ItemType.ONION;
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
$Entity/EntityInteractable.onInteract.connect(
|
||||||
|
self.onEntityInteract
|
||||||
|
)
|
||||||
|
|
||||||
|
func _exit_tree() -> void:
|
||||||
|
$Entity/EntityInteractable.onInteract.disconnect(
|
||||||
|
self.onEntityInteract
|
||||||
|
)
|
||||||
|
|
||||||
|
func onEntityInteract(
|
||||||
|
interactor:EntityInteractor,
|
||||||
|
interactee:EntityInteractable
|
||||||
|
) -> void:
|
||||||
|
ITEM.PLAYER_INVENTORY.addItem(ITEM.ONION);
|
||||||
|
|
||||||
|
# Dispose self
|
||||||
|
get_parent().remove_child(self)
|
||||||
|
self.queue_free()
|
1
scripts/Entity/OnionSprig.gd.uid
Normal file
1
scripts/Entity/OnionSprig.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://0nn3ix2nwk3f
|
13
scripts/Item/Ingredient/Onion.gd
Normal file
13
scripts/Item/Ingredient/Onion.gd
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class_name Onion extends "res://scripts/Item/Item.gd"
|
||||||
|
|
||||||
|
func getName() -> String:
|
||||||
|
return "Onion"
|
||||||
|
|
||||||
|
func getCategory() -> ItemCategory:
|
||||||
|
return ItemCategory.MEDICINE;
|
||||||
|
|
||||||
|
func isConsumable() -> bool:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
func consume() -> void:
|
||||||
|
print("Consuming Potion");
|
1
scripts/Item/Ingredient/Onion.gd.uid
Normal file
1
scripts/Item/Ingredient/Onion.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bmfaw3kid1pqx
|
4
scripts/Item/ItemType.gd
Normal file
4
scripts/Item/ItemType.gd
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
enum ItemType {
|
||||||
|
POTION,
|
||||||
|
ONION
|
||||||
|
}
|
1
scripts/Item/ItemType.gd.uid
Normal file
1
scripts/Item/ItemType.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://nibssdy3ardv
|
@@ -3,6 +3,7 @@ const Inventory = preload("res://scripts/Item/Inventory.gd")
|
|||||||
|
|
||||||
# Item Constants
|
# Item Constants
|
||||||
static var POTION = preload("res://scripts/Item/Potion.gd").new();
|
static var POTION = preload("res://scripts/Item/Potion.gd").new();
|
||||||
|
static var ONION = preload("res://scripts/Item/Ingredient/Onion.gd").new();
|
||||||
|
|
||||||
# Static inventories
|
# Static inventories
|
||||||
static var PLAYER_INVENTORY = Inventory.new();
|
static var PLAYER_INVENTORY = Inventory.new();
|
||||||
|
Reference in New Issue
Block a user