mirror of
https://codeberg.org/sunder/sunder.git
synced 2026-07-15 22:14:33 +00:00
first commit 🎉
This commit is contained in:
commit
6e724f67fe
805 changed files with 62098 additions and 0 deletions
48
scenes/interfaces/hud/iffs/IFF.tscn
Normal file
48
scenes/interfaces/hud/iffs/IFF.tscn
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://bbeecp3jusppn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b4eysyabiblgn" path="res://scenes/interfaces/hud/iffs/iff.gd" id="1_g6kgb"]
|
||||
[ext_resource type="Shader" uid="uid://n2dcb4l0qun2" path="res://scenes/interfaces/progress_bar/resources/visual_shader.res" id="2_8cjkh"]
|
||||
[ext_resource type="PackedScene" uid="uid://chy8tm6hvummq" path="res://scenes/interfaces/progress_bar/ProgressBar3D.tscn" id="2_h0pl8"]
|
||||
[ext_resource type="Texture2D" uid="uid://d4i7h27euhnvk" path="res://scenes/interfaces/waypoint/assets/minimal.svg" id="4_sjeyi"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4quui"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("2_8cjkh")
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_ks8vt"]
|
||||
resource_local_to_scene = true
|
||||
material = SubResource("ShaderMaterial_4quui")
|
||||
size = Vector2(0.35, 0.025)
|
||||
center_offset = Vector3(0, 0.09, 0)
|
||||
|
||||
[node name="IFF" type="Node3D"]
|
||||
script = ExtResource("1_g6kgb")
|
||||
value = 128.0
|
||||
border = 0.4
|
||||
billboard = 1
|
||||
|
||||
[node name="Username" type="Label3D" parent="."]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
offset = Vector2(0, 64)
|
||||
billboard = 1
|
||||
fixed_size = true
|
||||
text = "Newblood"
|
||||
font_size = 24
|
||||
|
||||
[node name="ProgressBar3D" parent="." instance=ExtResource("2_h0pl8")]
|
||||
instance_shader_parameters/billboard = 1
|
||||
instance_shader_parameters/border = 0.0
|
||||
instance_shader_parameters/fill = Color(1, 1, 1, 1)
|
||||
instance_shader_parameters/size = Vector2(0.35, 0.025)
|
||||
mesh = SubResource("QuadMesh_ks8vt")
|
||||
border = 0.0
|
||||
billboard = 1
|
||||
fill = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="Chevron" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(0.4, 0, 0, 0, 0.4, 0, 0, 0, 0.4, 0, 0, 0)
|
||||
offset = Vector2(0, 64)
|
||||
pixel_size = 0.001
|
||||
billboard = 1
|
||||
fixed_size = true
|
||||
texture = ExtResource("4_sjeyi")
|
||||
113
scenes/interfaces/hud/iffs/iff.gd
Normal file
113
scenes/interfaces/hud/iffs/iff.gd
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
# This file is part of sunder.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
@tool
|
||||
class_name IFF extends Node3D
|
||||
|
||||
signal health_changed(new_value:float)
|
||||
signal fill_changed(color:Color)
|
||||
signal background_changed(color:Color)
|
||||
signal billboard_changed(new_billboard:int)
|
||||
signal border_changed(new_border:float)
|
||||
|
||||
# If `true`, the waypoint fades as the camera get closer.
|
||||
#@export var fade:bool = true
|
||||
|
||||
## The minimum [member value].
|
||||
@export var min_value:float = 0.:
|
||||
set(new_value):
|
||||
min_value = new_value
|
||||
value = value
|
||||
|
||||
## The maximum [member value].
|
||||
@export var max_value:float = 255.:
|
||||
set(new_value):
|
||||
max_value = new_value
|
||||
value = value
|
||||
|
||||
## Current value.
|
||||
@export var value:float = 255.:
|
||||
set(new_value):
|
||||
value = clampf(new_value, min_value, max_value)
|
||||
health_changed.emit(value)
|
||||
|
||||
## The border for the progress bar.
|
||||
@export_range(0., 1.) var border:float = .2:
|
||||
set(new_border):
|
||||
border = new_border
|
||||
border_changed.emit(border)
|
||||
|
||||
## The username to display on top of this indicator.
|
||||
@export var username:String = "Username":
|
||||
set = set_username
|
||||
|
||||
func set_username(new_name:String) -> void:
|
||||
username = new_name
|
||||
if is_inside_tree():
|
||||
label.text = new_name
|
||||
|
||||
## The foreground color to use for this indicator.
|
||||
@export var fill:Color = Color.WHITE:
|
||||
set(value):
|
||||
fill = value
|
||||
fill_changed.emit(fill)
|
||||
|
||||
## The background color to use for this indicator.
|
||||
@export var background:Color = Color(0, 0, 0, 0.5):
|
||||
set(color):
|
||||
background = color
|
||||
background_changed.emit(color)
|
||||
|
||||
## The billboard mode to use. See [member BaseMaterial3D.BillboardMode] for possible values.
|
||||
@export_enum("Disabled", "Enabled", "Y-Billboard") var billboard:int = 2:
|
||||
set(new_billboard):
|
||||
billboard = new_billboard
|
||||
billboard_changed.emit(billboard)
|
||||
|
||||
@onready var label:Label3D = $Username
|
||||
@onready var chevron:Sprite3D = $Chevron
|
||||
@onready var health_bar:ProgressBar3D = $ProgressBar3D
|
||||
|
||||
func _ready() -> void:
|
||||
label.text = username
|
||||
background_changed.connect(_on_background_changed)
|
||||
border_changed.connect(_on_border_changed)
|
||||
health_changed.connect(_on_health_changed)
|
||||
billboard_changed.connect(_on_billboard_changed)
|
||||
fill_changed.connect(_on_fill_changed)
|
||||
|
||||
func _on_billboard_changed(new_billboard:int) -> void:
|
||||
label.billboard = new_billboard as BaseMaterial3D.BillboardMode
|
||||
health_bar.billboard = new_billboard
|
||||
chevron.billboard = new_billboard as BaseMaterial3D.BillboardMode
|
||||
|
||||
func _on_border_changed(new_border:float) -> void:
|
||||
health_bar.border = new_border
|
||||
|
||||
func _on_username_changed(new_username:String) -> void:
|
||||
# The label's text can only be set once the node is ready.
|
||||
if is_inside_tree():
|
||||
label.text = new_username
|
||||
|
||||
func _on_background_changed(color:Color) -> void:
|
||||
label.outline_modulate = color
|
||||
health_bar.background = color
|
||||
|
||||
func _on_fill_changed(color:Color) -> void:
|
||||
label.modulate = color
|
||||
health_bar.fill = color
|
||||
chevron.modulate = color
|
||||
|
||||
func _on_health_changed(new_value:float) -> void:
|
||||
health_bar.value = new_value
|
||||
1
scenes/interfaces/hud/iffs/iff.gd.uid
Normal file
1
scenes/interfaces/hud/iffs/iff.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b4eysyabiblgn
|
||||
Loading…
Add table
Add a link
Reference in a new issue