ajout des graines procédurales et des cinamatiques
This commit is contained in:
@@ -11,6 +11,7 @@ const SCORE_ICON = preload("res://common/icons/growth.svg")
|
||||
@export var plant_archetype: PlantArchetype
|
||||
@export var plant_mutations: Array[PlantMutation]
|
||||
@export var random_seed : int
|
||||
var stored_icon : Texture
|
||||
|
||||
func _init(
|
||||
_plant_name : String = "",
|
||||
@@ -23,7 +24,7 @@ func _init(
|
||||
random_seed = randi()
|
||||
|
||||
static func generate_from_parent(plant_data : PlantData) -> Seed:
|
||||
if randf() > MUTATION_PROBABILITY:
|
||||
if randf() < MUTATION_PROBABILITY:
|
||||
return Seed.new(
|
||||
plant_data.plant_name,
|
||||
plant_data.archetype,
|
||||
@@ -37,10 +38,14 @@ static func generate_from_parent(plant_data : PlantData) -> Seed:
|
||||
)
|
||||
|
||||
static func generate_random() -> Seed:
|
||||
var archetype = PlantArchetype.get_random()
|
||||
var random_mutations : Array[PlantMutation] = []
|
||||
if randf() < MUTATION_PROBABILITY:
|
||||
random_mutations = ([archetype.available_mutations.pick_random().duplicate_deep()] as Array[PlantMutation])
|
||||
var new_seed = Seed.new(
|
||||
Random.generate_random_word(),
|
||||
PlantArchetype.get_random(),
|
||||
[]
|
||||
random_mutations
|
||||
)
|
||||
|
||||
return new_seed
|
||||
@@ -54,7 +59,9 @@ func get_description() -> String:
|
||||
return tr("PLANT_%s_MUST_BE_USED_IN_DECONTAMINATED_ZONE") % plant_name
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return PlantTextureBuilder.build_seed_texture(random_seed)
|
||||
if stored_icon == null:
|
||||
stored_icon = PlantTextureBuilder.build_seed_texture(plant_name.hash())
|
||||
return stored_icon
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return 1
|
||||
|
||||
29
entities/player/inventory/scripts/items/ship_portal.gd
Normal file
29
entities/player/inventory/scripts/items/ship_portal.gd
Normal file
@@ -0,0 +1,29 @@
|
||||
extends Item
|
||||
class_name ShipPortal
|
||||
|
||||
func get_item_name() -> String:
|
||||
return tr("SHIP_TELEPORT")
|
||||
|
||||
func get_item_type() -> ItemType:
|
||||
return Item.ItemType.TOOL_ITEM
|
||||
|
||||
func get_description() -> String:
|
||||
return tr("SHIP_TELEPORT_DESC_TEXT")
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/chevrons-up.svg")
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return 0
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return 0
|
||||
|
||||
func can_use(_player : Player, _zone: Player.ActionZone) -> bool:
|
||||
return true
|
||||
|
||||
func use_text() -> String:
|
||||
return tr("SHIP_TELEPORT_USE_TEXT")
|
||||
|
||||
func use(_player : Player, _zone: Player.ActionZone):
|
||||
SceneManager.change_to_scene_id('COCKPIT')
|
||||
@@ -0,0 +1 @@
|
||||
uid://0xpq37its6qc
|
||||
@@ -6,6 +6,7 @@ const SIGNAL_DURATION = 1
|
||||
const PARTICLES_DISTANCE = 100
|
||||
const DEFAULT_ICON = preload("res://common/icons/north-star.svg")
|
||||
const ENERGY_ICON = preload("res://common/icons/bolt.svg")
|
||||
const DOOR_ICON = preload("res://common/icons/logout.svg")
|
||||
|
||||
var started_time = 0.
|
||||
var signals : Array[DetectorSignalIndividual] = []
|
||||
@@ -15,15 +16,19 @@ var signals : Array[DetectorSignalIndividual] = []
|
||||
func _init(region : Region, pos : Vector2):
|
||||
for e in region.entity_container.get_children():
|
||||
if e is TruckRecharge:
|
||||
print(pos)
|
||||
print(e.global_position)
|
||||
print(e.global_position.angle_to(pos))
|
||||
signals.append(
|
||||
DetectorSignalIndividual.new(
|
||||
(pos - e.global_position).normalized().angle(),
|
||||
ENERGY_ICON
|
||||
)
|
||||
)
|
||||
if e is Door and e.available and e.visible:
|
||||
signals.append(
|
||||
DetectorSignalIndividual.new(
|
||||
(pos - e.global_position).normalized().angle(),
|
||||
DOOR_ICON
|
||||
)
|
||||
)
|
||||
|
||||
func _draw():
|
||||
if started_time < SIGNAL_DURATION:
|
||||
|
||||
Reference in New Issue
Block a user