ajout du détecteur et liaison entre les scènes

This commit is contained in:
2026-02-20 01:00:55 +01:00
parent dc1a6686bc
commit fb8a2da4ff
42 changed files with 737 additions and 418 deletions

View File

@@ -79,12 +79,12 @@ shader_parameter/layer_scale = 20.0
shader_parameter/layer_scale_step = 10.0
shader_parameter/layers_count = 3
[sub_resource type="Sky" id="Sky_65b6a"]
[sub_resource type="Sky" id="Sky_kdvug"]
sky_material = SubResource("ShaderMaterial_mwti2")
[sub_resource type="Environment" id="Environment_lhhy6"]
background_mode = 2
sky = SubResource("Sky_65b6a")
sky = SubResource("Sky_kdvug")
sky_custom_fov = 61.7
ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)
@@ -171,7 +171,7 @@ environment = SubResource("Environment_lhhy6")
[node name="Player3D" parent="." unique_id=549819967 instance=ExtResource("3_4wxm6")]
unique_name_in_owner = true
transform = Transform3D(-1, 0, -1.509958e-07, 0, 1, 0, 1.509958e-07, 0, -1, -51.325, 1, -4.22)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -29.925, 1, 4.22)
[node name="Phone" parent="." unique_id=429299908 instance=ExtResource("4_mwti2")]
unique_name_in_owner = true

View File

@@ -2,6 +2,7 @@
extends Node3D
const INTRO_DIALOG = "res://dialogs/timelines/story/demeter_intro.dtl"
const FAILED_DIALOG = "res://dialogs/timelines/gameplay_related/demeter_astra_failed.dtl"
const ROOM_PART_SCENE := preload("res://stages/3d_scenes/astra_base/room_part.tscn")
const ROOM_END_SCENE := preload("res://stages/3d_scenes/astra_base/assets/3d/astra_base_room_end.blend")
@@ -15,6 +16,8 @@ const LIFT_TIME := 2
@export var room_part_number := 100 : set = set_room_part_number
var chosen_incubator_id := -1
# Cheat Code
func _input(_e):
if (
@@ -32,7 +35,8 @@ func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
set_room_part_number()
var new_player_incubator := %Incubators.get_children().pick_random() as Incubator
chosen_incubator_id = randi_range(0, len(%Incubators.get_children()))
var new_player_incubator := %Incubators.get_children()[chosen_incubator_id] as Incubator
new_player_incubator.used = true
%Player3D.position = new_player_incubator.global_position + Vector3.UP
%Player3D.rotation = new_player_incubator.rotation
@@ -42,6 +46,8 @@ func _ready():
%Lift.interactable = true
)
GameInfo.game_data.incubator_used.append(chosen_incubator_id)
story()
@@ -55,7 +61,13 @@ func story():
Dialogic.start(INTRO_DIALOG)
await Dialogic.timeline_ended
else:
%Phone.clicked.connect(
func ():
Dialogic.start(FAILED_DIALOG)
%Phone.interactable = false
)
%LiftAnimationPlayer.play("arrive")
await %Lift.clicked
%LiftAnimationPlayer.play_backwards("arrive")
@@ -85,6 +97,7 @@ func set_room_part_number(_room_part_number : int = room_part_number):
var shifted_origin = Vector3.LEFT * ROOM_PART_SHIFT * room_part_number/2
var incubator_id = 0
for i in range(room_part_number):
var new_room_part := ROOM_PART_SCENE.instantiate() as Node3D
%RoomParts.add_child(new_room_part)
@@ -92,7 +105,9 @@ func set_room_part_number(_room_part_number : int = room_part_number):
for j in range(INCUBATOR_BY_ROOM):
for direction in [-1, 1]:
var new_incubator := INCUBATOR_SCENE.instantiate() as Incubator
new_incubator.used = incubator_id in GameInfo.game_data.incubator_used
%Incubators.add_child(new_incubator)
incubator_id += 1
new_incubator.position = (
new_room_part.position
+ j * Vector3.LEFT * (ROOM_PART_SHIFT / INCUBATOR_BY_ROOM)

View File

@@ -8,7 +8,7 @@ func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
await %Phone.clicked
Dialogic.start_timeline(OUTRO_TIMELINE_PATH)
Dialogic.start(OUTRO_TIMELINE_PATH)
await Dialogic.timeline_ended
%Credits.show()

View File

@@ -1,6 +1,13 @@
extends Node3D
const DIALOG_PATH = "res://dialogs/timelines/story/demeter_ship_presentation.dtl"
# Called when the node enters the scene tree for the first time.
func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
%Phone.play_audio()
await %Phone.clicked
Dialogic.start(DIALOG_PATH)
await Dialogic.timeline_ended
SceneManager.change_to_scene_id("COCKPIT")

View File

@@ -147,4 +147,5 @@ omni_range = 21.258795
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.37195766, 2.8968668, -0.44411802)
[node name="Phone" parent="." unique_id=429299908 instance=ExtResource("7_dkh4e")]
unique_name_in_owner = true
transform = Transform3D(-0.83126587, 0, -0.555875, 0, 1, 0, 0.555875, 0, -0.83126587, -4.110002, 1.6397171, 6.610814)

View File

@@ -1,10 +1,58 @@
[gd_scene format=3 uid="uid://d0n52psuns1vl"]
[ext_resource type="Script" uid="uid://ddf3fktoer2ng" path="res://stages/intro/scripts/intro.gd" id="1_2nxbv"]
[ext_resource type="Shader" uid="uid://bv2rghn44mrrf" path="res://stages/title_screen/resources/shaders/stars.gdshader" id="2_851lr"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2nxbv"]
shader = ExtResource("2_851lr")
shader_parameter/sky_color = Color(0.03, 0.05, 0.11, 1)
shader_parameter/star_base_color = Color(0.8, 1, 0.3, 1)
shader_parameter/star_hue_offset = 0.6
shader_parameter/star_intensity = 0.08
shader_parameter/star_twinkle_speed = 0.8
shader_parameter/star_twinkle_intensity = 0.2
shader_parameter/layer_scale = 20.0
shader_parameter/layer_scale_step = 10.0
shader_parameter/layers_count = 3
[sub_resource type="Sky" id="Sky_65b6a"]
sky_material = SubResource("ShaderMaterial_2nxbv")
[sub_resource type="Environment" id="Environment_mi20s"]
background_mode = 2
sky = SubResource("Sky_65b6a")
sky_custom_fov = 61.7
ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)
ambient_light_sky_contribution = 0.85
ambient_light_energy = 2.0
reflected_light_source = 2
tonemap_mode = 2
tonemap_exposure = 0.7
tonemap_white = 1.84
glow_enabled = true
glow_intensity = 0.22
glow_bloom = 0.22
glow_hdr_threshold = 0.79
glow_hdr_scale = 0.0
glow_hdr_luminance_cap = 5.63
fog_enabled = true
fog_mode = 1
fog_light_color = Color(0.13725491, 0.39215687, 0.6666667, 1)
fog_density = 0.1831
fog_aerial_perspective = 0.113
fog_sky_affect = 0.0
volumetric_fog_sky_affect = 0.0
adjustment_enabled = true
adjustment_saturation = 1.3
[node name="Intro" type="Node" unique_id=1801844904]
script = ExtResource("1_2nxbv")
game_scene_path = "uid://d28cp7a21kwou"
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1051527956]
layer = 100
[node name="Node3D" type="Node3D" parent="." unique_id=1668131521]
[node name="Camera3D" type="Camera3D" parent="Node3D" unique_id=2070854508]
[node name="WorldEnvironment" type="WorldEnvironment" parent="Node3D" unique_id=115692868]
environment = SubResource("Environment_mi20s")

View File

@@ -5,8 +5,8 @@
[ext_resource type="PackedScene" uid="uid://yk78ubpu5ghq" path="res://gui/game/pass_day/pass_day.tscn" id="3_ktnx3"]
[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/game/game_gui.tscn" id="4_qdnee"]
[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="5_ovqi1"]
[ext_resource type="PackedScene" uid="uid://cg1visg52i21a" path="res://entities/interactables/ladder/ladder.tscn" id="6_2w03p"]
[ext_resource type="PackedScene" uid="uid://d324mlmgls4fs" path="res://entities/interactables/truck/recharge/truck_recharge.tscn" id="7_6d8m3"]
[ext_resource type="PackedScene" uid="uid://b8m537op75gib" path="res://entities/interactables/door/door.tscn" id="8_2f6js"]
[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="8_fwgig"]
[node name="Region" type="Node2D" unique_id=1509166288 node_paths=PackedStringArray("entity_container")]
@@ -28,14 +28,31 @@ region = NodePath("../..")
[node name="Entities" type="Node2D" parent="." unique_id=2132324579]
y_sort_enabled = true
[node name="TruckLadder" parent="Entities" unique_id=1990299618 instance=ExtResource("6_2w03p")]
position = Vector2(51, -112)
[node name="Player" parent="Entities" unique_id=75851644 instance=ExtResource("5_ovqi1")]
z_index = 1
position = Vector2(3000, -41)
[node name="TruckRecharge" parent="Entities" unique_id=2068738444 instance=ExtResource("7_6d8m3")]
position = Vector2(-50, -124)
position = Vector2(-1, -169)
[node name="AstraDoor" parent="Entities" unique_id=2053096538 instance=ExtResource("8_2f6js")]
unique_name_in_owner = true
visible = false
modulate = Color(1, 0, 0, 1)
position = Vector2(-43, 367)
available = false
default_info_title = "ASTRA_FACTORY"
default_info_desc = "ASTRA_FACTORY_TEXT"
[node name="ShipGarageDoor" parent="Entities" unique_id=1073871193 instance=ExtResource("8_2f6js")]
unique_name_in_owner = true
visible = false
modulate = Color(1, 0, 0, 1)
to_scene_id = "GARAGE"
default_interact_text = "ENTER"
available = false
default_info_title = "MYSTERIOUS_DOOR"
default_info_desc = "MYSTERIOUS_DOOR_TEXT"
[node name="Camera" parent="." unique_id=1399042986 node_paths=PackedStringArray("following") instance=ExtResource("8_fwgig")]
following = NodePath("../Entities/Player")

View File

@@ -9,6 +9,7 @@ const TILE_SET : TileSet = preload("res://stages/terrain/region/resources/moss_b
const TILE_SCALE = 1
const TILE_SIZE : int = roundi(TILE_SET.tile_size.x * TILE_SCALE)
const START_ROCK_HOLE_RADIUS = 5
const PLAYER_ROCK_HOLE_RADIUS = 5
const START_DECONTAMINATION_HOLE_RADIUS = 3
const CHUNK_TILE_SIZE : int = 20
const CHUNK_SIZE = CHUNK_TILE_SIZE * TILE_SIZE
@@ -69,8 +70,6 @@ func _ready():
if e is Plant:
data.add_plant_data(e.data, false)
generate_first_entities()
ground_layer = GroundLayer.new(self)
add_child(ground_layer)
rock_layer = RockLayer.new(self)
@@ -91,11 +90,6 @@ func _process(_d):
#region ------------------ Generation ------------------
func generate_first_entities():
if not (Vector2i.ZERO in data.generated_chunk_entities):
# Generate shovel
drop_item(Shovel.new(), entity_container.global_position + Vector2(0, 100))
func get_chunk_key(coord) -> String:
return "%d:%d" % [coord.x, coord.y]
@@ -150,6 +144,21 @@ func edit_map_origin():
rock_layer.remove_rocks(hole_tiles, true)
decontamination_layer.place_decontaminations(decontamination_tiles, true)
# Dig a hole in player position
var player_hole_tiles : Array[Vector2i] = []
var player_tile_position := Vector2i(
roundi(data.player_position.x/float(TILE_SIZE)),
roundi(data.player_position.y/float(TILE_SIZE))
)
for x in range(-PLAYER_ROCK_HOLE_RADIUS, PLAYER_ROCK_HOLE_RADIUS):
for y in range(-PLAYER_ROCK_HOLE_RADIUS, PLAYER_ROCK_HOLE_RADIUS):
var coord = Vector2i(x,y)
if coord.distance_to(Vector2.ZERO) < PLAYER_ROCK_HOLE_RADIUS:
player_hole_tiles.append(coord + player_tile_position)
rock_layer.remove_rocks(player_hole_tiles, true)
setup_tutorial_doors()
func remove_chunk(chunk : Chunk):
generated_chunks.erase(get_chunk_key(chunk.data.chunk_coord))
chunk.unload()
@@ -179,6 +188,18 @@ func save():
data.player_position = player.global_position
GameInfo.save_game_data()
func setup_tutorial_doors():
%AstraDoor.visible = data.tutorial
%ShipGarageDoor.visible = data.tutorial
if data.tutorial:
%AstraDoor.global_position = data.get_random_spawn_position()
%AstraDoor.available = false
%ShipGarageDoor.available = data.state == RegionData.State.SUCCEEDED
data.succeded.connect(
func ():
%ShipGarageDoor.available = true
)
#endregion
#region ------------------ Usage ------------------

View File

@@ -14,6 +14,7 @@ signal pass_day_ended(region_data : RegionData)
const DEFAULT_START_CHARGE := 10
const DEFAULT_OBJECTIVE := 10
const MAX_RANDOM_SPAWN_DISTANCE = 3000
@export var region_seed : int
@export var region_name : String
@@ -31,7 +32,7 @@ const DEFAULT_OBJECTIVE := 10
@export var chunks_data : Dictionary[String, ChunkData]
@export var player_position : Vector2i = Region.CHUNK_SIZE/2. * Vector2.ONE
@export var player_position : Vector2i = Region.CHUNK_SIZE/2. * Vector2.ONE + get_random_spawn_position()
@export var charges : int :
set(v):
@@ -81,7 +82,9 @@ func add_chunk_data(coord : Vector2i, data : ChunkData):
chunks_data[get_coord_id(coord)] = data
func get_chunk_data(coord : Vector2i) -> ChunkData:
return chunks_data[get_coord_id(coord)]
if get_coord_id(coord) in chunks_data:
return chunks_data[get_coord_id(coord)]
return null
func get_or_create_chunk_data(coord : Vector2i) -> ChunkData:
if has_chunk_data(coord):
@@ -147,3 +150,13 @@ func _on_plant_disappeared(plant_data : PlantData):
update()
#endregion
func get_random_spawn_position():
var rng := RandomNumberGenerator.new()
rng.seed = region_seed
return Vector2(
rng.randf_range(-MAX_RANDOM_SPAWN_DISTANCE,MAX_RANDOM_SPAWN_DISTANCE),
rng.randf_range(-MAX_RANDOM_SPAWN_DISTANCE,MAX_RANDOM_SPAWN_DISTANCE),
)

View File

@@ -25,7 +25,7 @@ func place_decontaminations(coords : Array[Vector2i], save := false, on_finished
floori(coord.y / float(Region.CHUNK_TILE_SIZE)),
)
(region.data
.get_chunk_data(chunk_coord)
.get_or_create_chunk_data(chunk_coord)
.update_decontamination_tile_diff(coord, ChunkData.TileDiff.PRESENT))
func is_decontamined(coord : Vector2i) -> bool:

View File

@@ -37,7 +37,7 @@ func remove_rocks(coords : Array[Vector2i], save = false,on_finished : Callable
)
var chunk_tile_coord : Vector2i = coord - chunk_coord * Region.CHUNK_TILE_SIZE
(region.data
.get_chunk_data(chunk_coord)
.get_or_create_chunk_data(chunk_coord)
.update_rock_tile_diff(chunk_tile_coord, ChunkData.TileDiff.ABSENT))
func dig_rocks(coords : Array[Vector2i]) -> bool: