mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-12 23:14:54 +00:00
👽 interstellar delivery
This commit is contained in:
parent
547c97bfba
commit
97c8292858
257 changed files with 7309 additions and 4637 deletions
32
interfaces/hud/hud.gd
Normal file
32
interfaces/hud/hud.gd
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# This file is part of open-fpsz.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
class_name HUD extends CanvasLayer
|
||||
|
||||
@export var health_bar:ProgressBar
|
||||
@export var energy_bar:ProgressBar
|
||||
@export var timer_label:Label
|
||||
@export var objective_label:Label
|
||||
@export var debug_label:Label
|
||||
@export var ammo_label:Label
|
||||
@export var throw_progress:TextureProgressBar
|
||||
|
||||
@onready var player:Player = owner
|
||||
|
||||
func _ready() -> void:
|
||||
health_bar.set_value(player.health.max_value)
|
||||
energy_bar.set_value(player.energy_max)
|
||||
|
||||
func _on_ammo_changed(new_ammo: int) -> void:
|
||||
ammo_label.text = str(new_ammo)
|
||||
|
|
@ -1,52 +1,11 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://bcv81ku26xo"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://bcv81ku26xo"]
|
||||
|
||||
[ext_resource type="Script" path="res://interfaces/hud/timer_label.gd" id="1_6qrx6"]
|
||||
[ext_resource type="StyleBox" uid="uid://dcn1ll2ra4lwn" path="res://interfaces/hud/vitals/background.tres" id="1_gmv44"]
|
||||
[ext_resource type="Script" path="res://interfaces/hud/hud.gd" id="1_yev76"]
|
||||
[ext_resource type="StyleBox" uid="uid://bq7rjpm38pao7" path="res://interfaces/hud/vitals/health_foreground.tres" id="2_6ejsl"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_2vxif"]
|
||||
script/source = "# This file is part of open-fpsz.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
extends CanvasLayer
|
||||
|
||||
@export var health_bar : ProgressBar
|
||||
@export var energy_bar : ProgressBar
|
||||
@export var debug_label : Label
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_w8l21"]
|
||||
script/source = "extends Label
|
||||
|
||||
@onready var player : Player = get_parent().owner
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
if not OS.is_debug_build():
|
||||
queue_free()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta : float) -> void:
|
||||
text = \"\"
|
||||
text += \"fps: %d (%.2f mspf)\\n\" % [Engine.get_frames_per_second(), 1000.0 / Engine.get_frames_per_second()]
|
||||
text += \"position: %d, %d, %d\\n\" % [player.position.x, player.position.y, player.position.z]
|
||||
text += \"speed: %d km/h\\n\" % (player.linear_velocity.length() * 3.6)
|
||||
var velocity_xz := Vector3(player.linear_velocity.x, 0., player.linear_velocity.z)
|
||||
text += \"speed_xz: %d km/h\\n\" % (velocity_xz.length() * 3.6)
|
||||
var viewport_render_size : Vector2i = get_viewport().size * get_viewport().scaling_3d_scale
|
||||
text += \"3D viewport resolution: %d × %d (%d%%)\\n\" \\
|
||||
% [viewport_render_size.x, viewport_render_size.y, round(get_viewport().scaling_3d_scale * 100)]
|
||||
"
|
||||
[ext_resource type="Theme" uid="uid://bec7g0fax3c8o" path="res://interfaces/global_theme.tres" id="2_gbqw5"]
|
||||
[ext_resource type="Texture2D" uid="uid://1mwcg0cd0msw" path="res://interfaces/hud/throw_force_texture.svg" id="6_rrus8"]
|
||||
|
||||
[sub_resource type="Shader" id="Shader_gaah5"]
|
||||
code = "shader_type canvas_item;
|
||||
|
|
@ -67,6 +26,33 @@ void fragment() {
|
|||
shader = SubResource("Shader_gaah5")
|
||||
shader_parameter/color = Color(1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="SystemFont" id="SystemFont_oo638"]
|
||||
subpixel_positioning = 0
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_w8l21"]
|
||||
script/source = "extends Label
|
||||
|
||||
@onready var player : Player = owner.get_parent()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
if not OS.is_debug_build():
|
||||
queue_free()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta : float) -> void:
|
||||
text = \"\"
|
||||
text += \"fps: %d (%.2f mspf)\\n\" % [Engine.get_frames_per_second(), 1000.0 / Engine.get_frames_per_second()]
|
||||
text += \"position: %d, %d, %d\\n\" % [player.position.x, player.position.y, player.position.z]
|
||||
text += \"speed: %d km/h\\n\" % (player.linear_velocity.length() * 3.6)
|
||||
var velocity_xz := Vector3(player.linear_velocity.x, 0., player.linear_velocity.z)
|
||||
text += \"speed_xz: %d km/h\\n\" % (velocity_xz.length() * 3.6)
|
||||
var viewport_render_size : Vector2i = get_viewport().size * get_viewport().scaling_3d_scale
|
||||
text += \"3D viewport resolution: %d × %d (%d%%)\\n\" \\
|
||||
% [viewport_render_size.x, viewport_render_size.y, round(get_viewport().scaling_3d_scale * 100)]
|
||||
text += \"health: %d\" % player.health.value
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f23s3"]
|
||||
bg_color = Color(0.0901961, 0.87451, 0.760784, 0.65098)
|
||||
corner_radius_top_left = 3
|
||||
|
|
@ -75,17 +61,23 @@ corner_radius_bottom_right = 3
|
|||
corner_radius_bottom_left = 3
|
||||
anti_aliasing = false
|
||||
|
||||
[node name="HUD" type="CanvasLayer" node_paths=PackedStringArray("health_bar", "energy_bar")]
|
||||
script = SubResource("GDScript_2vxif")
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_2pxd4"]
|
||||
properties/0/path = NodePath("MarginContainer/Multiplayer/TimerLabel:text")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 2
|
||||
properties/1/path = NodePath("MarginContainer/Multiplayer/ObjectiveLabel:visible")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 2
|
||||
|
||||
[node name="HUD" type="CanvasLayer" node_paths=PackedStringArray("health_bar", "energy_bar", "timer_label", "objective_label", "debug_label", "ammo_label", "throw_progress")]
|
||||
script = ExtResource("1_yev76")
|
||||
health_bar = NodePath("MarginContainer/HBoxContainer/VBoxContainer/HealthBar")
|
||||
energy_bar = NodePath("MarginContainer/HBoxContainer/VBoxContainer/EnergyBar")
|
||||
|
||||
[node name="DebugLabel" type="Label" parent="."]
|
||||
offset_left = 20.0
|
||||
offset_top = 20.0
|
||||
offset_right = 21.0
|
||||
offset_bottom = 43.0
|
||||
script = SubResource("GDScript_w8l21")
|
||||
timer_label = NodePath("MarginContainer/Multiplayer/TimerLabel")
|
||||
objective_label = NodePath("MarginContainer/Multiplayer/ObjectiveLabel")
|
||||
debug_label = NodePath("MarginContainer/DebugLabel")
|
||||
ammo_label = NodePath("MarginContainer/HBoxContainer/HBoxContainer/AmmoLabel")
|
||||
throw_progress = NodePath("MarginContainer/CenterContainer/TextureProgressBar")
|
||||
|
||||
[node name="Reticle" type="ColorRect" parent="."]
|
||||
material = SubResource("ShaderMaterial_7blp5")
|
||||
|
|
@ -103,24 +95,53 @@ grow_vertical = 2
|
|||
mouse_filter = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -42.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 20
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("2_gbqw5")
|
||||
theme_override_constants/margin_left = 24
|
||||
theme_override_constants/margin_top = 24
|
||||
theme_override_constants/margin_right = 24
|
||||
theme_override_constants/margin_bottom = 24
|
||||
|
||||
[node name="Multiplayer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TimerLabel" type="Label" parent="MarginContainer/Multiplayer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "Warmup"
|
||||
horizontal_alignment = 1
|
||||
script = ExtResource("1_6qrx6")
|
||||
|
||||
[node name="ObjectiveLabel" type="Label" parent="MarginContainer/Multiplayer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(1, 0.75, 0, 1)
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.5)
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "YOU ARE THE RABBIT"
|
||||
horizontal_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="DebugLabel" type="Label" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_fonts/font = SubResource("SystemFont_oo638")
|
||||
script = SubResource("GDScript_w8l21")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 8
|
||||
size_flags_stretch_ratio = 0.2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
|
|
@ -132,7 +153,7 @@ theme_override_styles/background = ExtResource("1_gmv44")
|
|||
theme_override_styles/fill = ExtResource("2_6ejsl")
|
||||
max_value = 255.0
|
||||
step = 1.0
|
||||
value = 1.0
|
||||
value = 255.0
|
||||
show_percentage = false
|
||||
|
||||
[node name="EnergyBar" type="ProgressBar" parent="MarginContainer/HBoxContainer/VBoxContainer"]
|
||||
|
|
@ -141,10 +162,42 @@ layout_mode = 2
|
|||
mouse_filter = 2
|
||||
theme_override_styles/background = ExtResource("1_gmv44")
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_f23s3")
|
||||
value = 60.0
|
||||
value = 100.0
|
||||
show_percentage = false
|
||||
|
||||
[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.8
|
||||
size_flags_stretch_ratio = 0.6
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.2
|
||||
|
||||
[node name="AmmoLabel" type="Label" parent="MarginContainer/HBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "24
|
||||
"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureProgressBar" type="TextureProgressBar" parent="MarginContainer/CenterContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
value = 100.0
|
||||
fill_mode = 4
|
||||
texture_progress = ExtResource("6_rrus8")
|
||||
radial_initial_angle = 293.0
|
||||
radial_fill_degrees = 135.0
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_interval = 0.1
|
||||
replication_config = SubResource("SceneReplicationConfig_2pxd4")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
|
|
|
|||
|
|
@ -51,8 +51,10 @@ signal border_changed(new_border : float)
|
|||
|
||||
## The username to display on top of this indicator.
|
||||
@export var username : String = "Username":
|
||||
set(value):
|
||||
username = value
|
||||
set = set_username
|
||||
|
||||
func set_username(new_name : String) -> void:
|
||||
username = new_name
|
||||
username_changed.emit(username)
|
||||
|
||||
## The foreground color to use for this indicator.
|
||||
|
|
|
|||
46
interfaces/hud/throw_force_texture.svg
Normal file
46
interfaces/hud/throw_force_texture.svg
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="26.53857mm"
|
||||
height="26.538568mm"
|
||||
viewBox="0 0 26.53857 26.538568"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs1">
|
||||
<linearGradient
|
||||
id="linearGradient1">
|
||||
<stop
|
||||
style="stop-color:#ffff00;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop1" />
|
||||
<stop
|
||||
style="stop-color:#ff0000;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop2" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
xlink:href="#linearGradient1"
|
||||
id="linearGradient2"
|
||||
x1="60.761497"
|
||||
y1="51.722984"
|
||||
x2="92.511497"
|
||||
y2="51.722984"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.86468252,0,0,0.86468252,10.370258,6.999024)" />
|
||||
</defs>
|
||||
<g
|
||||
id="layer1"
|
||||
transform="translate(-63.367213,-38.4537)">
|
||||
<circle
|
||||
style="fill:none;stroke:url(#linearGradient2);stroke-width:3.66051;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;paint-order:markers stroke fill"
|
||||
id="path1"
|
||||
cx="76.636497"
|
||||
cy="51.722984"
|
||||
r="11.43903" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
37
interfaces/hud/throw_force_texture.svg.import
Normal file
37
interfaces/hud/throw_force_texture.svg.import
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://1mwcg0cd0msw"
|
||||
path="res://.godot/imported/throw_force_texture.svg-c8f74c490a74ad039fa1bdb24add5fd6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://interfaces/hud/throw_force_texture.svg"
|
||||
dest_files=["res://.godot/imported/throw_force_texture.svg-c8f74c490a74ad039fa1bdb24add5fd6.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
32
interfaces/hud/timer_label.gd
Normal file
32
interfaces/hud/timer_label.gd
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# This file is part of open-fpsz.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
extends Label
|
||||
|
||||
var timer: Timer = null
|
||||
|
||||
func _ready() -> void:
|
||||
if Game.type is Multiplayer:
|
||||
timer = Game.type.timer
|
||||
else:
|
||||
visible = false
|
||||
set_process(false)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if timer and not timer.is_stopped() \
|
||||
and !(multiplayer.multiplayer_peer is OfflineMultiplayerPeer) \
|
||||
and multiplayer.is_server():
|
||||
var minutes: int = int(timer.time_left / 60)
|
||||
var seconds : int = int(fmod(timer.time_left, 60))
|
||||
text = "%d:%02d" % [minutes, seconds]
|
||||
Loading…
Add table
Add a link
Reference in a new issue