changement du scene manager, amélioration du cockpit et autres
* refonte du scene manager * refonte du audio manager * premier rework des plantes * nettoyage des dossiers/fichiers * renommage de planète en region * fix des run
@@ -1,44 +0,0 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://tsi5j1uxppa4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/planet/scripts/planet.gd" id="1_y7d8a"]
|
||||
[ext_resource type="PackedScene" uid="uid://dt6mptqg80dew" path="res://gui/game/tutorial/tutorial.tscn" id="2_0wx6t"]
|
||||
[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/game/game_gui.tscn" id="2_02xai"]
|
||||
[ext_resource type="PackedScene" uid="uid://yk78ubpu5ghq" path="res://gui/game/pass_day/pass_day.tscn" id="3_0wx6t"]
|
||||
[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="3_6qoee"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="4_hyapw"]
|
||||
[ext_resource type="PackedScene" uid="uid://cg1visg52i21a" path="res://entities/interactables/truck/ladder/truck_ladder.tscn" id="5_yjoqs"]
|
||||
[ext_resource type="PackedScene" uid="uid://d324mlmgls4fs" path="res://entities/interactables/truck/recharge/truck_recharge.tscn" id="6_0wx6t"]
|
||||
|
||||
[node name="Planet" type="Node2D" node_paths=PackedStringArray("entity_container")]
|
||||
script = ExtResource("1_y7d8a")
|
||||
entity_container = NodePath("Entities")
|
||||
|
||||
[node name="PlanetGui" type="CanvasLayer" parent="."]
|
||||
layer = 2
|
||||
|
||||
[node name="Tutorial" parent="PlanetGui" node_paths=PackedStringArray("player", "planet") instance=ExtResource("2_0wx6t")]
|
||||
player = NodePath("../../Entities/Player")
|
||||
planet = NodePath("../..")
|
||||
|
||||
[node name="PassDay" parent="PlanetGui" instance=ExtResource("3_0wx6t")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="GameGui" parent="." instance=ExtResource("2_02xai")]
|
||||
|
||||
[node name="Entities" type="Node2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="Player" parent="Entities" instance=ExtResource("4_hyapw")]
|
||||
|
||||
[node name="TruckLadder" parent="Entities" instance=ExtResource("5_yjoqs")]
|
||||
position = Vector2(71, -149)
|
||||
|
||||
[node name="TruckRecharge" parent="Entities" instance=ExtResource("6_0wx6t")]
|
||||
position = Vector2(-85, -165)
|
||||
|
||||
[node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("3_6qoee")]
|
||||
position = Vector2(573, 324)
|
||||
following = NodePath("../Entities/Player")
|
||||
|
||||
[connection signal="pass_day_ended" from="." to="GameGui" method="_on_planet_pass_day_ended"]
|
||||
[connection signal="pass_day_started" from="." to="GameGui" method="_on_planet_pass_day_started"]
|
||||
@@ -1,60 +0,0 @@
|
||||
extends Node2D
|
||||
class_name Garden
|
||||
|
||||
var plants : Array[Plant]
|
||||
var planet_data : PlanetData
|
||||
|
||||
func _init(_planet_data : PlanetData, _initial_plants : Array[Plant] = []):
|
||||
planet_data = _planet_data
|
||||
plants = _initial_plants
|
||||
# update_garden_score()
|
||||
|
||||
func _ready():
|
||||
for p in plants:
|
||||
p.harvested.connect(_on_plant_harvested)
|
||||
p.state_changed.connect(_on_plant_state_changed)
|
||||
|
||||
func get_score():
|
||||
var score = 0
|
||||
planet_data.score_by_plant.resize(len(plants))
|
||||
for i in range(len(plants)):
|
||||
var plant_score = plants[i].calculate_plant_score()
|
||||
score += plant_score
|
||||
var old_score = 0 if planet_data.score_by_plant[i] == null else planet_data.score_by_plant[i]
|
||||
if old_score < plant_score:
|
||||
planet_data.plant_has_gained_score(plants[i], plant_score - old_score)
|
||||
planet_data.score_by_plant[i] = plant_score
|
||||
return score
|
||||
|
||||
func plant(
|
||||
type : PlantType,
|
||||
plant_mutations : Array[PlantMutation] = []
|
||||
) -> Plant:
|
||||
var new_plant = Plant.new(
|
||||
type,
|
||||
plant_mutations
|
||||
)
|
||||
plants.append(new_plant)
|
||||
planet_data.score_by_plant.append(0)
|
||||
new_plant.harvested.connect(_on_plant_harvested)
|
||||
new_plant.state_changed.connect(_on_plant_state_changed)
|
||||
get_tree().create_timer(0.05).timeout.connect(update_garden_score)
|
||||
return new_plant
|
||||
|
||||
func _on_plant_state_changed(_p: Plant):
|
||||
update_garden_score()
|
||||
|
||||
func _on_plant_harvested(p: Plant):
|
||||
remove_plant(p)
|
||||
|
||||
func remove_plant(p: Plant):
|
||||
var id = plants.find(p)
|
||||
if id >= 0:
|
||||
plants.remove_at(id)
|
||||
planet_data.score_by_plant.remove_at(id)
|
||||
|
||||
get_tree().create_timer(0.05).timeout.connect(update_garden_score)
|
||||
|
||||
|
||||
func update_garden_score():
|
||||
planet_data.garden_score = get_score()
|
||||
@@ -1 +0,0 @@
|
||||
uid://dpgtjhjgfqquj
|
||||
@@ -1,62 +0,0 @@
|
||||
extends Resource
|
||||
class_name PlanetData
|
||||
|
||||
signal plant_gaining_score(p : Plant, amount : int)
|
||||
signal updated(planet_data : PlanetData)
|
||||
|
||||
const DEFAULT_START_CHARGE := 10
|
||||
const DEFAULT_OBJECTIVE := 10
|
||||
|
||||
@export var planet_seed : int
|
||||
@export var garden_score : int = 0 :
|
||||
set(v):
|
||||
garden_score = v
|
||||
updated.emit(self)
|
||||
@export var day : int = 1
|
||||
@export var entities_saved_data : Array[EntityData] = []
|
||||
@export var score_by_plant : Array[int] = []
|
||||
@export var generated_chunk_entities : Array[Vector2i]
|
||||
@export var tutorial_step : int = 0
|
||||
|
||||
@export var chunks_data : Dictionary[String, ChunkData]
|
||||
|
||||
@export var charges : int
|
||||
@export var objective : int
|
||||
|
||||
func _init(
|
||||
parameter : PlanetParameter = PlanetParameter.new()
|
||||
):
|
||||
charges = parameter.charges
|
||||
objective = parameter.objective
|
||||
planet_seed = parameter.planet_seed
|
||||
|
||||
#region ------------------ Chunks ------------------
|
||||
|
||||
func get_coord_id(coord):
|
||||
return "%d:%d" % [coord.x, coord.y]
|
||||
|
||||
func has_chunk_data(coord : Vector2i) -> bool:
|
||||
return chunks_data.has(get_coord_id(coord))
|
||||
|
||||
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)]
|
||||
|
||||
func get_or_create_chunk_data(coord : Vector2i) -> ChunkData:
|
||||
if has_chunk_data(coord):
|
||||
return get_chunk_data(coord)
|
||||
else:
|
||||
var new_chunk_data = ChunkData.new(coord)
|
||||
add_chunk_data(coord, new_chunk_data)
|
||||
return new_chunk_data
|
||||
|
||||
#endregion
|
||||
|
||||
#region ------------------ Score ------------------
|
||||
|
||||
func plant_has_gained_score(plant : Plant, amount : int):
|
||||
plant_gaining_score.emit(plant, amount)
|
||||
|
||||
#endregion
|
||||
@@ -1,14 +0,0 @@
|
||||
extends Resource
|
||||
class_name PlanetParameter
|
||||
|
||||
@export var charges : int
|
||||
@export var objective : int
|
||||
@export var planet_seed : int
|
||||
|
||||
func _init(
|
||||
_charges : int = 10,
|
||||
_objective : int = 10
|
||||
):
|
||||
charges = _charges
|
||||
objective = _objective
|
||||
planet_seed = randi()
|
||||
@@ -3,12 +3,12 @@
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://cjspglv6gidd7"
|
||||
path="res://.godot/imported/alert.wav-d5e63ab6c4571ed5f0d9340b9c046178.sample"
|
||||
path="res://.godot/imported/alert.wav-d6f6d417dbab2ed86fb9c828e1764c61.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/sounds/alert.wav"
|
||||
dest_files=["res://.godot/imported/alert.wav-d5e63ab6c4571ed5f0d9340b9c046178.sample"]
|
||||
source_file="res://stages/terrain/region/assets/sounds/alert.wav"
|
||||
dest_files=["res://.godot/imported/alert.wav-d6f6d417dbab2ed86fb9c828e1764c61.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://c30s61i0j7l88"
|
||||
path="res://.godot/imported/quota_announcement.wav-e296196858a1e87a106693abaaa5f6af.sample"
|
||||
path="res://.godot/imported/quota_announcement.wav-b06177dc8ee27bb609c7b0a8b9812aa9.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/sounds/quota_announcement.wav"
|
||||
dest_files=["res://.godot/imported/quota_announcement.wav-e296196858a1e87a106693abaaa5f6af.sample"]
|
||||
source_file="res://stages/terrain/region/assets/sounds/quota_announcement.wav"
|
||||
dest_files=["res://.godot/imported/quota_announcement.wav-b06177dc8ee27bb609c7b0a8b9812aa9.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cd62k5urdpw3i"
|
||||
path="res://.godot/imported/blue_rect.png-d2bf0f89bd9a318145a3150338e6ed14.ctex"
|
||||
path="res://.godot/imported/blue_rect.png-6eb6bcb621810ab61b6d3aead70129b2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/blue_rect.png"
|
||||
dest_files=["res://.godot/imported/blue_rect.png-d2bf0f89bd9a318145a3150338e6ed14.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/blue_rect.png"
|
||||
dest_files=["res://.godot/imported/blue_rect.png-6eb6bcb621810ab61b6d3aead70129b2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bnrjnvceprxfn"
|
||||
path="res://.godot/imported/garden_background_texture.png-15af9185e7f2afb324adf3e5bc16d734.ctex"
|
||||
path="res://.godot/imported/garden_background_texture.png-002bbb09c02ebe4313ea8a293c00ef9e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/garden_background_texture.png"
|
||||
dest_files=["res://.godot/imported/garden_background_texture.png-15af9185e7f2afb324adf3e5bc16d734.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/garden_background_texture.png"
|
||||
dest_files=["res://.godot/imported/garden_background_texture.png-002bbb09c02ebe4313ea8a293c00ef9e.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bseoyd8mqjo7y"
|
||||
path="res://.godot/imported/garden_decontamined_background_texture.png-059bd195ae2e24916e642e6f3275cffd.ctex"
|
||||
path="res://.godot/imported/garden_decontamined_background_texture.png-d2e9b3111739dbe0f3e878510238390a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png"
|
||||
dest_files=["res://.godot/imported/garden_decontamined_background_texture.png-059bd195ae2e24916e642e6f3275cffd.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/garden_decontamined_background_texture.png"
|
||||
dest_files=["res://.godot/imported/garden_decontamined_background_texture.png-d2e9b3111739dbe0f3e878510238390a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ex35g5nvtsy0"
|
||||
path="res://.godot/imported/garden_decontamined_background_texture_old.png-df017d633ed63644def49f2ef3a9d5b3.ctex"
|
||||
path="res://.godot/imported/garden_decontamined_background_texture_old.png-951b3e125e8b7083a60c2b7435bce68a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png"
|
||||
dest_files=["res://.godot/imported/garden_decontamined_background_texture_old.png-df017d633ed63644def49f2ef3a9d5b3.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png"
|
||||
dest_files=["res://.godot/imported/garden_decontamined_background_texture_old.png-951b3e125e8b7083a60c2b7435bce68a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bvangyp301tsp"
|
||||
path="res://.godot/imported/green_rect.png-2cde15567ae810adb5864776d70ef438.ctex"
|
||||
path="res://.godot/imported/green_rect.png-5f705079cd8c03d8ad17266e7ce975db.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/green_rect.png"
|
||||
dest_files=["res://.godot/imported/green_rect.png-2cde15567ae810adb5864776d70ef438.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/green_rect.png"
|
||||
dest_files=["res://.godot/imported/green_rect.png-5f705079cd8c03d8ad17266e7ce975db.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://yl4dg6gerykb"
|
||||
path="res://.godot/imported/green_tiles.png-24cb2e8d3d77d0f127478dc375fc7791.ctex"
|
||||
path="res://.godot/imported/green_tiles.png-8b5f7bc46b5efa30092dac78c9cc56fc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/green_tiles.png"
|
||||
dest_files=["res://.godot/imported/green_tiles.png-24cb2e8d3d77d0f127478dc375fc7791.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/green_tiles.png"
|
||||
dest_files=["res://.godot/imported/green_tiles.png-8b5f7bc46b5efa30092dac78c9cc56fc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://o43d0p2ojbbh"
|
||||
path="res://.godot/imported/moss_contamination_atlas_red.png-285da16354bb22d2c5b8102e267e7ff9.ctex"
|
||||
path="res://.godot/imported/moss_contamination_atlas_red.png-70e6e889f4d027e7e5a753054fb81f78.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_red.png"
|
||||
dest_files=["res://.godot/imported/moss_contamination_atlas_red.png-285da16354bb22d2c5b8102e267e7ff9.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_red.png"
|
||||
dest_files=["res://.godot/imported/moss_contamination_atlas_red.png-70e6e889f4d027e7e5a753054fb81f78.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 142 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dr72xhc07i56e"
|
||||
path="res://.godot/imported/moss_contamination_atlas_texture.png-315849d799f890ff8a71f9ec9fcd4776.ctex"
|
||||
path="res://.godot/imported/moss_contamination_atlas_texture.png-80aa9a19eb65e2c40b783557f4f8a743.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png"
|
||||
dest_files=["res://.godot/imported/moss_contamination_atlas_texture.png-315849d799f890ff8a71f9ec9fcd4776.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png"
|
||||
dest_files=["res://.godot/imported/moss_contamination_atlas_texture.png-80aa9a19eb65e2c40b783557f4f8a743.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cquonnydto387"
|
||||
path="res://.godot/imported/moss_contamination_atlas_texture_2.png-273150e06680f719d234dbf50850407d.ctex"
|
||||
path="res://.godot/imported/moss_contamination_atlas_texture_2.png-d3b17c123dfe73058f82ef745ed7ae76.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png"
|
||||
dest_files=["res://.godot/imported/moss_contamination_atlas_texture_2.png-273150e06680f719d234dbf50850407d.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png"
|
||||
dest_files=["res://.godot/imported/moss_contamination_atlas_texture_2.png-d3b17c123dfe73058f82ef745ed7ae76.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c07hqxv7mybw7"
|
||||
path="res://.godot/imported/moss_element_1.png-a6f9a32694a449c52289ffe35904adcc.ctex"
|
||||
path="res://.godot/imported/moss_element_1.png-5689c80beabd4d37765ecc4aa128cd18.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_element_1.png"
|
||||
dest_files=["res://.godot/imported/moss_element_1.png-a6f9a32694a449c52289ffe35904adcc.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_element_1.png"
|
||||
dest_files=["res://.godot/imported/moss_element_1.png-5689c80beabd4d37765ecc4aa128cd18.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://x68ggxb8jbid"
|
||||
path="res://.godot/imported/moss_element_2.png-5cbf59b34a70d33c02f41b72eab35dd5.ctex"
|
||||
path="res://.godot/imported/moss_element_2.png-0612506a49d7e87c3d31a8a0d4bbe052.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_element_2.png"
|
||||
dest_files=["res://.godot/imported/moss_element_2.png-5cbf59b34a70d33c02f41b72eab35dd5.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_element_2.png"
|
||||
dest_files=["res://.godot/imported/moss_element_2.png-0612506a49d7e87c3d31a8a0d4bbe052.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cb1k4g8fcsuke"
|
||||
path="res://.godot/imported/moss_element_3.png-c6f84b36571c3be4bea3a4fbc54917b2.ctex"
|
||||
path="res://.godot/imported/moss_element_3.png-590cfa4dea5af9388a3be231b1eb9e69.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_element_3.png"
|
||||
dest_files=["res://.godot/imported/moss_element_3.png-c6f84b36571c3be4bea3a4fbc54917b2.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_element_3.png"
|
||||
dest_files=["res://.godot/imported/moss_element_3.png-590cfa4dea5af9388a3be231b1eb9e69.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 581 KiB After Width: | Height: | Size: 581 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dsa7wbwjiebnw"
|
||||
path="res://.godot/imported/moss_ground_texture.png-c04fbb538eff33b5a200a959b09aefb5.ctex"
|
||||
path="res://.godot/imported/moss_ground_texture.png-db5ac5662696a68d00ce73febb556cc3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_ground_texture.png"
|
||||
dest_files=["res://.godot/imported/moss_ground_texture.png-c04fbb538eff33b5a200a959b09aefb5.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_ground_texture.png"
|
||||
dest_files=["res://.godot/imported/moss_ground_texture.png-db5ac5662696a68d00ce73febb556cc3.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 212 KiB After Width: | Height: | Size: 212 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ch4rydip0nlt6"
|
||||
path="res://.godot/imported/moss_rock_atlas_texture.png-9e39fbed50de2857d6c90ff91f86917a.ctex"
|
||||
path="res://.godot/imported/moss_rock_atlas_texture.png-42db73700a39c396acd665f1acf7a968.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png"
|
||||
dest_files=["res://.godot/imported/moss_rock_atlas_texture.png-9e39fbed50de2857d6c90ff91f86917a.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png"
|
||||
dest_files=["res://.godot/imported/moss_rock_atlas_texture.png-42db73700a39c396acd665f1acf7a968.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bi08trir23od2"
|
||||
path="res://.godot/imported/red_rect.png-2c97ffc5003cb92590914f11ff4ed41d.ctex"
|
||||
path="res://.godot/imported/red_rect.png-37a9e533ba7e4668f9eb8a241791dccb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/red_rect.png"
|
||||
dest_files=["res://.godot/imported/red_rect.png-2c97ffc5003cb92590914f11ff4ed41d.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/red_rect.png"
|
||||
dest_files=["res://.godot/imported/red_rect.png-37a9e533ba7e4668f9eb8a241791dccb.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ddecvei4l62gn"
|
||||
path="res://.godot/imported/red_tiles.png-0bb5056d42a3159163beb701fb8aa247.ctex"
|
||||
path="res://.godot/imported/red_tiles.png-a93183162dddbf2e40094e4a73dd9c29.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/red_tiles.png"
|
||||
dest_files=["res://.godot/imported/red_tiles.png-0bb5056d42a3159163beb701fb8aa247.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/red_tiles.png"
|
||||
dest_files=["res://.godot/imported/red_tiles.png-a93183162dddbf2e40094e4a73dd9c29.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 190 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://beqx4rmgthkql"
|
||||
path="res://.godot/imported/rock_background_texture.png-7bbae13b0384e1483bd66633981b566b.ctex"
|
||||
path="res://.godot/imported/rock_background_texture.png-79a8569ff49f7d85f8b64d55ac1ce62d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/rock_background_texture.png"
|
||||
dest_files=["res://.godot/imported/rock_background_texture.png-7bbae13b0384e1483bd66633981b566b.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/rock_background_texture.png"
|
||||
dest_files=["res://.godot/imported/rock_background_texture.png-79a8569ff49f7d85f8b64d55ac1ce62d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 315 KiB After Width: | Height: | Size: 315 KiB |
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 204 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://02nuoqleo4yu"
|
||||
path="res://.godot/imported/rock_cristal_texture.png-33ee9694873f9aa2e8604c502b12dee5.ctex"
|
||||
path="res://.godot/imported/rock_cristal_texture.png-c34612644dbfa24e49296bfe43df46c6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/rock_cristal_texture.png"
|
||||
dest_files=["res://.godot/imported/rock_cristal_texture.png-33ee9694873f9aa2e8604c502b12dee5.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/rock_cristal_texture.png"
|
||||
dest_files=["res://.godot/imported/rock_cristal_texture.png-c34612644dbfa24e49296bfe43df46c6.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bmdb63witojeg"
|
||||
path="res://.godot/imported/round_red_tiles.png-7f838ac911f20be784ac93821bd5d5ba.ctex"
|
||||
path="res://.godot/imported/round_red_tiles.png-c254569faa1f0323275dcc266f2b4c86.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/planet/assets/textures/round_red_tiles.png"
|
||||
dest_files=["res://.godot/imported/round_red_tiles.png-7f838ac911f20be784ac93821bd5d5ba.ctex"]
|
||||
source_file="res://stages/terrain/region/assets/textures/round_red_tiles.png"
|
||||
dest_files=["res://.godot/imported/round_red_tiles.png-c254569faa1f0323275dcc266f2b4c86.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bnwq0xl7ak661"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/planet/scripts/planet.gd" id="1_ne67o"]
|
||||
[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/region/scripts/region.gd" id="1_ne67o"]
|
||||
|
||||
[node name="Planet" type="Node2D"]
|
||||
script = ExtResource("1_ne67o")
|
||||
43
stages/terrain/region/region.tscn
Normal file
@@ -0,0 +1,43 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://tsi5j1uxppa4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/region/scripts/region.gd" id="1_441sk"]
|
||||
[ext_resource type="PackedScene" uid="uid://dt6mptqg80dew" path="res://gui/game/tutorial/tutorial.tscn" id="2_2f6js"]
|
||||
[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://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="8_fwgig"]
|
||||
|
||||
[node name="Region" type="Node2D" node_paths=PackedStringArray("entity_container")]
|
||||
script = ExtResource("1_441sk")
|
||||
first_loot_number = null
|
||||
loot_item_number = null
|
||||
entity_container = NodePath("Entities")
|
||||
|
||||
[node name="RegionGui" type="CanvasLayer" parent="."]
|
||||
layer = 2
|
||||
|
||||
[node name="Tutorial" parent="RegionGui" node_paths=PackedStringArray("player", "region") instance=ExtResource("2_2f6js")]
|
||||
player = NodePath("../../Entities/Player")
|
||||
region = NodePath("../..")
|
||||
|
||||
[node name="PassDay" parent="RegionGui" instance=ExtResource("3_ktnx3")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="GameGui" parent="." instance=ExtResource("4_qdnee")]
|
||||
|
||||
[node name="Entities" type="Node2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="TruckLadder" parent="Entities" instance=ExtResource("6_2w03p")]
|
||||
position = Vector2(51, -112)
|
||||
|
||||
[node name="Player" parent="Entities" instance=ExtResource("5_ovqi1")]
|
||||
z_index = 1
|
||||
|
||||
[node name="TruckRecharge" parent="Entities" instance=ExtResource("7_6d8m3")]
|
||||
position = Vector2(-50, -124)
|
||||
|
||||
[node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("8_fwgig")]
|
||||
following = NodePath("../Entities/Player")
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://b3vnia5tb6pil"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://q5isn3rwrir8" path="res://common/vfx/materials/shaders/texture_color_filter.gdshader" id="1_4m73r"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/garden_background_texture.png" id="2_4m73r"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/region/assets/textures/garden_background_texture.png" id="2_4m73r"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_4m73r")
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://85ap1buim1ha"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://q5isn3rwrir8" path="res://common/vfx/materials/shaders/texture_color_filter.gdshader" id="1_v8wor"]
|
||||
[ext_resource type="Texture2D" uid="uid://bseoyd8mqjo7y" path="res://stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png" id="2_v8wor"]
|
||||
[ext_resource type="Texture2D" uid="uid://bseoyd8mqjo7y" path="res://stages/terrain/region/assets/textures/garden_decontamined_background_texture.png" id="2_v8wor"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_v8wor")
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=6 format=3 uid="uid://bq3dmwkej5gmx"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://bglep64ppn74p" path="res://common/vfx/materials/shaders/textures_data_filter.gdshader" id="1_kujx0"]
|
||||
[ext_resource type="Texture2D" uid="uid://beqx4rmgthkql" path="res://stages/terrain/planet/assets/textures/rock_background_texture.png" id="2_6cs2h"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/garden_background_texture.png" id="2_ydx6d"]
|
||||
[ext_resource type="Texture2D" uid="uid://beqx4rmgthkql" path="res://stages/terrain/region/assets/textures/rock_background_texture.png" id="2_6cs2h"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/region/assets/textures/garden_background_texture.png" id="2_ydx6d"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_kujx0"]
|
||||
noise_type = 0
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=6 format=3 uid="uid://ljvaj1vab53a"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://bglep64ppn74p" path="res://common/vfx/materials/shaders/textures_data_filter.gdshader" id="1_ye8oh"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/garden_background_texture.png" id="2_6hswu"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3t26nlbnkxg7" path="res://stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png" id="2_r7pv0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/region/assets/textures/garden_background_texture.png" id="2_6hswu"]
|
||||
[ext_resource type="Texture2D" uid="uid://ex35g5nvtsy0" path="res://stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png" id="2_r7pv0"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_6hswu"]
|
||||
frequency = 0.0109
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://dpxu8yeee4qi1"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://q5isn3rwrir8" path="res://common/vfx/materials/shaders/texture_color_filter.gdshader" id="1_k4e5t"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/garden_background_texture.png" id="2_k4e5t"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/region/assets/textures/garden_background_texture.png" id="2_k4e5t"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_k4e5t")
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=4 format=3 uid="uid://d365ovfmi3d0s"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://q5isn3rwrir8" path="res://common/vfx/materials/shaders/texture_color_filter.gdshader" id="1_xr5ia"]
|
||||
[ext_resource type="Texture2D" uid="uid://beqx4rmgthkql" path="res://stages/terrain/planet/assets/textures/rock_background_texture.png" id="2_ieaec"]
|
||||
[ext_resource type="Texture2D" uid="uid://02nuoqleo4yu" path="res://stages/terrain/planet/assets/textures/rock_cristal_texture.png" id="2_sc014"]
|
||||
[ext_resource type="Texture2D" uid="uid://beqx4rmgthkql" path="res://stages/terrain/region/assets/textures/rock_background_texture.png" id="2_ieaec"]
|
||||
[ext_resource type="Texture2D" uid="uid://02nuoqleo4yu" path="res://stages/terrain/region/assets/textures/rock_cristal_texture.png" id="2_sc014"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_xr5ia")
|
||||
@@ -1,9 +1,9 @@
|
||||
[gd_resource type="TileSet" load_steps=9 format=3 uid="uid://bqo32vh5etspf"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ch4rydip0nlt6" path="res://stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png" id="1_spfgy"]
|
||||
[ext_resource type="Texture2D" uid="uid://dr72xhc07i56e" path="res://stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png" id="1_uqnql"]
|
||||
[ext_resource type="Texture2D" uid="uid://yl4dg6gerykb" path="res://stages/terrain/planet/assets/textures/green_tiles.png" id="2_04qcq"]
|
||||
[ext_resource type="Texture2D" uid="uid://bi08trir23od2" path="res://stages/terrain/planet/assets/textures/red_rect.png" id="4_spfgy"]
|
||||
[ext_resource type="Texture2D" uid="uid://ch4rydip0nlt6" path="res://stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png" id="1_spfgy"]
|
||||
[ext_resource type="Texture2D" uid="uid://dr72xhc07i56e" path="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png" id="1_uqnql"]
|
||||
[ext_resource type="Texture2D" uid="uid://yl4dg6gerykb" path="res://stages/terrain/region/assets/textures/green_tiles.png" id="2_04qcq"]
|
||||
[ext_resource type="Texture2D" uid="uid://bi08trir23od2" path="res://stages/terrain/region/assets/textures/red_rect.png" id="4_spfgy"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_4i8c6"]
|
||||
resource_name = "Rock"
|
||||
@@ -4,8 +4,8 @@ class_name Chunk
|
||||
|
||||
signal generated
|
||||
|
||||
var planet : Planet
|
||||
var planet_seed : int
|
||||
var region : Region
|
||||
var region_seed : int
|
||||
var wall_threshold = 0.3
|
||||
var decontamination_threshold = 0.
|
||||
var cristal_threshold = 0.08
|
||||
@@ -27,24 +27,24 @@ const ROCK_NOISE_FREQUENCY := 0.01
|
||||
const DECONTAMINATION_NOISE_FREQUENCY := 0.01
|
||||
|
||||
@export_tool_button("Update", "Callable") var update_action = func():
|
||||
planet_seed = randi()
|
||||
region_seed = randi()
|
||||
generate()
|
||||
|
||||
var data : ChunkData
|
||||
|
||||
func _init(
|
||||
_data : ChunkData,
|
||||
_planet : Planet = null,
|
||||
_planet : Region = null,
|
||||
):
|
||||
planet = _planet
|
||||
if planet:
|
||||
planet_seed = planet.data.planet_seed
|
||||
region = _planet
|
||||
if region:
|
||||
region_seed = region.data.region_seed
|
||||
data = _data
|
||||
|
||||
func generate():
|
||||
rock_noise_image = generate_noise(planet_seed + 1, ROCK_NOISE_FREQUENCY)
|
||||
decontamination_noise_image = generate_noise(planet_seed + 2, DECONTAMINATION_NOISE_FREQUENCY)
|
||||
global_position = data.chunk_coord * (Planet.CHUNK_TILE_SIZE * Planet.TILE_SIZE)
|
||||
rock_noise_image = generate_noise(region_seed + 1, ROCK_NOISE_FREQUENCY)
|
||||
decontamination_noise_image = generate_noise(region_seed + 2, DECONTAMINATION_NOISE_FREQUENCY)
|
||||
global_position = data.chunk_coord * (Region.CHUNK_TILE_SIZE * Region.TILE_SIZE)
|
||||
generate_rocks()
|
||||
generate_ground()
|
||||
generate_decontamination()
|
||||
@@ -55,17 +55,17 @@ func finish_one_generation(generation_name : String):
|
||||
is_generated = true
|
||||
|
||||
func unload():
|
||||
for x in range(Planet.CHUNK_TILE_SIZE):
|
||||
for y in range(Planet.CHUNK_TILE_SIZE):
|
||||
var global_coord = Vector2i(x, y) + Planet.CHUNK_TILE_SIZE * data.chunk_coord
|
||||
planet.rock_layer.erase_cell(global_coord)
|
||||
planet.ground_layer.erase_cell(global_coord)
|
||||
planet.decontamination_layer.erase_cell(global_coord)
|
||||
for x in range(Region.CHUNK_TILE_SIZE):
|
||||
for y in range(Region.CHUNK_TILE_SIZE):
|
||||
var global_coord = Vector2i(x, y) + Region.CHUNK_TILE_SIZE * data.chunk_coord
|
||||
region.rock_layer.erase_cell(global_coord)
|
||||
region.ground_layer.erase_cell(global_coord)
|
||||
region.decontamination_layer.erase_cell(global_coord)
|
||||
|
||||
# Debug
|
||||
# func _draw():
|
||||
# draw_rect(
|
||||
# Rect2(Vector2.ZERO, Vector2.ONE * Planet.CHUNK_TILE_SIZE * Planet.TILE_SIZE),
|
||||
# Rect2(Vector2.ZERO, Vector2.ONE * Region.CHUNK_TILE_SIZE * Region.TILE_SIZE),
|
||||
# Color.WHITE,
|
||||
# false,
|
||||
# 3
|
||||
@@ -78,7 +78,7 @@ func unload():
|
||||
# y
|
||||
# )
|
||||
# draw_rect(
|
||||
# Rect2(Vector2i(x,y) * Planet.CHUNK_SIZE / NOISE_IMAGE_SIZE, Vector2i.ONE * Planet.CHUNK_SIZE / NOISE_IMAGE_SIZE),
|
||||
# Rect2(Vector2i(x,y) * Region.CHUNK_SIZE / NOISE_IMAGE_SIZE, Vector2i.ONE * Region.CHUNK_SIZE / NOISE_IMAGE_SIZE),
|
||||
# Color.WHITE * ((noise_value+1)/2),
|
||||
# true,
|
||||
# )
|
||||
@@ -104,25 +104,25 @@ func generate_noise(
|
||||
|
||||
func get_tile_value_from_noise(tile_position : Vector2i, noise : Noise) -> float:
|
||||
var val = noise.get_noise_2d(
|
||||
floori(float(tile_position.x * NOISE_IMAGE_SIZE) / Planet.CHUNK_TILE_SIZE),
|
||||
floori(float(tile_position.y * NOISE_IMAGE_SIZE) / Planet.CHUNK_TILE_SIZE)
|
||||
floori(float(tile_position.x * NOISE_IMAGE_SIZE) / Region.CHUNK_TILE_SIZE),
|
||||
floori(float(tile_position.y * NOISE_IMAGE_SIZE) / Region.CHUNK_TILE_SIZE)
|
||||
)
|
||||
return (val + 1)/2
|
||||
|
||||
func generate_rocks():
|
||||
var cristals : Array[Vector2i] = []
|
||||
var rocks : Array[Vector2i] = []
|
||||
for x in range(Planet.CHUNK_TILE_SIZE):
|
||||
for y in range(Planet.CHUNK_TILE_SIZE):
|
||||
for x in range(Region.CHUNK_TILE_SIZE):
|
||||
for y in range(Region.CHUNK_TILE_SIZE):
|
||||
var tile_type := get_generated_rock_type(Vector2i(x, y))
|
||||
var global_coord = Vector2i(x, y) + Planet.CHUNK_TILE_SIZE * data.chunk_coord
|
||||
var global_coord = Vector2i(x, y) + Region.CHUNK_TILE_SIZE * data.chunk_coord
|
||||
if tile_type == RockLayer.TileType.CRISTAL:
|
||||
cristals.append(global_coord)
|
||||
elif tile_type == RockLayer.TileType.ROCK:
|
||||
rocks.append(global_coord)
|
||||
|
||||
planet.rock_layer.place_rocks(cristals, RockLayer.TileType.CRISTAL, func(): finish_one_generation("rock"))
|
||||
planet.rock_layer.place_rocks(rocks, RockLayer.TileType.ROCK, func(): finish_one_generation("cristal"))
|
||||
region.rock_layer.place_rocks(cristals, RockLayer.TileType.CRISTAL, func(): finish_one_generation("rock"))
|
||||
region.rock_layer.place_rocks(rocks, RockLayer.TileType.ROCK, func(): finish_one_generation("cristal"))
|
||||
|
||||
func get_generated_rock_type(coord : Vector2i) -> RockLayer.TileType:
|
||||
var tile_value : float = get_tile_value_from_noise(coord, rock_noise_image)
|
||||
@@ -137,16 +137,16 @@ func get_generated_rock_type(coord : Vector2i) -> RockLayer.TileType:
|
||||
|
||||
func generate_ground():
|
||||
var coords : Array[Vector2i] = []
|
||||
for x in range(Planet.CHUNK_TILE_SIZE):
|
||||
for y in range(Planet.CHUNK_TILE_SIZE):
|
||||
coords.append(Vector2i(x,y) + Planet.CHUNK_TILE_SIZE * data.chunk_coord)
|
||||
for x in range(Region.CHUNK_TILE_SIZE):
|
||||
for y in range(Region.CHUNK_TILE_SIZE):
|
||||
coords.append(Vector2i(x,y) + Region.CHUNK_TILE_SIZE * data.chunk_coord)
|
||||
|
||||
planet.ground_layer.place_ground(coords, func(): finish_one_generation("ground"))
|
||||
region.ground_layer.place_ground(coords, func(): finish_one_generation("ground"))
|
||||
|
||||
func generate_decontamination():
|
||||
var decontamination_tiles : Array[Vector2i] = []
|
||||
for x in range(Planet.CHUNK_TILE_SIZE):
|
||||
for y in range(Planet.CHUNK_TILE_SIZE):
|
||||
for x in range(Region.CHUNK_TILE_SIZE):
|
||||
for y in range(Region.CHUNK_TILE_SIZE):
|
||||
var coord = Vector2i(x,y)
|
||||
var tile_value : float = get_tile_value_from_noise(coord, decontamination_noise_image)
|
||||
var saved_diff := data.get_decontamination_tile_diff(coord)
|
||||
@@ -154,9 +154,9 @@ func generate_decontamination():
|
||||
(saved_diff == ChunkData.TileDiff.PRESENT or tile_value < decontamination_threshold)
|
||||
and saved_diff != ChunkData.TileDiff.ABSENT
|
||||
):
|
||||
decontamination_tiles.append(Vector2i(x,y) + Planet.CHUNK_TILE_SIZE * data.chunk_coord)
|
||||
decontamination_tiles.append(Vector2i(x,y) + Region.CHUNK_TILE_SIZE * data.chunk_coord)
|
||||
|
||||
planet.decontamination_layer.place_decontaminations(
|
||||
region.decontamination_layer.place_decontaminations(
|
||||
decontamination_tiles,
|
||||
false,
|
||||
func():
|
||||
@@ -1,13 +1,11 @@
|
||||
extends Terrain
|
||||
class_name Planet
|
||||
|
||||
signal pass_day_started(planet : Planet)
|
||||
signal pass_day_proceeded(planet : Planet)
|
||||
signal pass_day_ended(planet : Planet)
|
||||
class_name Region
|
||||
|
||||
const MIN_PASS_DAY_ANIMATION_TIME : float = PassDay.TIME_MARGIN * 2
|
||||
|
||||
const TILE_SET : TileSet = preload("res://stages/terrain/planet/resources/moss_biome.tres")
|
||||
const TUTORIAL_SCENE : PackedScene = preload("res://gui/game/tutorial/tutorial.tscn")
|
||||
|
||||
const TILE_SET : TileSet = preload("res://stages/terrain/region/resources/moss_biome.tres")
|
||||
const TILE_SCALE = 1
|
||||
const TILE_SIZE : int = roundi(TILE_SET.tile_size.x * TILE_SCALE)
|
||||
const START_ROCK_HOLE_RADIUS = 5
|
||||
@@ -23,21 +21,22 @@ const CHUNK_UNLOAD_DISTANCE : int = 2
|
||||
var is_generated : bool : get = check_is_generated
|
||||
var generated_value : float : get = get_generated_value
|
||||
|
||||
var data : PlanetData
|
||||
var data : RegionData
|
||||
|
||||
var in_passing_day_animation = false
|
||||
|
||||
var contamination_texture : ImageTexture
|
||||
var rock_layer : RockLayer
|
||||
var ground_layer : GroundLayer
|
||||
var decontamination_layer : DecontaminationLayer
|
||||
var garden : Garden = null
|
||||
|
||||
var tile_set = Planet.TILE_SET
|
||||
var tile_set = Region.TILE_SET
|
||||
|
||||
var generated_chunks : Dictionary[String,Chunk] = {}
|
||||
var generation_semaphore: Semaphore
|
||||
|
||||
func _init():
|
||||
data = GameInfo.game_data.current_planet_data
|
||||
data = GameInfo.game_data.current_region_data
|
||||
|
||||
func _ready():
|
||||
generation_semaphore = Semaphore.new()
|
||||
@@ -46,18 +45,12 @@ func _ready():
|
||||
entity_container.position = TILE_SIZE * CHUNK_TILE_SIZE * Vector2.ONE / 2
|
||||
load_entities(data.entities_saved_data)
|
||||
|
||||
var plants : Array[Plant] = []
|
||||
for e in entity_container.get_children():
|
||||
if e is Plant:
|
||||
plants.append(e)
|
||||
|
||||
garden = Garden.new(data, plants)
|
||||
add_child(garden)
|
||||
data.add_plant_data(e.data)
|
||||
|
||||
generate_first_entities()
|
||||
|
||||
AudioManager.enter_planet()
|
||||
|
||||
ground_layer = GroundLayer.new(self)
|
||||
add_child(ground_layer)
|
||||
rock_layer = RockLayer.new(self)
|
||||
@@ -74,21 +67,6 @@ func _process(_d):
|
||||
generate_near_chunks(player)
|
||||
remove_far_chunks(player)
|
||||
|
||||
# queue_redraw()
|
||||
|
||||
# func _draw():
|
||||
# var factor = 20
|
||||
# for x in range(terrain_size.x / factor):
|
||||
# for y in range(terrain_size.y / factor):
|
||||
# var point = Vector2(x, y) * factor
|
||||
|
||||
# draw_circle(
|
||||
# point,
|
||||
# factor/10,
|
||||
# Color.BLUE if garden.is_there_contamination(point) else Color.RED,
|
||||
# true
|
||||
# )
|
||||
|
||||
#region ------------------ Generation ------------------
|
||||
|
||||
func generate_first_entities():
|
||||
@@ -182,37 +160,37 @@ func save():
|
||||
#region ------------------ Usage ------------------
|
||||
|
||||
func plant(
|
||||
type : PlantType,
|
||||
plant_position : Vector2,
|
||||
plant_mutations : Array[PlantMutation] = []
|
||||
plant_seed : Seed,
|
||||
plant_position : Vector2i
|
||||
) -> bool:
|
||||
var new_plant = garden.plant(type, plant_mutations)
|
||||
var new_plant_data = PlantData.generate_from_seed(plant_seed, plant_position)
|
||||
data.add_plant_data(new_plant_data)
|
||||
var new_plant = Plant.new(new_plant_data)
|
||||
add_entity(new_plant, plant_position)
|
||||
return true
|
||||
|
||||
func pass_day():
|
||||
data.start_pass_day()
|
||||
%PassDay.pass_day_animation()
|
||||
for e : Node2D in entity_container.get_children():
|
||||
if e.has_method("_start_pass_day"):
|
||||
e._start_pass_day()
|
||||
pass_day_started.emit(self)
|
||||
if not %PassDay.is_animation_appeared:
|
||||
await %PassDay.animation_appeared
|
||||
|
||||
pass_day_proceeded.emit(self)
|
||||
|
||||
data.day += 1
|
||||
for e : Node2D in entity_container.get_children():
|
||||
if e.has_method("_pass_day"):
|
||||
e._pass_day()
|
||||
|
||||
pass_day_ended.emit(self)
|
||||
data.proceed_pass_day()
|
||||
if not %PassDay.is_animation_disappeared:
|
||||
await %PassDay.animation_disappeared
|
||||
for e : Node2D in entity_container.get_children():
|
||||
if e.has_method("_end_pass_day"):
|
||||
e._end_pass_day()
|
||||
|
||||
garden.update_garden_score()
|
||||
data.end_pass_day()
|
||||
|
||||
save()
|
||||
#endregion
|
||||
128
stages/terrain/region/scripts/region_data.gd
Normal file
@@ -0,0 +1,128 @@
|
||||
extends Resource
|
||||
class_name RegionData
|
||||
|
||||
enum State {IN_PROGRESS,FAILED,SUCCEEDED}
|
||||
|
||||
signal plant_changing_score(p : PlantData, amount : int)
|
||||
signal updated(region_data : RegionData)
|
||||
|
||||
signal pass_day_started(region_data : RegionData)
|
||||
signal pass_day_proceeded(region_data : RegionData)
|
||||
signal pass_day_ended(region_data : RegionData)
|
||||
|
||||
const DEFAULT_START_CHARGE := 10
|
||||
const DEFAULT_OBJECTIVE := 10
|
||||
|
||||
@export var region_seed : int
|
||||
@export var region_name : String
|
||||
@export var day : int = 1
|
||||
@export var entities_saved_data : Array[EntityData] = []
|
||||
@export var score_by_plant : Dictionary[PlantData, int] = {}
|
||||
@export var generated_chunk_entities : Array[Vector2i]
|
||||
@export var tutorial_step : int = 0
|
||||
@export var tutorial = false
|
||||
|
||||
@export var chunks_data : Dictionary[String, ChunkData]
|
||||
|
||||
@export var charges : int :
|
||||
set(v):
|
||||
charges = v
|
||||
updated.emit(self)
|
||||
@export var objective : int :
|
||||
set(v):
|
||||
objective = v
|
||||
updated.emit(self)
|
||||
|
||||
|
||||
var in_passing_day_animation := false
|
||||
|
||||
func _init(
|
||||
parameter : RegionParameter = RegionParameter.new()
|
||||
):
|
||||
charges = parameter.charges
|
||||
objective = parameter.objective
|
||||
region_name = parameter.name
|
||||
region_seed = parameter.region_seed
|
||||
|
||||
tutorial = parameter.tutorial
|
||||
|
||||
#region ------------------ Chunks ------------------
|
||||
|
||||
func get_coord_id(coord):
|
||||
return "%d:%d" % [coord.x, coord.y]
|
||||
|
||||
func has_chunk_data(coord : Vector2i) -> bool:
|
||||
return chunks_data.has(get_coord_id(coord))
|
||||
|
||||
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)]
|
||||
|
||||
func get_or_create_chunk_data(coord : Vector2i) -> ChunkData:
|
||||
if has_chunk_data(coord):
|
||||
return get_chunk_data(coord)
|
||||
else:
|
||||
var new_chunk_data = ChunkData.new(coord)
|
||||
add_chunk_data(coord, new_chunk_data)
|
||||
return new_chunk_data
|
||||
|
||||
#endregion
|
||||
|
||||
#region ------------------ Score ------------------
|
||||
|
||||
func get_score():
|
||||
var score = 0
|
||||
for plant_data in score_by_plant:
|
||||
score += score_by_plant[plant_data]
|
||||
return score
|
||||
|
||||
func is_objective_reached():
|
||||
return get_score() >= objective
|
||||
|
||||
func get_state() -> State:
|
||||
if get_score() >= objective:
|
||||
return State.SUCCEEDED
|
||||
elif charges <= 0:
|
||||
return State.FAILED
|
||||
else:
|
||||
return State.IN_PROGRESS
|
||||
#endregion
|
||||
|
||||
#region ------------------ Day ------------------
|
||||
|
||||
func start_pass_day():
|
||||
in_passing_day_animation = true
|
||||
pass_day_started.emit(self)
|
||||
|
||||
func proceed_pass_day():
|
||||
pass_day_proceeded.emit(self)
|
||||
|
||||
func end_pass_day():
|
||||
pass_day_ended.emit(self)
|
||||
in_passing_day_animation = false
|
||||
|
||||
#endregion
|
||||
|
||||
#region ------------------ Plants ------------------
|
||||
|
||||
func add_plant_data(plant_data : PlantData):
|
||||
score_by_plant[plant_data] = plant_data.get_score()
|
||||
plant_data.disappeared.connect(_on_plant_disappeared)
|
||||
plant_data.updated.connect(_on_plant_updated)
|
||||
|
||||
func _on_plant_updated(plant_data : PlantData):
|
||||
var old_plant_score = score_by_plant[plant_data]
|
||||
score_by_plant[plant_data] = plant_data.get_score()
|
||||
|
||||
if old_plant_score != score_by_plant[plant_data]:
|
||||
plant_changing_score.emit(plant_data, score_by_plant[plant_data] - old_plant_score)
|
||||
updated.emit(self)
|
||||
|
||||
func _on_plant_disappeared(plant_data : PlantData):
|
||||
plant_changing_score.emit(plant_data, - score_by_plant[plant_data])
|
||||
score_by_plant.erase(plant_data)
|
||||
updated.emit(self)
|
||||
|
||||
#endregion
|
||||
21
stages/terrain/region/scripts/region_parameter.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Resource
|
||||
class_name RegionParameter
|
||||
|
||||
@export var charges : int
|
||||
@export var objective : int
|
||||
@export var name : String
|
||||
@export var tutorial : bool
|
||||
@export var region_seed : int
|
||||
|
||||
func _init(
|
||||
_charges : int = 10,
|
||||
_objective : int = 10,
|
||||
_name = Random.generate_random_name(),
|
||||
_tutorial = false,
|
||||
_region_seed = randi(),
|
||||
):
|
||||
charges = _charges
|
||||
objective = _objective
|
||||
name = _name
|
||||
tutorial = _tutorial
|
||||
region_seed = _region_seed
|
||||
@@ -1,5 +1,5 @@
|
||||
@tool
|
||||
extends PlanetLayer
|
||||
extends RegionLayer
|
||||
class_name DecontaminationLayer
|
||||
|
||||
const DECONTAMINATION_TILE_TERRAIN_SET : int = 0
|
||||
@@ -21,10 +21,10 @@ func place_decontaminations(coords : Array[Vector2i], save := false, on_finished
|
||||
if save:
|
||||
for coord in coords:
|
||||
var chunk_coord = Vector2i(
|
||||
floori(coord.x / float(Planet.CHUNK_TILE_SIZE)),
|
||||
floori(coord.y / float(Planet.CHUNK_TILE_SIZE)),
|
||||
floori(coord.x / float(Region.CHUNK_TILE_SIZE)),
|
||||
floori(coord.y / float(Region.CHUNK_TILE_SIZE)),
|
||||
)
|
||||
(planet.data
|
||||
(region.data
|
||||
.get_chunk_data(chunk_coord)
|
||||
.update_decontamination_tile_diff(coord, ChunkData.TileDiff.PRESENT))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@tool
|
||||
extends PlanetLayer
|
||||
extends RegionLayer
|
||||
class_name GroundLayer
|
||||
|
||||
const MATERIAL : Material = preload("res://stages/terrain/planet/resources/materials/moss_biome/ground_planet_tilemap.tres")
|
||||
const MATERIAL : Material = preload("res://stages/terrain/region/resources/materials/moss_biome/ground_planet_tilemap.tres")
|
||||
const GROUND_TILE_TERRAIN_SET : int = 0
|
||||
const GROUND_TILE_TERRAIN : int = 3
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
@abstract
|
||||
extends TileMapLayer
|
||||
class_name PlanetLayer
|
||||
class_name RegionLayer
|
||||
|
||||
var threads : Array[Thread] = []
|
||||
var is_generated = false
|
||||
var planet : Planet
|
||||
var region : Region
|
||||
|
||||
func _init(
|
||||
_planet : Planet = null
|
||||
_planet : Region = null
|
||||
):
|
||||
planet = _planet
|
||||
region = _planet
|
||||
|
||||
func _ready():
|
||||
tile_set = planet.tile_set
|
||||
scale = Vector2.ONE * Planet.TILE_SCALE
|
||||
tile_set = region.tile_set
|
||||
scale = Vector2.ONE * Region.TILE_SCALE
|
||||
navigation_enabled = false
|
||||
setup()
|
||||
|
||||
@@ -58,13 +58,13 @@ func place_terrain_cells(
|
||||
tile_terrain_set : int = 0,
|
||||
tile_terrain : int = 0
|
||||
):
|
||||
planet.generation_semaphore.wait()
|
||||
region.generation_semaphore.wait()
|
||||
set_cells_terrain_connect(
|
||||
coords,
|
||||
tile_terrain_set,
|
||||
tile_terrain
|
||||
)
|
||||
planet.generation_semaphore.post()
|
||||
region.generation_semaphore.post()
|
||||
|
||||
func _exit_tree():
|
||||
for t in threads:
|
||||
@@ -1,8 +1,8 @@
|
||||
@tool
|
||||
extends PlanetLayer
|
||||
extends RegionLayer
|
||||
class_name RockLayer
|
||||
|
||||
const MATERIAL : Material = preload("res://stages/terrain/planet/resources/materials/rock_planet_tilemap.tres")
|
||||
const MATERIAL : Material = preload("res://stages/terrain/region/resources/materials/rock_planet_tilemap.tres")
|
||||
const ROCK_TILE_TERRAIN_SET : int = 0
|
||||
const ROCK_TILE_TERRAIN : int = 1
|
||||
const CRISTAL_TILE_TERRAIN : int = 2
|
||||
@@ -34,11 +34,11 @@ func remove_rocks(coords : Array[Vector2i], save = false,on_finished : Callable
|
||||
if save:
|
||||
for coord in coords:
|
||||
var chunk_coord = Vector2i(
|
||||
floori(coord.x / float(Planet.CHUNK_TILE_SIZE)),
|
||||
floori(coord.y / float(Planet.CHUNK_TILE_SIZE)),
|
||||
floori(coord.x / float(Region.CHUNK_TILE_SIZE)),
|
||||
floori(coord.y / float(Region.CHUNK_TILE_SIZE)),
|
||||
)
|
||||
var chunk_tile_coord : Vector2i = coord - chunk_coord * Planet.CHUNK_TILE_SIZE
|
||||
(planet.data
|
||||
var chunk_tile_coord : Vector2i = coord - chunk_coord * Region.CHUNK_TILE_SIZE
|
||||
(region.data
|
||||
.get_chunk_data(chunk_coord)
|
||||
.update_rock_tile_diff(chunk_tile_coord, ChunkData.TileDiff.ABSENT))
|
||||
|
||||
@@ -57,15 +57,12 @@ func dig_rocks(coords : Array[Vector2i]) -> bool:
|
||||
|
||||
func loot_rock(coord : Vector2i):
|
||||
if get_tile_type(coord) == TileType.CRISTAL and randf() < CRISTAL_LOOT_CHANCE:
|
||||
if len(GameInfo.game_data.unlocked_plant_types):
|
||||
var loot = Seed.new(
|
||||
GameInfo.game_data.unlocked_plant_types.pick_random()
|
||||
)
|
||||
planet.drop_item(
|
||||
loot,
|
||||
coord * Planet.TILE_SIZE + Vector2i.ONE * floori(Planet.TILE_SIZE/2.),
|
||||
floor(Planet.TILE_SIZE/2.)
|
||||
)
|
||||
var loot = Seed.generate_random()
|
||||
region.drop_item(
|
||||
loot,
|
||||
coord * Region.TILE_SIZE + Vector2i.ONE * floori(Region.TILE_SIZE/2.),
|
||||
floor(Region.TILE_SIZE/2.)
|
||||
)
|
||||
|
||||
func has_tile(coord : Vector2i) -> bool:
|
||||
return has_cell(coord)
|
||||
@@ -48,7 +48,7 @@ func load_entities(saved_entities_data : Array[EntityData]):
|
||||
enroll_entity(static_entity)
|
||||
|
||||
for save_data in saved_entities_data:
|
||||
var entity = save_data.load()
|
||||
var entity = save_data.load_entity()
|
||||
if entity:
|
||||
add_entity(entity, save_data.position)
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 MiB |
@@ -1,40 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d2p7h0aga85tn"
|
||||
path="res://.godot/imported/truck_interior.png-ff9bd2d0107d83f7c4209d959ee69f15.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/truck/assets/sprite/truck_interior.png"
|
||||
dest_files=["res://.godot/imported/truck_interior.png-ff9bd2d0107d83f7c4209d959ee69f15.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
|
||||
|
Before Width: | Height: | Size: 1.1 MiB |
@@ -1,8 +0,0 @@
|
||||
extends Resource
|
||||
class_name TruckData
|
||||
|
||||
@export var rewards_given : Array[Reward] = []
|
||||
@export var rewards : Array[Reward] = []
|
||||
@export var rewarded_times : int = 0
|
||||
@export var compost_containing_seeds : Array[int] = []
|
||||
@export var entities_saved_data : Array[EntityData] = []
|
||||
@@ -1 +0,0 @@
|
||||
uid://dyx17r0phlodb
|
||||
@@ -1,93 +0,0 @@
|
||||
extends Terrain
|
||||
class_name TruckInterior
|
||||
|
||||
const PLANET_RUN_PATH = "res://stages/planet_run/planet_run.tscn"
|
||||
|
||||
@export var composts : Array[Compost]
|
||||
@onready var spawn_position : Node2D = %SpawnPosition
|
||||
@onready var data : TruckData = GameInfo.game_data.truck_data
|
||||
|
||||
func _on_exit_interacted(_p : Player):
|
||||
data.entities_saved_data = save_entities()
|
||||
data.rewards = []
|
||||
for c in composts:
|
||||
data.rewards.append(c.reward)
|
||||
SceneManager.change_scene(SceneManager.PLANET_SCENE)
|
||||
|
||||
func _ready():
|
||||
load_entities(data.entities_saved_data)
|
||||
while len(data.compost_containing_seeds) < len(composts):
|
||||
data.compost_containing_seeds.append(0)
|
||||
for i in range(len(composts)):
|
||||
var compost = composts[i]
|
||||
compost.containing_seed = data.compost_containing_seeds[i]
|
||||
compost.filled.connect(
|
||||
func (c: Compost):
|
||||
data.compost_containing_seeds[i] = c.containing_seed
|
||||
)
|
||||
|
||||
if i < len(data.rewards):
|
||||
compost.reward = data.rewards[i]
|
||||
else:
|
||||
var new_reward = generate_reward()
|
||||
compost.reward = new_reward
|
||||
data.rewards.append(new_reward)
|
||||
compost.rewarded.connect(_on_compost_rewarded)
|
||||
|
||||
AudioManager.enter_truck()
|
||||
|
||||
func _on_compost_rewarded(c: Compost):
|
||||
data.rewarded_times += 1
|
||||
data.rewards_given.append(c.reward)
|
||||
c.reward = generate_reward()
|
||||
|
||||
func get_compost_rewards() -> Array[Reward]:
|
||||
var rewards : Array[Reward] = []
|
||||
for c in composts:
|
||||
if c.reward:
|
||||
rewards.append(c.reward)
|
||||
return rewards
|
||||
|
||||
func get_random_reward_cost() -> int:
|
||||
return randi_range(data.rewarded_times + 1, data.rewarded_times + 2)
|
||||
|
||||
func get_possible_rewards() -> Array[Reward]:
|
||||
var possible_rewards : Array[Reward] = [
|
||||
UpgradeMaxEnergyReward.new(get_random_reward_cost() + 2),
|
||||
UpgradeMaxInventoryReward.new(get_random_reward_cost()),
|
||||
GiveItemReward.new(
|
||||
get_random_reward_cost(),
|
||||
Blueprint.new(preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres"))
|
||||
),
|
||||
]
|
||||
|
||||
if data.rewards_given.find_custom(
|
||||
func(r : Reward):
|
||||
return r is GiveItemReward and r.item is Trowel
|
||||
) == -1:
|
||||
possible_rewards.append(
|
||||
GiveItemReward.new(
|
||||
get_random_reward_cost(),
|
||||
Knife.new()
|
||||
)
|
||||
)
|
||||
if data.rewards_given.find_custom(
|
||||
func(r : Reward):
|
||||
return r is GiveItemReward and r.item is Knife
|
||||
) == -1:
|
||||
possible_rewards.append(
|
||||
GiveItemReward.new(
|
||||
get_random_reward_cost(),
|
||||
Trowel.new()
|
||||
)
|
||||
)
|
||||
|
||||
return possible_rewards
|
||||
|
||||
func generate_reward() -> Reward:
|
||||
var max_tries = 3
|
||||
var reward = get_possible_rewards().pick_random()
|
||||
while get_compost_rewards().map(func(r): return r.desc()).find(reward.desc()) != -1 and max_tries > 0:
|
||||
max_tries -= 1
|
||||
reward = get_possible_rewards().pick_random()
|
||||
return reward
|
||||
@@ -1 +0,0 @@
|
||||
uid://d0gmkwebxdptk
|
||||
@@ -1,27 +0,0 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://biwkti5cir5ut"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ceplumcunebag" path="res://stages/terrain/truck/truck_interior.tscn" id="1_ycq4y"]
|
||||
[ext_resource type="Script" uid="uid://d1nsr56bh1a1y" path="res://entities/camera/scripts/camera.gd" id="2_063c3"]
|
||||
[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/game/game_gui.tscn" id="2_dw1sv"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="5_dw1sv"]
|
||||
|
||||
[node name="Truck" type="Node2D"]
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="GameGui" parent="CanvasLayer" instance=ExtResource("2_dw1sv")]
|
||||
|
||||
[node name="TruckInterior" parent="." node_paths=PackedStringArray("entity_container") instance=ExtResource("1_ycq4y")]
|
||||
position = Vector2(0, 0)
|
||||
entity_container = NodePath("Entities")
|
||||
|
||||
[node name="Entities" type="Node2D" parent="TruckInterior"]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="Player" parent="TruckInterior/Entities" instance=ExtResource("5_dw1sv")]
|
||||
position = Vector2(51, 492)
|
||||
|
||||
[node name="Camera" type="Camera2D" parent="."]
|
||||
position = Vector2(385, 343)
|
||||
script = ExtResource("2_063c3")
|
||||
metadata/_custom_type_script = "uid://d1nsr56bh1a1y"
|
||||
@@ -1,62 +0,0 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://ceplumcunebag"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://d2p7h0aga85tn" path="res://stages/terrain/truck/assets/sprite/truck_interior.png" id="1_5c5ey"]
|
||||
[ext_resource type="Script" uid="uid://d0gmkwebxdptk" path="res://stages/terrain/truck/scripts/truck_interior.gd" id="1_fk6sc"]
|
||||
[ext_resource type="Script" uid="uid://dyprcd68fjstf" path="res://entities/interactables/scripts/interactable.gd" id="3_fk6sc"]
|
||||
[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="3_v18jm"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2dkmy6xs31c" path="res://entities/interactables/truck/compost/compost.tscn" id="6_b7823"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_wi5be"]
|
||||
radius = 69.76956
|
||||
height = 376.0
|
||||
|
||||
[node name="TruckInterior" type="Node2D" node_paths=PackedStringArray("composts")]
|
||||
position = Vector2(-40, -469)
|
||||
script = ExtResource("1_fk6sc")
|
||||
composts = [NodePath("Compost"), NodePath("Compost2")]
|
||||
metadata/_custom_type_script = "uid://dfl1ijmbmw57r"
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.67495143, 0.69801295, 0.68495274, 1)
|
||||
position = Vector2(292, 376)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("1_5c5ey")
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
scale = Vector2(0.5, 0.5)
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D"]
|
||||
position = Vector2(112.00001, 670)
|
||||
scale = Vector2(0.8064369, 0.8064369)
|
||||
polygon = PackedVector2Array(141.36256, -138.8825, 1616.9894, -111.60202, 1656.67, 461.2884, 389.36707, 466.24847, 386.88702, 545.6099, -173.60316, 533.2097, -141.36258, -57.041016, -2.480053, -89.28162, 109.12198, -106.64194, 131, -327, -487, -326, -465, 841, 2150.1992, 815.9348, 2110.5183, -825.855, -521, -732, -482, -327, 133, -331)
|
||||
|
||||
[node name="SpawnPosition" type="Node2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(52, 473.00003)
|
||||
scale = Vector2(0.5539248, 0.5539248)
|
||||
|
||||
[node name="Exit" type="Area2D" parent="."]
|
||||
position = Vector2(47, 497.00003)
|
||||
scale = Vector2(0.5539248, 0.5539248)
|
||||
script = ExtResource("3_fk6sc")
|
||||
default_interact_text = "EXIT_TRUCK"
|
||||
default_info_title = "EXIT"
|
||||
default_info_desc = "LADDER_DESC_TEXT"
|
||||
metadata/_custom_type_script = "uid://dyprcd68fjstf"
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="Exit"]
|
||||
position = Vector2(10.831797, -16.24775)
|
||||
scale = Vector2(1.8052993, 1.8052993)
|
||||
texture = ExtResource("3_v18jm")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Exit"]
|
||||
position = Vector2(9.026497, 81.2384)
|
||||
shape = SubResource("CapsuleShape2D_wi5be")
|
||||
|
||||
[node name="Compost" parent="." instance=ExtResource("6_b7823")]
|
||||
position = Vector2(358, 357)
|
||||
|
||||
[node name="Compost2" parent="." instance=ExtResource("6_b7823")]
|
||||
position = Vector2(536, 365)
|
||||
|
||||
[connection signal="interacted" from="Exit" to="." method="_on_exit_interacted"]
|
||||