cosmic/scenes/Ships/player_ship.tscn
2024-05-19 13:44:40 +03:00

177 lines
5.5 KiB
Text

[gd_scene load_steps=15 format=3 uid="uid://dok3i8u5t1ka4"]
[ext_resource type="Script" path="res://scripts/Ship/player_ship.gd" id="2_oqdd7"]
[ext_resource type="Script" path="res://scripts/Ship/player_input_controller.gd" id="3_0e84a"]
[ext_resource type="PackedScene" uid="uid://bsu4eqwdfewwi" path="res://scenes/Ships/Modules/Hulls/hull.tscn" id="3_ku5af"]
[ext_resource type="PackedScene" uid="uid://mw4kwxoeqch3" path="res://scenes/Ships/Modules/Engines/engine.tscn" id="4_pmbbn"]
[ext_resource type="PackedScene" uid="uid://bunboi5ouscw8" path="res://scenes/Ships/Modules/Shields/shield.tscn" id="5_7fjpq"]
[ext_resource type="Script" path="res://scripts/Ship/player_camera.gd" id="5_rclap"]
[ext_resource type="Script" path="res://scripts/Ship/weapons.gd" id="6_f6fm2"]
[ext_resource type="PackedScene" uid="uid://bf10g066l8grd" path="res://scenes/Ships/Modules/Weapons/laser.tscn" id="7_0ss0b"]
[ext_resource type="Theme" uid="uid://dmb8bcdghdjd" path="res://main_theme.tres" id="8_8lpnq"]
[sub_resource type="GDScript" id="GDScript_ry4sc"]
resource_name = "money_counter"
script/source = "extends Label
## Text with placeholder
@onready var unformatted_text: String = tr(text) + \" %d\"
## Shortcut to get_parent().get_parent()
@onready var ship: PlayerShip = get_parent().get_parent()
func _process(_delta):
text = unformatted_text % ship.money
"
[sub_resource type="GDScript" id="GDScript_vko7a"]
resource_name = "velocity_counter"
script/source = "extends Label
## Text with placeholder
@onready var unformatted_text: String = tr(text) + \" %d px/s\"
## Shortcut to get_parent().get_parent()
@onready var ship: PlayerShip = get_parent().get_parent()
func _process(_delta):
text = unformatted_text % ship.hull.scalar_velocity
"
[sub_resource type="GDScript" id="GDScript_uoaip"]
resource_name = "health_counter"
script/source = "extends Label
## Text with placeholder
@onready var unformatted_text: String = tr(text) + \" {0} / {1}\"
## Shortcut to get_parent().get_parent()
@onready var ship: PlayerShip = get_parent().get_parent()
func _process(_delta):
text = unformatted_text.format([
round(ship.hull.hp * 100) / 100.0,
ship.hull.max_hp
])
"
[sub_resource type="GDScript" id="GDScript_q1sx2"]
resource_name = "shield_counter"
script/source = "extends Label
## Text with placeholder
@onready var unformatted_text: String = tr(text) + \" {0} / {1}\"
## Shortcut to get_parent().get_parent()
@onready var ship: PlayerShip = get_parent().get_parent()
func _process(_delta):
text = unformatted_text.format([
round(ship.shield.capacity * 100) / 100.0,
ship.shield.max_capacity
])
"
[sub_resource type="GDScript" id="GDScript_rrgab"]
resource_name = "ammunition_counter"
script/source = "extends Label
## Text with placeholder
@onready var unformatted_text: PackedStringArray = text.split(\"\\n\")
## Shortcut to get_parent().get_parent()
@onready var ship: PlayerShip = get_parent().get_parent()
func _ready():
for i in range(len(unformatted_text)):
unformatted_text[i] = tr(unformatted_text[i])
unformatted_text[1] += \" {0} / {1}\"
unformatted_text[2] += \" {2} / {3}\"
for i in range(len(unformatted_text) - 1):
unformatted_text[i] += \"\\n\"
func _process(_delta):
var format = [
round(ship.hull.ammunition[\"Laser Energy\"] * 100) / 100.0,
ship.hull.max_ammunition[\"Laser Energy\"],
ship.hull.ammunition[\"Rockets\"],
ship.hull.max_ammunition[\"Rockets\"]
]
text = \"\".join(unformatted_text).format(format)
"
[node name="PlayerShip" type="Node2D"]
process_mode = 1
script = ExtResource("2_oqdd7")
[node name="InputController" type="Node2D" parent="."]
script = ExtResource("3_0e84a")
[node name="HullHolder" type="Node" parent="."]
[node name="Hull" parent="HullHolder" instance=ExtResource("3_ku5af")]
collision_mask = 3
max_contacts_reported = 1
contact_monitor = true
[node name="Engine" parent="." instance=ExtResource("4_pmbbn")]
[node name="Shield" parent="." instance=ExtResource("5_7fjpq")]
[node name="Weapons" type="Node2D" parent="."]
script = ExtResource("6_f6fm2")
[node name="Laser" parent="Weapons" instance=ExtResource("7_0ss0b")]
position = Vector2(75, 0)
action_id = "primary"
[node name="ColorableGUI" type="CanvasLayer" parent="."]
[node name="Money" type="Label" parent="ColorableGUI"]
offset_left = 7.0
offset_top = 611.0
offset_right = 92.0
offset_bottom = 634.0
theme = ExtResource("8_8lpnq")
text = "PLAYER_GUI_MONEY"
script = SubResource("GDScript_ry4sc")
[node name="Velocity" type="Label" parent="ColorableGUI"]
offset_left = 7.0
offset_top = 688.0
offset_right = 137.0
offset_bottom = 711.0
theme = ExtResource("8_8lpnq")
text = "PLAYER_GUI_VELOCITY"
script = SubResource("GDScript_vko7a")
[node name="Health" type="Label" parent="ColorableGUI"]
offset_left = 7.0
offset_top = 663.0
offset_right = 168.0
offset_bottom = 686.0
theme = ExtResource("8_8lpnq")
text = "PLAYER_GUI_HEALTH"
script = SubResource("GDScript_uoaip")
[node name="Shield" type="Label" parent="ColorableGUI"]
offset_left = 8.0
offset_top = 638.0
offset_right = 164.0
offset_bottom = 661.0
theme = ExtResource("8_8lpnq")
text = "PLAYER_GUI_SHIELD"
script = SubResource("GDScript_q1sx2")
[node name="Ammunition" type="Label" parent="ColorableGUI"]
offset_left = 849.0
offset_top = 641.0
offset_right = 1276.0
offset_bottom = 716.0
theme = ExtResource("8_8lpnq")
text = "PLAYER_GUI_AMMUNITION
PLAYER_GUI_AMMUNITION_LASER
PLAYER_GUI_AMMUNITION_ROCKETS"
horizontal_alignment = 2
script = SubResource("GDScript_rrgab")
[node name="NonColorableGUI" type="CanvasLayer" parent="."]
[node name="Camera" type="Camera2D" parent="."]
zoom = Vector2(0.5, 0.5)
script = ExtResource("5_rclap")