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:
@@ -6,13 +6,13 @@ class_name InGameBaseIndicator
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
setup(tr("GARDEN"))
|
||||
follow_game_position(Planet.CHUNK_SIZE / 2. * Vector2.ONE)
|
||||
follow_game_position(Region.CHUNK_SIZE / 2. * Vector2.ONE)
|
||||
|
||||
func _process(_delta):
|
||||
visible = player and (
|
||||
player.global_position.x < 0
|
||||
or player.global_position.x > Planet.CHUNK_SIZE
|
||||
or player.global_position.x > Region.CHUNK_SIZE
|
||||
or player.global_position.y < 0
|
||||
or player.global_position.y > Planet.CHUNK_SIZE
|
||||
or player.global_position.y > Region.CHUNK_SIZE
|
||||
)
|
||||
update()
|
||||
|
||||
@@ -5,7 +5,7 @@ const INDICATOR_SCENE = preload("res://gui/game/tutorial/in_game_indicator/in_ga
|
||||
|
||||
var indicators : Array[InGameIndicator]
|
||||
@export var player : Player
|
||||
@export var planet : Planet
|
||||
@export var region : Region
|
||||
|
||||
@onready var steps : Array[Step] = [
|
||||
TakeShovelStep.new(),
|
||||
@@ -19,18 +19,18 @@ var indicators : Array[InGameIndicator]
|
||||
var actual_step : Step = null : set = pass_to_step
|
||||
|
||||
func _process(_d):
|
||||
if not GameInfo.game_data.tutorial_done:
|
||||
if not actual_step and planet.data.tutorial_step < len(steps):
|
||||
if region.data.tutorial:
|
||||
if not actual_step and region.data.tutorial_step < len(steps):
|
||||
destroy_indicators()
|
||||
pass_to_step(steps[planet.data.tutorial_step])
|
||||
pass_to_step(steps[region.data.tutorial_step])
|
||||
|
||||
if player and actual_step and actual_step.is_step_over(player, planet):
|
||||
if player and actual_step and actual_step.is_step_over(player, region):
|
||||
destroy_indicators()
|
||||
planet.data.tutorial_step += 1
|
||||
if planet.data.tutorial_step < len(steps):
|
||||
pass_to_step(steps[planet.data.tutorial_step])
|
||||
else :
|
||||
GameInfo.game_data.tutorial_done = true
|
||||
region.data.tutorial_step += 1
|
||||
if region.data.tutorial_step < len(steps):
|
||||
pass_to_step(steps[region.data.tutorial_step])
|
||||
else:
|
||||
destroy_indicators()
|
||||
|
||||
func destroy_indicators():
|
||||
for i in indicators:
|
||||
@@ -39,7 +39,7 @@ func destroy_indicators():
|
||||
|
||||
func pass_to_step(new_step : Step):
|
||||
actual_step = new_step
|
||||
indicators = new_step.generate_indicators(player, planet)
|
||||
indicators = new_step.generate_indicators(player, region)
|
||||
for i in indicators:
|
||||
add_child(i)
|
||||
|
||||
@@ -51,15 +51,15 @@ class Step:
|
||||
)
|
||||
return new_indicator
|
||||
|
||||
func generate_indicators(_player : Player, _planet : Planet) -> Array[InGameIndicator]:
|
||||
func generate_indicators(_player : Player, _region : Region) -> Array[InGameIndicator]:
|
||||
return []
|
||||
|
||||
func is_step_over(_p : Player, _planet : Planet) -> bool:
|
||||
func is_step_over(_p : Player, _region : Region) -> bool:
|
||||
return true
|
||||
|
||||
class TakeShovelStep extends Step:
|
||||
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
|
||||
for entity in planet.entity_container.get_children():
|
||||
func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]:
|
||||
for entity in region.entity_container.get_children():
|
||||
if entity is ItemObject and entity.item is Shovel:
|
||||
var indicator = generate_indicator(tr("TAKE_THE_SHOVEL"))
|
||||
indicator.follow_entity(entity)
|
||||
@@ -69,14 +69,14 @@ class TakeShovelStep extends Step:
|
||||
printerr("No Shovel found...")
|
||||
return []
|
||||
|
||||
func is_step_over(p : Player, _planet : Planet) -> bool:
|
||||
func is_step_over(p : Player, _region : Region) -> bool:
|
||||
for item in p.data.inventory.items:
|
||||
if item is Shovel:
|
||||
return true
|
||||
return false
|
||||
|
||||
class DigSeedStep extends Step:
|
||||
func generate_indicators(p: Player, planet : Planet) -> Array[InGameIndicator]:
|
||||
func generate_indicators(p: Player, region : Region) -> Array[InGameIndicator]:
|
||||
var closest_seed = null
|
||||
var limit_distance = 1000
|
||||
|
||||
@@ -87,7 +87,7 @@ class DigSeedStep extends Step:
|
||||
for x in range(actual_distance):
|
||||
for y in range(actual_distance):
|
||||
var coord = Vector2i(x,y) - Vector2i.ONE * floori(actual_distance/2.) + player_tile
|
||||
if planet.rock_layer.get_tile_type(coord) == RockLayer.TileType.CRISTAL:
|
||||
if region.rock_layer.get_tile_type(coord) == RockLayer.TileType.CRISTAL:
|
||||
if closest_seed == null or player_tile.distance_to(coord) < player_tile.distance_to(closest_seed):
|
||||
closest_seed = coord
|
||||
|
||||
@@ -95,20 +95,20 @@ class DigSeedStep extends Step:
|
||||
|
||||
if closest_seed:
|
||||
var indicator = generate_indicator(tr("DIG_UNDERGROUND_LOOT"))
|
||||
indicator.follow_game_position(closest_seed * Planet.TILE_SIZE + Vector2i.ONE * floori(Planet.TILE_SIZE/2.))
|
||||
indicator.follow_game_position(closest_seed * Region.TILE_SIZE + Vector2i.ONE * floori(Region.TILE_SIZE/2.))
|
||||
return [indicator]
|
||||
return []
|
||||
|
||||
func is_step_over(_p : Player, planet : Planet) -> bool:
|
||||
for entity in planet.entity_container.get_children():
|
||||
func is_step_over(_p : Player, region : Region) -> bool:
|
||||
for entity in region.entity_container.get_children():
|
||||
if entity is ItemObject and entity.item is Seed:
|
||||
return true
|
||||
return false
|
||||
|
||||
class TakeSeedStep extends Step:
|
||||
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
|
||||
func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]:
|
||||
var indicators : Array[InGameIndicator] = []
|
||||
for entity in planet.entity_container.get_children():
|
||||
for entity in region.entity_container.get_children():
|
||||
if entity is ItemObject and entity.item is Seed:
|
||||
var indicator = generate_indicator(tr("TAKE_A_SEED"))
|
||||
indicator.follow_entity(entity)
|
||||
@@ -117,27 +117,27 @@ class TakeSeedStep extends Step:
|
||||
)
|
||||
return indicators
|
||||
|
||||
func is_step_over(p : Player, _planet : Planet) -> bool:
|
||||
func is_step_over(p : Player, _region : Region) -> bool:
|
||||
for item in p.data.inventory.items:
|
||||
if item is Seed:
|
||||
return true
|
||||
return false
|
||||
|
||||
class PlantSeedStep extends Step:
|
||||
func generate_indicators(p: Player, planet : Planet) -> Array[InGameIndicator]:
|
||||
func generate_indicators(p: Player, region : Region) -> Array[InGameIndicator]:
|
||||
var indicator = generate_indicator(tr("PLANT_THE_SEED_IN_DECONTAMINED_ZONE"))
|
||||
indicator.follow_game_position(Planet.CHUNK_TILE_SIZE/2. * Planet.TILE_SIZE * Vector2.ONE)
|
||||
indicator.follow_game_position(Region.CHUNK_TILE_SIZE/2. * Region.TILE_SIZE * Vector2.ONE)
|
||||
return [indicator]
|
||||
|
||||
func is_step_over(_p : Player, planet : Planet) -> bool:
|
||||
for entity in planet.entity_container.get_children():
|
||||
func is_step_over(_p : Player, region : Region) -> bool:
|
||||
for entity in region.entity_container.get_children():
|
||||
if entity is Plant:
|
||||
return true
|
||||
return false
|
||||
|
||||
class RechargeStep extends Step:
|
||||
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
|
||||
for entity in planet.entity_container.get_children():
|
||||
func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]:
|
||||
for entity in region.entity_container.get_children():
|
||||
var indicator = generate_indicator(tr("RECHARGE_TO_PASS_DAYS"))
|
||||
indicator.follow_entity(entity)
|
||||
if entity is TruckRecharge:
|
||||
@@ -147,20 +147,20 @@ class RechargeStep extends Step:
|
||||
printerr("No Recharge Station found...")
|
||||
return []
|
||||
|
||||
func is_step_over(_p : Player, planet : Planet) -> bool:
|
||||
if planet == null :
|
||||
func is_step_over(_p : Player, region : Region) -> bool:
|
||||
if region == null :
|
||||
return false
|
||||
return planet.data.day > 1
|
||||
return region.data.day > 1
|
||||
|
||||
class WaitMaturePlant extends Step:
|
||||
func generate_indicators(_p: Player, _planet : Planet) -> Array[InGameIndicator]:
|
||||
func generate_indicators(_p: Player, _region : Region) -> Array[InGameIndicator]:
|
||||
return []
|
||||
|
||||
func is_step_over(_p : Player, planet : Planet) -> bool:
|
||||
if planet == null :
|
||||
func is_step_over(_p : Player, region : Region) -> bool:
|
||||
if region == null :
|
||||
return false
|
||||
for entity in planet.entity_container.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
for entity in region.entity_container.get_children():
|
||||
if entity is Plant and entity.data.get_state() == PlantData.State.MATURE:
|
||||
return true
|
||||
return false
|
||||
|
||||
@@ -168,10 +168,10 @@ class HarvestMaturePlant extends Step:
|
||||
|
||||
var mature_plant_number : int = 0
|
||||
|
||||
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
|
||||
func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]:
|
||||
var indicators : Array[InGameIndicator] = []
|
||||
for entity in planet.entity_container.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
for entity in region.entity_container.get_children():
|
||||
if entity is Plant and entity.data.get_state() == PlantData.State.MATURE:
|
||||
var indicator = generate_indicator(tr("HARVEST_MATURE_PLANTS_WITH_SHOVEL"))
|
||||
indicator.follow_entity(entity)
|
||||
indicators.append(
|
||||
@@ -180,11 +180,11 @@ class HarvestMaturePlant extends Step:
|
||||
mature_plant_number += 1
|
||||
return indicators
|
||||
|
||||
func is_step_over(_p : Player, planet : Planet) -> bool:
|
||||
if planet == null :
|
||||
func is_step_over(_p : Player, region : Region) -> bool:
|
||||
if region == null :
|
||||
return false
|
||||
var actual_mature_plant_number = 0
|
||||
for entity in planet.entity_container.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
for entity in region.entity_container.get_children():
|
||||
if entity is Plant and entity.data.get_state() == PlantData.State.MATURE:
|
||||
actual_mature_plant_number += 1
|
||||
return mature_plant_number != actual_mature_plant_number
|
||||
|
||||
Reference in New Issue
Block a user