Added Seeds that get spawn from Grass.

main
Martin Felis 2024-11-01 18:07:23 +01:00
parent 2375341b61
commit 851534dc75
34 changed files with 517 additions and 32 deletions

View File

@ -0,0 +1,48 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dykjhgsqsihbj"
path="res://.godot/imported/Mage.glb-40a7a7ea54ec1419f6ea0f43a4f9458d.scn"
[deps]
source_file="res://assets/3rdparty/KayKit_Adventurers_1.0_EXTRA/Characters/gltf/Mage.glb"
dest_files=["res://.godot/imported/Mage.glb-40a7a7ea54ec1419f6ea0f43a4f9458d.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={
"nodes": {
"PATH:Rig/Skeleton3D/2H_Staff/2H_Staff": {
"import/skip_import": true
},
"PATH:Rig/Skeleton3D/Spellbook/Spellbook": {
"import/skip_import": true
},
"PATH:Rig/Skeleton3D/Spellbook_open/Spellbook_open": {
"import/skip_import": true
}
}
}
gltf/naming_version=1
gltf/embedded_image_handling=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,38 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://hsebtdlvcren"
path.s3tc="res://.godot/imported/Mage_mage_texture.png-6b5f9120f8aad7a4abc4672ec474b41b.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "4929e1d8419d602df7a7be89ce778863"
}
[deps]
source_file="res://assets/3rdparty/KayKit_Adventurers_1.0_EXTRA/Characters/gltf/Mage_mage_texture.png"
dest_files=["res://.godot/imported/Mage_mage_texture.png-6b5f9120f8aad7a4abc4672ec474b41b.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cykl6plps8ewj"
path="res://.godot/imported/mage_texture.png-741b5df61e695443a6e234dd9a731d82.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/3rdparty/KayKit_Adventurers_1.0_EXTRA/Characters/gltf/mage_texture.png"
dest_files=["res://.godot/imported/mage_texture.png-741b5df61e695443a6e234dd9a731d82.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

124
assets/characters/mage.tscn Normal file
View File

@ -0,0 +1,124 @@
[gd_scene load_steps=6 format=3 uid="uid://bnstbaflxlhuj"]
[ext_resource type="PackedScene" uid="uid://dykjhgsqsihbj" path="res://assets/3rdparty/KayKit_Adventurers_1.0_EXTRA/Characters/gltf/Mage.glb" id="1_ojy63"]
[ext_resource type="AnimationLibrary" uid="uid://dbaynxuqbkor6" path="res://assets/characters/rogue_animation_library.tres" id="2_xc1in"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_l7k36"]
animation = &"rogue_animation_library/Idle"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_84wiy"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_dwyg8"]
states/rogue_animation_library_Idle/node = SubResource("AnimationNodeAnimation_l7k36")
states/rogue_animation_library_Idle/position = Vector2(470, 100)
transitions = ["Start", "rogue_animation_library_Idle", SubResource("AnimationNodeStateMachineTransition_84wiy")]
[node name="Mage" type="Node3D"]
[node name="Mage" parent="." instance=ExtResource("1_ojy63")]
[node name="Skeleton3D" parent="Mage/Rig" index="0"]
bones/0/rotation = Quaternion(0, 1.19209e-07, 0, 1)
bones/1/position = Vector3(0, 0.392064, 0)
bones/1/rotation = Quaternion(-1.11123e-10, 0.0431578, 2.57241e-09, 0.999068)
bones/2/rotation = Quaternion(-6.93889e-18, 7.10543e-15, 4.93038e-32, 1)
bones/3/rotation = Quaternion(8.27181e-25, 3.72529e-09, 0, 1)
bones/4/position = Vector3(0.212007, 0.134132, 8.40246e-08)
bones/4/rotation = Quaternion(-0.559906, -0.0608804, -0.643974, 0.517779)
bones/4/scale = Vector3(0.999999, 0.999999, 1)
bones/5/rotation = Quaternion(3.65498e-08, -4.88301e-08, -0.494719, 0.869053)
bones/6/rotation = Quaternion(-9.73784e-11, -2.98437e-10, 0.0266581, 0.999645)
bones/6/scale = Vector3(1, 1, 1)
bones/7/rotation = Quaternion(-0.321065, -0.325319, 0.145726, 0.87741)
bones/8/position = Vector3(8.34815e-10, 0.0961251, -0.0575001)
bones/8/rotation = Quaternion(1.60975e-09, 1.60975e-09, -0.707107, 0.707107)
bones/8/scale = Vector3(1, 1, 1)
bones/9/rotation = Quaternion(-8.95373e-08, 0.707107, 0.707107, -9.81383e-08)
bones/10/rotation = Quaternion(-8.95373e-08, 0.707107, 0.707107, -9.81383e-08)
bones/11/position = Vector3(-0.212007, 0.134132, 8.40246e-08)
bones/11/rotation = Quaternion(-0.618244, 0.0807285, 0.618012, 0.478873)
bones/11/scale = Vector3(0.999999, 0.999999, 1)
bones/12/rotation = Quaternion(2.09853e-08, 5.12855e-08, 0.517939, 0.855417)
bones/13/rotation = Quaternion(-9.73784e-11, 2.98437e-10, -0.0266581, 0.999645)
bones/13/scale = Vector3(1, 1, 1)
bones/14/rotation = Quaternion(-0.319291, 0.300524, -0.22735, 0.869512)
bones/15/position = Vector3(-8.34815e-10, 0.0961251, -0.0575001)
bones/15/rotation = Quaternion(-1.02444e-09, -4.24391e-09, 0.707107, 0.707107)
bones/15/scale = Vector3(1, 1, 1)
bones/18/rotation = Quaternion(-5.8061e-11, -0.0313416, -1.88013e-09, 0.999509)
bones/19/rotation = Quaternion(-0.130526, -7.04464e-15, -9.27445e-16, 0.991445)
bones/21/position = Vector3(0.170945, 0.113587, 1.39233e-08)
bones/21/rotation = Quaternion(0.996186, 0.0479136, 0.0566427, -0.045939)
bones/21/scale = Vector3(1, 1, 1)
bones/22/rotation = Quaternion(0.165014, 6.49414e-08, -1.11407e-07, 0.986291)
bones/23/rotation = Quaternion(-0.533729, -0.260895, -1.72985e-05, 0.804405)
bones/24/rotation = Quaternion(-3.04797e-08, 0.920355, -0.391084, 6.94849e-08)
bones/24/scale = Vector3(1, 1, 1)
bones/25/position = Vector3(-0.170945, 0.113587, 1.39233e-08)
bones/25/rotation = Quaternion(0.997322, -0.0294574, 0.0315293, 0.0590483)
bones/25/scale = Vector3(1, 1, 1)
bones/26/rotation = Quaternion(0.274008, -6.38135e-08, 1.92761e-07, 0.961727)
bones/27/rotation = Quaternion(-0.559039, 0.114513, -0.00862764, 0.82115)
bones/28/rotation = Quaternion(3.04797e-08, 0.920355, -0.391084, -6.94849e-08)
bones/28/scale = Vector3(1, 1, 1)
bones/29/position = Vector3(0.170945, 0.29231, 0.575812)
bones/29/rotation = Quaternion(0.707107, -2.29302e-07, -4.60551e-08, 0.707107)
bones/30/position = Vector3(0.213918, 0.0259903, 0.173866)
bones/30/rotation = Quaternion(-0.705092, 0.0533355, 0.0533355, 0.705092)
bones/31/position = Vector3(1.94581e-08, 0.362833, -2.42861e-15)
bones/31/rotation = Quaternion(9.65792e-09, 1.77955e-09, 0.985719, -0.168398)
bones/32/position = Vector3(-1.11482e-08, 0.213436, -2.50942e-15)
bones/32/rotation = Quaternion(-1.04035e-07, 0.391084, 0.920355, -2.9526e-08)
bones/33/position = Vector3(8.58988e-09, 0.16565, -5.09137e-09)
bones/34/rotation = Quaternion(1, -3.10863e-15, 1.94707e-07, -6.91739e-22)
bones/36/position = Vector3(-0.170945, 0.29231, 0.575812)
bones/36/rotation = Quaternion(0.707107, -3.82385e-08, 1.45009e-07, 0.707107)
bones/37/position = Vector3(-0.170945, 0.0259903, 0.245789)
bones/37/rotation = Quaternion(-0.707107, -7.05285e-08, -7.05285e-08, 0.707107)
bones/38/position = Vector3(1.94581e-08, 0.362833, 2.42861e-15)
bones/38/rotation = Quaternion(-5.83589e-09, 6.43837e-10, 0.994809, 0.101756)
bones/39/position = Vector3(3.75294e-09, 0.213436, 0)
bones/39/rotation = Quaternion(-1.04035e-07, 0.391084, 0.920355, -2.95261e-08)
bones/40/position = Vector3(-6.31128e-09, 0.16565, 1.36608e-09)
bones/40/rotation = Quaternion(-0.391084, -6.885e-08, -6.56287e-08, 0.920355)
bones/41/rotation = Quaternion(1, 4.44086e-16, 1.94707e-07, 6.91739e-22)
bones/43/position = Vector3(0.453507, 1.10676, -0.588859)
bones/43/rotation = Quaternion(-0.707107, -7.27951e-08, -7.27951e-08, 0.707107)
bones/44/position = Vector3(0.520841, 0.788312, -0.0576373)
bones/44/rotation = Quaternion(0.794627, -1.2666e-07, 0.607098, -5.96046e-08)
bones/45/position = Vector3(-0.453507, 1.10676, -0.58886)
bones/45/rotation = Quaternion(-0.707107, -7.27951e-08, -7.27951e-08, 0.707107)
bones/46/position = Vector3(-0.510844, 0.788312, 0.0597369)
bones/46/rotation = Quaternion(0.758253, 1.82539e-07, -0.651961, 1.11759e-08)
[node name="Spellbook" parent="Mage/Rig/Skeleton3D" index="0"]
transform = Transform3D(3.03989e-07, 0.964832, 0.262864, -0.999999, 9.10786e-07, -3.5482e-07, -7.37311e-07, -0.262865, 0.964832, 0.577621, 0.636705, 0.237873)
[node name="Spellbook_open" parent="Mage/Rig/Skeleton3D" index="1"]
transform = Transform3D(3.03989e-07, 0.964832, 0.262864, -0.999999, 9.10786e-07, -3.5482e-07, -7.37311e-07, -0.262865, 0.964832, 0.545985, 0.636705, 0.121754)
[node name="1H_Wand" parent="Mage/Rig/Skeleton3D" index="2"]
transform = Transform3D(1.09228e-07, -0.149894, 0.988701, 0.999999, -9.80669e-07, -5.96046e-07, 1.3651e-06, 0.988701, 0.149894, -0.49106, 0.641029, 0.106596)
[node name="2H_Staff" parent="Mage/Rig/Skeleton3D" index="3"]
transform = Transform3D(1.09228e-07, -0.149894, 0.988701, 0.999999, -9.80669e-07, -5.96046e-07, 1.3651e-06, 0.988701, 0.149894, -0.49106, 0.641029, 0.106596)
[node name="Mage_Hat" parent="Mage/Rig/Skeleton3D" index="4"]
transform = Transform3D(0.99972, -0.0061203, 0.0228413, 1.39341e-09, 0.965926, 0.258819, -0.023647, -0.258747, 0.965656, -7.48424e-09, 1.7705, -1.02479e-07)
[node name="Mage_Cape" parent="Mage/Rig/Skeleton3D" index="5"]
transform = Transform3D(0.996275, -5.14962e-09, 0.0862354, 5.13044e-09, 1, 4.44078e-10, -0.0862354, 1.46374e-15, 0.996275, -1.2997e-08, 1.20227, -1.01951e-07)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../Mage")
libraries = {
"rogue_animation_library": ExtResource("2_xc1in")
}
[node name="AnimationTree" type="AnimationTree" parent="."]
root_node = NodePath("../Mage")
tree_root = SubResource("AnimationNodeStateMachine_dwyg8")
anim_player = NodePath("../AnimationPlayer")
[editable path="Mage"]

BIN
assets/custom/seeds.blend Normal file

Binary file not shown.

View File

@ -0,0 +1,51 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://ddd7nq81ag3lg"
path="res://.godot/imported/seeds.blend-b1fe43304cafc66b1e1347fc3eeae2f9.scn"
[deps]
source_file="res://assets/custom/seeds.blend"
dest_files=["res://.godot/imported/seeds.blend-b1fe43304cafc66b1e1347fc3eeae2f9.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

BIN
assets/custom/seeds.blend1 Normal file

Binary file not shown.

BIN
assets/custom/seeds.glb Normal file

Binary file not shown.

View File

@ -0,0 +1,36 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://tcdn7l77rl1a"
path="res://.godot/imported/seeds.glb-23ad838f3774296d1039ac42af351974.scn"
[deps]
source_file="res://assets/custom/seeds.glb"
dest_files=["res://.godot/imported/seeds.glb-23ad838f3774296d1039ac42af351974.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

BIN
assets/items/seeds.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://db1oiikkj5m3e"
path="res://.godot/imported/seeds.png-6bfcc221f6eb34964b98afdb75e4a651.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/items/seeds.png"
dest_files=["res://.godot/imported/seeds.png-6bfcc221f6eb34964b98afdb75e4a651.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

7
assets/items/seeds.tscn Normal file
View File

@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=3 uid="uid://nu84ofa6lx0s"]
[ext_resource type="PackedScene" uid="uid://tcdn7l77rl1a" path="res://assets/custom/seeds.glb" id="1_t02b2"]
[node name="Seeds" type="Node3D"]
[node name="seeds" parent="." instance=ExtResource("1_t02b2")]

15
data/items/seeds.tres Normal file
View File

@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="ItemResource" load_steps=4 format=3 uid="uid://mvph5aepql1t"]
[ext_resource type="Script" path="res://model/item_resource.gd" id="1_ks17v"]
[ext_resource type="Texture2D" uid="uid://db1oiikkj5m3e" path="res://assets/items/seeds.png" id="1_rdv4h"]
[ext_resource type="PackedScene" uid="uid://nu84ofa6lx0s" path="res://assets/items/seeds.tscn" id="2_27srp"]
[resource]
script = ExtResource("1_ks17v")
name = "Seeds"
scene = ExtResource("2_27srp")
icon = ExtResource("1_rdv4h")
max_stack_size = 64
is_tool = false
is_buildable = false
tool_action = 0

View File

@ -1,5 +1,5 @@
~ start ~ start
Chloe: [[Hi|Hello|Howdy]], weather seems nice today! Chloe: [[Hi|Hello|Howdy]], ein schöner Tag, nicht wahr?
=> END => END

View File

@ -0,0 +1,20 @@
~ start
Klaus: Wo sind sie denn? ... Wo sind sie denn? ...
Klaus: Ich brauche die Samen!
- Alles ok?
Klaus: Wo sind sie ... Ah, Entschuldigung.
Klaus: Ich suche die Samen für meine Pflanzen. Hast Du welche?
- Ja.
if is_seeds_found == false:
Klaus: Lüg' mich nicht an!
else:
Klaus: Danke!
set is_seeds_delivered = true
- Leider nicht.
Klaus: Dann suche ich eben weiter.
- (-> Weggehen)
=> END

View File

@ -0,0 +1,15 @@
[remap]
importer="dialogue_manager_compiler_12"
type="Resource"
uid="uid://mn4emvkkv3v4"
path="res://.godot/imported/mage_missing_seeds.dialogue-6d7742e15f77c9281243d17b9856b01e.tres"
[deps]
source_file="res://dialogue/mage_missing_seeds.dialogue"
dest_files=["res://.godot/imported/mage_missing_seeds.dialogue-6d7742e15f77c9281243d17b9856b01e.tres"]
[params]
defaults=true

View File

@ -3,10 +3,17 @@ extends Area3D
signal conversation_started signal conversation_started
@export var dialogue_start: String = "start"
@export var related_quest_path: NodePath
@export var quest_dialogue_resource: DialogueResource @export var quest_dialogue_resource: DialogueResource
@export var default_dialogue_resource: DialogueResource @export var default_dialogue_resource: DialogueResource
@export var dialogue_start: String = "start"
@onready var builder_missing_tool:QuestBuilderMissingTool = %BuilderMissingTool var related_quest:QuestBase = null
func _ready():
if not related_quest_path.is_empty():
related_quest = get_node(related_quest_path)
func action() -> void: func action() -> void:
var balloon = load("res://ui/dialogue/balloon.tscn").instantiate() as DialogueBaloon var balloon = load("res://ui/dialogue/balloon.tscn").instantiate() as DialogueBaloon
@ -14,7 +21,7 @@ func action() -> void:
get_tree().current_scene.add_child(balloon) get_tree().current_scene.add_child(balloon)
var quest_states = get_tree().get_nodes_in_group("quest_state") var quest_states = get_tree().get_nodes_in_group("quest_state")
if not builder_missing_tool.is_completed: if related_quest != null and not related_quest.is_completed:
balloon.start(quest_dialogue_resource, dialogue_start, quest_states) balloon.start(quest_dialogue_resource, dialogue_start, quest_states)
else: else:
balloon.start(default_dialogue_resource, dialogue_start, quest_states) balloon.start(default_dialogue_resource, dialogue_start, quest_states)

View File

@ -1,6 +1,7 @@
@tool @tool
extends Node3D extends Node3D
@export var seed_drop_rate:float = 1.0
@export var is_chopped:bool = true: @export var is_chopped:bool = true:
get: get:
return is_chopped return is_chopped
@ -12,10 +13,12 @@ extends Node3D
@onready var grass_large: Node3D = %grassLarge @onready var grass_large: Node3D = %grassLarge
@onready var grow_timer: Timer = %GrowTimer @onready var grow_timer: Timer = %GrowTimer
@onready var item_spawner: ItemSpawner = %ItemSpawner
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
_update_geometry() _update_geometry()
grow_timer.wait_time = grow_timer.wait_time + grow_timer.wait_time * 0.2 * (randf() - 0.5)
func _update_geometry() -> void: func _update_geometry() -> void:
if grass_large == null: if grass_large == null:
@ -26,10 +29,13 @@ func _update_geometry() -> void:
else: else:
grass_large.transform = Transform3D(Basis.IDENTITY.scaled(Vector3(1, 3, 1)), grass_large.position) grass_large.transform = Transform3D(Basis.IDENTITY.scaled(Vector3(1, 3, 1)), grass_large.position)
func _on_hitbox_area_shape_entered(area_rid: RID, area: Area3D, area_shape_index: int, local_shape_index: int) -> void: func _on_hitbox_area_shape_entered(_area_rid: RID, _area: Area3D, _area_shape_index: int, _local_shape_index: int) -> void:
if is_chopped:
return
is_chopped = true is_chopped = true
grow_timer.start() grow_timer.start()
item_spawner.spawn()
func _on_grow_timer_timeout() -> void: func _on_grow_timer_timeout() -> void:
if is_chopped: if is_chopped:

View File

@ -1,18 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://bwt4hbinrod8q"] [gd_scene load_steps=6 format=3 uid="uid://bwt4hbinrod8q"]
[ext_resource type="Script" path="res://objects/grass.gd" id="1_sc4bm"] [ext_resource type="Script" path="res://objects/grass.gd" id="1_sc4bm"]
[ext_resource type="PackedScene" uid="uid://c5x71uagdcocv" path="res://assets/3rdparty/kenney/survival-kit/Models/grassLarge.glb" id="2_4frmr"] [ext_resource type="PackedScene" uid="uid://c5x71uagdcocv" path="res://assets/3rdparty/kenney/survival-kit/Models/grassLarge.glb" id="2_4frmr"]
[ext_resource type="Script" path="res://objects/item_spawner.gd" id="3_eji24"]
[ext_resource type="Resource" uid="uid://mvph5aepql1t" path="res://data/items/seeds.tres" id="4_rsj4o"]
[sub_resource type="BoxShape3D" id="BoxShape3D_4etwi"] [sub_resource type="BoxShape3D" id="BoxShape3D_4etwi"]
size = Vector3(0.5, 0.483398, 0.5) size = Vector3(0.5, 0.483398, 0.5)
[node name="Grass" type="Node3D"] [node name="Grass" type="Node3D"]
script = ExtResource("1_sc4bm") script = ExtResource("1_sc4bm")
seed_drop_rate = null
is_chopped = false is_chopped = false
[node name="grassLarge" parent="." instance=ExtResource("2_4frmr")] [node name="grassLarge" parent="." instance=ExtResource("2_4frmr")]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0)
[node name="Hitbox" type="Area3D" parent="."] [node name="Hitbox" type="Area3D" parent="."]
collision_layer = 0 collision_layer = 0
@ -27,5 +30,10 @@ shape = SubResource("BoxShape3D_4etwi")
unique_name_in_owner = true unique_name_in_owner = true
wait_time = 2.0 wait_time = 2.0
[node name="ItemSpawner" type="Node3D" parent="."]
unique_name_in_owner = true
script = ExtResource("3_eji24")
item = ExtResource("4_rsj4o")
[connection signal="area_shape_entered" from="Hitbox" to="." method="_on_hitbox_area_shape_entered"] [connection signal="area_shape_entered" from="Hitbox" to="." method="_on_hitbox_area_shape_entered"]
[connection signal="timeout" from="GrowTimer" to="." method="_on_grow_timer_timeout"] [connection signal="timeout" from="GrowTimer" to="." method="_on_grow_timer_timeout"]

14
objects/item_spawner.gd Normal file
View File

@ -0,0 +1,14 @@
class_name ItemSpawner
extends Node3D
@export var item:ItemResource = null
@export var spawn_chance:float = 0.2
@onready var pickup_item_scene:PackedScene = preload("res://objects/pickup_item.tscn")
func spawn() -> void:
if randf() < spawn_chance:
var pickup_item:PickupItem = pickup_item_scene.instantiate()
get_parent().add_child(pickup_item)
pickup_item.global_transform = global_transform
pickup_item.item = load("res://data/items/seeds.tres")

View File

@ -0,0 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://br6po50kfianv"]
[ext_resource type="Script" path="res://objects/item_spawner.gd" id="1_uc120"]
[ext_resource type="Resource" uid="uid://mvph5aepql1t" path="res://data/items/seeds.tres" id="2_7m1cg"]
[node name="ItemSpawner" type="Node3D"]
script = ExtResource("1_uc120")
item = ExtResource("2_7m1cg")

View File

@ -15,6 +15,7 @@ extends CharacterBody3D
const SPEED = 5.0 const SPEED = 5.0
const JUMP_VELOCITY = 4.5 const JUMP_VELOCITY = 4.5
var tool_damage:bool = false
var tracking_node:Node3D = null var tracking_node:Node3D = null
var look_direction:Vector3 = Vector3.BACK var look_direction:Vector3 = Vector3.BACK
var look_direction_damper:SpringDamper = SpringDamper.new(Vector3.ZERO, 2, 0.003, 0.003) var look_direction_damper:SpringDamper = SpringDamper.new(Vector3.ZERO, 2, 0.003, 0.003)

View File

@ -13,7 +13,7 @@ signal item_picked_up(node_path:NodePath)
if value != item: if value != item:
item = value item = value
if not Engine.is_editor_hint() or world_item_node == null: if world_item_node == null:
return return
for child in world_item_node.get_children(): for child in world_item_node.get_children():
@ -22,7 +22,7 @@ signal item_picked_up(node_path:NodePath)
world_item_node.add_child(item.scene.instantiate()) world_item_node.add_child(item.scene.instantiate())
# Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
if item == null: if item == null:
push_error ("Error: invalid PickupItem at %s" % str(global_position)) push_error ("Error: invalid PickupItem at %s" % str(global_position))

View File

@ -9,7 +9,8 @@ const JUMP_VELOCITY = 3.5
@onready var animation_tree:AnimationTree = $Geometry/AnimationTree @onready var animation_tree:AnimationTree = $Geometry/AnimationTree
@onready var build_location:Node3D = %BuildLocation @onready var build_location:Node3D = %BuildLocation
@onready var right_hand_attachement:HandTool = %RightHandAttachement @onready var right_hand_attachement:HandTool = %RightHandAttachement
@export var tool_damage:bool = false :
var tool_damage:bool = false :
get: get:
return tool_damage return tool_damage
set(value): set(value):
@ -18,7 +19,6 @@ const JUMP_VELOCITY = 3.5
if right_hand_attachement != null and right_hand_attachement.tool_hitbox: if right_hand_attachement != null and right_hand_attachement.tool_hitbox:
right_hand_attachement.tool_hitbox.monitorable = bool(tool_damage) right_hand_attachement.tool_hitbox.monitorable = bool(tool_damage)
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
var inventory:Inventory = Inventory.new() var inventory:Inventory = Inventory.new()
var selected_tool_slot_index:int = 0 var selected_tool_slot_index:int = 0
@ -28,7 +28,7 @@ var _direction:Vector3 = Vector3.ZERO
var _look_direction:Vector3 = Vector3.BACK var _look_direction:Vector3 = Vector3.BACK
var _look_direction_damper:SpringDamper = SpringDamper.new(Vector3.ZERO) var _look_direction_damper:SpringDamper = SpringDamper.new(Vector3.ZERO)
var is_conversation_active:bool = false var is_input_blocked:bool = false
signal trigger_message(message:String) signal trigger_message(message:String)
@ -56,7 +56,7 @@ func _physics_process(delta):
if not is_on_floor(): if not is_on_floor():
velocity.y -= gravity * delta velocity.y -= gravity * delta
if not is_conversation_active: if not is_input_blocked:
_handle_input() _handle_input()
move_and_slide() move_and_slide()

View File

@ -26,7 +26,7 @@ length = 0.001
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("%Geometry/..:tool_slice_damage") tracks/0/path = NodePath("%Geometry/..:tool_damage")
tracks/0/interp = 0 tracks/0/interp = 0
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
@ -169,7 +169,7 @@ unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.98728) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.98728)
[node name="RightHandBone" type="BoneAttachment3D" parent="."] [node name="RightHandBone" type="BoneAttachment3D" parent="."]
transform = Transform3D(-8.44922e-05, -0.0603305, 0.395424, 0.4, -0.000359516, 3.04633e-05, 0.000350951, 0.395424, 0.0603306, -0.1964, 0.25612, 0.042693) transform = Transform3D(-0.001175, -0.0650121, 0.394679, 0.39997, -0.00487941, 0.000386901, 0.00475177, 0.394651, 0.0650216, -0.19617, 0.248974, 0.0428286)
bone_name = "Knife" bone_name = "Knife"
bone_idx = 17 bone_idx = 17
use_external_skeleton = true use_external_skeleton = true

View File

@ -19,7 +19,3 @@ func set_tool(node:Node3D) -> void:
if _current_tool != null: if _current_tool != null:
add_child(_current_tool) add_child(_current_tool)
tool_hitbox = find_child("Hitbox", true, false) tool_hitbox = find_child("Hitbox", true, false)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -178,7 +178,7 @@ jump={
[internationalization] [internationalization]
locale/translations_pot_files=PackedStringArray("res://dialogue/bridge_builder_missing_tool.dialogue", "res://dialogue/default_dialogue.dialogue") locale/translations_pot_files=PackedStringArray("res://dialogue/bridge_builder_missing_tool.dialogue", "res://dialogue/default_dialogue.dialogue", "res://dialogue/mage_missing_seeds.dialogue")
[layer_names] [layer_names]

View File

@ -1,40 +1,38 @@
class_name QuestBuilderMissingTool class_name QuestBuilderMissingTool
extends Node extends QuestBase
@export var is_hammer_found:bool = false @export var is_hammer_found:bool = false
@export var is_hammer_delivered:bool = false @export var is_hammer_delivered:bool = false
@export var is_bridge_built:bool = false @export var is_bridge_built:bool = false
@export var is_completed:bool = false
@onready var bridge = %Bridge @onready var bridge = %Bridge
@onready var merchant: NonPlayerCharacter = %Merchant @onready var merchant: NonPlayerCharacter = %Merchant
var _bridge_transform:Transform3D = Transform3D.IDENTITY var _bridge_transform:Transform3D = Transform3D.IDENTITY
var _player:Player = null
var _merchant_conversation_actionable:ConversationActionable = null var _merchant_conversation_actionable:ConversationActionable = null
signal wrench_delivered signal wrench_delivered
func _ready(): func _ready():
super._ready()
_bridge_transform = bridge.global_transform _bridge_transform = bridge.global_transform
bridge.global_transform = Transform3D.IDENTITY.translated(Vector3.UP * -1000) bridge.global_transform = Transform3D.IDENTITY.translated(Vector3.UP * -1000)
_player = get_tree().root.find_child("Player", true, false)
_merchant_conversation_actionable = merchant.find_child("Conversation", true, false) _merchant_conversation_actionable = merchant.find_child("Conversation", true, false)
assert(_merchant_conversation_actionable != null) assert(_merchant_conversation_actionable != null)
_merchant_conversation_actionable.conversation_started.connect(on_dialogue_started) _merchant_conversation_actionable.conversation_started.connect(on_dialogue_started)
func on_dialogue_started() -> void: func on_dialogue_started() -> void:
_player.is_conversation_active = true _player.is_input_blocked = true
func on_dialogue_ended(_dialog_resource: DialogueResource) -> void: func on_dialogue_ended(_dialog_resource: DialogueResource) -> void:
_player.is_conversation_active = false _player.is_input_blocked = false
if is_completed: if is_completed:
return return
if is_hammer_delivered and not is_bridge_built: if is_hammer_delivered and not is_bridge_built:
print ("Will build bridge!")
wrench_delivered.emit() wrench_delivered.emit()

View File

@ -0,0 +1,16 @@
class_name QuestNeedSomeSeeds
extends QuestBase
@export var is_seeds_found:bool = false
@export var is_seeds_delivered:bool = false
func _process(_delta):
if is_completed:
return
var seeds_item:ItemResource = load("res://data/items/seeds.tres")
if _player.inventory.has_all([seeds_item]):
is_seeds_found = true
if is_seeds_delivered:
is_completed = true

View File

@ -109,10 +109,10 @@ func load_game():
player.global_transform = save_data.player_transform player.global_transform = save_data.player_transform
# Quest state # Quest state
for node:Node in get_tree().get_nodes_in_group("quest_state"): for quest_state:Node in get_tree().get_nodes_in_group("quest_state"):
for property in node.get_property_list(): for property in quest_state.get_property_list():
if (property.usage & PROPERTY_USAGE_STORAGE != 0) and (property.usage & PROPERTY_USAGE_SCRIPT_VARIABLE) != 0: if (property.usage & PROPERTY_USAGE_STORAGE != 0) and (property.usage & PROPERTY_USAGE_SCRIPT_VARIABLE) != 0 and (save_data.quest_states.has(quest_state.name)) and (save_data.quest_states[quest_state.name].has(property.name)):
node.set(property.name, save_data.quest_states[node.name][property.name]) quest_state.set(property.name, save_data.quest_states[quest_state.name][property.name])
# Inventory # Inventory
player.inventory.clear() player.inventory.clear()

9
systems/QuestBase.gd Normal file
View File

@ -0,0 +1,9 @@
class_name QuestBase
extends Node
@export var is_completed:bool = false
var _player:Player = null
func _ready():
_player = get_tree().root.find_child("Player", true, false)