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
This commit is contained in:
2026-01-23 18:06:27 +01:00
parent 62b34473b6
commit 83d462f2f4
247 changed files with 2964 additions and 3159 deletions

View File

@@ -2,33 +2,33 @@ class_name Math
static func get_chunk_from_pos(coord) -> Vector2i:
return Vector2i(
floori(coord.x / (Planet.CHUNK_TILE_SIZE * Planet.TILE_SIZE)),
floori(coord.y / (Planet.CHUNK_TILE_SIZE * Planet.TILE_SIZE))
floori(coord.x / (Region.CHUNK_TILE_SIZE * Region.TILE_SIZE)),
floori(coord.y / (Region.CHUNK_TILE_SIZE * Region.TILE_SIZE))
)
static func get_tile_from_pos(coord) -> Vector2i:
return Vector2i(
floori(coord.x / (Planet.TILE_SIZE)),
floori(coord.y / (Planet.TILE_SIZE)),
floori(coord.x / (Region.TILE_SIZE)),
floori(coord.y / (Region.TILE_SIZE)),
)
static func get_tiles_in_circle(center: Vector2, radius : float) -> Array[Vector2i]:
var tiles : Array[Vector2i] = []
for x in range(
floori((center.x - radius/2.) / Planet.TILE_SIZE),
ceili((center.x + radius/2.) / Planet.TILE_SIZE),
floori((center.x - radius/2.) / Region.TILE_SIZE),
ceili((center.x + radius/2.) / Region.TILE_SIZE),
):
for y in range(
floori((center.y - radius/2.) / Planet.TILE_SIZE),
ceili((center.y + radius/2.) / Planet.TILE_SIZE),
floori((center.y - radius/2.) / Region.TILE_SIZE),
ceili((center.y + radius/2.) / Region.TILE_SIZE),
):
if is_tile_on_circle(Vector2i(x,y), center, radius):
tiles.append(Vector2i(x,y))
return tiles
static func is_tile_on_circle(tile_coord : Vector2i, circle_center: Vector2, circle_radius : float) -> bool:
var absolute_tile_pos : Vector2 = tile_coord * Planet.TILE_SIZE
var absolute_tile_pos : Vector2 = tile_coord * Region.TILE_SIZE
# Loop over tile corners to know if the area collide
var corners : Array[Vector2] = []
@@ -36,8 +36,8 @@ static func is_tile_on_circle(tile_coord : Vector2i, circle_center: Vector2, cir
for y in [0,1]:
corners.append(
absolute_tile_pos
+ Vector2.RIGHT * x * Planet.TILE_SIZE
+ Vector2.DOWN * y * Planet.TILE_SIZE
+ Vector2.RIGHT * x * Region.TILE_SIZE
+ Vector2.DOWN * y * Region.TILE_SIZE
)
# Check if segment touch area

View File

@@ -0,0 +1,45 @@
class_name Random
const MIN_WORD_LEN = 4
const MAX_WORD_LEN = 8
const VOWEL = ["a","e","i","o","u","y"]
const CONSONANTS = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z"]
static func generate_random_name(random_seed = randi()) -> String:
var word_len = randf_range(4,8)
var word = ''
var last_letter_is_vowel = false
for i in range(word_len):
if last_letter_is_vowel:
word += CONSONANTS.pick_random()
else:
word += VOWEL.pick_random()
last_letter_is_vowel = not last_letter_is_vowel
return word.capitalize()
static func mutate_name(word : String) -> String:
return word
# TODO
func shorten_name(word : String):
if randi()%2 == 0:
return word.left(len(word) - 1).capitalize()
else :
return word.right(len(word) - 1).capitalize()
func elongate_name(word : String):
if randi()%2 == 0:
var letter = CONSONANTS.pick_random() if word.left(1) in VOWEL else VOWEL.pick_random()
return (letter + word).capitalize()
else :
var letter = CONSONANTS.pick_random() if word.right(1) in VOWEL else VOWEL.pick_random()
return (word + letter).capitalize()
func replace_character(word : String):
# TODO
return word

View File

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