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,71 +6,71 @@ const ITEM_SPRITE_SIZE = 40.
|
||||
const SPRITE_SCENE : PackedScene = preload("res://entities/interactables/item_object/item_object_sprite.tscn")
|
||||
|
||||
@export var item : Item :
|
||||
set(_item):
|
||||
item = _item
|
||||
if object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
object_sprite.generate_particles(item.get_particles())
|
||||
set(_item):
|
||||
item = _item
|
||||
if object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
object_sprite.generate_particles(item.get_particles())
|
||||
|
||||
@onready var object_sprite : ItemObjectSprite = generate_sprite()
|
||||
|
||||
func _init(_item = null):
|
||||
if _item:
|
||||
item = _item
|
||||
if _item:
|
||||
item = _item
|
||||
|
||||
func _ready():
|
||||
generate_collision(ITEM_AREA_WIDTH)
|
||||
if item and object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
object_sprite.generate_particles(item.get_particles())
|
||||
generate_collision(ITEM_AREA_WIDTH)
|
||||
if item and object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
object_sprite.generate_particles(item.get_particles())
|
||||
|
||||
func pointer_text() -> String:
|
||||
var name_suffix = ""
|
||||
var name_suffix = ""
|
||||
|
||||
if item is Seed:
|
||||
name_suffix = tr("SEED")
|
||||
if item is Package:
|
||||
name_suffix = tr("PACKAGE")
|
||||
if item is Seed:
|
||||
name_suffix = tr("SEED")
|
||||
if item is Package:
|
||||
name_suffix = tr("PACKAGE")
|
||||
|
||||
return item.name + (" " + name_suffix if name_suffix else "")
|
||||
return item.name + (" " + name_suffix if name_suffix else "")
|
||||
|
||||
func interact_text():
|
||||
return tr("TAKE")
|
||||
return tr("TAKE")
|
||||
|
||||
func card_info() -> CardInfo:
|
||||
return item.card_info()
|
||||
return item.card_info()
|
||||
|
||||
func interact(player : Player) -> bool:
|
||||
player.pick_item(item)
|
||||
|
||||
pickup_animation(player)
|
||||
|
||||
return true
|
||||
player.pick_item(item)
|
||||
|
||||
pickup_animation(player)
|
||||
|
||||
return true
|
||||
|
||||
func pickup_animation(player : Player):
|
||||
available = false
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
available = false
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
|
||||
tween.tween_property(self, "position", player.position, 0.2)
|
||||
tween.tween_callback(
|
||||
func():
|
||||
Pointer.stop_inspect(self)
|
||||
queue_free()
|
||||
)
|
||||
if object_sprite:
|
||||
object_sprite.pickup_animation()
|
||||
tween.tween_property(self, "position", player.position, 0.2)
|
||||
tween.tween_callback(
|
||||
func():
|
||||
Pointer.stop_inspect(self)
|
||||
queue_free()
|
||||
)
|
||||
if object_sprite:
|
||||
object_sprite.pickup_animation()
|
||||
|
||||
func generate_sprite() -> ItemObjectSprite:
|
||||
var sprite_node = SPRITE_SCENE.instantiate() as ItemObjectSprite
|
||||
add_child(sprite_node)
|
||||
var sprite_node = SPRITE_SCENE.instantiate() as ItemObjectSprite
|
||||
add_child(sprite_node)
|
||||
|
||||
if item:
|
||||
sprite_node.apply_texture_to_sprite(
|
||||
item.icon,
|
||||
ITEM_SPRITE_SIZE
|
||||
)
|
||||
if item:
|
||||
sprite_node.apply_texture_to_sprite(
|
||||
item.icon,
|
||||
ITEM_SPRITE_SIZE
|
||||
)
|
||||
|
||||
return sprite_node
|
||||
return sprite_node
|
||||
|
||||
func save() -> EntityData:
|
||||
return ItemObjectData.new(self)
|
||||
return ItemObjectData.new(self)
|
||||
|
||||
@@ -7,5 +7,5 @@ func _init(e : ItemObject):
|
||||
position = e.global_position
|
||||
item = e.item
|
||||
|
||||
func load() -> Entity:
|
||||
func load_entity() -> Entity:
|
||||
return ItemObject.new(item)
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dlrj7tyi5wfh8"
|
||||
path="res://.godot/imported/truck_ladder.png-00d93dc49c0cc6457febb75d7b82dec4.ctex"
|
||||
path="res://.godot/imported/truck_ladder.png-925870bf5fd0f6bfe7226189e1ff2e75.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/truck/assets/sprites/truck_ladder.png"
|
||||
dest_files=["res://.godot/imported/truck_ladder.png-00d93dc49c0cc6457febb75d7b82dec4.ctex"]
|
||||
source_file="res://entities/interactables/ladder/assets/truck_ladder.png"
|
||||
dest_files=["res://.godot/imported/truck_ladder.png-925870bf5fd0f6bfe7226189e1ff2e75.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
170
entities/interactables/ladder/ladder.tscn
Normal file
170
entities/interactables/ladder/ladder.tscn
Normal file
@@ -0,0 +1,170 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://cg1visg52i21a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://buimaomxu01wj" path="res://entities/interactables/ladder/scripts/ladder.gd" id="1_26qdk"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlrj7tyi5wfh8" path="res://entities/interactables/ladder/assets/truck_ladder.png" id="2_xila4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="3_214ms"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hslnw"]
|
||||
radius = 26.0
|
||||
height = 112.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gmirm"]
|
||||
atlas = ExtResource("2_xila4")
|
||||
region = Rect2(205, 157, 87, 208)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_4ixvu"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_214ms"]
|
||||
resource_name = "Pulse"
|
||||
length = 0.8
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.4, 0.8),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(1.4, 1.4), Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_px7p1"]
|
||||
_data = {
|
||||
&"Pulse": SubResource("Animation_214ms"),
|
||||
&"RESET": SubResource("Animation_4ixvu")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bgoyn"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TruckLadder:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-1.25, -30)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Icon:self_modulate:a")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("TruckLadder:modulate:a")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xvoyd"]
|
||||
resource_name = "appear"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TruckLadder:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.7),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -108), Vector2(-1.25, -30)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Icon:self_modulate:a")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.6666667, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 1.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("TruckLadder:modulate:a")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 1.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_orxxj"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_bgoyn"),
|
||||
&"appear": SubResource("Animation_xvoyd")
|
||||
}
|
||||
|
||||
[node name="Ladder" type="Area2D"]
|
||||
script = ExtResource("1_26qdk")
|
||||
default_interact_text = "ENTER_TRUCK"
|
||||
default_info_title = "TRUCK_ENTRANCE"
|
||||
default_info_desc = "LADDER_DESC_TEXT"
|
||||
metadata/_custom_type_script = "uid://dyprcd68fjstf"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-0.25, -28)
|
||||
shape = SubResource("CapsuleShape2D_hslnw")
|
||||
|
||||
[node name="TruckLadder" type="Sprite2D" parent="."]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
position = Vector2(-1.25, -30)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = SubResource("AtlasTexture_gmirm")
|
||||
|
||||
[node name="Icon" type="Sprite2D" parent="."]
|
||||
self_modulate = Color(1, 1, 1, 0)
|
||||
position = Vector2(0.75, -29.000004)
|
||||
texture = ExtResource("3_214ms")
|
||||
|
||||
[node name="IconAnimationPlayer" type="AnimationPlayer" parent="Icon"]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_px7p1")
|
||||
}
|
||||
autoplay = "RESET"
|
||||
|
||||
[node name="LadderAnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_orxxj")
|
||||
}
|
||||
20
entities/interactables/ladder/scripts/ladder.gd
Normal file
20
entities/interactables/ladder/scripts/ladder.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
extends Interactable
|
||||
class_name Ladder
|
||||
|
||||
func _ready():
|
||||
appear()
|
||||
# hide()
|
||||
GameInfo.game_data.current_region_data.updated.connect(
|
||||
func (region_data : RegionData):
|
||||
if region_data.get_state() == RegionData.State.SUCCEEDED or region_data.get_state() == RegionData.State.FAILED:
|
||||
%IconAnimationPlayer.play("Pulse")
|
||||
)
|
||||
|
||||
func appear():
|
||||
show()
|
||||
%LadderAnimationPlayer.play("appear")
|
||||
|
||||
func interact(p : Player):
|
||||
p.region.save()
|
||||
SceneManager.change_scene("COCKPIT")
|
||||
return true
|
||||
@@ -1,27 +0,0 @@
|
||||
extends Interactable
|
||||
class_name Machine
|
||||
|
||||
const MAX_MACHINE_LEVEL = 3
|
||||
|
||||
var level : int = 1
|
||||
var type : MachineType
|
||||
|
||||
func pointer_text() -> String:
|
||||
return type.name
|
||||
|
||||
static func get_level_color(l : int) -> Color:
|
||||
match l:
|
||||
1: return Color("4ed38a")
|
||||
2: return Color("4ec6ee")
|
||||
3: return Color("bd70e2")
|
||||
_: return Color("bd70e2")
|
||||
|
||||
static func instantiate_machine(machine_type : MachineType, machine_level = 1) -> Machine:
|
||||
var new_machine : Machine = machine_type.scene.instantiate() as Machine
|
||||
new_machine.level = machine_level
|
||||
new_machine.type = machine_type
|
||||
|
||||
return new_machine
|
||||
|
||||
func save() -> EntityData:
|
||||
return MachineData.new(self)
|
||||
@@ -1 +0,0 @@
|
||||
uid://du7qppxobx5nd
|
||||
@@ -1,13 +0,0 @@
|
||||
extends EntityData
|
||||
class_name MachineData
|
||||
|
||||
@export var level : int
|
||||
@export var type : MachineType
|
||||
|
||||
func _init(m : Machine):
|
||||
position = m.global_position
|
||||
level = m.level
|
||||
type = m.type
|
||||
|
||||
func load() -> Entity:
|
||||
return Machine.instantiate_machine(type, level)
|
||||
@@ -1 +0,0 @@
|
||||
uid://b24o2jgqvfact
|
||||
@@ -1,6 +0,0 @@
|
||||
extends Resource
|
||||
class_name MachineType
|
||||
|
||||
@export var name : String
|
||||
@export var scene : PackedScene
|
||||
@export_multiline var description : String
|
||||
@@ -1 +0,0 @@
|
||||
uid://bepx311a3f0o
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 283 KiB |
@@ -1,40 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cqqlkm14lawpa"
|
||||
path="res://.godot/imported/panneau_solaire_1.png-b9a4049f295152380ed394a82c03b8e2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png"
|
||||
dest_files=["res://.godot/imported/panneau_solaire_1.png-b9a4049f295152380ed394a82c03b8e2.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
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 657 KiB |
@@ -1,40 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b1n8nad43usw4"
|
||||
path="res://.godot/imported/panneau_solaire_2.png-479b68803815c59c599ff8c3a78ca895.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png"
|
||||
dest_files=["res://.godot/imported/panneau_solaire_2.png-479b68803815c59c599ff8c3a78ca895.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
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 369 KiB |
@@ -1,40 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c22re5wfsm1ax"
|
||||
path="res://.godot/imported/panneau_solaire_3.png-022ae039aa352e1519471d4f9c114a8b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png"
|
||||
dest_files=["res://.godot/imported/panneau_solaire_3.png-022ae039aa352e1519471d4f9c114a8b.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
|
||||
@@ -1,90 +0,0 @@
|
||||
extends Machine
|
||||
class_name SolarPanel
|
||||
|
||||
const ENERGY_ICON = preload("res://common/icons/bolt.svg")
|
||||
|
||||
var charged : bool = false
|
||||
var recharge_days : int = 0
|
||||
|
||||
func get_days_to_recharge(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 2
|
||||
2: return 2
|
||||
3: return 2
|
||||
_: return 1
|
||||
|
||||
func get_energy_production(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 1
|
||||
2: return 2
|
||||
3: return 3
|
||||
_: return 1
|
||||
|
||||
# Méthode déclenchée par la classe planet
|
||||
func _pass_day():
|
||||
if not charged:
|
||||
recharge_days += 1
|
||||
if recharge_days >= get_days_to_recharge():
|
||||
set_charged(true)
|
||||
|
||||
func set_charged(_charged = true, with_anim : bool = true):
|
||||
charged = _charged
|
||||
recharge_days = 0
|
||||
if with_anim:
|
||||
if charged:
|
||||
%AnimationPlayer.play("charged")
|
||||
else :
|
||||
%AnimationPlayer.play_backwards("charged")
|
||||
await %AnimationPlayer.animation_finished
|
||||
%Flair.modulate = Color.WHITE if charged else Color.TRANSPARENT
|
||||
%Pannels.modulate = Color.WHITE if charged else Color("6c6c6c")
|
||||
|
||||
func card_info() -> CardInfo:
|
||||
var info = CardInfo.new(
|
||||
pointer_text()
|
||||
)
|
||||
|
||||
if default_info_desc != "":
|
||||
var desc_section = CardSectionInfo.new(
|
||||
tr("DESCRIPTION"),
|
||||
default_info_desc
|
||||
)
|
||||
desc_section.title_icon = DESC_ICON
|
||||
info.sections.append(
|
||||
desc_section
|
||||
)
|
||||
|
||||
var charged_text = tr("CHARGED")
|
||||
|
||||
if not charged and (get_days_to_recharge() - recharge_days) == 1:
|
||||
charged_text = tr("1_DAY_BEFORE_CHARGE")
|
||||
elif not charged and (get_days_to_recharge() - recharge_days) > 1:
|
||||
charged_text = tr("%d_DAYS_BEFORE_CHARGE") % (get_days_to_recharge() - recharge_days)
|
||||
|
||||
info.stats.append(
|
||||
CardStatInfo.new(
|
||||
charged_text,
|
||||
ENERGY_ICON
|
||||
)
|
||||
)
|
||||
|
||||
return info
|
||||
|
||||
|
||||
func setup_machine_sprite():
|
||||
# %Base.self_modulate = Machine.get_level_color(level)
|
||||
pass
|
||||
|
||||
func interact_text():
|
||||
return tr("RECHARGE_%d_ENERGY") % get_energy_production()
|
||||
|
||||
func can_interact(_p : Player) -> bool:
|
||||
return charged
|
||||
|
||||
func interact(p : Player) -> bool:
|
||||
p.recharge(get_energy_production())
|
||||
set_charged(false)
|
||||
return true
|
||||
|
||||
func save() -> EntityData:
|
||||
return SolarPanelData.new(self)
|
||||
@@ -1 +0,0 @@
|
||||
uid://bjy8gc0eyl2ss
|
||||
@@ -1,19 +0,0 @@
|
||||
extends MachineData
|
||||
class_name SolarPanelData
|
||||
|
||||
@export var charged : bool = false
|
||||
@export var recharge_days : int = 0
|
||||
|
||||
func _init(m : SolarPanel):
|
||||
position = m.global_position
|
||||
level = m.level
|
||||
type = m.type
|
||||
charged = m.charged
|
||||
recharge_days = m.recharge_days
|
||||
|
||||
func load() -> Entity:
|
||||
var sp = Machine.instantiate_machine(type, level) as SolarPanel
|
||||
sp.set_charged(charged, false)
|
||||
sp.recharge_days = recharge_days
|
||||
|
||||
return sp
|
||||
@@ -1 +0,0 @@
|
||||
uid://dv1tok0civrpp
|
||||
@@ -1,11 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://dew3p4fffjryo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bepx311a3f0o" path="res://entities/interactables/machines/scripts/machine_type.gd" id="1_ctita"]
|
||||
[ext_resource type="PackedScene" uid="uid://gwq2oos6ljyp" path="res://entities/interactables/machines/solar_pannel/solar_pannel.tscn" id="1_naexs"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ctita")
|
||||
name = "SOLAR_PANNEL"
|
||||
scene = ExtResource("1_naexs")
|
||||
description = "SOLAR_PANNEL_DESCRIPTION_TEXT"
|
||||
metadata/_custom_type_script = "uid://bepx311a3f0o"
|
||||
@@ -1,104 +0,0 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://gwq2oos6ljyp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bjy8gc0eyl2ss" path="res://entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd" id="1_t4vnu"]
|
||||
[ext_resource type="Texture2D" uid="uid://b1n8nad43usw4" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png" id="2_ny3sb"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqqlkm14lawpa" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png" id="3_bml32"]
|
||||
[ext_resource type="Texture2D" uid="uid://c22re5wfsm1ax" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png" id="4_ob8kj"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6utw7"]
|
||||
radius = 48.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_77hon"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprites/Pannels:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.42352942, 0.42352942, 0.42352942, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprites/Flair:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gal8b"]
|
||||
resource_name = "charged"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprites/Pannels:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.033333335, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.42365062, 0.42365065, 0.42365062, 1), Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprites/Flair:modulate")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5vw1f"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_77hon"),
|
||||
&"charged": SubResource("Animation_gal8b")
|
||||
}
|
||||
|
||||
[node name="SolarPannel" type="Area2D"]
|
||||
script = ExtResource("1_t4vnu")
|
||||
default_interact_text = "USE"
|
||||
default_info_title = "SOLAR_PANNEL"
|
||||
default_info_desc = "SOLAR_PANNEL_DESCRIPTION_TEXT"
|
||||
metadata/_custom_type_script = "uid://du7qppxobx5nd"
|
||||
|
||||
[node name="Sprites" type="Node2D" parent="."]
|
||||
position = Vector2(15.999999, -16.999998)
|
||||
scale = Vector2(0.09, 0.09)
|
||||
|
||||
[node name="Pannels" type="Sprite2D" parent="Sprites"]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.42352942, 0.42352942, 0.42352942, 1)
|
||||
texture = ExtResource("2_ny3sb")
|
||||
|
||||
[node name="Base" type="Sprite2D" parent="Sprites"]
|
||||
unique_name_in_owner = true
|
||||
texture = ExtResource("3_bml32")
|
||||
|
||||
[node name="Flair" type="Sprite2D" parent="Sprites"]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
texture = ExtResource("4_ob8kj")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(6, -23)
|
||||
shape = SubResource("CircleShape2D_6utw7")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_5vw1f")
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
extends Interactable
|
||||
class_name TruckLadder
|
||||
|
||||
func interact(p : Player):
|
||||
p.planet.save()
|
||||
SceneManager.change_scene(SceneManager.COCKPIT_SCENE)
|
||||
return true
|
||||
@@ -1,33 +0,0 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cg1visg52i21a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://buimaomxu01wj" path="res://entities/interactables/truck/ladder/scripts/truck_ladder.gd" id="1_26qdk"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlrj7tyi5wfh8" path="res://entities/interactables/truck/assets/sprites/truck_ladder.png" id="2_xila4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="3_214ms"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hslnw"]
|
||||
radius = 26.0
|
||||
height = 112.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gmirm"]
|
||||
atlas = ExtResource("2_xila4")
|
||||
region = Rect2(205, 157, 87, 208)
|
||||
|
||||
[node name="TruckLadder" type="Area2D"]
|
||||
script = ExtResource("1_26qdk")
|
||||
default_interact_text = "ENTER_TRUCK"
|
||||
default_info_title = "TRUCK_ENTRANCE"
|
||||
default_info_desc = "LADDER_DESC_TEXT"
|
||||
metadata/_custom_type_script = "uid://dyprcd68fjstf"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-0.25, -28)
|
||||
shape = SubResource("CapsuleShape2D_hslnw")
|
||||
|
||||
[node name="TruckLadder" type="Sprite2D" parent="."]
|
||||
position = Vector2(-1.25, -30)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = SubResource("AtlasTexture_gmirm")
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="."]
|
||||
position = Vector2(0.75, -29.000004)
|
||||
texture = ExtResource("3_214ms")
|
||||
@@ -1,20 +1,24 @@
|
||||
extends Interactable
|
||||
class_name TruckRecharge
|
||||
|
||||
func _ready():
|
||||
if region:
|
||||
%Bolt.modulate = Color.WHITE if region.data.charges > 0 else Color.RED
|
||||
|
||||
func can_interact(_p : Player) -> bool:
|
||||
return (
|
||||
planet != null
|
||||
and planet.data
|
||||
and planet.data.charges > 0
|
||||
region != null
|
||||
and region.data
|
||||
and region.data.charges > 0
|
||||
)
|
||||
|
||||
func interact(_p: Player) -> bool:
|
||||
|
||||
if can_interact(_p):
|
||||
planet.data.charges -= 1
|
||||
planet.pass_day()
|
||||
region.data.charges -= 1
|
||||
region.pass_day()
|
||||
|
||||
%Bolt.modulate = Color.WHITE if planet.data.charges > 0 else Color.RED
|
||||
%Bolt.modulate = Color.WHITE if region.data.charges > 0 else Color.RED
|
||||
|
||||
return true
|
||||
return false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://d324mlmgls4fs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bsrn3gd2a532q" path="res://entities/interactables/truck/recharge/scripts/truck_recharge.gd" id="1_ipgcv"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlrj7tyi5wfh8" path="res://entities/interactables/truck/assets/sprites/truck_ladder.png" id="2_87dtp"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlrj7tyi5wfh8" path="res://entities/interactables/ladder/assets/truck_ladder.png" id="2_87dtp"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_jcfmm"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bjhct"]
|
||||
|
||||
Reference in New Issue
Block a user