Compare commits

..

6 Commits

Author SHA1 Message Date
kziolkowski 762a694be3 Spawning and watering is now bound to the cursor position (kinda) 2025-04-25 00:13:50 +02:00
kziolkowski 339428c312 Basic watering functionality implemented 2025-04-24 23:36:23 +02:00
kziolkowski 7e19268847 Merge remote-tracking branch 'origin/main' into c_sharp_setup
# Conflicts:
#	scripts/CSharp/Common/CharacterControls/VesnaBehaviour.cs.uid
#	scripts/CSharp/Common/Farming/FieldService.cs.uid
2025-04-24 21:22:56 +02:00
kziolkowski 20b37de108 generated files 2025-04-24 21:22:14 +02:00
kziolkowski 7d1187d218 Merge pull request 'inventory' (#3) from inventory into main
Reviewed-on: #3
Reviewed-by: kziolkowski <katharina.ziolkowski@gmail.com>
2025-04-24 21:18:13 +02:00
kziolkowski c73d3ff370 Reworked the fieldservice 2025-04-14 18:00:10 +02:00
37 changed files with 174 additions and 372 deletions
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="RiderAndroidProjectSystem" />
</component>
</project>
+10
View File
@@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="GdSdk Master" type="GdScript">
<properties path="$USER_HOME$/.cache/JetBrains/Rider2025.1/projects/.idea.babushka.a4de4632/sdk/GdSdk Master" version="Master" date="2024-06-01T15:14:16.000+02:00" />
<CLASSES />
<JAVADOC />
<SOURCES>
<root url="file://$USER_HOME$/.cache/JetBrains/Rider2025.1/projects/.idea.babushka.a4de4632/sdk/GdSdk Master" />
</SOURCES>
</library>
</component>
+2 -1
View File
@@ -1,2 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArea3D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F8a54226fa2e1c9371a8091f24cfd744aef11fe6869527dc23b9b837623a29b9_003FArea3D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArea3D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F8a54226fa2e1c9371a8091f24cfd744aef11fe6869527dc23b9b837623a29b9_003FArea3D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACastHelpers_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fd111abf504bf42b5968a609b168fd093b2e200_003Fbb_003F1c116fcd_003FCastHelpers_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
@@ -3,25 +3,26 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://csig0r8rffflt" uid="uid://csig0r8rffflt"
path="res://.godot/imported/fence part end part.png-eb57fa6bd3b30e6dbbabec560b997ff4.ctex" path.s3tc="res://.godot/imported/fence part end part.png-eb57fa6bd3b30e6dbbabec560b997ff4.s3tc.ctex"
metadata={ metadata={
"vram_texture": false "imported_formats": ["s3tc_bptc"],
"vram_texture": true
} }
[deps] [deps]
source_file="res://art/farm/farming/farmobjekte/zaun/fence part end part.png" source_file="res://art/farm/farming/farmobjekte/zaun/fence part end part.png"
dest_files=["res://.godot/imported/fence part end part.png-eb57fa6bd3b30e6dbbabec560b997ff4.ctex"] dest_files=["res://.godot/imported/fence part end part.png-eb57fa6bd3b30e6dbbabec560b997ff4.s3tc.ctex"]
[params] [params]
compress/mode=0 compress/mode=2
compress/high_quality=false compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=true
mipmaps/limit=-1 mipmaps/limit=-1
roughness/mode=0 roughness/mode=0
roughness/src_normal="" roughness/src_normal=""
@@ -31,4 +32,4 @@ process/normal_map_invert_y=false
process/hdr_as_srgb=false process/hdr_as_srgb=false
process/hdr_clamp_exposure=false process/hdr_clamp_exposure=false
process/size_limit=0 process/size_limit=0
detect_3d/compress_to=1 detect_3d/compress_to=0
@@ -4,12 +4,11 @@ importer="scene"
importer_version=1 importer_version=1
type="PackedScene" type="PackedScene"
uid="uid://b3kyrsoobmkhp" uid="uid://b3kyrsoobmkhp"
path="res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn" valid=false
[deps] [deps]
source_file="res://art/mockups/3d/best_house_blender.blend" source_file="res://art/mockups/3d/best_house_blender.blend"
dest_files=["res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"]
[params] [params]
+3 -2
View File
@@ -1,7 +1,7 @@
[gd_scene load_steps=303 format=3 uid="uid://dbd1niu3tp8y5"] [gd_scene load_steps=303 format=3 uid="uid://dbd1niu3tp8y5"]
[ext_resource type="Script" uid="uid://b4ugrget2x6lb" path="res://scripts/CSharp/Common/CharacterControls/Player3D.cs" id="1_3trg2"] [ext_resource type="Script" uid="uid://b4ugrget2x6lb" path="res://scripts/CSharp/Common/CharacterControls/Player3D.cs" id="1_3trg2"]
[ext_resource type="Script" uid="uid://xm0um640aes7" path="res://scripts/CSharp/Common/CharacterControls/VesnaBehaviour.cs" id="1_pkl5l"] [ext_resource type="Script" uid="uid://bblprbhnbyv77" path="res://scripts/CSharp/Common/CharacterControls/VesnaBehaviour.cs" id="1_pkl5l"]
[ext_resource type="Texture2D" uid="uid://duaideiajsu8r" path="res://art/characters/Vesna/babushka concept art vesna.png" id="2_3trg2"] [ext_resource type="Texture2D" uid="uid://duaideiajsu8r" path="res://art/characters/Vesna/babushka concept art vesna.png" id="2_3trg2"]
[ext_resource type="PackedScene" uid="uid://biwd3jj65qrlh" path="res://prefabs/farming/base_field.tscn" id="2_oq5hi"] [ext_resource type="PackedScene" uid="uid://biwd3jj65qrlh" path="res://prefabs/farming/base_field.tscn" id="2_oq5hi"]
[ext_resource type="Texture2D" uid="uid://c4ggew55w0icj" path="res://art/farm/farming/farmobjekte/harke.png" id="4_kngqo"] [ext_resource type="Texture2D" uid="uid://c4ggew55w0icj" path="res://art/farm/farming/farmobjekte/harke.png" id="4_kngqo"]
@@ -1337,10 +1337,11 @@ sprite_frames = SubResource("SpriteFrames_4q8ml")
autoplay = "default" autoplay = "default"
frame_progress = 0.481133 frame_progress = 0.481133
[node name="FarmingControls" type="Node3D" parent="." node_paths=PackedStringArray("_hoeSprite", "_wateringCanSprite", "_movingPlayer")] [node name="FarmingControls" type="Node3D" parent="." node_paths=PackedStringArray("_hoeSprite", "_wateringCanSprite", "_movingPlayer", "_camera")]
script = ExtResource("4_q5t2e") script = ExtResource("4_q5t2e")
_hoeSprite = NodePath("../CharacterBody3D/Farming/Hoe") _hoeSprite = NodePath("../CharacterBody3D/Farming/Hoe")
_wateringCanSprite = NodePath("../CharacterBody3D/Farming/Watering can") _wateringCanSprite = NodePath("../CharacterBody3D/Farming/Watering can")
_fieldPrefab = ExtResource("2_oq5hi") _fieldPrefab = ExtResource("2_oq5hi")
_movingPlayer = NodePath("../CharacterBody3D") _movingPlayer = NodePath("../CharacterBody3D")
_camera = NodePath("../CharacterBody3D/CameraPivot2/SubPivot/Camera3D")
metadata/_custom_type_script = "uid://b1sscdr4ptec8" metadata/_custom_type_script = "uid://b1sscdr4ptec8"
+1 -1
View File
@@ -1,6 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://cgjc4wurbgimy"] [gd_scene load_steps=5 format=3 uid="uid://cgjc4wurbgimy"]
[ext_resource type="Script" uid="uid://b7vlkecrn0t5c" path="res://scripts/CSharp/Common/Inventory/InventoryUi.cs" id="1_6wusm"] [ext_resource type="Script" uid="uid://hg7jay2kt441" path="res://scripts/CSharp/Common/Inventory/InventoryUi.cs" id="1_6wusm"]
[ext_resource type="Script" uid="uid://b2jhdxcrhtm2d" path="res://scripts/CSharp/Common/Inventory/InventoryTestScript.cs" id="3_exrk4"] [ext_resource type="Script" uid="uid://b2jhdxcrhtm2d" path="res://scripts/CSharp/Common/Inventory/InventoryTestScript.cs" id="3_exrk4"]
[ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/pickaxe.tres" id="4_5fdxq"] [ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/pickaxe.tres" id="4_5fdxq"]
[ext_resource type="Texture2D" uid="uid://c7wqla0mbu3np" path="res://graphics/ui/babushka_ui_tmp_inventory_select.png" id="4_tiss4"] [ext_resource type="Texture2D" uid="uid://c7wqla0mbu3np" path="res://graphics/ui/babushka_ui_tmp_inventory_select.png" id="4_tiss4"]
+10 -6
View File
@@ -1,7 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://biwd3jj65qrlh"] [gd_scene load_steps=7 format=3 uid="uid://biwd3jj65qrlh"]
[ext_resource type="Texture2D" uid="uid://c2pirgay3jfnn" path="res://art/farm/tilable grounds/böden/trockene farming erde.png" id="1_2cisk"] [ext_resource type="Texture2D" uid="uid://c2pirgay3jfnn" path="res://art/farm/tilable grounds/böden/trockene farming erde.png" id="1_2cisk"]
[ext_resource type="Script" uid="uid://histmmyi1wr" path="res://scripts/CSharp/Common/Farming/FieldBehaviour.cs" id="2_u7egi"] [ext_resource type="Script" uid="uid://histmmyi1wr" path="res://scripts/CSharp/Common/Farming/FieldBehaviour.cs" id="2_u7egi"]
[ext_resource type="Texture2D" uid="uid://ctvdxwgmfaj5c" path="res://art/farm/tilable grounds/böden/nasse farming erde.png" id="4_lsseu"]
[ext_resource type="PackedScene" uid="uid://bjhj1wa5olwcu" path="res://prefabs/farming/base_plant.tscn" id="4_u7egi"] [ext_resource type="PackedScene" uid="uid://bjhj1wa5olwcu" path="res://prefabs/farming/base_plant.tscn" id="4_u7egi"]
[ext_resource type="PackedScene" uid="uid://ob04y3syvo0e" path="res://prefabs/interaction_area.tscn" id="4_xc4m0"] [ext_resource type="PackedScene" uid="uid://ob04y3syvo0e" path="res://prefabs/interaction_area.tscn" id="4_xc4m0"]
@@ -18,17 +19,20 @@ _showLabel = false
[node name="CollisionShape3D" parent="InteractionArea/Area3D" index="0"] [node name="CollisionShape3D" parent="InteractionArea/Area3D" index="0"]
shape = SubResource("SphereShape3D_u7egi") shape = SubResource("SphereShape3D_u7egi")
[node name="Sprite3D" type="Sprite3D" parent="."] [node name="FieldBehaviour" type="Sprite3D" parent="."]
transform = Transform3D(0.4, 0, 0, 0, -1.74846e-08, -0.4, 0, 0.4, -1.74846e-08, 0, 0, 0) transform = Transform3D(0.4, 0, 0, 0, -1.74846e-08, -0.4, 0, 0.4, -1.74846e-08, 0, 0, 0)
pixel_size = 0.004 pixel_size = 0.004
texture = ExtResource("1_2cisk")
script = ExtResource("2_u7egi") script = ExtResource("2_u7egi")
Tilled = ExtResource("1_2cisk") Tilled = ExtResource("1_2cisk")
Watered = ExtResource("4_lsseu")
FieldState = 1 FieldState = 1
metadata/_custom_type_script = "uid://histmmyi1wr"
[node name="BasePlant" parent="Sprite3D" instance=ExtResource("4_u7egi")] [node name="BasePlant" parent="FieldBehaviour" node_paths=PackedStringArray("_seeds", "_smallPlants", "_bigPlants", "_readyPlants") instance=ExtResource("4_u7egi")]
transform = Transform3D(0.5, 0, 0, 0, -2.18557e-08, 0.5, 0, -0.5, -2.18557e-08, 0, 0, 0) transform = Transform3D(0.5, 0, 0, 0, -2.18557e-08, 0.5, 0, -0.5, -2.18557e-08, 0, 0, 0)
_seeds = [null, null, null]
[connection signal="Interacted" from="InteractionArea" to="Sprite3D/BasePlant" method="Grow"] _smallPlants = [null, null, null, null]
_bigPlants = [null, null, null, null]
_readyPlants = [null, null, null, null]
[editable path="InteractionArea"] [editable path="InteractionArea"]
@@ -1,6 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://bs3vs05wp5a20"]
[ext_resource type="Script" uid="uid://cpbv0b3ahorep" path="res://scripts/CSharp/Common/WorldManagement/WorldChangeTrigger.cs" id="1_wqqyh"]
[node name="WorldChangeTrigger" type="Area3D"]
script = ExtResource("1_wqqyh")
+5 -1
View File
@@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="Babushka" config/name="Babushka"
run/main_scene="uid://dbgkbil1ultks" run/main_scene="uid://br7yq757cawts"
config/features=PackedStringArray("4.4", "C#", "Forward Plus") config/features=PackedStringArray("4.4", "C#", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
@@ -66,6 +66,10 @@ translation/id_counter=22
translation/locales=["de", "en"] translation/locales=["de", "en"]
text/autopauses={} text/autopauses={}
[display]
window/size/always_on_top=true
[dotnet] [dotnet]
project/assembly_name="Babushka" project/assembly_name="Babushka"
-1
View File
@@ -6,5 +6,4 @@
script = ExtResource("1_07aya") script = ExtResource("1_07aya")
name = "Pick Axe" name = "Pick Axe"
color = Color(0.589014, 0.823353, 0.998475, 1) color = Color(0.589014, 0.823353, 0.998475, 1)
maxStack = 1
metadata/_custom_type_script = "uid://cbskymrxs6ksu" metadata/_custom_type_script = "uid://cbskymrxs6ksu"
@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="SpawnPointResource" load_steps=2 format=3 uid="uid://cipetn2hmnew4"]
[ext_resource type="Script" uid="uid://cjr2efpm660kr" path="res://scripts/CSharp/Common/WorldManagement/SpawnPointResource.cs" id="1_ymkjy"]
[resource]
script = ExtResource("1_ymkjy")
name = ""
metadata/_custom_type_script = "uid://cjr2efpm660kr"
@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="SpawnPointResource" load_steps=2 format=3 uid="uid://daow8nx85vuc8"]
[ext_resource type="Script" uid="uid://cjr2efpm660kr" path="res://scripts/CSharp/Common/WorldManagement/SpawnPointResource.cs" id="1_kdbco"]
[resource]
script = ExtResource("1_kdbco")
name = "GameStart"
metadata/_custom_type_script = "uid://cjr2efpm660kr"
-8
View File
@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="SpawnPointResource" load_steps=2 format=3 uid="uid://dissbtj4nflu5"]
[ext_resource type="Script" uid="uid://cjr2efpm660kr" path="res://scripts/CSharp/Common/WorldManagement/SpawnPointResource.cs" id="1_vyl4c"]
[resource]
script = ExtResource("1_vyl4c")
name = "tmp1"
metadata/_custom_type_script = "uid://cjr2efpm660kr"
-21
View File
@@ -1,21 +0,0 @@
[gd_scene load_steps=6 format=3 uid="uid://dbgkbil1ultks"]
[ext_resource type="Script" uid="uid://g338f4yomfo3" path="res://scripts/CSharp/Common/WorldManagement/WorldContainer.cs" id="1_l112d"]
[ext_resource type="PackedScene" uid="uid://dbxy2y85r1d8x" path="res://scenes/worlds/Babushka_world_item_pickup_testing.tscn" id="2_akoq3"]
[ext_resource type="PackedScene" uid="uid://dbd1niu3tp8y5" path="res://prefabs/Player3D.tscn" id="2_l45op"]
[ext_resource type="Resource" uid="uid://daow8nx85vuc8" path="res://resources/spawnpoints/spawnpoint_game_start.tres" id="3_4ix36"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="3_akoq3"]
[node name="BabushkaSceneMain" type="Node"]
[node name="WorldContainer" type="Node" parent="."]
script = ExtResource("1_l112d")
startingWorld = ExtResource("2_akoq3")
startingSpawnPoint = ExtResource("3_4ix36")
[node name="Player3d" parent="." instance=ExtResource("2_l45op")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.51633, 0.725631, 3.57249)
[node name="Inventory" parent="." instance=ExtResource("3_akoq3")]
[connection signal="WorldChanged" from="WorldContainer" to="Player3d" method="TeleportTo"]
@@ -1,17 +1,13 @@
[gd_scene load_steps=17 format=3 uid="uid://dbxy2y85r1d8x"] [gd_scene load_steps=12 format=3 uid="uid://dbxy2y85r1d8x"]
[ext_resource type="Script" uid="uid://6aq8mr0sofrs" path="res://scripts/CSharp/Common/WorldManagement/World.cs" id="1_jnel3"] [ext_resource type="PackedScene" uid="uid://dbd1niu3tp8y5" path="res://prefabs/Player3D.tscn" id="1_pdc5e"]
[ext_resource type="PackedScene" uid="uid://biwd3jj65qrlh" path="res://prefabs/farming/base_field.tscn" id="2_741gk"] [ext_resource type="PackedScene" uid="uid://biwd3jj65qrlh" path="res://prefabs/farming/base_field.tscn" id="2_741gk"]
[ext_resource type="PackedScene" uid="uid://5hltxpdxmqcq" path="res://prefabs/interactions/generic_item_on_ground.tscn" id="5_sjt6k"] [ext_resource type="PackedScene" uid="uid://5hltxpdxmqcq" path="res://prefabs/interactions/generic_item_on_ground.tscn" id="5_sjt6k"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="6_876p1"]
[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/bucket.tres" id="6_nvnpb"] [ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/bucket.tres" id="6_nvnpb"]
[ext_resource type="Script" uid="uid://12hleqx8amr8" path="res://scripts/CSharp/Common/Farming/FieldService.cs" id="7_3rkjv"] [ext_resource type="Script" uid="uid://c6hh7m8wikv04" path="res://scripts/CSharp/Common/Farming/FieldService.cs" id="7_3rkjv"]
[ext_resource type="Resource" uid="uid://c5yg3lx756v4v" path="res://resources/items/hoe.tres" id="7_hv2km"] [ext_resource type="Resource" uid="uid://c5yg3lx756v4v" path="res://resources/items/hoe.tres" id="7_hv2km"]
[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="8_hv2km"] [ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="8_hv2km"]
[ext_resource type="Script" uid="uid://c7eaa0neniiss" path="res://scripts/CSharp/Common/WorldManagement/SpawnPointMarker.cs" id="8_w0pbi"]
[ext_resource type="Resource" uid="uid://daow8nx85vuc8" path="res://resources/spawnpoints/spawnpoint_game_start.tres" id="9_sal3e"]
[ext_resource type="Resource" uid="uid://cipetn2hmnew4" path="res://resources/spawnpoints/from_test_scene.tres" id="10_sal3e"]
[ext_resource type="PackedScene" uid="uid://bs3vs05wp5a20" path="res://prefabs/world_elements/world_change_trigger.tscn" id="11_43jow"]
[ext_resource type="PackedScene" uid="uid://cidjhvp38n4b4" path="res://scenes/worlds/babushka_world_level_change_test.tscn" id="12_oux87"]
[sub_resource type="PlaneMesh" id="PlaneMesh_8yprl"] [sub_resource type="PlaneMesh" id="PlaneMesh_8yprl"]
@@ -21,11 +17,7 @@ albedo_color = Color(0.505882, 0.588235, 0.494118, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_t58di"] [sub_resource type="BoxShape3D" id="BoxShape3D_t58di"]
size = Vector3(2.01563, 0.160522, 2.00824) size = Vector3(2.01563, 0.160522, 2.00824)
[sub_resource type="BoxShape3D" id="BoxShape3D_oux87"] [node name="SceneFarmVesna" type="Node3D"]
size = Vector3(1, 1, 2.94604)
[node name="WorldItemPickupTest" type="Node3D"]
script = ExtResource("1_jnel3")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0) transform = Transform3D(10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0)
@@ -39,6 +31,10 @@ surface_material_override/0 = SubResource("StandardMaterial3D_8tgff")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.000976563, -0.0739136, -0.00112915) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.000976563, -0.0739136, -0.00112915)
shape = SubResource("BoxShape3D_t58di") shape = SubResource("BoxShape3D_t58di")
[node name="Player3d" parent="." node_paths=PackedStringArray("_fieldParent") instance=ExtResource("1_pdc5e")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.51633, 0.725631, 3.57249)
_fieldParent = NodePath("../FieldService")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.618408, 0.785857, 0, -0.785857, 0.618408, -0.802612, 0, 4.73262) transform = Transform3D(1, 0, 0, 0, 0.618408, 0.785857, 0, -0.785857, 0.618408, -0.802612, 0, 4.73262)
@@ -46,6 +42,8 @@ transform = Transform3D(1, 0, 0, 0, 0.618408, 0.785857, 0, -0.785857, 0.618408,
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0.0574723, 0) transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0.0574723, 0)
visible = false visible = false
[node name="Inventory" parent="." instance=ExtResource("6_876p1")]
[node name="FieldService" type="Node3D" parent="."] [node name="FieldService" type="Node3D" parent="."]
script = ExtResource("7_3rkjv") script = ExtResource("7_3rkjv")
@@ -71,28 +69,6 @@ _infiniteSupply = true
[node name="SpawnWithItem" parent="GenericItemOnGround4" index="1"] [node name="SpawnWithItem" parent="GenericItemOnGround4" index="1"]
_blueprint = ExtResource("8_hv2km") _blueprint = ExtResource("8_hv2km")
[node name="Spawnpoint" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.87715, 0, 1.54015)
script = ExtResource("8_w0pbi")
spawnPointResource = ExtResource("9_sal3e")
[node name="Spawnpoint tmp" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.3672, 0, 0.113484)
script = ExtResource("8_w0pbi")
spawnPointResource = ExtResource("10_sal3e")
[node name="WorldChangeTrigger" parent="." instance=ExtResource("11_43jow")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.78829, 0.546566, -0.241783)
collision_mask = 17
switchToWorld = ExtResource("12_oux87")
switchToSpawnPoint = ExtResource("10_sal3e")
[node name="CollisionShape3D" type="CollisionShape3D" parent="WorldChangeTrigger"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.193655, 0, 0.233521)
shape = SubResource("BoxShape3D_oux87")
[connection signal="area_entered" from="WorldChangeTrigger" to="WorldChangeTrigger" method="AreaEnteredHandler"]
[editable path="GenericItemOnGround"] [editable path="GenericItemOnGround"]
[editable path="GenericItemOnGround2"] [editable path="GenericItemOnGround2"]
[editable path="GenericItemOnGround3"] [editable path="GenericItemOnGround3"]
@@ -1,56 +0,0 @@
[gd_scene load_steps=11 format=3 uid="uid://cidjhvp38n4b4"]
[ext_resource type="Script" uid="uid://6aq8mr0sofrs" path="res://scripts/CSharp/Common/WorldManagement/World.cs" id="1_nat7a"]
[ext_resource type="PackedScene" uid="uid://bs3vs05wp5a20" path="res://prefabs/world_elements/world_change_trigger.tscn" id="5_tb7xe"]
[ext_resource type="PackedScene" uid="uid://dbxy2y85r1d8x" path="res://scenes/worlds/Babushka_world_item_pickup_testing.tscn" id="6_evakd"]
[ext_resource type="Script" uid="uid://c7eaa0neniiss" path="res://scripts/CSharp/Common/WorldManagement/SpawnPointMarker.cs" id="8_pl6uc"]
[ext_resource type="Resource" uid="uid://daow8nx85vuc8" path="res://resources/spawnpoints/spawnpoint_game_start.tres" id="9_rutwt"]
[ext_resource type="Resource" uid="uid://cipetn2hmnew4" path="res://resources/spawnpoints/from_test_scene.tres" id="10_s5gm8"]
[sub_resource type="PlaneMesh" id="PlaneMesh_8yprl"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8tgff"]
albedo_color = Color(0.505882, 0.588235, 0.494118, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_t58di"]
size = Vector3(2.01563, 0.160522, 2.00824)
[sub_resource type="BoxShape3D" id="BoxShape3D_tydq3"]
size = Vector3(1, 1, 6.21814)
[node name="WorldItemPickupTest" type="Node3D"]
script = ExtResource("1_nat7a")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0)
mesh = SubResource("PlaneMesh_8yprl")
skeleton = NodePath("")
surface_material_override/0 = SubResource("StandardMaterial3D_8tgff")
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.000976563, -0.0739136, -0.00112915)
shape = SubResource("BoxShape3D_t58di")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.618408, 0.785857, 0, -0.785857, 0.618408, -0.802612, 0, 4.73262)
[node name="Spawnpoint" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.87715, 0, 1.54015)
script = ExtResource("8_pl6uc")
spawnPointResource = ExtResource("9_rutwt")
[node name="Spawnpoint tmp" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.00564, 0, 0.0870138)
script = ExtResource("8_pl6uc")
spawnPointResource = ExtResource("10_s5gm8")
[node name="WorldChangeTrigger" parent="." instance=ExtResource("5_tb7xe")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.82414, 0, 0)
switchToWorld = ExtResource("6_evakd")
switchToSpawnPoint = ExtResource("10_s5gm8")
[node name="CollisionShape3D" type="CollisionShape3D" parent="WorldChangeTrigger"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.235657)
shape = SubResource("BoxShape3D_tydq3")
@@ -129,11 +129,5 @@ public partial class Player3D : CharacterBody3D
animatedSprite.Visible = false; animatedSprite.Visible = false;
} }
} }
public void Teleport(Vector3 newPosition)
{
GlobalPosition = newPosition;
ResetPhysicsInterpolation();
GD.Print("Player Teleported");
}
} }
@@ -15,11 +15,6 @@ public partial class VesnaBehaviour : Node
{ {
_farmingControls.FieldParent = _fieldParent; _farmingControls.FieldParent = _fieldParent;
} }
public void TeleportTo(Vector3 newPosition)
{
GetNode<Player3D>("CharacterBody3D").Teleport(newPosition);
}
#region Farming #region Farming
@@ -1 +1 @@
uid://xm0um640aes7 uid://bblprbhnbyv77
@@ -1,5 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Godot; using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Farming; namespace Babushka.scripts.CSharp.Common.Farming;
@@ -10,6 +13,7 @@ public partial class FarmingControls : Node3D
[Export] private Sprite3D _wateringCanSprite; [Export] private Sprite3D _wateringCanSprite;
[Export] private PackedScene _fieldPrefab; [Export] private PackedScene _fieldPrefab;
[Export] private Node3D _movingPlayer; [Export] private Node3D _movingPlayer;
[Export] private Camera3D _camera;
public FieldService FieldParent; public FieldService FieldParent;
@@ -42,45 +46,63 @@ public partial class FarmingControls : Node3D
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)
{ {
if (@event.IsActionPressed("click") && _hoeInHand) Vector2 mousePosition = GetViewport().GetMousePosition();
{ var dropPlane = new Plane(new Vector3(0, 0, 10), 10);
MakeField(); Vector3? position3D = dropPlane.IntersectsRay(_camera.ProjectRayOrigin(mousePosition),
} _camera.ProjectRayNormal(mousePosition));
Debug.Print(position3D.ToString());
if (@event.IsActionPressed("click") && _waterCanInHand) if (position3D.HasValue)
{ {
WaterTheField(); Vector2I adjustedPosition = new Vector2I(AdjustValue(position3D.Value.X), AdjustValue(position3D.Value.Y));
if (@event.IsActionPressed("click") && _hoeInHand)
{
MakeField(adjustedPosition);
}
if (@event.IsActionPressed("click") && _waterCanInHand)
{
WaterTheField(adjustedPosition);
}
} }
} }
private void WaterTheField() private void WaterTheField(Vector2I fieldPosition)
{ {
FieldBehaviour field = FieldParent.Get(fieldPosition);
if (field == null)
return;
field.Water();
} }
private void MakeField() private void MakeField(Vector2I fieldPosition)
{ {
if(FieldParent == null || _fieldPrefab == null) if(FieldParent == null || _fieldPrefab == null)
return; return;
Node fieldInstance = _fieldPrefab.Instantiate();
if (fieldInstance is Node3D field3d) // only instantiate a field if there isn't one already.
if(FieldParent.Get(fieldPosition) == null)
{ {
Vector3 playerPos = _movingPlayer.GlobalPosition; Node fieldInstance = _fieldPrefab.Instantiate();
playerPos = new Vector3(AdjustValue(playerPos.X), 0.1f, AdjustValue(playerPos.Z)); if (fieldInstance is Node3D field3d)
field3d.Position = playerPos; {
Vector2I intPosition = new Vector2I((int) playerPos.X, (int) playerPos.Z); // add dictionary entry for the field
FieldParent.AddEntry(intPosition, FieldState.Tilled); Array<Node> fields = field3d.FindChildren("*", nameof(FieldBehaviour));
if (fields.Count > 0)
FieldParent.TryAddEntry(fieldPosition, fields[0] as FieldBehaviour);
// reposition and reparent the instance
field3d.Position = new Vector3(fieldPosition.X, 0.1f, fieldPosition.Y * -1);;
FieldParent.AddChild(fieldInstance);
}
} }
FieldParent.AddChild(fieldInstance);
} }
private float AdjustValue(float value) private int AdjustValue(float value)
{ {
return Mathf.Floor(value); return (int) Mathf.Floor(value);
} }
} }
+54 -49
View File
@@ -1,54 +1,59 @@
using System.Diagnostics;
using Godot; using Godot;
namespace Babushka.scripts.CSharp.Common.Farming; namespace Babushka.scripts.CSharp.Common.Farming
public enum FieldState
{ {
Empty = 0, public enum FieldState
Tilled = 1, {
Planted = 2, Empty = 0,
Watered = 3 Tilled = 1,
Planted = 2,
Watered = 3,
NotFound = 99
}
[GlobalClass]
public partial class FieldBehaviour : Sprite3D
{
[Export] private Texture2D Tilled;
[Export] private Texture2D Watered;
[Export] public FieldState FieldState = FieldState.Empty;
public Vector2 FieldPosition;
public override void _Ready()
{
Texture = Tilled;
base._Ready();
}
public void Water()
{
FieldState = FieldState.Watered;
Texture = Watered;
}
/// <summary>
/// Called when the player enters the field'S interaction area and presses <E>.
/// </summary>
public void Farm()
{
switch (FieldState)
{
case FieldState.Empty:
Texture = Tilled;
FieldState = FieldState.Tilled;
break;
case FieldState.Tilled:
FieldState = FieldState.Planted;
break;
case FieldState.Planted:
break;
default:
break;
}
}
}
} }
public partial class FieldBehaviour : Sprite3D
{
[Export] private Texture2D Tilled;
[Export] private Texture2D Watered;
[Export] private FieldState FieldState = FieldState.Empty;
public Vector2 FieldPosition;
public override void _Ready()
{
Texture = Tilled;
base._Ready();
}
public void Water()
{
FieldState = FieldState.Watered;
Texture = Watered;
}
/// <summary>
/// Called when the player enters the field'S interaction area and presses <E>.
/// </summary>
public void Farm()
{
switch (FieldState)
{
case FieldState.Empty:
Texture = Tilled;
FieldState = FieldState.Tilled;
break;
case FieldState.Tilled:
FieldState = FieldState.Planted;
break;
case FieldState.Planted:
break;
default:
break;
}
}
}
+17 -9
View File
@@ -1,3 +1,4 @@
using System.Diagnostics;
using Godot; using Godot;
using Godot.Collections; using Godot.Collections;
@@ -6,32 +7,39 @@ namespace Babushka.scripts.CSharp.Common.Farming;
[GlobalClass] [GlobalClass]
public partial class FieldService : Node3D public partial class FieldService : Node3D
{ {
[Export] private Dictionary<Vector2I, FieldState> fields = new Dictionary<Vector2I, FieldState>(); [Export] private Dictionary<Vector2I, FieldBehaviour> fields = new Dictionary<Vector2I, FieldBehaviour>();
//Create //Create
public bool TryAddEntry(Vector2I key, FieldBehaviour field)
public void AddEntry(Vector2I key, FieldState state)
{ {
fields.Add(key, state); if (!fields.ContainsKey(key))
{
fields.Add(key, field);
return true;
}
return false;
} }
// Read // Read
public FieldBehaviour Get(Vector2I key)
public FieldState Get(Vector2I key)
{ {
return fields[key]; if (fields.TryGetValue(key, out FieldBehaviour field))
return field;
return null;
} }
//Update //Update
public void UpdateEntry(Vector2I fieldPosition, FieldState state) public void UpdateEntry(Vector2I fieldPosition, FieldBehaviour state)
{ {
if (fields.ContainsKey(fieldPosition)) if (fields.ContainsKey(fieldPosition))
{ {
fields[fieldPosition] = state; fields[fieldPosition] = state;
} }
else else
{ {
AddEntry(fieldPosition, state); TryAddEntry(fieldPosition, state);
} }
} }
@@ -1 +1 @@
uid://12hleqx8amr8 uid://c6hh7m8wikv04
@@ -1 +0,0 @@
uid://b7vlkecrn0t5c
@@ -0,0 +1 @@
uid://hg7jay2kt441
@@ -1 +0,0 @@
uid://bb4fc5y43ksfg
@@ -1,8 +0,0 @@
using Godot;
using System;
using Babushka.scripts.CSharp.Common.WorldManagement;
public partial class SpawnPointMarker : Node3D
{
[Export] public SpawnPointResource spawnPointResource;
}
@@ -1 +0,0 @@
uid://c7eaa0neniiss
@@ -1,14 +0,0 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.WorldManagement;
[GlobalClass]
public partial class SpawnPointResource : Resource
{
[Export] public string name;
public SpawnPointResource()
{
name = "";
}
}
@@ -1 +0,0 @@
uid://cjr2efpm660kr
@@ -1,21 +0,0 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
using Babushka.scripts.CSharp.Common.WorldManagement;
public partial class World : Node
{
public IReadOnlyDictionary<SpawnPointResource, SpawnPointMarker> SpawnPoints;
public override void _EnterTree()
{
GD.Print("World Enter Tree");
// find all child nodes of type SpawnPoint
SpawnPoints = FindChildren("*")
.OfType<SpawnPointMarker>()
.Select(sp => new KeyValuePair<SpawnPointResource, SpawnPointMarker>(sp.spawnPointResource, sp))
.ToDictionary();
}
}
@@ -1 +0,0 @@
uid://6aq8mr0sofrs
@@ -1,26 +0,0 @@
using Godot;
using System;
using Babushka.scripts.CSharp.Common.WorldManagement;
public partial class WorldChangeTrigger : Area3D
{
[Export] private PackedScene switchToWorld;
[Export] private SpawnPointResource switchToSpawnPoint;
public override void _EnterTree()
{
//AreaEntered += AreaEnteredHandler;
}
public override void _ExitTree()
{
//AreaEntered -= AreaEnteredHandler;
}
public void AreaEnteredHandler(Area3D area)
{
GD.Print("Area Entered");
var worldContainer = (WorldContainer)FindParent("WorldContainer");
worldContainer.SwitchWorld(switchToWorld, switchToSpawnPoint);
}
}
@@ -1 +0,0 @@
uid://cpbv0b3ahorep
@@ -1,41 +0,0 @@
using Godot;
using System;
using System.Linq;
using Babushka.scripts.CSharp.Common.WorldManagement;
public partial class WorldContainer : Node
{
[Export] private PackedScene startingWorld;
[Export] private SpawnPointResource startingSpawnPoint;
[Signal] public delegate void WorldChangedEventHandler(Vector3 spawnPointPosition);
public void SwitchWorld(PackedScene newWorldScene, SpawnPointResource spawnPoint)
{
// Unload the current world
if (GetChildCount() > 0)
{
GetChild(0).QueueFree();
}
// Load the new world
var newWorld = newWorldScene.Instantiate<World>();
AddChild(newWorld);
// Switch to the new spawn point
if (newWorld.SpawnPoints.TryGetValue(spawnPoint, out var spawnPointMarker))
{
EmitSignalWorldChanged(spawnPointMarker.GlobalPosition);
}
else
{
GD.PrintErr("Selected spawn point not found in the new world.");
EmitSignalWorldChanged(newWorld.SpawnPoints.First().Value.GlobalPosition);
}
}
public override void _Ready()
{
SwitchWorld(startingWorld,startingSpawnPoint);
}
}
@@ -1 +0,0 @@
uid://g338f4yomfo3