5 Commits

Author SHA1 Message Date
Matteo Sonaglioni
be320d3881 Merge branch 'main' into polish2 2026-05-11 15:29:31 +02:00
Matteo Sonaglioni
4e9a5bc24d add river chunk 2026-05-07 22:10:36 +02:00
Matteo Sonaglioni
1d03bb0156 chunk zen garden 2026-05-07 19:14:21 +02:00
Matteo Sonaglioni
36ce503aca river curve chunk 2 2026-05-07 02:45:51 +02:00
d22479bae4 Merge pull request 'main' (#13) from main into polish2
Reviewed-on: #13
2026-05-06 20:30:18 +00:00
411 changed files with 698 additions and 41728 deletions

View File

@@ -2,7 +2,6 @@ extends CharacterBody3D
class_name AIBase class_name AIBase
@export_group("Settings")
@export var speed: float = 4.0 @export var speed: float = 4.0
var _enable_state_machine: bool = true var _enable_state_machine: bool = true
@export var enable_state_machine: bool: @export var enable_state_machine: bool:
@@ -11,19 +10,13 @@ var _enable_state_machine: bool = true
toggle_enable_state_machine() toggle_enable_state_machine()
get: get:
return _enable_state_machine return _enable_state_machine
@export var anim_player: AnimationPlayer
@export_group("Entities")
enum EntityType { HUMANOID, ANIMAL }
@export var entity_type: EntityType = EntityType.HUMANOID
@export var entity_name: String = ""
@export var allowed_biomes: Array[String] = []
@export_range(0.0, 100.0, 0.1) var spawn_uniqueness: float = 1.0
@onready var patrol_radius_shape: CollisionShape3D = $%PatrolRadiusShape @onready var patrol_radius_shape: CollisionShape3D = $%PatrolRadiusShape
@onready var nav_agent: NavigationAgent3D = $%NavigationAgent3D @onready var nav_agent: NavigationAgent3D = $%NavigationAgent3D
@onready var state_machine: StateMachine = $%StateMachine @onready var state_machine: StateMachine = $%StateMachine
func _ready() -> void: func _ready() -> void:
randomize() randomize()
toggle_enable_state_machine() toggle_enable_state_machine()
@@ -48,11 +41,6 @@ func _physics_process(delta: float) -> void:
velocity.x = direction.x * speed velocity.x = direction.x * speed
velocity.z = direction.z * speed velocity.z = direction.z * speed
if velocity.length_squared() > 0.1:
var look_dir = Vector3(velocity.x, 0, velocity.z)
var target_transform = global_transform.looking_at(global_position - look_dir, Vector3.UP)
global_transform = global_transform.interpolate_with(target_transform, delta * 10.0)
move_and_slide() move_and_slide()
func navigate_to_random_point() -> void: func navigate_to_random_point() -> void:

View File

@@ -2,6 +2,8 @@
[ext_resource type="Script" uid="uid://b30p1yqojbbbk" path="res://core/ai/agents/base/ai_base.gd" id="1_4d1nn"] [ext_resource type="Script" uid="uid://b30p1yqojbbbk" path="res://core/ai/agents/base/ai_base.gd" id="1_4d1nn"]
[ext_resource type="Script" uid="uid://ps3vlu2qvmop" path="res://core/ai/framework/state_machine.gd" id="2_q1hg3"] [ext_resource type="Script" uid="uid://ps3vlu2qvmop" path="res://core/ai/framework/state_machine.gd" id="2_q1hg3"]
[ext_resource type="Script" uid="uid://nga8qx56iwgu" path="res://core/ai/agents/base/idle_state.gd" id="3_26faq"]
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/agents/base/patrol_state.gd" id="4_lim44"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_mh3lg"] [sub_resource type="CapsuleMesh" id="CapsuleMesh_mh3lg"]
@@ -12,7 +14,6 @@ radius = 20.0
[node name="AiBase" type="CharacterBody3D" unique_id=1228675528] [node name="AiBase" type="CharacterBody3D" unique_id=1228675528]
script = ExtResource("1_4d1nn") script = ExtResource("1_4d1nn")
entity_name = "Humanoid"
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=214482161] [node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=214482161]
mesh = SubResource("CapsuleMesh_mh3lg") mesh = SubResource("CapsuleMesh_mh3lg")
@@ -23,9 +24,18 @@ shape = SubResource("CapsuleShape3D_mh3lg")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="." unique_id=1370024449] [node name="NavigationAgent3D" type="NavigationAgent3D" parent="." unique_id=1370024449]
unique_name_in_owner = true unique_name_in_owner = true
[node name="StateMachine" type="Node" parent="." unique_id=1286404264] [node name="StateMachine" type="Node" parent="." unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
unique_name_in_owner = true unique_name_in_owner = true
script = ExtResource("2_q1hg3") script = ExtResource("2_q1hg3")
initial_state = NodePath("IdleState")
[node name="IdleState" type="Node" parent="StateMachine" unique_id=763668255]
script = ExtResource("3_26faq")
state_id = &"idle"
[node name="PatrolState" type="Node" parent="StateMachine" unique_id=2054606629]
script = ExtResource("4_lim44")
state_id = &"patrol"
[node name="PatrolRadiusShape" type="CollisionShape3D" parent="." unique_id=1379515938] [node name="PatrolRadiusShape" type="CollisionShape3D" parent="." unique_id=1379515938]
unique_name_in_owner = true unique_name_in_owner = true

View File

@@ -0,0 +1,26 @@
extends State
const PATROL_STATE_ID: StringName = &"patrol"
@export var wait_time: float = 3.0
var runtime_timer: Timer
func enter() -> void:
runtime_timer = Timer.new()
runtime_timer.name = "IdleTimer"
add_child(runtime_timer)
runtime_timer.one_shot = true
runtime_timer.timeout.connect(_on_timer_timeout)
runtime_timer.start(wait_time)
func exit() -> void:
if runtime_timer:
if runtime_timer.is_connected("timeout", _on_timer_timeout):
runtime_timer.timeout.disconnect(_on_timer_timeout)
runtime_timer.queue_free()
runtime_timer = null
func _on_timer_timeout() -> void:
transitioned.emit(self, PATROL_STATE_ID)

View File

@@ -0,0 +1 @@
uid://nga8qx56iwgu

View File

@@ -1,10 +1,12 @@
extends State extends State
const IDLE_STATE_ID: StringName = &"idle"
@onready var agent: AIBase = owner
func enter() -> void: func enter() -> void:
super.enter()
run_animation()
agent.navigate_to_random_point() agent.navigate_to_random_point()
func physics_update(_delta) -> void: func physics_update(_delta) -> void:
if agent.nav_agent.is_navigation_finished(): if agent.nav_agent.is_navigation_finished():
transitioned.emit(self, next_state_id) transitioned.emit(self, IDLE_STATE_ID)

View File

@@ -1,53 +0,0 @@
[gd_scene format=3 uid="uid://dd8wn62anbts8"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_p2hpa"]
[ext_resource type="PackedScene" uid="uid://bjp8wbrtfl4v2" path="res://core/ai/agents/cow/cow_mannequin.tscn" id="2_6gadt"]
[sub_resource type="BoxShape3D" id="BoxShape3D_6gadt"]
size = Vector3(1, 1.4033203, 2.201294)
[node name="AiCow" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_p2hpa")]
anim_player = NodePath("CowMannequin/AnimationPlayer")
[node name="MeshInstance3D" parent="." index="0" unique_id=214482161]
visible = false
[node name="CollisionShape3D" parent="." index="1" unique_id=92811823]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.20166016, 0.24859619)
shape = SubResource("BoxShape3D_6gadt")
[node name="CowMannequin" parent="." index="5" unique_id=1390675137 instance=ExtResource("2_6gadt")]
transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, -0.9, 0)
[node name="Skeleton3D" parent="CowMannequin/Armature" parent_id_path=PackedInt32Array(1390675137, 698629112) index="0" unique_id=1122133347]
bones/1/position = Vector3(-0.00911771, 0.0010000349, 0.006467142)
bones/3/position = Vector3(0.0017672703, 0.020791268, -0.0029404918)
bones/4/position = Vector3(-0.0032468068, 0.0023884464, 0.01873094)
bones/4/rotation = Quaternion(0.10042217, -0.10042243, 0.69993955, 0.69993955)
bones/5/rotation = Quaternion(0.67686933, -0.7237772, -0.07669845, 0.11005373)
bones/6/rotation = Quaternion(0.2912588, -0.018159404, 0.0055299345, 0.95645595)
bones/8/position = Vector3(-0.0032468068, 0.003527336, -0.02178527)
bones/8/rotation = Quaternion(-0.13840333, 0.13840266, 0.6934296, 0.6934297)
bones/9/rotation = Quaternion(0.63873273, -0.71572495, 0.1725141, -0.22360067)
bones/10/rotation = Quaternion(-0.5624951, 0.015998652, 0.010887203, 0.82657415)
bones/12/position = Vector3(0.0026304817, 0.0015686632, 0.01873094)
bones/12/rotation = Quaternion(0.69003975, 0.6900398, -0.15441875, 0.15441847)
bones/13/rotation = Quaternion(-0.06197851, -0.1282304, 0.73018706, 0.6682384)
bones/14/rotation = Quaternion(0.1410681, 0.051763278, -0.0073862504, 0.9886182)
bones/16/position = Vector3(0.0026304817, 0.005057063, -0.02178527)
bones/16/rotation = Quaternion(0.70645297, 0.7064531, 0.030399354, -0.030400336)
bones/17/rotation = Quaternion(0.198508, 0.20028433, 0.69889957, 0.65728253)
bones/18/rotation = Quaternion(-0.4085358, -0.008673466, -0.0038824743, 0.9126928)
bones/20/position = Vector3(-0.0003228268, 0.009853916, -0.026626632)
bones/26/position = Vector3(-0.00072195934, 0.0076745725, 0.016512236)
bones/26/rotation = Quaternion(0.0042201285, 0.8477673, 0.5299017, -0.021842854)
bones/27/rotation = Quaternion(0.1513493, -0.04170839, -0.04666066, 0.9864972)
bones/28/rotation = Quaternion(-0.6312453, -0.17917253, 0.17600863, 0.73378986)
bones/30/position = Vector3(-0.0003228271, 0.011335416, -0.01734586)
bones/33/position = Vector3(-0.008358625, 0.004613471, -0.013200058)
bones/33/rotation = Quaternion(0.76341635, -5.672201e-07, -6.704141e-07, 0.6459068)
bones/35/position = Vector3(0.008608938, 0.0010000349, 0.028441517)
bones/35/rotation = Quaternion(0.7071068, -6.866289e-07, -1.22965e-06, 0.7071067)
bones/37/position = Vector3(0.007849856, 0.0010000349, -0.02901155)
[editable path="CowMannequin"]

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,81 +0,0 @@
[gd_scene format=3 uid="uid://bjp8wbrtfl4v2"]
[ext_resource type="PackedScene" uid="uid://b7d57tyxi41r1" path="res://core/ai/agents/cow/cow.fbx" id="1_60f5q"]
[ext_resource type="Animation" uid="uid://bsuoywknbbnm0" path="res://core/ai/agents/cow/idle.res" id="2_5ukcj"]
[ext_resource type="Animation" uid="uid://ckmybsnuf4stp" path="res://core/ai/agents/cow/walking.res" id="3_0mu5m"]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_lowte"]
_data = {
&"idle": ExtResource("2_5ukcj"),
&"walking": ExtResource("3_0mu5m")
}
[node name="CowMannequin" unique_id=786985233 instance=ExtResource("1_60f5q")]
[node name="Skeleton3D" parent="Armature" parent_id_path=PackedInt32Array(698629112) index="0" unique_id=1122133347]
bones/1/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.7071067)
bones/1/scale = Vector3(1, 1, 1)
bones/4/rotation = Quaternion(0.0015316998, -0.0015319793, 0.70710516, 0.70710516)
bones/5/position = Vector3(1.3183898e-16, 0.006025583, -6.675722e-10)
bones/5/rotation = Quaternion(0.703962, -0.69745475, -0.08083715, 0.10705068)
bones/5/scale = Vector3(1, 0.99999976, 1)
bones/6/position = Vector3(-1.403955e-10, 0.009248152, 3.7406075e-11)
bones/6/rotation = Quaternion(0.18324056, -0.018661192, 0.0034790868, 0.98288476)
bones/6/scale = Vector3(1, 1, 1)
bones/8/scale = Vector3(0.99999994, 0.99999994, 1)
bones/9/position = Vector3(-3.8163916e-17, 0.0046958304, 1.907358e-10)
bones/9/rotation = Quaternion(0.6754388, -0.68119305, 0.18401879, -0.21423234)
bones/9/scale = Vector3(1, 0.99999994, 1.0000001)
bones/10/position = Vector3(7.2902e-10, 0.011755081, -3.0995417e-10)
bones/10/rotation = Quaternion(-0.35146433, 0.018116632, 0.0068026204, 0.9360013)
bones/10/scale = Vector3(0.9999999, 1, 1.0000001)
bones/12/rotation = Quaternion(0.707105, 0.70710486, 0.0016303749, -0.0016306548)
bones/12/scale = Vector3(1, 1, 1)
bones/13/position = Vector3(-1.5265567e-16, 0.0060255853, 6.6757205e-10)
bones/13/rotation = Quaternion(-0.057434652, -0.13032891, 0.70625645, 0.69348216)
bones/13/scale = Vector3(0.99999994, 1, 0.9999999)
bones/14/position = Vector3(-4.5945833e-10, 0.009248151, -5.7053273e-09)
bones/14/rotation = Quaternion(0.18302466, 0.051401887, -0.0095829815, 0.9817169)
bones/14/scale = Vector3(1, 1.0000001, 0.99999994)
bones/16/rotation = Quaternion(0.7071062, 0.7071063, 0.0008663558, -0.0008670737)
bones/16/scale = Vector3(1, 1, 1)
bones/17/position = Vector3(1.7347235e-17, 0.0046958304, -1.9073432e-10)
bones/17/rotation = Quaternion(0.1907959, 0.2076444, 0.67355627, 0.6832297)
bones/17/scale = Vector3(1, 1, 1.0000001)
bones/18/position = Vector3(1.834215e-10, 0.011755081, -1.7500804e-09)
bones/18/rotation = Quaternion(-0.35151497, -0.0088962475, -0.003340601, 0.93613404)
bones/18/scale = Vector3(1, 1.0000001, 0.99999994)
bones/20/rotation = Quaternion(0.60080343, -0.03016121, 0.03526711, 0.7980488)
bones/21/position = Vector3(0.00011168665, 0.0039693406, -0.013754063)
bones/21/rotation = Quaternion(0.98885596, 3.1474094e-08, 2.23642e-07, -0.14887528)
bones/21/scale = Vector3(1, 1.0000001, 1.0000001)
bones/22/position = Vector3(-2.5714557e-11, 0.00836347, -9.433328e-09)
bones/22/rotation = Quaternion(-0.6231534, 9.0575064e-08, -7.589477e-08, 0.78209966)
bones/22/scale = Vector3(1, 0.9999999, 0.99999994)
bones/23/position = Vector3(-2.1545942e-12, 0.0072733457, -2.594807e-09)
bones/23/rotation = Quaternion(-1.8223004e-08, 0.98608583, -0.16623694, 2.7314604e-07)
bones/23/scale = Vector3(1, 0.9999997, 0.9999997)
bones/24/position = Vector3(3.3663968e-13, 0.006993335, -2.8376712e-09)
bones/24/rotation = Quaternion(-0.048028953, 2.6759114e-08, 4.5447155e-08, 0.998846)
bones/24/scale = Vector3(1, 0.99999994, 1.0000001)
bones/26/rotation = Quaternion(0.0054439656, 0.86556005, 0.50029516, -0.021930087)
bones/26/scale = Vector3(1, 1.0000002, 1)
bones/27/position = Vector3(1.8971762e-10, 0.013189232, -5.7312505e-10)
bones/27/rotation = Quaternion(0.15129425, -0.018451845, -0.013046658, 0.9882304)
bones/27/scale = Vector3(0.99999994, 0.99999994, 1.0000001)
bones/28/position = Vector3(-2.1601461e-10, 0.013573305, 4.8459786e-10)
bones/28/rotation = Quaternion(-0.6245376, -0.19781438, 0.16660775, 0.7369289)
bones/28/scale = Vector3(1, 0.9999999, 1.0000001)
bones/30/rotation = Quaternion(3.5765906e-06, 0.67050743, 0.7419029, 3.2289404e-06)
bones/31/position = Vector3(-1.2499713e-14, 0.01925819, -1.2902629e-09)
bones/31/rotation = Quaternion(0.086390205, 0.0012038474, -0.013495129, 0.99616927)
bones/31/scale = Vector3(0.9999999, 0.99999994, 1)
bones/33/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.7071067)
bones/33/scale = Vector3(1, 1, 1)
bones/35/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067)
bones/35/scale = Vector3(1, 1, 1)
bones/37/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067)
bones/37/scale = Vector3(1, 1, 1)
[node name="AnimationPlayer" parent="." index="1" unique_id=1944296898]
libraries/custom = SubResource("AnimationLibrary_lowte")

Binary file not shown.

Binary file not shown.

View File

@@ -1,61 +0,0 @@
[gd_scene format=3 uid="uid://cayakdk7gmlyg"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_e5v3h"]
[ext_resource type="PackedScene" uid="uid://dqhueybnlrrqx" path="res://core/ai/agents/horse/horse_mannequin.tscn" id="2_4t6jw"]
[ext_resource type="Animation" uid="uid://doyi6etqvy4n2" path="res://core/ai/agents/horse/idle.res" id="3_qe4rt"]
[ext_resource type="Animation" uid="uid://hotr7r3fd1sq" path="res://core/ai/agents/horse/walking.res" id="4_q8m0v"]
[sub_resource type="BoxShape3D" id="BoxShape3D_4t6jw"]
size = Vector3(1, 1.4991455, 1.7949219)
[sub_resource type="AnimationLibrary" id="AnimationLibrary_or6xs"]
_data = {
&"idle": ExtResource("3_qe4rt"),
&"walking": ExtResource("4_q8m0v")
}
[node name="AiHorse" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_e5v3h")]
anim_player = NodePath("HorseMannequin/AnimationPlayer")
[node name="MeshInstance3D" parent="." index="0" unique_id=214482161]
visible = false
[node name="CollisionShape3D" parent="." index="1" unique_id=92811823]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2074585, 0.14794922)
shape = SubResource("BoxShape3D_4t6jw")
[node name="HorseMannequin" parent="." index="5" unique_id=1289880358 instance=ExtResource("2_4t6jw")]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0)
[node name="Skeleton3D" parent="HorseMannequin/Armature" parent_id_path=PackedInt32Array(1289880358, 502167939) index="0" unique_id=972507008]
bones/1/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.7071067)
bones/4/rotation = Quaternion(0.0012952884, -0.0012955684, 0.7071056, 0.7071057)
bones/5/rotation = Quaternion(0.70685357, -0.70227593, -0.04508998, 0.07164877)
bones/6/rotation = Quaternion(0.13314606, -0.018813655, 0.0025279524, 0.9909147)
bones/8/rotation = Quaternion(0.00078355736, -0.00078427553, 0.70710635, 0.70710635)
bones/9/rotation = Quaternion(0.6711558, -0.6744515, 0.20213859, -0.23195927)
bones/10/rotation = Quaternion(-0.3574636, 0.018072592, 0.006918765, 0.9337266)
bones/12/rotation = Quaternion(0.7071054, 0.7071055, 0.0013743625, -0.0013746425)
bones/13/rotation = Quaternion(-0.02159133, -0.09508795, 0.70796114, 0.69948786)
bones/14/rotation = Quaternion(0.13298893, 0.051821847, -0.0069631753, 0.9897374)
bones/16/rotation = Quaternion(0.7071064, 0.70710653, 0.00066260004, -0.00066331815)
bones/17/rotation = Quaternion(0.20885532, 0.22542001, 0.6690968, 0.6766645)
bones/18/rotation = Quaternion(-0.3575147, -0.008874607, -0.003397635, 0.9338592)
bones/20/rotation = Quaternion(0.6010642, -0.021428203, 0.02848876, 0.79840535)
bones/21/rotation = Quaternion(0.99267024, 2.482745e-08, 2.2239277e-07, -0.12085533)
bones/22/rotation = Quaternion(-0.6165577, 9.507701e-08, -7.2693986e-08, 0.7873097)
bones/23/rotation = Quaternion(-1.5614631e-08, 0.9891947, -0.14660779, 2.7153942e-07)
bones/24/rotation = Quaternion(0.03904001, 3.5621138e-08, 1.47960275e-08, 0.99923766)
bones/26/rotation = Quaternion(0.008421451, 0.95973384, 0.27944198, -0.027427308)
bones/27/rotation = Quaternion(-0.08868468, -0.022488868, -0.01781765, 0.9956465)
bones/28/rotation = Quaternion(-0.62453747, -0.1978144, 0.1666077, 0.736929)
bones/30/rotation = Quaternion(3.4527793e-06, 0.6944211, 0.71956885, 3.3297817e-06)
bones/31/rotation = Quaternion(0.053752482, 0.0007617086, -0.013526975, 0.9984624)
bones/33/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.7071067)
bones/35/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067)
bones/37/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067)
[node name="AnimationPlayer" parent="HorseMannequin" index="1" unique_id=868895357]
libraries/custom = SubResource("AnimationLibrary_or6xs")
[editable path="HorseMannequin"]

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
[gd_scene format=3 uid="uid://dqhueybnlrrqx"]
[ext_resource type="PackedScene" uid="uid://be1ql8okme4n7" path="res://core/ai/agents/horse/horse.fbx" id="1_fbqil"]
[node name="HorseMannequin" unique_id=1289880358 instance=ExtResource("1_fbqil")]

Binary file not shown.

Binary file not shown.

View File

@@ -1,10 +0,0 @@
[gd_scene format=3 uid="uid://bdqeshcwwnyc4"]
[ext_resource type="PackedScene" uid="uid://mvh2v6v72stt" path="res://core/ai/agents/human/ai_human.tscn" id="1_awhwq"]
[node name="AiCitizen" unique_id=1228675528 instance=ExtResource("1_awhwq")]
[node name="StateMachine" parent="." index="3" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("")
[editable path="HumanMannequin"]

View File

@@ -1,53 +0,0 @@
[gd_scene format=3 uid="uid://bbseno7clbepx"]
[ext_resource type="PackedScene" uid="uid://bdqeshcwwnyc4" path="res://core/ai/agents/human/ai_citizen.tscn" id="1_cduuu"]
[node name="AiCitizenSitter" unique_id=1228675528 instance=ExtResource("1_cduuu")]
[node name="SK_Mannequin" parent="HumanMannequin" parent_id_path=PackedInt32Array(333236377) index="0" unique_id=377304892]
transform = Transform3D(0.99906886, 0.025971904, -0.03444738, 0.038254507, -0.16420224, 0.98568463, 0.019943757, -0.98608464, -0.1650429, 0.034450583, -0.44864154, 0.18535595)
[node name="Skeleton3D" parent="HumanMannequin/SK_Mannequin" index="0" unique_id=427572412]
bones/2/rotation = Quaternion(-0.007029906, 0.032859802, -0.23654123, 0.97104025)
bones/3/rotation = Quaternion(-0.000884556, 0.0033522977, 0.10280211, 0.99469584)
bones/4/rotation = Quaternion(-0.00040807336, 0.0034836144, 0.0045103733, 0.9999837)
bones/5/rotation = Quaternion(0.13797933, 0.74176145, 0.017092831, 0.6560942)
bones/6/rotation = Quaternion(0.049281683, 0.43982458, -0.36467218, 0.81923133)
bones/7/rotation = Quaternion(-0.049351897, 0.03842162, -0.476375, 0.87701494)
bones/8/rotation = Quaternion(-0.41694272, -0.05554785, -0.18030654, 0.889136)
bones/9/rotation = Quaternion(0.094457716, 0.050416686, 0.50820345, 0.85455555)
bones/10/rotation = Quaternion(0.011606372, 0.08610083, 0.2719557, 0.95838)
bones/12/rotation = Quaternion(-0.00016985182, 0.0032503307, 0.42722064, 0.90414155)
bones/13/rotation = Quaternion(-0.018024907, 0.015150134, 0.27278355, 0.9617873)
bones/15/rotation = Quaternion(-0.13467012, -0.10029431, 0.2853874, 0.94358844)
bones/16/rotation = Quaternion(0.010311794, -0.034373257, 0.13259757, 0.9905202)
bones/18/rotation = Quaternion(-0.09865642, -0.08747626, 0.37470394, 0.917721)
bones/19/rotation = Quaternion(0.0042531197, -0.033760007, 0.1860149, 0.98195755)
bones/21/rotation = Quaternion(0.70078146, 0.36200625, -0.001720201, 0.61469823)
bones/22/rotation = Quaternion(-0.001820262, 0.12128391, 0.22490783, 0.9668006)
bones/26/rotation = Quaternion(0.76902086, -0.13267346, -0.62528044, -0.005393706)
bones/27/rotation = Quaternion(0.034201004, 0.38763282, -0.48749813, 0.7816117)
bones/28/rotation = Quaternion(-0.053170834, 0.025972798, -0.32202634, 0.9448796)
bones/29/rotation = Quaternion(-0.43919632, 0.049489442, -0.098192796, 0.89163643)
bones/30/rotation = Quaternion(0.103668794, 0.04579189, 0.46590617, 0.8775462)
bones/31/rotation = Quaternion(0.011519267, 0.09922818, 0.29214594, 0.95114243)
bones/33/rotation = Quaternion(9.437185e-05, 0.009016322, 0.44048977, 0.89771235)
bones/34/rotation = Quaternion(-0.018226523, 0.017689873, 0.23132406, 0.97254515)
bones/36/rotation = Quaternion(-0.13272016, -0.101737194, 0.26830983, 0.9487069)
bones/37/rotation = Quaternion(0.010193698, -0.046628788, 0.19672133, 0.97929704)
bones/39/rotation = Quaternion(-0.110196866, -0.05036995, 0.35450295, 0.9271716)
bones/40/rotation = Quaternion(0.0042593707, -0.028552007, 0.17841409, 0.983532)
bones/42/rotation = Quaternion(0.7297342, 0.26573184, -0.09265223, 0.6231294)
bones/43/rotation = Quaternion(0.06426929, 0.22943345, 0.1991351, 0.95056564)
bones/47/rotation = Quaternion(0.00421817, -0.00037953872, -0.21590644, 0.9764049)
bones/49/rotation = Quaternion(0.14012733, -0.038448263, 0.6819175, 0.7168505)
bones/50/rotation = Quaternion(-0.05631607, 0.020481886, -0.74316776, 0.6664162)
bones/52/rotation = Quaternion(-0.0004946971, -0.048858073, -0.0074254284, 0.998778)
bones/55/rotation = Quaternion(0.0132777635, 0.10731075, 0.71409845, -0.6916441)
bones/56/rotation = Quaternion(0.03920827, -0.09832406, -0.75485575, 0.64729285)
bones/58/rotation = Quaternion(0.01656407, -0.06386153, 0.030505493, 0.9973549)
[node name="AnimationPlayer" parent="HumanMannequin" parent_id_path=PackedInt32Array(333236377) index="1" unique_id=233699491]
autoplay = &"custom/sit"
[editable path="HumanMannequin"]

View File

@@ -1,25 +0,0 @@
[gd_scene format=3 uid="uid://bnnuke5e7e1yr"]
[ext_resource type="PackedScene" uid="uid://bdqeshcwwnyc4" path="res://core/ai/agents/human/ai_citizen.tscn" id="1_dms8s"]
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_awhwq"]
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_8d0tj"]
[node name="AiCitizenWalker" unique_id=1228675528 instance=ExtResource("1_dms8s")]
[node name="StateMachine" parent="." index="3" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("IdleState")
[node name="IdleState" type="Node" parent="StateMachine" index="0" unique_id=42226979]
script = ExtResource("2_awhwq")
state_id = &"idle"
next_state_id = &"patrol"
animation_name = "custom/idle"
[node name="PatrolState" type="Node" parent="StateMachine" index="1" unique_id=1357892786]
script = ExtResource("3_8d0tj")
state_id = &"patrol"
next_state_id = &"idle"
animation_name = "custom/walking"
wait_time = 0.0
[editable path="HumanMannequin"]

View File

@@ -1,27 +0,0 @@
[gd_scene format=3 uid="uid://ceqxsqfiotm5j"]
[ext_resource type="PackedScene" uid="uid://mvh2v6v72stt" path="res://core/ai/agents/human/ai_human.tscn" id="1_l2y7m"]
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_2oda6"]
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="4_2oda6"]
[node name="AiFarmer" unique_id=1228675528 instance=ExtResource("1_l2y7m")]
[node name="StateMachine" parent="." index="3" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("GatherState")
[node name="PatrolState" type="Node" parent="StateMachine" index="0" unique_id=930272128]
script = ExtResource("3_2oda6")
state_id = &"patrol"
next_state_id = &"gather"
animation_name = "custom/walking"
wait_time = 0.0
[node name="GatherState" type="Node" parent="StateMachine" index="1" unique_id=48091671]
script = ExtResource("4_2oda6")
state_id = &"gather"
next_state_id = &"patrol"
animation_name = "custom/gather"
exit_on_animation_finished = true
wait_time = 1.0
[editable path="HumanMannequin"]

View File

@@ -1,58 +0,0 @@
[gd_scene format=3 uid="uid://mvh2v6v72stt"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_hko2w"]
[ext_resource type="PackedScene" uid="uid://legcajdd0jsy" path="res://core/ai/agents/human/human_mannequin.tscn" id="2_cnrgi"]
[node name="AiHuman" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_hko2w")]
anim_player = NodePath("HumanMannequin/AnimationPlayer")
[node name="MeshInstance3D" parent="." index="0" unique_id=214482161]
visible = false
[node name="HumanMannequin" parent="." index="5" unique_id=333236377 instance=ExtResource("2_cnrgi")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
[node name="SK_Mannequin" parent="HumanMannequin" index="0" unique_id=377304892]
transform = Transform3D(0.99999994, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0)
[node name="Skeleton3D" parent="HumanMannequin/SK_Mannequin" index="0" unique_id=427572412]
bones/2/rotation = Quaternion(-2.1971985e-24, 0, -0.062388558, 0.99805194)
bones/3/rotation = Quaternion(4.135903e-25, 1.6543612e-24, 0.12241964, 0.99247843)
bones/4/rotation = Quaternion(2.2850868e-23, 0, 0.024252614, 0.9997059)
bones/5/rotation = Quaternion(0.20891805, 0.7294167, 0.12304399, 0.6396598)
bones/6/rotation = Quaternion(0.11299576, 0.33062968, -0.16141911, 0.92296255)
bones/7/rotation = Quaternion(-0.05401651, -0.079182714, -0.26340967, 0.9599103)
bones/8/rotation = Quaternion(-0.61789525, 0.019371983, 0.010653294, 0.7859496)
bones/9/rotation = Quaternion(0.1333045, -0.0031801206, 0.22317973, 0.96561414)
bones/10/rotation = Quaternion(0.012043531, -0.0029058352, 0.10444825, 0.9944532)
bones/12/rotation = Quaternion(0.028522171, -0.05687394, 0.19848494, 0.9780366)
bones/13/rotation = Quaternion(-0.018628873, 0.007972199, 0.10711657, 0.99404)
bones/15/rotation = Quaternion(-0.1295377, -0.18789689, 0.14421311, 0.9628693)
bones/16/rotation = Quaternion(0.010359715, -0.010519396, 0.09774818, 0.9951017)
bones/18/rotation = Quaternion(-0.095480494, -0.116765715, 0.18851167, 0.9704188)
bones/19/rotation = Quaternion(0.00430111, -0.0141675975, 0.11596311, 0.9931432)
bones/21/rotation = Quaternion(0.6303091, 0.37152508, -0.07729015, 0.6772783)
bones/22/rotation = Quaternion(0.0026046867, 0.086798474, 0.13014112, 0.98768544)
bones/26/rotation = Quaternion(0.7294168, -0.20891781, -0.6396598, 0.12304417)
bones/27/rotation = Quaternion(0.11299576, 0.33062968, -0.16141911, 0.92296255)
bones/28/rotation = Quaternion(-0.05401651, -0.079182714, -0.26340967, 0.9599103)
bones/29/rotation = Quaternion(-0.61789525, 0.019371983, 0.010653294, 0.7859496)
bones/30/rotation = Quaternion(0.1333045, -0.0031801206, 0.22317973, 0.96561414)
bones/31/rotation = Quaternion(0.012043531, -0.0029058352, 0.10444825, 0.9944532)
bones/33/rotation = Quaternion(0.028522171, -0.05687394, 0.19848494, 0.9780366)
bones/34/rotation = Quaternion(-0.018628873, 0.007972199, 0.10711657, 0.99404)
bones/36/rotation = Quaternion(-0.1295377, -0.18789689, 0.14421311, 0.9628693)
bones/37/rotation = Quaternion(0.010359715, -0.010519396, 0.09774818, 0.9951017)
bones/39/rotation = Quaternion(-0.095480494, -0.116765715, 0.18851167, 0.9704188)
bones/40/rotation = Quaternion(0.00430111, -0.0141675975, 0.11596311, 0.9931432)
bones/42/rotation = Quaternion(0.6303091, 0.37152508, -0.07729015, 0.6772783)
bones/43/rotation = Quaternion(0.0026047025, 0.08679848, 0.13014114, 0.98768544)
bones/47/rotation = Quaternion(-1.5923227e-23, 0, -0.20371072, 0.97903115)
bones/49/rotation = Quaternion(0.07370486, -0.062138822, -0.008584324, 0.9953053)
bones/50/rotation = Quaternion(-0.048884246, 0.018863896, -0.06552225, 0.99647444)
bones/52/rotation = Quaternion(-0.0058857696, 0.03199128, 0.07035475, 0.9969916)
bones/55/rotation = Quaternion(0.062138822, 0.07370486, 0.9953054, 0.008584333)
bones/56/rotation = Quaternion(-0.048884246, 0.018863896, -0.06552225, 0.99647444)
bones/58/rotation = Quaternion(-0.0058857696, 0.03199128, 0.07035475, 0.9969916)
[editable path="HumanMannequin"]

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,94 +0,0 @@
[gd_scene format=3 uid="uid://legcajdd0jsy"]
[ext_resource type="PackedScene" uid="uid://ys8pesrqeyv2" path="res://core/ai/agents/human/human_mannequin_mixamo.fbx" id="1_561x5"]
[ext_resource type="Animation" uid="uid://c3rjx3uo8mbt3" path="res://core/ai/agents/human/gather.res" id="2_3r4wv"]
[ext_resource type="Animation" uid="uid://b2wo1mpqihko6" path="res://core/ai/agents/human/idle.res" id="2_b4vfe"]
[ext_resource type="Animation" uid="uid://ckkmrph86jlsd" path="res://core/ai/agents/human/walking.res" id="3_jl3mr"]
[ext_resource type="Animation" uid="uid://biaxql3fr1787" path="res://core/ai/agents/human/sit.res" id="4_xaokg"]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3r4wv"]
_data = {
&"gather": ExtResource("2_3r4wv"),
&"idle": ExtResource("2_b4vfe"),
&"sit": ExtResource("4_xaokg"),
&"walking": ExtResource("3_jl3mr")
}
[node name="HumanMannequin" unique_id=1583776159 instance=ExtResource("1_561x5")]
[node name="SK_Mannequin" parent="." index="0" unique_id=377304892]
transform = Transform3D(0.9990688, 0.025971903, -0.034447376, 0.038254507, -0.16420223, 0.9856846, 0.019943757, -0.9860846, -0.16504289, 0.034450583, -0.44864154, 0.18535595)
[node name="Skeleton3D" parent="SK_Mannequin" index="0" unique_id=427572412]
bones/2/rotation = Quaternion(-0.007029906, 0.032859802, -0.23654123, 0.97104025)
bones/3/rotation = Quaternion(-0.000884556, 0.0033522977, 0.10280211, 0.99469584)
bones/4/position = Vector3(0.13407329, 0.004204774, -5.584202e-15)
bones/4/rotation = Quaternion(-0.00040807336, 0.0034836144, 0.0045103733, 0.9999837)
bones/5/rotation = Quaternion(0.13797933, 0.74176145, 0.017092831, 0.6560942)
bones/6/position = Vector3(0.15784872, 1.4317955e-11, 6.3591354e-11)
bones/6/rotation = Quaternion(0.049281683, 0.43982458, -0.36467218, 0.81923133)
bones/7/position = Vector3(0.3033993, 8.407472e-11, 3.197531e-11)
bones/7/rotation = Quaternion(-0.049351897, 0.03842162, -0.476375, 0.87701494)
bones/8/position = Vector3(0.26975143, 1.572964e-11, -9.6207486e-11)
bones/8/rotation = Quaternion(-0.41694272, -0.05554785, -0.18030654, 0.889136)
bones/9/rotation = Quaternion(0.094457716, 0.050416686, 0.50820345, 0.85455555)
bones/10/position = Vector3(0.04287498, -2.9850333e-10, 5.048406e-11)
bones/10/rotation = Quaternion(0.011606372, 0.08610083, 0.2719557, 0.95838)
bones/11/position = Vector3(0.0339379, 1.1695445e-10, -2.349232e-11)
bones/12/rotation = Quaternion(-0.00016985182, 0.0032503307, 0.42722064, 0.90414155)
bones/13/position = Vector3(0.046403743, -3.648193e-11, 1.830866e-11)
bones/13/rotation = Quaternion(-0.018024907, 0.015150134, 0.27278355, 0.9617873)
bones/14/position = Vector3(0.036488436, -1.9989443e-10, 1.6076356e-11)
bones/15/rotation = Quaternion(-0.13467012, -0.10029431, 0.2853874, 0.94358844)
bones/16/position = Vector3(0.03570981, 1.8669866e-10, 3.9181436e-12)
bones/16/rotation = Quaternion(0.010311794, -0.034373257, 0.13259757, 0.9905202)
bones/17/position = Vector3(0.029856307, -3.005879e-10, -4.0375425e-11)
bones/18/rotation = Quaternion(-0.09865642, -0.08747626, 0.37470394, 0.917721)
bones/19/position = Vector3(0.04430177, 4.6665116e-11, -9.4033115e-12)
bones/19/rotation = Quaternion(0.0042531197, -0.033760007, 0.1860149, 0.98195755)
bones/20/position = Vector3(0.034766525, -1.6786372e-10, 2.768652e-11)
bones/21/rotation = Quaternion(0.70078146, 0.36200625, -0.001720201, 0.61469823)
bones/22/position = Vector3(0.038696717, 5.0118687e-11, 9.9849684e-11)
bones/22/rotation = Quaternion(-0.001820262, 0.12128391, 0.22490783, 0.9668006)
bones/23/position = Vector3(0.040621713, 1.0721979e-11, -5.127232e-12)
bones/24/position = Vector3(0.14, 1.110223e-16, 2.220446e-16)
bones/24/rotation = Quaternion(-2.7755576e-17, -6.938894e-17, -6.938894e-18, 1)
bones/25/position = Vector3(0.005, -2.7755576e-17, 0)
bones/25/rotation = Quaternion(-9.540979e-18, -2.7755576e-17, 9.540979e-18, 1)
bones/26/rotation = Quaternion(0.76902086, -0.13267346, -0.62528044, -0.005393706)
bones/27/rotation = Quaternion(0.034201004, 0.38763282, -0.48749813, 0.7816117)
bones/28/rotation = Quaternion(-0.053170834, 0.025972798, -0.32202634, 0.9448796)
bones/29/position = Vector3(-0.26975244, 2.563412e-07, -1.1905385e-08)
bones/29/rotation = Quaternion(-0.43919632, 0.049489442, -0.098192796, 0.89163643)
bones/30/rotation = Quaternion(0.103668794, 0.04579189, 0.46590617, 0.8775462)
bones/31/rotation = Quaternion(0.011519267, 0.09922818, 0.29214594, 0.95114243)
bones/33/rotation = Quaternion(9.437185e-05, 0.009016322, 0.44048977, 0.89771235)
bones/34/rotation = Quaternion(-0.018226523, 0.017689873, 0.23132406, 0.97254515)
bones/36/rotation = Quaternion(-0.13272016, -0.101737194, 0.26830983, 0.9487069)
bones/37/rotation = Quaternion(0.010193698, -0.046628788, 0.19672133, 0.97929704)
bones/39/rotation = Quaternion(-0.110196866, -0.05036995, 0.35450295, 0.9271716)
bones/40/rotation = Quaternion(0.0042593707, -0.028552007, 0.17841409, 0.983532)
bones/42/rotation = Quaternion(0.7297342, 0.26573184, -0.09265223, 0.6231294)
bones/43/rotation = Quaternion(0.06426929, 0.22943345, 0.1991351, 0.95056564)
bones/45/rotation = Quaternion(-0.1176271, 1.3974802e-16, -6.288661e-17, 0.99305785)
bones/46/rotation = Quaternion(-0.17323487, -2.099698e-25, 1.9374898e-17, 0.9848805)
bones/47/rotation = Quaternion(0.00421817, -0.00037953872, -0.21590644, 0.9764049)
bones/48/position = Vector3(0.092836134, 0.0036415688, 2.7747754e-17)
bones/48/rotation = Quaternion(1.2661336e-17, 9.989056e-18, 0.13354194, 0.99104315)
bones/49/rotation = Quaternion(0.14012733, -0.038448263, 0.6819175, 0.7168505)
bones/50/position = Vector3(-0.42572036, 1.7074263e-12, -4.667877e-12)
bones/50/rotation = Quaternion(-0.05631607, 0.020481886, -0.74316776, 0.6664162)
bones/51/position = Vector3(-0.20476776, -1.3877788e-17, 0)
bones/52/position = Vector3(-0.4019669, -3.933849e-11, 1.899425e-12)
bones/52/rotation = Quaternion(-0.0004946971, -0.048858073, -0.0074254284, 0.998778)
bones/54/position = Vector3(-0.22094238, 4.7704896e-18, 0)
bones/55/rotation = Quaternion(0.0132777635, 0.10731075, 0.71409845, -0.6916441)
bones/56/rotation = Quaternion(0.03920827, -0.09832406, -0.75485575, 0.64729285)
bones/57/position = Vector3(0.20476907, 0, -5.551115e-17)
bones/58/rotation = Quaternion(0.01656407, -0.06386153, 0.030505493, 0.9973549)
bones/60/position = Vector3(0.22094241, 3.035766e-18, -2.7755576e-17)
bones/67/position = Vector3(-4.440892e-16, 0, 7.632783e-17)
bones/67/rotation = Quaternion(-2.8449465e-16, 8.326673e-17, 2.7755576e-17, 1)
[node name="AnimationPlayer" parent="." index="1" unique_id=233699491]
libraries/custom = SubResource("AnimationLibrary_3r4wv")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -1,68 +0,0 @@
[gd_scene format=3 uid="uid://c2hg6hu2y5srb"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_j8spt"]
[ext_resource type="PackedScene" uid="uid://b0xb7kl4rjd66" path="res://core/ai/agents/pig/pig_mannequin.tscn" id="2_qmc2e"]
[ext_resource type="Animation" uid="uid://cneiflmpalcg5" path="res://core/ai/agents/pig/idle.res" id="3_lvpc5"]
[ext_resource type="Animation" uid="uid://0563r715lmw1" path="res://core/ai/agents/pig/walking.res" id="4_3f3hl"]
[sub_resource type="BoxShape3D" id="BoxShape3D_lvpc5"]
size = Vector3(1, 1.4848633, 1.960083)
[sub_resource type="AnimationLibrary" id="AnimationLibrary_lvpc5"]
_data = {
&"idle": ExtResource("3_lvpc5"),
&"walking": ExtResource("4_3f3hl")
}
[node name="AiPig" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_j8spt")]
anim_player = NodePath("PigMannequin/AnimationPlayer")
[node name="MeshInstance3D" parent="." index="0" unique_id=214482161]
visible = false
[node name="CollisionShape3D" parent="." index="1" unique_id=92811823]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.24243164, 0.10699463)
shape = SubResource("BoxShape3D_lvpc5")
[node name="PigMannequin" parent="." index="5" unique_id=926755470 instance=ExtResource("2_qmc2e")]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0)
[node name="Skeleton3D" parent="PigMannequin/Armature" parent_id_path=PackedInt32Array(926755470, 1135672511) index="0" unique_id=689596368]
bones/1/rotation = Quaternion(0.7071068, -7.052583e-07, -7.052583e-07, 0.7071067)
bones/3/position = Vector3(5.37765e-05, 0.017809996, -0.007695386)
bones/3/rotation = Quaternion(-0.027121998, 0, 0, 0.99963224)
bones/4/position = Vector3(-0.004269575, -0.0009057691, 0.018837402)
bones/4/rotation = Quaternion(-0.20850496, 0.20850474, 0.675667, 0.6756669)
bones/5/rotation = Quaternion(0.70767504, -0.7007484, -0.04928623, 0.07562217)
bones/6/rotation = Quaternion(0.5074964, -0.016355418, 0.009635334, 0.86144483)
bones/8/position = Vector3(-0.004269574, 0.0008725248, -0.02819033)
bones/8/rotation = Quaternion(-0.021000031, 0.020999499, 0.7067949, 0.7067949)
bones/9/rotation = Quaternion(0.6762797, -0.7030302, 0.13760945, -0.17163305)
bones/10/rotation = Quaternion(-0.76131815, 0.012544005, 0.014735432, 0.64808965)
bones/12/position = Vector3(0.0036532492, -0.0009057691, 0.018837402)
bones/12/rotation = Quaternion(0.67572093, 0.6757209, -0.20832984, 0.20832963)
bones/13/rotation = Quaternion(-0.025831472, -0.099082425, 0.70891863, 0.6978179)
bones/14/rotation = Quaternion(0.50689334, 0.045050938, -0.026540417, 0.8604216)
bones/16/position = Vector3(0.0036521717, 0.0008013838, -0.028183708)
bones/16/rotation = Quaternion(0.7068031, 0.7068031, -0.020723455, 0.020722982)
bones/17/rotation = Quaternion(0.1443776, 0.16487122, 0.6747477, 0.7047611)
bones/18/rotation = Quaternion(-0.7649948, -0.0061196624, -0.0072699804, 0.64396644)
bones/20/position = Vector3(-0.00042349403, 0.0063493187, -0.030968314)
bones/20/rotation = Quaternion(0.60138106, 0.012805484, 0.0019118772, 0.79885745)
bones/22/position = Vector3(-0.0002038494, 0.0041766805, 0.0044565103)
bones/22/rotation = Quaternion(0.0076635648, 0.7548352, 0.6556045, -0.018651871)
bones/23/rotation = Quaternion(0.065689825, -0.010677165, -0.019551655, 0.99759144)
bones/24/rotation = Quaternion(-0.24106143, -0.2388839, 0.03569213, 0.9399734)
bones/26/position = Vector3(-0.00032282702, 0.010153349, -0.021613695)
bones/26/rotation = Quaternion(3.6196245e-06, 0.6452338, 0.7639852, 3.2175833e-06)
bones/27/rotation = Quaternion(0.0455184, 0.00040800165, -0.025042463, 0.99864954)
bones/29/position = Vector3(-0.01117923, 0.0010000349, -0.03163386)
bones/29/rotation = Quaternion(0.7071068, -6.178108e-07, -6.178107e-07, 0.7071067)
bones/31/rotation = Quaternion(0.7071068, -1.0424332e-06, -1.0424329e-06, 0.7071067)
bones/33/position = Vector3(0.010670463, 0.0010000349, -0.03166372)
bones/33/rotation = Quaternion(0.70755845, -7.1388774e-07, -1.0355643e-06, 0.7066547)
[node name="AnimationPlayer" parent="PigMannequin" index="1" unique_id=1348500176]
libraries/custom = SubResource("AnimationLibrary_lvpc5")
[editable path="PigMannequin"]

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
[gd_scene format=3 uid="uid://b0xb7kl4rjd66"]
[ext_resource type="PackedScene" uid="uid://bi5f24frndw7j" path="res://core/ai/agents/pig/pig.fbx" id="1_ptg6h"]
[node name="PigMannequin" unique_id=926755470 instance=ExtResource("1_ptg6h")]

Binary file not shown.

View File

@@ -1,40 +0,0 @@
[gd_scene format=3 uid="uid://2md4l83fy8kr"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_0bu1i"]
[ext_resource type="PackedScene" uid="uid://c16j3umhplew4" path="res://core/ai/agents/pug/pug_mannequin.tscn" id="2_n0mit"]
[ext_resource type="Animation" uid="uid://cwrfo6h44qghm" path="res://core/ai/agents/pug/idle.res" id="3_hv1px"]
[ext_resource type="Animation" uid="uid://dbv2ikwa8h4nb" path="res://core/ai/agents/pug/walking.res" id="4_cjq2y"]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_iapui"]
_data = {
&"idle": ExtResource("3_hv1px"),
&"walking": ExtResource("4_cjq2y")
}
[node name="AiPug" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_0bu1i")]
anim_player = NodePath("PugMannequin/AnimationPlayer")
[node name="MeshInstance3D" parent="." index="0" unique_id=214482161]
visible = false
[node name="PugMannequin" parent="." index="5" unique_id=1732134047 instance=ExtResource("2_n0mit")]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0)
[node name="Skeleton3D" parent="PugMannequin/Armature" parent_id_path=PackedInt32Array(1732134047, 251322627) index="0" unique_id=1067550931]
bones/8/position = Vector3(-0.0054483665, 0.008346455, -0.020266803)
bones/8/rotation = Quaternion(-0.007561639, 0.007561228, 0.70706636, 0.70706636)
bones/9/rotation = Quaternion(0.6665347, -0.6790185, 0.20055033, -0.23333457)
bones/10/rotation = Quaternion(-0.37439552, 0.017943675, 0.007246467, 0.92706716)
bones/14/rotation = Quaternion(0.13296904, 0.051822018, -0.0069621373, 0.9897401)
bones/16/position = Vector3(0.0048320387, 0.008252437, -0.02027757)
bones/16/rotation = Quaternion(0.7070978, 0.7070978, -0.0035577225, 0.0035573125)
bones/17/rotation = Quaternion(0.20727697, 0.22687204, 0.66435784, 0.68131787)
bones/18/rotation = Quaternion(-0.38250104, -0.0087800585, -0.0036350952, 0.9239062)
bones/20/rotation = Quaternion(0.6013276, -0.007656022, 0.017799761, 0.79876757)
bones/24/rotation = Quaternion(-0.45064288, -0.22904137, 0.090387635, 0.858074)
bones/27/rotation = Quaternion(0.05229574, 5.703821e-05, -0.025155801, 0.99831474)
[node name="AnimationPlayer" parent="PugMannequin" index="1" unique_id=2146190163]
libraries/custom = SubResource("AnimationLibrary_iapui")
[editable path="PugMannequin"]

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +0,0 @@
[gd_scene format=3 uid="uid://c16j3umhplew4"]
[ext_resource type="PackedScene" uid="uid://buqmw5lbfom07" path="res://core/ai/agents/pug/pug.fbx" id="1_3c2yk"]
[node name="PugMannequin" unique_id=1732134047 instance=ExtResource("1_3c2yk")]
[node name="Skeleton3D" parent="Armature" parent_id_path=PackedInt32Array(251322627) index="0" unique_id=1067550931]
bones/1/rotation = Quaternion(0.7071068, -8.7384586e-07, -8.7384575e-07, 0.7071067)
bones/3/position = Vector3(5.37765e-05, 0.023020823, -0.0001735416)
bones/4/rotation = Quaternion(0.0013124894, -0.0013127187, 0.7071056, 0.7071056)
bones/5/rotation = Quaternion(0.7071125, -0.70201516, -0.045116592, 0.07163183)
bones/6/rotation = Quaternion(0.13312602, -0.018813718, 0.0025276097, 0.9909174)
bones/8/rotation = Quaternion(0.0006567046, -0.0006571151, 0.7071065, 0.7071065)
bones/9/rotation = Quaternion(0.66675293, -0.67880416, 0.20062506, -0.23327015)
bones/10/rotation = Quaternion(-0.35678986, 0.01807761, 0.006905738, 0.9339843)
bones/12/rotation = Quaternion(0.70710534, 0.70710546, 0.0014091316, -0.0014093613)
bones/13/rotation = Quaternion(-0.021626502, -0.09508007, 0.7082199, 0.6992257)
bones/14/rotation = Quaternion(0.13296904, 0.051822014, -0.0069621364, 0.98974)
bones/16/rotation = Quaternion(0.7071066, 0.7071067, 0.00044525132, -0.00044566192)
bones/17/rotation = Quaternion(0.20738536, 0.2267729, 0.6646832, 0.6810004)
bones/18/rotation = Quaternion(-0.35684106, -0.008877046, -0.003391197, 0.93411684)
bones/20/rotation = Quaternion(0.6013276, -0.007656024, 0.017799761, 0.79876757)
bones/22/rotation = Quaternion(0.0076703057, 0.9327372, 0.3595561, -0.025732514)
bones/23/rotation = Quaternion(-0.089636706, -0.019697238, -0.01825219, 0.99561244)
bones/24/rotation = Quaternion(-0.44343108, -0.23039742, 0.11800072, 0.85811526)
bones/26/rotation = Quaternion(5.170388e-06, 0.6954638, 0.7185612, 5.0026606e-06)
bones/27/rotation = Quaternion(0.052304644, 0.00074447604, -0.01352817, 0.99853927)
bones/29/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067)
bones/31/rotation = Quaternion(0.7071068, -1.2110207e-06, -1.2110205e-06, 0.7071067)

Binary file not shown.

View File

@@ -1,36 +0,0 @@
[gd_scene format=3 uid="uid://bs1bdtm7jdtgb"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_smbiq"]
[ext_resource type="PackedScene" uid="uid://58u6viv3qd63" path="res://core/ai/agents/sheep/sheep_mannequin.tscn" id="2_hnenk"]
[ext_resource type="Animation" uid="uid://ifn4akvcgaua" path="res://core/ai/agents/sheep/idle.res" id="3_i3d22"]
[ext_resource type="Animation" uid="uid://52eg4664eik0" path="res://core/ai/agents/sheep/walking.res" id="4_hxh1r"]
[sub_resource type="BoxShape3D" id="BoxShape3D_hnenk"]
size = Vector3(1, 1.4770508, 1.3725281)
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vlyix"]
_data = {
&"idle": ExtResource("3_i3d22"),
&"walking": ExtResource("4_hxh1r")
}
[node name="AiSheep" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_smbiq")]
anim_player = NodePath("SheepMannequin/AnimationPlayer")
[node name="MeshInstance3D" parent="." index="0" unique_id=214482161]
visible = false
[node name="CollisionShape3D" parent="." index="1" unique_id=92811823]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.23852539, 0.11299133)
shape = SubResource("BoxShape3D_hnenk")
[node name="SheepMannequin" parent="." index="5" unique_id=1153770042 instance=ExtResource("2_hnenk")]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0)
[node name="Armature" parent="SheepMannequin" index="0" unique_id=1644576745]
transform = Transform3D(100, 0, 0, 0, -4.3711384e-06, 99.99999, 0, -99.99999, -4.3711384e-06, 0, 0, 0)
[node name="AnimationPlayer" parent="SheepMannequin" index="1" unique_id=770197846]
libraries/custom = SubResource("AnimationLibrary_vlyix")
[editable path="SheepMannequin"]

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +0,0 @@
[gd_scene format=3 uid="uid://58u6viv3qd63"]
[ext_resource type="PackedScene" uid="uid://oog8biov508a" path="res://core/ai/agents/sheep/sheep.fbx" id="1_pnkxh"]
[node name="SheepMannequin" unique_id=1153770042 instance=ExtResource("1_pnkxh")]
[node name="Skeleton3D" parent="Armature" parent_id_path=PackedInt32Array(1644576745) index="0" unique_id=811031257]
bones/1/rotation = Quaternion(0.7071068, -7.052583e-07, -7.052583e-07, 0.7071067)
bones/4/rotation = Quaternion(0.0017592248, -0.0017595046, 0.7071046, 0.7071046)
bones/5/rotation = Quaternion(0.706397, -0.7005701, -0.057003256, 0.08339989)
bones/6/rotation = Quaternion(0.17354831, -0.018694565, 0.003295098, 0.98464245)
bones/8/rotation = Quaternion(0.0011415672, -0.0011422854, 0.7071059, 0.7071059)
bones/9/rotation = Quaternion(0.66940695, -0.67618734, 0.20153745, -0.23248184)
bones/10/rotation = Quaternion(-0.38440856, 0.017864142, 0.0074402345, 0.92296034)
bones/12/rotation = Quaternion(0.70710427, 0.7071044, 0.001866237, -0.0018665171)
bones/13/rotation = Quaternion(-0.033540055, -0.106803544, 0.7078988, 0.6973861)
bones/14/rotation = Quaternion(0.17334078, 0.051493812, -0.009075931, 0.9834729)
bones/16/rotation = Quaternion(0.70710605, 0.7071062, 0.0009843343, -0.0009850523)
bones/17/rotation = Quaternion(0.2082713, 0.22595985, 0.6673435, 0.67839366)
bones/18/rotation = Quaternion(-0.384463, -0.008772296, -0.0036537221, 0.92309153)
bones/20/rotation = Quaternion(0.6012591, 0.022893472, -0.005923484, 0.7987042)
bones/22/rotation = Quaternion(0.006586622, 0.9146406, 0.40345904, -0.02469813)
bones/23/rotation = Quaternion(0.07927493, -0.021147288, -0.014362239, 0.996525)
bones/24/rotation = Quaternion(-0.6495659, -0.19198355, 0.17329836, 0.71496445)
bones/26/rotation = Quaternion(3.4527793e-06, 0.6944211, 0.71956885, 3.3297817e-06)
bones/27/rotation = Quaternion(0.0651835, 0.0008379451, -0.017830681, 0.9977136)
bones/29/rotation = Quaternion(0.7071068, -7.052583e-07, -7.052583e-07, 0.7071067)
bones/31/rotation = Quaternion(0.7071068, -1.0424332e-06, -1.0424329e-06, 0.7071067)
bones/33/rotation = Quaternion(0.7071068, -1.0424332e-06, -1.0424329e-06, 0.7071067)

Binary file not shown.

View File

@@ -1,6 +0,0 @@
extends State
func enter() -> void:
super.enter()
run_animation()

View File

@@ -1 +0,0 @@
uid://d3hy70ec8vqo5

View File

@@ -3,55 +3,18 @@ extends Node
class_name State class_name State
@export var state_id: StringName = &"" @export var state_id: StringName = &""
@export var next_state_id: StringName
@export var animation_name: String
@export var exit_on_animation_finished: bool
@export var wait_time: float = 3.0
var runtime_timer: Timer
@onready var agent: AIBase = owner
@warning_ignore("unused_signal")
signal transitioned(state: State, new_state_id: StringName) signal transitioned(state: State, new_state_id: StringName)
func _ready() -> void:
if wait_time > 0:
runtime_timer = Timer.new()
runtime_timer.name = "IdleTimer"
runtime_timer.one_shot = true
add_child(runtime_timer)
runtime_timer.timeout.connect(_on_timer_timeout)
func enter() -> void: func enter() -> void:
if exit_on_animation_finished: pass
if not agent.anim_player.animation_finished.is_connected(_on_animation_finished):
agent.anim_player.animation_finished.connect(_on_animation_finished)
elif wait_time > 0:
runtime_timer.start(wait_time)
func exit() -> void: func exit() -> void:
if exit_on_animation_finished and agent.anim_player.animation_finished.is_connected(_on_animation_finished):
agent.anim_player.animation_finished.disconnect(_on_animation_finished)
if runtime_timer and not runtime_timer.is_stopped():
runtime_timer.stop()
func update(_delta: float) -> void:
pass pass
func physics_update(_delta: float) -> void: func update(_delta) -> void:
pass pass
func run_animation() -> void: func physics_update(_delta) -> void:
if agent.anim_player and agent.anim_player.has_animation(animation_name): pass
agent.anim_player.play(animation_name)
func _on_animation_finished(anim_name: StringName) -> void:
if animation_name == anim_name:
if wait_time > 0:
runtime_timer.start(wait_time)
else:
transitioned.emit(self, next_state_id)
func _on_timer_timeout() -> void:
transitioned.emit(self, next_state_id)

View File

@@ -1,4 +1,3 @@
@tool
extends VBoxContainer extends VBoxContainer
class_name AudioOption class_name AudioOption
@@ -6,24 +5,14 @@ class_name AudioOption
const MIN_VOLUME: float = 0.0 const MIN_VOLUME: float = 0.0
const MAX_VOLUME: float = 1.0 const MAX_VOLUME: float = 1.0
@export var image: Texture:
set(value):
image = value
if is_inside_tree() and has_node("%Texture"):
$%Texture.texture = image
@export var bus_name: StringName = &"Master" @export var bus_name: StringName = &"Master"
@export var label_text: String = "Master Volume"
@export_range(0.0, 1.0, 0.01) var default_volume: float = 1.0 @export_range(0.0, 1.0, 0.01) var default_volume: float = 1.0
@onready var label: Label = $Label
@onready var slider: HSlider = $HSlider @onready var slider: HSlider = $HSlider
func _ready() -> void: func _ready() -> void:
if image != null and has_node("%Texture"):
$%Texture.texture = image
if Engine.is_editor_hint():
return
slider.min_value = MIN_VOLUME slider.min_value = MIN_VOLUME
slider.max_value = MAX_VOLUME slider.max_value = MAX_VOLUME
slider.step = 0.01 slider.step = 0.01
@@ -31,9 +20,12 @@ func _ready() -> void:
refresh() refresh()
func refresh() -> void: func refresh() -> void:
label.text = label_text
if not has_bus(): if not has_bus():
slider.set_value_no_signal(default_volume) slider.set_value_no_signal(default_volume)
slider.editable = false slider.editable = false
label.text = "%s (bus missing)" % label_text
return return
slider.editable = true slider.editable = true
@@ -54,9 +46,6 @@ func get_bus_index() -> int:
return AudioServer.get_bus_index(bus_name) return AudioServer.get_bus_index(bus_name)
func _set_bus_volume(linear_value: float) -> void: func _set_bus_volume(linear_value: float) -> void:
if Engine.is_editor_hint():
return
if not has_bus(): if not has_bus():
return return

View File

@@ -0,0 +1,14 @@
[gd_scene format=3 uid="uid://cescrovsjlwke"]
[ext_resource type="Script" uid="uid://bnh1y560h55vc" path="res://core/audio/settings/audio_option.gd" id="1_orafl"]
[node name="AudioOption" type="VBoxContainer" unique_id=1509773712]
custom_minimum_size = Vector2(300, 0)
script = ExtResource("1_orafl")
[node name="Label" type="Label" parent="." unique_id=781845786]
layout_mode = 2
text = "Master Volume"
[node name="HSlider" type="HSlider" parent="." unique_id=1286896253]
layout_mode = 2

View File

@@ -3,8 +3,12 @@ extends Control
class_name SettingsMenu class_name SettingsMenu
@onready var audio_options_container: VBoxContainer = $%AudioOptionsContainer @onready var audio_options_container: VBoxContainer = $%AudioOptionsContainer
@onready var reset_button: Button = $%ResetToDefault_Button
@onready var close_button: Button = $%Close_Button
func _ready() -> void: func _ready() -> void:
reset_button.pressed.connect(_on_reset_to_default_button_pressed)
close_button.pressed.connect(_on_close_button_pressed)
_refresh_audio_options() _refresh_audio_options()
func _get_audio_options() -> Array[AudioOption]: func _get_audio_options() -> Array[AudioOption]:
@@ -23,3 +27,10 @@ func _refresh_audio_options() -> void:
func _apply_current_audio_values() -> void: func _apply_current_audio_values() -> void:
for audio_option in _get_audio_options(): for audio_option in _get_audio_options():
audio_option.apply_current_value() audio_option.apply_current_value()
func _on_reset_to_default_button_pressed() -> void:
for audio_option in _get_audio_options():
audio_option.reset_to_default()
func _on_close_button_pressed() -> void:
visible = false

View File

@@ -0,0 +1,74 @@
[gd_scene format=3 uid="uid://caqf471x0kttc"]
[ext_resource type="Script" uid="uid://cvr25q1blyxg" path="res://core/audio/settings/settings_menu.gd" id="1_4lekq"]
[ext_resource type="PackedScene" uid="uid://cescrovsjlwke" path="res://core/audio/settings/audio_option.tscn" id="1_hwcco"]
[node name="SettingsMenu" type="Control" unique_id=1639777294]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_4lekq")
[node name="PanelContainer" type="PanelContainer" parent="." unique_id=315821242]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -79.5
offset_top = -110.0
offset_right = 79.5
offset_bottom = 110.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer" unique_id=648635784]
layout_mode = 2
size_flags_vertical = 0
theme_override_constants/margin_left = 12
theme_override_constants/margin_top = 12
theme_override_constants/margin_right = 12
theme_override_constants/margin_bottom = 12
[node name="AudioOptionsContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer" unique_id=824023653]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/separation = 12
[node name="MasterVolume_AudioOption" parent="PanelContainer/MarginContainer/AudioOptionsContainer" unique_id=1509773712 instance=ExtResource("1_hwcco")]
layout_mode = 2
[node name="HSeparator" type="HSeparator" parent="PanelContainer/MarginContainer/AudioOptionsContainer" unique_id=1053430754]
layout_mode = 2
[node name="MusicVolume_AudioOption" parent="PanelContainer/MarginContainer/AudioOptionsContainer" unique_id=690924616 instance=ExtResource("1_hwcco")]
layout_mode = 2
bus_name = &"Music"
label_text = "Music Volume"
[node name="HSeparator2" type="HSeparator" parent="PanelContainer/MarginContainer/AudioOptionsContainer" unique_id=453716295]
layout_mode = 2
[node name="SFXVolume_AudioOption" parent="PanelContainer/MarginContainer/AudioOptionsContainer" unique_id=2096291127 instance=ExtResource("1_hwcco")]
layout_mode = 2
bus_name = &"SFX"
label_text = "SFX Volume"
[node name="HSeparator3" type="HSeparator" parent="PanelContainer/MarginContainer/AudioOptionsContainer" unique_id=498553283]
layout_mode = 2
[node name="ResetToDefault_Button" type="Button" parent="PanelContainer/MarginContainer/AudioOptionsContainer" unique_id=720420423]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
text = "Reset To Default"
[node name="Close_Button" type="Button" parent="PanelContainer/MarginContainer/AudioOptionsContainer" unique_id=1137906684]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
text = "Close"

View File

@@ -1,29 +1,13 @@
extends Node3D extends Node3D
#constants about biome, pieces and entity spawn
const CHUNK_TYPE_BIOME: int = 0 const CHUNK_TYPE_BIOME: int = 0
const CHUNK_TYPE_STRAIGHT_TRACK: int = 1 const CHUNK_TYPE_STRAIGHT_TRACK: int = 1
const CHUNK_TYPE_CURVED_TRACK: int = 2 const CHUNK_TYPE_CURVED_TRACK: int = 2
const ENTITY_TYPE_HUMANOID: int = 0
const ENTITY_TYPE_ANIMAL: int = 1
const ENTITY_SPAWN_ANY: int = 0
const ENTITY_SPAWN_HUMANOID_ONLY: int = 1
const ENTITY_SPAWN_ANIMAL_ONLY: int = 2
const CHUNK_GENERATION_FRAME_BUDGET_USEC: int = 2000 #2 ms/frame to generate chunks const CHUNK_GENERATION_STEPS_PER_FRAME: int = 2
const CHUNK_CLEANUP_FRAME_BUDGET_USEC: int = 1000 #1 ms/frame per cleanup const CHUNK_CLEANUP_STEPS_PER_FRAME: int = 4
const LAMPPOST_WIRE_FRAME_BUDGET_USEC: int = 1000 #1 ms/frame per i fili dei lampioni const LAMPPOST_WIRE_STEPS_PER_FRAME: int = 1
#(about 4 ms o work for frame) const RAILWAY_SCENE_DIRECTORY: String = "res://tgcc/chunk/railway/scene"
#Se compaiono chunk troppo lentamente davanti al treno:
#aumentare generazione a 3000 o 4000
#Se ci sono micro-scatti:
#abbassare generazione a 1000 o 1500
#Se i fili appaiono in ritardo:
#aumentare wire a 1500 o 2000
#Se il cleanup causa scatti:
#abbassare cleanup a 500
const MAX_CHUNK_UNIQUENESS: int = 5
const RIVER_SIDE_ORDER: Array[String] = ["north", "est", "south", "west"] const RIVER_SIDE_ORDER: Array[String] = ["north", "est", "south", "west"]
const RIVER_DIRECTIONS: Dictionary = { const RIVER_DIRECTIONS: Dictionary = {
"north": Vector2(0.0, -1.0), "north": Vector2(0.0, -1.0),
@@ -39,43 +23,33 @@ const RIVER_NEIGHBOUR_OFFSETS: Dictionary = {
} }
@export_group("Rails") @export_group("Rails")
@export var rail_path: Path3D #rail path @export var rail_path: Path3D
@export var railway_pool: Resource
@export_group("Biomes") @export_group("Biomes")
@export var biome_list: Array[Biome] #list of scenes for the biome @export var biome_list: Array[Biome]
@export_group("Entities")
@export var entity_pool: Resource
@export_range(0.0, 1.0, 0.01) var entity_spawn_probability: float = 0.6
@export_range(0, 20, 1) var max_entities_per_chunk: int = 3
@export_group("Grid and Area") @export_group("Grid and Area")
@export var chunk_size: float = 20.0 #size of a cell; default 20 (global position is defined dividing x and z for this value) @export var chunk_size: float = 20.0
@export var eye_line: int = 3 #cells to be considerated around the train (e.g. 3 => a square of cells from -3 to 3 around train cell) @export var eye_line: int = 3
@export var district_scale: float = 0.05 #noise value to distribuite biome; low values create large area, high values create biome with more variants @export var district_scale: float = 0.05
@export_group("Lamppost") @export_group("Lamppost")
@export var lamppost_wire_material: ShaderMaterial @export var lamppost_wire_material: ShaderMaterial
@export_range(0.01, 1.0) var wire_thickness: float = 0.05 @export_range(0.01, 1.0) var wire_thickness: float = 0.05
@export var lamppost_dist_factor: int = 10 #max distance of connections @export var lamppost_dist_factor: int = 10
var board: Dictionary = {} var board: Dictionary = {}
var last_pos_train: Vector2i = Vector2i(999999, 999999) var last_pos_train: Vector2i = Vector2i(999999, 999999)
var noise_generator: FastNoiseLite var noise_generator: FastNoiseLite
var altitude_generator: FastNoiseLite var altitude_generator: FastNoiseLite
var wire_connections: Dictionary = {} var wire_connections: Dictionary = {}
var chunk_candidate_cache: Dictionary = {} #node cache (metadata) var chunk_candidate_cache: Dictionary = {}
var prop_candidate_cache: Dictionary = {}
var entity_candidate_cache: Dictionary = {}
var pending_generation_cells: Array[Vector2i] = [] var pending_generation_cells: Array[Vector2i] = []
var pending_cleanup_cells: Array[Vector2i] = [] var pending_cleanup_cells: Array[Vector2i] = []
var pending_wire_cells: Array[Vector2i] = [] var pending_wire_cells: Array[Vector2i] = []
var pending_generation_cursor: int = 0
var pending_cleanup_cursor: int = 0
var pending_wire_cursor: int = 0
var pending_wire_lookup: Dictionary = {} var pending_wire_lookup: Dictionary = {}
var rail_chunk_catalogue: Dictionary = {} #rails chunk list var pending_radar_update: bool = false
var rail_chunk_catalogue: Dictionary = {}
var manual_biome: Biome = null var manual_biome: Biome = null
@@ -85,7 +59,6 @@ func _ready() -> void:
#connect events #connect events
UIEvents.update_rail_chunks.connect(_update_rail_chunks) UIEvents.update_rail_chunks.connect(_update_rail_chunks)
#noise generator for biome and altitute
noise_generator = FastNoiseLite.new() noise_generator = FastNoiseLite.new()
noise_generator.noise_type = FastNoiseLite.TYPE_PERLIN noise_generator.noise_type = FastNoiseLite.TYPE_PERLIN
noise_generator.seed = randi() noise_generator.seed = randi()
@@ -96,11 +69,8 @@ func _ready() -> void:
altitude_generator.seed = randi() altitude_generator.seed = randi()
altitude_generator.frequency = district_scale * 0.5 altitude_generator.frequency = district_scale * 0.5
#fill cache with available chunk
_warm_chunk_candidate_cache() _warm_chunk_candidate_cache()
_warm_entity_candidate_cache()
_warm_rail_chunk_catalogue() _warm_rail_chunk_catalogue()
#set unique pieces
_update_set_pieces() _update_set_pieces()
func _update_set_pieces() -> void: func _update_set_pieces() -> void:
@@ -115,7 +85,7 @@ func _update_set_pieces() -> void:
var local_biome = "" var local_biome = ""
if manual_biome != null: if manual_biome != null:
local_biome = manual_biome.name local_biome = manual_biome.nome
else: else:
var grid_x = roundi(sp.global_position.x / chunk_size) var grid_x = roundi(sp.global_position.x / chunk_size)
var grid_z = roundi(sp.global_position.z / chunk_size) var grid_z = roundi(sp.global_position.z / chunk_size)
@@ -133,7 +103,6 @@ func _update_set_pieces() -> void:
func _destroy_and_regenrate_world() -> void: func _destroy_and_regenrate_world() -> void:
_warm_chunk_candidate_cache() _warm_chunk_candidate_cache()
_warm_entity_candidate_cache()
_clear_pending_world_work() _clear_pending_world_work()
#Turn off old temples #Turn off old temples
@@ -142,7 +111,7 @@ func _destroy_and_regenrate_world() -> void:
#Destroy all models #Destroy all models
for pos in board.keys(): for pos in board.keys():
var cella = board[pos] var cella = board[pos]
if not _is_persistent_obstacle(cella): if cella["type"] != "obstacle":
if cella.has("node") and is_instance_valid(cella["node"]): if cella.has("node") and is_instance_valid(cella["node"]):
cella["node"].queue_free() cella["node"].queue_free()
@@ -156,13 +125,16 @@ func _destroy_and_regenrate_world() -> void:
var train_pos = rail_path.train_instance.global_position var train_pos = rail_path.train_instance.global_position
var current_pos = Vector2i(roundi(train_pos.x / chunk_size), roundi(train_pos.z / chunk_size)) var current_pos = Vector2i(roundi(train_pos.x / chunk_size), roundi(train_pos.z / chunk_size))
_refresh_world(current_pos) _refresh_world(current_pos)
pending_radar_update = true
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
#based on time budgets the queues are evaluated by frame and not all together
_drain_cleanup_queue() _drain_cleanup_queue()
_drain_generation_queue() _drain_generation_queue()
_drain_wire_queue() _drain_wire_queue()
if pending_radar_update:
pending_radar_update = false
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
if rail_path == null or rail_path.train_instance == null: return if rail_path == null or rail_path.train_instance == null: return
@@ -174,6 +146,7 @@ func _physics_process(_delta: float) -> void:
if current_pos != last_pos_train: if current_pos != last_pos_train:
last_pos_train = current_pos last_pos_train = current_pos
_refresh_world(current_pos) _refresh_world(current_pos)
pending_radar_update = true
func collect_all_chunkinfo(root: Node, list: Array[Node]) -> void: func collect_all_chunkinfo(root: Node, list: Array[Node]) -> void:
if root == null: return if root == null: return
@@ -184,33 +157,6 @@ func collect_all_chunkinfo(root: Node, list: Array[Node]) -> void:
for child in root.get_children(): for child in root.get_children():
collect_all_chunkinfo(child, list) collect_all_chunkinfo(child, list)
func collect_all_propinfo(root: Node, list: Array[Node]) -> void:
if root == null: return
if "available_props" in root:
list.append(root)
for child in root.get_children():
collect_all_propinfo(child, list)
func collect_all_entityinfo(root: Node, list: Array[Node]) -> void:
if root == null: return
if "entity_type" in root:
list.append(root)
for child in root.get_children():
collect_all_entityinfo(child, list)
func collect_all_entity_spawn_points(root: Node, list: Array[Node]) -> void:
if root == null: return
if "allowed_type" in root or root.is_in_group("entity_spawn_point"):
list.append(root)
for child in root.get_children():
collect_all_entity_spawn_points(child, list)
func _warm_chunk_candidate_cache() -> void: func _warm_chunk_candidate_cache() -> void:
var unique_scenes: Dictionary = {} var unique_scenes: Dictionary = {}
@@ -231,30 +177,27 @@ func _warm_chunk_candidate_cache() -> void:
for scene in unique_scenes.values(): for scene in unique_scenes.values():
_get_chunk_scene_metadata(scene) _get_chunk_scene_metadata(scene)
func _warm_entity_candidate_cache() -> void:
entity_candidate_cache.clear()
if entity_pool == null or not "available_entities" in entity_pool:
return
for scene in entity_pool.available_entities:
if scene == null:
continue
_get_entity_scene_metadata(scene)
func _warm_rail_chunk_catalogue() -> void: func _warm_rail_chunk_catalogue() -> void:
rail_chunk_catalogue.clear() rail_chunk_catalogue.clear()
if railway_pool == null or not "available_railways" in railway_pool:
var directory := DirAccess.open(RAILWAY_SCENE_DIRECTORY)
if directory == null:
return return
for scene in railway_pool.available_railways: directory.list_dir_begin()
if scene == null: var file_name := directory.get_next()
continue while file_name != "":
if not directory.current_is_dir() and file_name.ends_with(".tscn"):
var scene_path := "%s/%s" % [RAILWAY_SCENE_DIRECTORY, file_name]
var scene := load(scene_path) as PackedScene
if scene != null:
var chunk_type = _get_chunk_type_from_scene(scene) var chunk_type = _get_chunk_type_from_scene(scene)
if chunk_type == CHUNK_TYPE_STRAIGHT_TRACK or chunk_type == CHUNK_TYPE_CURVED_TRACK: if chunk_type == CHUNK_TYPE_STRAIGHT_TRACK or chunk_type == CHUNK_TYPE_CURVED_TRACK:
if not rail_chunk_catalogue.has(chunk_type): if not rail_chunk_catalogue.has(chunk_type):
rail_chunk_catalogue[chunk_type] = [] rail_chunk_catalogue[chunk_type] = []
rail_chunk_catalogue[chunk_type].append(scene) rail_chunk_catalogue[chunk_type].append(scene)
file_name = directory.get_next()
directory.list_dir_end()
func _get_chunk_scene_cache_key(scene: PackedScene) -> String: func _get_chunk_scene_cache_key(scene: PackedScene) -> String:
if scene == null: if scene == null:
@@ -296,7 +239,6 @@ func _get_chunk_scene_metadata(scene: PackedScene) -> Dictionary:
"info_path": info_path, "info_path": info_path,
"rotations": rotations, "rotations": rotations,
"has_lamppost": "have_lamppost" in info_node and info_node.have_lamppost, "has_lamppost": "have_lamppost" in info_node and info_node.have_lamppost,
"uniqueness": _get_chunk_uniqueness_from_info(info_node),
} }
preview_chunk.queue_free() preview_chunk.queue_free()
chunk_candidate_cache[key] = metadata chunk_candidate_cache[key] = metadata
@@ -330,10 +272,8 @@ func _clear_pending_world_work() -> void:
pending_generation_cells.clear() pending_generation_cells.clear()
pending_cleanup_cells.clear() pending_cleanup_cells.clear()
pending_wire_cells.clear() pending_wire_cells.clear()
pending_generation_cursor = 0
pending_cleanup_cursor = 0
pending_wire_cursor = 0
pending_wire_lookup.clear() pending_wire_lookup.clear()
pending_radar_update = false
func _collect_replaceable_rail_chunks(root: Node, result: Array[Node3D]) -> void: func _collect_replaceable_rail_chunks(root: Node, result: Array[Node3D]) -> void:
if root == null: if root == null:
@@ -341,7 +281,7 @@ func _collect_replaceable_rail_chunks(root: Node, result: Array[Node3D]) -> void
if root is Node3D: if root is Node3D:
var node_3d := root as Node3D var node_3d := root as Node3D
if _is_railway_scene_registered(node_3d.scene_file_path): if node_3d.scene_file_path.begins_with(RAILWAY_SCENE_DIRECTORY):
var info_list: Array[Node] = [] var info_list: Array[Node] = []
collect_all_chunkinfo(node_3d, info_list) collect_all_chunkinfo(node_3d, info_list)
var info_node = info_list[0] if info_list.size() > 0 else null var info_node = info_list[0] if info_list.size() > 0 else null
@@ -354,17 +294,6 @@ func _collect_replaceable_rail_chunks(root: Node, result: Array[Node3D]) -> void
for child in root.get_children(): for child in root.get_children():
_collect_replaceable_rail_chunks(child, result) _collect_replaceable_rail_chunks(child, result)
func _is_railway_scene_registered(scene_path: String) -> bool:
if scene_path == "":
return false
for candidates in rail_chunk_catalogue.values():
for candidate in candidates:
var scene := candidate as PackedScene
if scene != null and scene.resource_path == scene_path:
return true
return false
func _pick_replacement_rail_scene(chunk_type: int, current_scene_path: String) -> PackedScene: func _pick_replacement_rail_scene(chunk_type: int, current_scene_path: String) -> PackedScene:
var candidates: Array = rail_chunk_catalogue.get(chunk_type, []) var candidates: Array = rail_chunk_catalogue.get(chunk_type, [])
if candidates.is_empty(): if candidates.is_empty():
@@ -411,8 +340,6 @@ func _replace_rail_chunk_instance(chunk_root: Node3D) -> bool:
chunk_root.queue_free() chunk_root.queue_free()
return true return true
#rebuild the scene catalogue from railway_pool,
#than serach on the current scene which chunks can be changed and for each one chose a new scene (the same kind)
func _refresh_rail_chunks() -> void: func _refresh_rail_chunks() -> void:
print("update rail chunks") print("update rail chunks")
_warm_rail_chunk_catalogue() _warm_rail_chunk_catalogue()
@@ -440,12 +367,8 @@ func _refresh_world(center: Vector2i) -> void:
_rebuild_generation_queue(center) _rebuild_generation_queue(center)
_rebuild_cleanup_queue(center) _rebuild_cleanup_queue(center)
#check cells around the train by rings:
#first the center, then borders with distance = 1, the distance = 2 and so to eye_line.
#Use maxi(abs(x), abs(z)) to know the border of the ring. Cells closest to the train have more priority
func _rebuild_generation_queue(center: Vector2i) -> void: func _rebuild_generation_queue(center: Vector2i) -> void:
pending_generation_cells.clear() pending_generation_cells.clear()
pending_generation_cursor = 0
for radius in range(eye_line + 1): for radius in range(eye_line + 1):
for x in range(-radius, radius + 1): for x in range(-radius, radius + 1):
@@ -458,17 +381,13 @@ func _rebuild_generation_queue(center: Vector2i) -> void:
continue continue
pending_generation_cells.append(grid_pos) pending_generation_cells.append(grid_pos)
#For each cells add to cleanup queue the cells too far
#Use eye_line plus a margin value to hide chunks not instantly when go out of the eye line
#Persistent obstacle cells are not deleted (rails or set_pieces)
func _rebuild_cleanup_queue(center: Vector2i) -> void: func _rebuild_cleanup_queue(center: Vector2i) -> void:
pending_cleanup_cells.clear() pending_cleanup_cells.clear()
pending_cleanup_cursor = 0
var safe_margin = 2 var safe_margin = 2
for grid_pos in board.keys(): for grid_pos in board.keys():
var cell = board[grid_pos] var cell = board[grid_pos]
if _is_persistent_obstacle(cell): if cell["type"] == "obstacle":
continue continue
var dist_x = abs(grid_pos.x - center.x) var dist_x = abs(grid_pos.x - center.x)
@@ -476,16 +395,10 @@ func _rebuild_cleanup_queue(center: Vector2i) -> void:
if dist_x > eye_line + safe_margin or dist_z > eye_line + safe_margin: if dist_x > eye_line + safe_margin or dist_z > eye_line + safe_margin:
pending_cleanup_cells.append(grid_pos) pending_cleanup_cells.append(grid_pos)
#Check if a queue can continue to work based on time budget setted
func _queue_has_frame_budget(start_usec: int, budget_usec: int, processed: int) -> bool:
return processed == 0 or Time.get_ticks_usec() - start_usec < budget_usec
func _drain_generation_queue() -> void: func _drain_generation_queue() -> void:
var processed: int = 0 var processed = 0
var start_usec: int = Time.get_ticks_usec() while processed < CHUNK_GENERATION_STEPS_PER_FRAME and not pending_generation_cells.is_empty():
while pending_generation_cursor < pending_generation_cells.size() and _queue_has_frame_budget(start_usec, CHUNK_GENERATION_FRAME_BUDGET_USEC, processed): var grid_pos = pending_generation_cells.pop_front()
var grid_pos: Vector2i = pending_generation_cells[pending_generation_cursor]
pending_generation_cursor += 1
if board.has(grid_pos): if board.has(grid_pos):
continue continue
@@ -494,21 +407,15 @@ func _drain_generation_queue() -> void:
_add_compatible_biome(grid_pos) _add_compatible_biome(grid_pos)
processed += 1 processed += 1
if pending_generation_cursor >= pending_generation_cells.size():
pending_generation_cells.clear()
pending_generation_cursor = 0
func _drain_cleanup_queue() -> void: func _drain_cleanup_queue() -> void:
var processed: int = 0 var processed = 0
var start_usec: int = Time.get_ticks_usec() while processed < CHUNK_CLEANUP_STEPS_PER_FRAME and not pending_cleanup_cells.is_empty():
while pending_cleanup_cursor < pending_cleanup_cells.size() and _queue_has_frame_budget(start_usec, CHUNK_CLEANUP_FRAME_BUDGET_USEC, processed): var grid_pos = pending_cleanup_cells.pop_front()
var grid_pos: Vector2i = pending_cleanup_cells[pending_cleanup_cursor]
pending_cleanup_cursor += 1
if not board.has(grid_pos): if not board.has(grid_pos):
continue continue
var cell = board[grid_pos] var cell = board[grid_pos]
if _is_persistent_obstacle(cell): if cell["type"] == "obstacle":
continue continue
if cell.has("node") and is_instance_valid(cell["node"]): if cell.has("node") and is_instance_valid(cell["node"]):
@@ -516,10 +423,6 @@ func _drain_cleanup_queue() -> void:
board.erase(grid_pos) board.erase(grid_pos)
processed += 1 processed += 1
if pending_cleanup_cursor >= pending_cleanup_cells.size():
pending_cleanup_cells.clear()
pending_cleanup_cursor = 0
func _queue_lamppost_wire_connection(grid_pos: Vector2i) -> void: func _queue_lamppost_wire_connection(grid_pos: Vector2i) -> void:
if pending_wire_lookup.has(grid_pos): if pending_wire_lookup.has(grid_pos):
return return
@@ -527,11 +430,9 @@ func _queue_lamppost_wire_connection(grid_pos: Vector2i) -> void:
pending_wire_cells.append(grid_pos) pending_wire_cells.append(grid_pos)
func _drain_wire_queue() -> void: func _drain_wire_queue() -> void:
var processed: int = 0 var processed = 0
var start_usec: int = Time.get_ticks_usec() while processed < LAMPPOST_WIRE_STEPS_PER_FRAME and not pending_wire_cells.is_empty():
while pending_wire_cursor < pending_wire_cells.size() and _queue_has_frame_budget(start_usec, LAMPPOST_WIRE_FRAME_BUDGET_USEC, processed): var grid_pos = pending_wire_cells.pop_front()
var grid_pos: Vector2i = pending_wire_cells[pending_wire_cursor]
pending_wire_cursor += 1
pending_wire_lookup.erase(grid_pos) pending_wire_lookup.erase(grid_pos)
if not board.has(grid_pos): if not board.has(grid_pos):
@@ -542,10 +443,6 @@ func _drain_wire_queue() -> void:
_connect_lamppost_wires(grid_pos) _connect_lamppost_wires(grid_pos)
processed += 1 processed += 1
if pending_wire_cursor >= pending_wire_cells.size():
pending_wire_cells.clear()
pending_wire_cursor = 0
func _generate_pieces_around_train(center: Vector2i) -> void: func _generate_pieces_around_train(center: Vector2i) -> void:
for x in range(-eye_line, eye_line + 1): for x in range(-eye_line, eye_line + 1):
for z in range(-eye_line, eye_line + 1): for z in range(-eye_line, eye_line + 1):
@@ -556,8 +453,6 @@ func _generate_pieces_around_train(center: Vector2i) -> void:
if not ce_obstacle: if not ce_obstacle:
_add_compatible_biome(grid_pos) _add_compatible_biome(grid_pos)
#Decice which catalogue of chunks use for a cell. If manual_biome is set use always it
#Otherwise read noise_generator.get_noise_2d to give an index for biome_list
func _choose_catalogue_by_cell(grid_pos: Vector2i) -> Array[PackedScene]: func _choose_catalogue_by_cell(grid_pos: Vector2i) -> Array[PackedScene]:
if manual_biome != null: if manual_biome != null:
return manual_biome.available_chunks return manual_biome.available_chunks
@@ -567,13 +462,6 @@ func _choose_catalogue_by_cell(grid_pos: Vector2i) -> Array[PackedScene]:
var indice = clamp(int(normalized_value * biome_list.size()), 0, biome_list.size() - 1) var indice = clamp(int(normalized_value * biome_list.size()), 0, biome_list.size() - 1)
return biome_list[indice].available_chunks return biome_list[indice].available_chunks
func _choose_biome_name_by_cell(grid_pos: Vector2i) -> String:
if manual_biome != null:
return manual_biome.name
var value = noise_generator.get_noise_2d(grid_pos.x, grid_pos.y)
return _get_procedural_biome_name(value)
func _get_procedural_biome_name(value: float) -> String: func _get_procedural_biome_name(value: float) -> String:
if manual_biome != null: if manual_biome != null:
return manual_biome.name return manual_biome.name
@@ -582,262 +470,6 @@ func _get_procedural_biome_name(value: float) -> String:
var index = clamp(int(normalized_value * biome_list.size()), 0, biome_list.size() - 1) var index = clamp(int(normalized_value * biome_list.size()), 0, biome_list.size() - 1)
return biome_list[index].name return biome_list[index].name
func _get_chunk_uniqueness_from_info(info_node: Node) -> int:
if info_node != null and "uniqueness" in info_node:
return clampi(info_node.uniqueness, 0, MAX_CHUNK_UNIQUENESS)
return 0
func _get_prop_uniqueness_from_info(info_node: Node) -> int:
if info_node != null and "uniqueness" in info_node:
return clampi(info_node.uniqueness, 0, MAX_CHUNK_UNIQUENESS)
return -1
func _is_persistent_obstacle(cell: Dictionary) -> bool:
return cell.get("type", "") == "obstacle" and cell.get("persistent", true)
func _has_nearby_unique_chunk(grid_pos: Vector2i, uniqueness: int) -> bool:
if uniqueness <= 0:
return false
for nearby_pos in board.keys():
var nearby_uniqueness = int(board[nearby_pos].get("uniqueness", 0))
if nearby_uniqueness <= 0:
continue
var min_distance = maxi(uniqueness, nearby_uniqueness)
var dist_x = abs(nearby_pos.x - grid_pos.x)
var dist_z = abs(nearby_pos.y - grid_pos.y)
if dist_x <= min_distance and dist_z <= min_distance:
return true
return false
func _get_uniqueness_pick_weight(uniqueness: int) -> float:
return 1.0 / pow(float(uniqueness + 1), 2.0)
func _pick_weighted_candidate(candidates: Array) -> Dictionary:
var total_weight = 0.0
for candidate in candidates:
total_weight += candidate.weight
if total_weight <= 0.0:
return candidates.pick_random()
var target_weight = randf() * total_weight
var current_weight = 0.0
for candidate in candidates:
current_weight += candidate.weight
if current_weight >= target_weight:
return candidate
return candidates.back()
func _pick_backup_scene(zone_catalogue: Array[PackedScene], grid_pos: Vector2i) -> PackedScene:
for scene in zone_catalogue:
var metadata = _get_chunk_scene_metadata(scene)
var uniqueness = int(metadata.get("uniqueness", 0))
if not _has_nearby_unique_chunk(grid_pos, uniqueness):
return scene
return zone_catalogue[0]
func _get_prop_scene_cache_key(scene: PackedScene) -> String:
if scene == null:
return ""
if scene.resource_path != "":
return scene.resource_path
return "prop_scene_%s" % scene.get_instance_id()
func _get_entity_scene_cache_key(scene: PackedScene) -> String:
if scene == null:
return ""
if scene.resource_path != "":
return scene.resource_path
return "entity_scene_%s" % scene.get_instance_id()
func _get_entity_scene_metadata(scene: PackedScene) -> Dictionary:
if scene == null:
return {}
var key = _get_entity_scene_cache_key(scene)
if entity_candidate_cache.has(key):
return entity_candidate_cache[key]
var preview_entity = scene.instantiate()
var entity_info_list: Array[Node] = []
collect_all_entityinfo(preview_entity, entity_info_list)
var info_node = entity_info_list[0] if entity_info_list.size() > 0 else null
if info_node == null:
preview_entity.queue_free()
entity_candidate_cache[key] = {}
return {}
var metadata = {
"type": info_node.entity_type,
"name": info_node.entity_name if "entity_name" in info_node else "",
"allowed_biomes": info_node.allowed_biomes.duplicate() if "allowed_biomes" in info_node else [],
"weight": maxf(info_node.spawn_uniqueness if "spawn_uniqueness" in info_node else 1.0, 0.0001)
}
preview_entity.queue_free()
entity_candidate_cache[key] = metadata
return metadata
func _get_prop_scene_uniqueness(scene: PackedScene) -> int:
if scene == null:
return -1
var key = _get_prop_scene_cache_key(scene)
if prop_candidate_cache.has(key):
return prop_candidate_cache[key]
var preview_prop = scene.instantiate()
var uniqueness = _get_prop_uniqueness_from_info(preview_prop)
if uniqueness == -1:
var prop_info_list: Array[Node] = []
collect_all_propinfo(preview_prop, prop_info_list)
if not prop_info_list.is_empty():
uniqueness = _get_prop_uniqueness_from_info(prop_info_list[0])
preview_prop.queue_free()
prop_candidate_cache[key] = uniqueness
return uniqueness
func _get_marker_prop_uniqueness(marker: Node) -> int:
var uniqueness = _get_prop_uniqueness_from_info(marker)
if uniqueness == -1:
return 0
return uniqueness
func _pick_weighted_prop_scene(marker: Node) -> PackedScene:
var candidates = []
var fallback_uniqueness = _get_marker_prop_uniqueness(marker)
for prop_scene in marker.available_props:
if prop_scene == null:
continue
var uniqueness = _get_prop_scene_uniqueness(prop_scene)
if uniqueness == -1:
uniqueness = fallback_uniqueness
candidates.append({
"scene": prop_scene,
"weight": _get_uniqueness_pick_weight(uniqueness),
"uniqueness": uniqueness
})
if candidates.is_empty():
return null
return _pick_weighted_candidate(candidates).scene
func _spawn_props_for_chunk(root: Node) -> void:
var prop_markers: Array[Node] = []
collect_all_propinfo(root, prop_markers)
for marker in prop_markers:
_spawn_prop_for_marker(marker)
func _spawn_prop_for_marker(marker: Node) -> void:
if marker.available_props.is_empty():
return
var prop_scene = _pick_weighted_prop_scene(marker)
if prop_scene == null:
return
var prop_instance = prop_scene.instantiate()
var prop_node = prop_instance as Node3D
if prop_node == null:
prop_instance.queue_free()
return
marker.add_child(prop_node)
prop_node.transform = Transform3D.IDENTITY
func _spawn_entities_for_chunk(root: Node, biome_name: String) -> void:
if entity_pool == null or not "available_entities" in entity_pool:
return
if entity_pool.available_entities.is_empty():
return
if entity_spawn_probability <= 0.0 or max_entities_per_chunk <= 0:
return
if entity_candidate_cache.is_empty():
_warm_entity_candidate_cache()
var spawn_points: Array[Node] = []
collect_all_entity_spawn_points(root, spawn_points)
if spawn_points.is_empty():
return
spawn_points.shuffle()
var spawned_count: int = 0
for spawn_point in spawn_points:
if spawned_count >= max_entities_per_chunk:
break
var point_node = spawn_point as Node3D
if point_node == null:
continue
var spawn_chance = entity_spawn_probability
if "spawn_chance" in spawn_point:
spawn_chance *= spawn_point.spawn_chance
if randf() > spawn_chance:
continue
var entity_scene = _pick_compatible_entity(biome_name, _get_spawn_point_type_filter(spawn_point))
if entity_scene == null:
continue
var entity_instance = entity_scene.instantiate()
var entity_node = entity_instance as Node3D
if entity_node == null:
entity_instance.queue_free()
continue
root.add_child(entity_node)
entity_node.global_transform = point_node.global_transform
if "random_y_rotation" in spawn_point and spawn_point.random_y_rotation:
entity_node.rotate_y(randf() * TAU)
spawned_count += 1
func _get_spawn_point_type_filter(spawn_point: Node) -> int:
if "allowed_type" in spawn_point:
match spawn_point.allowed_type:
ENTITY_SPAWN_HUMANOID_ONLY:
return ENTITY_TYPE_HUMANOID
ENTITY_SPAWN_ANIMAL_ONLY:
return ENTITY_TYPE_ANIMAL
return -1
func _pick_compatible_entity(biome_name: String, type_filter: int) -> PackedScene:
if entity_pool == null or not "available_entities" in entity_pool:
return null
var candidates = []
for entity_scene in entity_pool.available_entities:
if entity_scene == null:
continue
var metadata = _get_entity_scene_metadata(entity_scene)
if metadata.is_empty():
continue
if type_filter != -1 and int(metadata["type"]) != type_filter:
continue
var allowed_biomes: Array = metadata.get("allowed_biomes", [])
if not allowed_biomes.is_empty() and not allowed_biomes.has(biome_name):
continue
candidates.append({
"scene": entity_scene,
"weight": float(metadata.get("weight", 1.0))
})
if candidates.is_empty():
return null
return _pick_weighted_candidate(candidates).scene
#Using a vertical raycast from the top to the bottom at the center of the cell
#If there is a collision search for a new chunk node
func _register_cell_with_ray(grid_pos: Vector2i) -> bool: func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
if board.has(grid_pos): return true if board.has(grid_pos): return true
@@ -885,7 +517,6 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
var river_exit_found = {"north": false, "est": false, "south": false, "west": false} var river_exit_found = {"north": false, "est": false, "south": false, "west": false}
var height_found = {"north": 0, "est": 0, "south": 0, "west": 0} var height_found = {"north": 0, "est": 0, "south": 0, "west": 0}
var have_lamppost = false var have_lamppost = false
var uniqueness = 0
#Get node info #Get node info
if right_info_node != null: if right_info_node != null:
@@ -899,8 +530,6 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
if "have_lamppost" in right_info_node: if "have_lamppost" in right_info_node:
have_lamppost = right_info_node.have_lamppost have_lamppost = right_info_node.have_lamppost
uniqueness = _get_chunk_uniqueness_from_info(right_info_node)
#Add piece to the grid #Add piece to the grid
board[grid_pos] = { board[grid_pos] = {
"type": "obstacle", "type": "obstacle",
@@ -909,9 +538,7 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
"heights": height_found, "heights": height_found,
"node": root_chunk, "node": root_chunk,
"info": right_info_node, "info": right_info_node,
"have_lamppost": have_lamppost, "have_lamppost": have_lamppost
"uniqueness": uniqueness,
"persistent": true
} }
if have_lamppost: if have_lamppost:
@@ -920,11 +547,6 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
return true return true
return false return false
#For the cell to fill check the contrains for the four neighbors:
#If the neighbor at north have and exit on south then new chunk should have exit to north (the same for east and ovest)
#Contrains: 1 -> connection is mandatory; 0 -> no connection; -1 -> no contrain because there is no neighbor or it already exits
#When generator know the contrains take all chunks and try all different rotations
#A candidate is valid only if all contrains are correct
func _add_compatible_biome(grid_pos: Vector2i) -> void: func _add_compatible_biome(grid_pos: Vector2i) -> void:
var req_conn_north = _needed_connection(grid_pos + Vector2i(0, -1), "south") var req_conn_north = _needed_connection(grid_pos + Vector2i(0, -1), "south")
var req_conn_est = _needed_connection(grid_pos + Vector2i(1, 0), "west") var req_conn_est = _needed_connection(grid_pos + Vector2i(1, 0), "west")
@@ -944,7 +566,6 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
var height_target = clamp(roundi((height_noise + 1.0) / 2.0), 0, 1) var height_target = clamp(roundi((height_noise + 1.0) / 2.0), 0, 1)
var zone_catalogue = _choose_catalogue_by_cell(grid_pos) var zone_catalogue = _choose_catalogue_by_cell(grid_pos)
var biome_name = _choose_biome_name_by_cell(grid_pos)
var valid_candidates = [] var valid_candidates = []
for scene in zone_catalogue: for scene in zone_catalogue:
@@ -958,9 +579,6 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
var u_conn = data["connections"] var u_conn = data["connections"]
var u_river_conn = data["river_connections"] var u_river_conn = data["river_connections"]
var u_height = data["heights"] var u_height = data["heights"]
var uniqueness = int(metadata.get("uniqueness", 0))
if _has_nearby_unique_chunk(grid_pos, uniqueness):
continue
var match_conn_n = (req_conn_north == -1) or ((req_conn_north == 1) == u_conn["north"]) var match_conn_n = (req_conn_north == -1) or ((req_conn_north == 1) == u_conn["north"])
var match_conn_e = (req_conn_est == -1) or ((req_conn_est == 1) == u_conn["est"]) var match_conn_e = (req_conn_est == -1) or ((req_conn_est == 1) == u_conn["est"])
@@ -989,14 +607,7 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
if req_height_south == -1 and u_height["south"] == height_target: score += 1 if req_height_south == -1 and u_height["south"] == height_target: score += 1
if req_height_west == -1 and u_height["west"] == height_target: score += 1 if req_height_west == -1 and u_height["west"] == height_target: score += 1
valid_candidates.append({ valid_candidates.append({"scene": scene, "rotation": rot, "data": data, "score": score})
"scene": scene,
"rotation": rot,
"data": data,
"score": score,
"weight": _get_uniqueness_pick_weight(uniqueness),
"uniqueness": uniqueness
})
if valid_candidates.size() > 0: if valid_candidates.size() > 0:
var max_score = -1 var max_score = -1
@@ -1007,13 +618,11 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
for c in valid_candidates: for c in valid_candidates:
if c.score == max_score: best_candidate.append(c) if c.score == max_score: best_candidate.append(c)
var choise = _pick_weighted_candidate(best_candidate) var choise = best_candidate.pick_random()
var new_chunk = choise.scene.instantiate() var new_chunk = choise.scene.instantiate()
new_chunk.position = Vector3(grid_pos.x * chunk_size, 0, grid_pos.y * chunk_size) new_chunk.position = Vector3(grid_pos.x * chunk_size, 0, grid_pos.y * chunk_size)
new_chunk.rotation.y = choise.rotation * (-PI / 2.0) new_chunk.rotation.y = choise.rotation * (-PI / 2.0)
add_child(new_chunk) add_child(new_chunk)
_spawn_props_for_chunk(new_chunk)
_spawn_entities_for_chunk(new_chunk, biome_name)
var info_new = _get_cached_chunk_info(new_chunk, choise.scene) var info_new = _get_cached_chunk_info(new_chunk, choise.scene)
@@ -1025,30 +634,25 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
_apply_river_flow_direction(new_chunk, river_flow_direction) _apply_river_flow_direction(new_chunk, river_flow_direction)
board[grid_pos] = { board[grid_pos] = {
"type": "biome", "type": "bioma",
"exit": choise.data["connections"], "exit": choise.data["connections"],
"river_exit": choise.data["river_connections"], "river_exit": choise.data["river_connections"],
"river_flow_direction": river_flow_direction, "river_flow_direction": river_flow_direction,
"heights": choise.data["heights"], "heights": choise.data["heights"],
"node": new_chunk, "node": new_chunk,
"info": info_new, "info": info_new,
"have_lamppost": have_lamppost, "have_lamppost": have_lamppost
"uniqueness": choise.uniqueness
} }
if have_lamppost: if have_lamppost:
_queue_lamppost_wire_connection(grid_pos) _queue_lamppost_wire_connection(grid_pos)
else: else:
var backup_scene = _pick_backup_scene(zone_catalogue, grid_pos) var backup = zone_catalogue[0].instantiate()
var backup = backup_scene.instantiate()
backup.position = Vector3(grid_pos.x * chunk_size, 0, grid_pos.y * chunk_size) backup.position = Vector3(grid_pos.x * chunk_size, 0, grid_pos.y * chunk_size)
add_child(backup) add_child(backup)
_spawn_props_for_chunk(backup)
_spawn_entities_for_chunk(backup, biome_name)
var info_backup = _get_cached_chunk_info(backup, backup_scene) var info_backup = _get_cached_chunk_info(backup, zone_catalogue[0])
var backup_uniqueness = _get_chunk_uniqueness_from_info(info_backup)
var safe_heights = { var safe_heights = {
"north": req_height_north if req_height_north != -1 else height_target, "north": req_height_north if req_height_north != -1 else height_target,
@@ -1064,12 +668,9 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
"heights": safe_heights, "heights": safe_heights,
"node": backup, "node": backup,
"info": info_backup, "info": info_backup,
"have_lamppost": false, "have_lamppost": false
"uniqueness": backup_uniqueness
} }
#Check if a neighbors have a river direction: if yes try to continue it,
#otherwise create a direction based on connections
func _calculate_river_flow_direction(grid_pos: Vector2i, river_connections: Dictionary) -> Vector2: func _calculate_river_flow_direction(grid_pos: Vector2i, river_connections: Dictionary) -> Vector2:
var connected_sides: Array[String] = [] var connected_sides: Array[String] = []
for side in RIVER_SIDE_ORDER: for side in RIVER_SIDE_ORDER:
@@ -1255,6 +856,37 @@ func _connect_lamppost_wires(new_board_pos: Vector2i) -> void:
p_sx_your_best = closest_sx[i_t] p_sx_your_best = closest_sx[i_t]
p_dx_your_best = closest_dx[i_t] p_dx_your_best = closest_dx[i_t]
if best_closest_to_root == null:
for x in range(-ray_research, ray_research + 1):
for z in range(-ray_research, ray_research + 1):
if x == 0 and z == 0: continue
var closest_pos = new_board_pos + Vector2i(x, z)
if board.has(closest_pos) and board[closest_pos].get("have_lamppost", false):
var closest_root = board[closest_pos]["node"]
var closest_info = board[closest_pos]["info"]
if not is_instance_valid(closest_root) or closest_root == new_root or closest_info == null: continue
if closest_info is Node3D: closest_info.force_update_transform()
var closest_sx = _get_lampposts(closest_info, "sx")
var closest_dx = _get_lampposts(closest_info, "dx")
if closest_sx.is_empty() or closest_dx.is_empty(): continue
for i_m in range(new_sx.size()):
for i_t in range(closest_sx.size()):
var c_mio = (new_sx[i_m].global_position + new_dx[i_m].global_position) / 2.0
var c_tuo = (closest_sx[i_t].global_position + closest_dx[i_t].global_position) / 2.0
var dist = c_mio.distance_to(c_tuo)
if dist < best_distance:
best_distance = dist
best_closest_to_root = closest_root
p_sx_my_best = new_sx[i_m]
p_dx_my_best = new_dx[i_m]
p_sx_your_best = closest_sx[i_t]
p_dx_your_best = closest_dx[i_t]
var max_dist = chunk_size * lamppost_dist_factor var max_dist = chunk_size * lamppost_dist_factor
if best_closest_to_root != null and best_distance < max_dist: if best_closest_to_root != null and best_distance < max_dist:
@@ -1273,7 +905,7 @@ func _connect_lamppost_wires(new_board_pos: Vector2i) -> void:
if not wire_connections.has(closest_id): wire_connections[closest_id] = 0 if not wire_connections.has(closest_id): wire_connections[closest_id] = 0
wire_connections[closest_id] += 1 wire_connections[closest_id] += 1
#draw lamppost wires #draw lamppost
func _draw_parable(p1: Vector3, p2: Vector3, parent: Node3D) -> void: func _draw_parable(p1: Vector3, p2: Vector3, parent: Node3D) -> void:
var segments = 15 var segments = 15
var lowering = 1.5 var lowering = 1.5

View File

@@ -2,9 +2,7 @@
[ext_resource type="Script" uid="uid://ct2k25kslaxe5" path="res://core/biome_generator/biome_generator.gd" id="1_c7ilo"] [ext_resource type="Script" uid="uid://ct2k25kslaxe5" path="res://core/biome_generator/biome_generator.gd" id="1_c7ilo"]
[ext_resource type="Material" uid="uid://b8p1sjxisi522" path="res://core/biome_generator/wires.tres" id="2_w42pm"] [ext_resource type="Material" uid="uid://b8p1sjxisi522" path="res://core/biome_generator/wires.tres" id="2_w42pm"]
[ext_resource type="Resource" path="res://core/biome_generator/railway_pool.tres" id="3_railway_pool"]
[node name="biome_generator" type="Node3D" unique_id=1861369341] [node name="biome_generator" type="Node3D" unique_id=1861369341]
script = ExtResource("1_c7ilo") script = ExtResource("1_c7ilo")
railway_pool = ExtResource("3_railway_pool")
lamppost_wire_material = ExtResource("2_w42pm") lamppost_wire_material = ExtResource("2_w42pm")

View File

@@ -5,7 +5,6 @@ class_name ChunkInfo
@export_group("Set Piece Rules (Unique pieces)") @export_group("Set Piece Rules (Unique pieces)")
@export var exclusive_biome: String = "" # Es: "Forest" @export var exclusive_biome: String = "" # Es: "Forest"
@export_range(0, 5, 1) var uniqueness: int = 0 #0=common; 5=unique
@export_group("Base exit") @export_group("Base exit")
@export var north: bool = false @export var north: bool = false

View File

@@ -1,9 +0,0 @@
[gd_resource type="Resource" script_class="EntityPool" format=3 uid="uid://cmd6s6thq4f7r"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_0kfj8"]
[ext_resource type="Script" uid="uid://53ryr0fsqiq7" path="res://core/biome_generator/entity_pool.gd" id="1_vccp2"]
[resource]
script = ExtResource("1_vccp2")
name = "Entity Pool"
available_entities = Array[PackedScene]([ExtResource("1_0kfj8")])

View File

@@ -1,5 +0,0 @@
extends Resource
class_name EntityPool
@export var name: String = "New Entity Pool"
@export var available_entities: Array[PackedScene] = []

View File

@@ -1 +0,0 @@
uid://53ryr0fsqiq7

View File

@@ -1,8 +0,0 @@
extends Marker3D
class_name EntitySpawnPoint
enum AllowedType { ANY, HUMANOID_ONLY, ANIMAL_ONLY }
@export var allowed_type: AllowedType = AllowedType.ANY
@export_range(0.0, 1.0, 0.01) var spawn_chance: float = 1.0
@export var random_y_rotation: bool = true

View File

@@ -1 +0,0 @@
uid://c5ercbqy7srx3

View File

@@ -1,5 +0,0 @@
extends Marker3D
class_name PropInfo
@export var available_props: Array[PackedScene]
@export_range(0, 5, 1) var uniqueness: int = 0 #0=common; 5=unique

View File

@@ -1 +0,0 @@
uid://dg6ngy4pmtsyc

View File

@@ -1,5 +0,0 @@
extends Resource
class_name RailwayPool
@export var name: String = "New Railway Pool"
@export var available_railways: Array[PackedScene] = []

View File

@@ -1 +0,0 @@
uid://c374rv220mvh1

View File

@@ -1,16 +0,0 @@
[gd_resource type="Resource" script_class="RailwayPool" format=3 uid="uid://nrm040srfjwo"]
[ext_resource type="PackedScene" uid="uid://cl2ast2tk7ifw" path="res://tgcc/chunk/railway/scene/chunk_railway_curve.tscn" id="1_86h1y"]
[ext_resource type="PackedScene" uid="uid://85l80b6jcdhr" path="res://tgcc/chunk/railway/scene/chunk_railway_curve_2.tscn" id="2_r0882"]
[ext_resource type="PackedScene" uid="uid://cewdxvcpqb53f" path="res://tgcc/chunk/railway/scene/chunk_railway_station_doubleside.tscn" id="3_3auto"]
[ext_resource type="PackedScene" uid="uid://d3pcshw2bioic" path="res://tgcc/chunk/railway/scene/chunk_railway_station_oneside.tscn" id="4_i1umq"]
[ext_resource type="PackedScene" uid="uid://bqxpqhla2kogq" path="res://tgcc/chunk/railway/scene/chunk_railway_straight.tscn" id="5_x44at"]
[ext_resource type="PackedScene" uid="uid://c3ub6rj0tlt6q" path="res://tgcc/chunk/railway/scene/chunk_railway_straight_2.tscn" id="6_vrrkw"]
[ext_resource type="PackedScene" uid="uid://cqevecsd1cm1v" path="res://tgcc/chunk/railway/scene/chunk_railway_straight_3.tscn" id="7_l17bw"]
[ext_resource type="PackedScene" uid="uid://f53hfrjaxkwa" path="res://tgcc/chunk/railway/scene/chunk_railway_straight_bridge.tscn" id="8_qcl5o"]
[ext_resource type="Script" uid="uid://c374rv220mvh1" path="res://core/biome_generator/railway_pool.gd" id="9_8tdc7"]
[resource]
script = ExtResource("9_8tdc7")
name = "Railway Pool"
available_railways = Array[PackedScene]([ExtResource("1_86h1y"), ExtResource("2_r0882"), ExtResource("3_3auto"), ExtResource("4_i1umq"), ExtResource("5_x44at"), ExtResource("6_vrrkw"), ExtResource("7_l17bw"), ExtResource("8_qcl5o")])

View File

@@ -67,12 +67,12 @@ grad_intensity_morning = 0.05
grad_intensity_afternoon = 0.1 grad_intensity_afternoon = 0.1
grad_intensity_night = 0.5 grad_intensity_night = 0.5
fog_color_morning = Color(0.7490196, 0.8509804, 0.9490196, 1) fog_color_morning = Color(0.7490196, 0.8509804, 0.9490196, 1)
fog_color_afternoon = Color(0.9823975, 0.8034449, 0.8778439, 1) fog_color_afternoon = Color(0.9647059, 0.5882353, 0.7607843, 1)
fog_color_night = Color(0.38409987, 0.28720453, 0.5907528, 1) fog_color_night = Color(0.14901961, 0.101960786, 0.2509804, 1)
fog_density_morning = 0.01 fog_density_morning = 0.01
fog_density_afternoon = 0.02 fog_density_afternoon = 0.02
glow_morning = 0.4 glow_morning = 0.4
glow_night = 0.8 glow_night = 0.6
material_fog = SubResource("ShaderMaterial_b5atu") material_fog = SubResource("ShaderMaterial_b5atu")
material_drops = SubResource("StandardMaterial3D_r4tfj") material_drops = SubResource("StandardMaterial3D_r4tfj")
material_clouds = SubResource("ShaderMaterial_ruhh7") material_clouds = SubResource("ShaderMaterial_ruhh7")

View File

@@ -1,29 +0,0 @@
@tool
extends Control
class_name ArrowButton
signal on_pressed
@export var image: Texture:
set(value):
image = value
if is_inside_tree() and has_node("%Texture"):
$%Texture.texture = image
@export var flip_h: bool = false:
set(value):
flip_h = value
if is_inside_tree() and has_node("%Texture"):
if $%Texture != null:
$%Texture.flip_h = flip_h
func _ready():
if image != null and has_node("%Texture"):
$%Texture.texture = image
$%Texture.flip_h = flip_h
func _on_gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
on_pressed.emit()

View File

@@ -1 +0,0 @@
uid://3uxuhvua1036

View File

@@ -1,38 +0,0 @@
[gd_scene format=3 uid="uid://dm3skv22c60tm"]
[ext_resource type="Texture2D" uid="uid://cm7fok7lhrano" path="res://core/game_menu/assets/page_1/freccetta.png" id="1_vbu0v"]
[ext_resource type="Script" uid="uid://3uxuhvua1036" path="res://core/game_menu/arrow_button.gd" id="2_xq7pl"]
[ext_resource type="PackedScene" uid="uid://dxun0jk5t0n6" path="res://core/game_menu/hoover_tween.tscn" id="3_hu4cn"]
[node name="ArrowButton" type="Control" unique_id=1696751730]
custom_minimum_size = Vector2(101, 124)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(0.5, 0.5)
script = ExtResource("2_xq7pl")
image = ExtResource("1_vbu0v")
[node name="Texture" type="TextureRect" parent="." unique_id=91599097]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.47369793
anchor_top = 0.4425926
anchor_right = 0.5263021
anchor_bottom = 0.5574074
grow_horizontal = 2
grow_vertical = 2
pivot_offset_ratio = Vector2(0.5, 0.5)
mouse_filter = 2
texture = ExtResource("1_vbu0v")
metadata/_edit_use_anchors_ = true
[node name="HooverTween" parent="." unique_id=2115829120 node_paths=PackedStringArray("detector_node", "visual_node") instance=ExtResource("3_hu4cn")]
detector_node = NodePath("..")
visual_node = NodePath("../Texture")
[connection signal="gui_input" from="." to="." method="_on_gui_input"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dqqnfnero7ckl"
path="res://.godot/imported/chooseyourbiome_text.png-4b7f54401f26c8523f3a3effe8f6caa4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/chooseyourbiome_text.png"
dest_files=["res://.godot/imported/chooseyourbiome_text.png-4b7f54401f26c8523f3a3effe8f6caa4.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bjqp8kmb5y7px"
path="res://.godot/imported/chooseyourtrain_text.png-ee3b98a7555062fc260ab8ebbed86f06.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/chooseyourtrain_text.png"
dest_files=["res://.godot/imported/chooseyourtrain_text.png-ee3b98a7555062fc260ab8ebbed86f06.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c3qcivnwuisju"
path="res://.godot/imported/color_dx_biome.png-3cc724dd240e512429a7cefd5adc1412.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/color_dx_biome.png"
dest_files=["res://.godot/imported/color_dx_biome.png-3cc724dd240e512429a7cefd5adc1412.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dc0sl04wem136"
path="res://.godot/imported/color_main_biome.png-89de4f4e7d123065cf25b299bcc8cc19.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/color_main_biome.png"
dest_files=["res://.godot/imported/color_main_biome.png-89de4f4e7d123065cf25b299bcc8cc19.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cin3kt42e6w3u"
path="res://.godot/imported/color_sx_biome.png-4c5ebaa4d4bd430214af8b874b4dcc9f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/color_sx_biome.png"
dest_files=["res://.godot/imported/color_sx_biome.png-4c5ebaa4d4bd430214af8b874b4dcc9f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cdjwvwst3f10a"
path="res://.godot/imported/customizecolor-1.png-abb88424ec3f49b90a0ab001b55b0613.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/customizecolor-1.png"
dest_files=["res://.godot/imported/customizecolor-1.png-abb88424ec3f49b90a0ab001b55b0613.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d4l5ih723j3md"
path="res://.godot/imported/customizecolor-2.png-fdc9e8b7a1a6738945f62225133a5f93.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/customizecolor-2.png"
dest_files=["res://.godot/imported/customizecolor-2.png-fdc9e8b7a1a6738945f62225133a5f93.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5arobd7gl4u4"
path="res://.godot/imported/customizecolor-3.png-bd0e0603c54a8be9173c4384e6c383e0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/customizecolor-3.png"
dest_files=["res://.godot/imported/customizecolor-3.png-bd0e0603c54a8be9173c4384e6c383e0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://el88fib24nl0"
path="res://.godot/imported/customizecolor-4.png-f5e40c0772c10048e3a4e0128aeb8a8b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/customizecolor-4.png"
dest_files=["res://.godot/imported/customizecolor-4.png-f5e40c0772c10048e3a4e0128aeb8a8b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Some files were not shown because too many files have changed in this diff Show More