diff --git a/godot/assets/goal_icon.png b/godot/assets/goal_icon.png
new file mode 100644
index 0000000..2c0bc3d
Binary files /dev/null and b/godot/assets/goal_icon.png differ
diff --git a/godot/assets/goal_icon.png.import b/godot/assets/goal_icon.png.import
new file mode 100644
index 0000000..a37a8ae
--- /dev/null
+++ b/godot/assets/goal_icon.png.import
@@ -0,0 +1,42 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://bn21glvbfmyvd"
+path.s3tc="res://.godot/imported/goal_icon.png-1fe98cf554c289fa7a08923cb33858c6.s3tc.ctex"
+path.etc2="res://.godot/imported/goal_icon.png-1fe98cf554c289fa7a08923cb33858c6.etc2.ctex"
+metadata={
+"imported_formats": ["s3tc_bptc", "etc2_astc"],
+"vram_texture": true
+}
+
+[deps]
+
+source_file="res://assets/goal_icon.png"
+dest_files=["res://.godot/imported/goal_icon.png-1fe98cf554c289fa7a08923cb33858c6.s3tc.ctex", "res://.godot/imported/goal_icon.png-1fe98cf554c289fa7a08923cb33858c6.etc2.ctex"]
+
+[params]
+
+compress/mode=2
+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=true
+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=0
diff --git a/godot/raw_assets/goal_icon.svg b/godot/raw_assets/goal_icon.svg
new file mode 100644
index 0000000..a2d8902
--- /dev/null
+++ b/godot/raw_assets/goal_icon.svg
@@ -0,0 +1,78 @@
+
+
+
+
diff --git a/godot/raw_assets/goal_icon.svg.import b/godot/raw_assets/goal_icon.svg.import
new file mode 100644
index 0000000..4e6af23
--- /dev/null
+++ b/godot/raw_assets/goal_icon.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://cmmtk8f4vvpdf"
+path="res://.godot/imported/goal_icon.svg-48e59e693e428cdafd0d963c1996b76d.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://raw_assets/goal_icon.svg"
+dest_files=["res://.godot/imported/goal_icon.svg-48e59e693e428cdafd0d963c1996b76d.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
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/godot/scenes/misc/goal.tscn b/godot/scenes/misc/goal.tscn
index cb0086d..5ccc6ee 100644
--- a/godot/scenes/misc/goal.tscn
+++ b/godot/scenes/misc/goal.tscn
@@ -1,6 +1,7 @@
[gd_scene format=3 uid="uid://c1r8nk58cci3a"]
[ext_resource type="Shader" uid="uid://bafca0fr7yxgo" path="res://shaders/goal_shader.gdshader" id="1_vdq5s"]
+[ext_resource type="Texture2D" uid="uid://bn21glvbfmyvd" path="res://assets/goal_icon.png" id="2_sxx5i"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sxx5i"]
resource_local_to_scene = true
@@ -19,8 +20,9 @@ cap_bottom = false
[sub_resource type="CylinderShape3D" id="CylinderShape3D_1cgct"]
radius = 2.0
-[node name="goal" type="Goal" unique_id=177528504 node_paths=PackedStringArray("mesh")]
+[node name="goal" type="Goal" unique_id=177528504 node_paths=PackedStringArray("mesh", "icon")]
mesh = NodePath("mesh_instance_3d")
+icon = NodePath("goal_icon")
collision_layer = 8
collision_mask = 11
@@ -31,3 +33,10 @@ mesh = SubResource("CylinderMesh_1cgct")
[node name="collision_shape_3d" type="CollisionShape3D" parent="." unique_id=2021568043]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CylinderShape3D_1cgct")
+
+[node name="goal_icon" type="Sprite3D" parent="." unique_id=625339734]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.9555063, 0)
+pixel_size = 0.005
+billboard = 1
+no_depth_test = true
+texture = ExtResource("2_sxx5i")
diff --git a/rust/src/map/goal.rs b/rust/src/map/goal.rs
index 3e6775c..a20e6ea 100644
--- a/rust/src/map/goal.rs
+++ b/rust/src/map/goal.rs
@@ -1,5 +1,5 @@
use godot::{
- classes::{Area3D, IArea3D, MeshInstance3D, ShaderMaterial},
+ classes::{Area3D, IArea3D, MeshInstance3D, ShaderMaterial, Sprite3D},
prelude::*,
};
@@ -17,6 +17,8 @@ pub struct Goal {
pub team: u8,
#[export]
pub mesh: Option>,
+ #[export]
+ pub icon: Option>,
base: Base,
}
@@ -39,20 +41,29 @@ impl IArea3D for Goal {
impl Goal {
fn update_color(&mut self) {
- if let Some(mesh) = &mut self.mesh
- && let Some(mat) = mesh.get_active_material(0)
- && let Ok(mut mat) = mat.try_cast::()
+ let color = if let Some(game) = Game::singleton()
+ && let Some(team) = game.bind().get_team(self.team)
{
- if let Some(game) = Game::singleton()
- && let Some(team) = game.bind().get_team(self.team)
+ Some(team.bind().color())
+ } else if let Some(playback) = &StandaloneReplayManager::singleton().bind().playback
+ && let Some(team) = playback.bind().replay.teams.get(self.team as usize)
+ {
+ let color: Color = team.color.clone().into();
+ Some(color)
+ } else {
+ None
+ };
+
+ if let Some(color) = color {
+ if let Some(mesh) = &mut self.mesh
+ && let Some(mat) = mesh.get_active_material(0)
+ && let Ok(mut mat) = mat.try_cast::()
{
- mat.set_shader_parameter("goal_color", &team.bind().color().to_variant());
- } else if let Some(playback) = &StandaloneReplayManager::singleton().bind().playback
- && let Some(team) = playback.bind().replay.teams.get(self.team as usize)
- {
- let color: Color = team.color.clone().into();
mat.set_shader_parameter("goal_color", &color.to_variant());
}
+ if let Some(icon) = &mut self.icon {
+ icon.set_modulate(color);
+ }
}
}