summaryrefslogtreecommitdiff
path: root/client/player
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-09-25 15:30:01 +0200
committertpart <tpart120@proton.me>2024-09-25 15:45:32 +0200
commit2323f3d4ba638491110be16734be9c24485caefa (patch)
tree2810e1759488b3e12976e7ef7ca508e68ded8975 /client/player
parent8603ed6c5cd6ba8abc8516a25d45fdd0792bc0f8 (diff)
downloadhurrycurry-2323f3d4ba638491110be16734be9c24485caefa.tar
hurrycurry-2323f3d4ba638491110be16734be9c24485caefa.tar.bz2
hurrycurry-2323f3d4ba638491110be16734be9c24485caefa.tar.zst
Support pinned messages
Diffstat (limited to 'client/player')
-rw-r--r--client/player/item_bubble.gd33
-rw-r--r--client/player/item_bubble.tscn65
2 files changed, 7 insertions, 91 deletions
diff --git a/client/player/item_bubble.gd b/client/player/item_bubble.gd
index ac71c27e..9c18bfbb 100644
--- a/client/player/item_bubble.gd
+++ b/client/player/item_bubble.gd
@@ -16,42 +16,17 @@
class_name ItemBubble
extends MeshInstance3D
-@onready var base: Node3D = $SubViewport/ItemMessage/VBoxContainer/SubViewportContainer/SubViewport/ItemBase
-@onready var progress: ProgressBar = $SubViewport/ItemMessage/VBoxContainer/ProgressBar
-
var item: Item
var timeout_remaining := 0.
var timeout_initial := 0.
var progress_style = preload("res://menu/theme/style/item_bubble_progress_style.tres")
-func _init():
- progress_style = progress_style.duplicate()
+@onready var item_message = $SubViewport/ItemMessage
-func set_item(t: String, timeout_initial_: float, timeout_remaining_: float):
- if timeout_remaining_ == 0.:
- remove_item()
- return
-
+func set_item(item_name: String, timeout_initial_: float, timeout_remaining_: float):
visible = true
- item = ItemFactory.produce(t, base)
- base.add_child(item)
-
- timeout_remaining = timeout_remaining_
- timeout_initial = timeout_initial_
- progress.max_value = timeout_initial
- progress.value = timeout_remaining
+ item_message.set_item(item_name, timeout_initial_, timeout_remaining_)
func remove_item():
visible = false
- if item != null:
- item.queue_free()
-
-func _process(delta):
- if visible:
- item.rotation.y += delta * TAU * .05
- timeout_remaining -= delta
- progress.value = timeout_remaining
- var x: float = timeout_remaining / timeout_initial
- progress_style.bg_color = Color(min((1-x) * 2, 1), min(x * 2, 1), 0.)
- progress_style.corner_radius_bottom_right = max(32.-(1.-x)*320, 0)
- progress.add_theme_stylebox_override("fill", progress_style)
+ item_message.remove_item()
diff --git a/client/player/item_bubble.tscn b/client/player/item_bubble.tscn
index 2e340ff3..cba432f2 100644
--- a/client/player/item_bubble.tscn
+++ b/client/player/item_bubble.tscn
@@ -1,7 +1,7 @@
-[gd_scene load_steps=9 format=3 uid="uid://cj777mi5nok6c"]
+[gd_scene load_steps=6 format=3 uid="uid://cj777mi5nok6c"]
[ext_resource type="Script" path="res://player/item_bubble.gd" id="1_84g24"]
-[ext_resource type="StyleBox" uid="uid://brw8uogdgx2gf" path="res://menu/theme/style/item_bubble_progress_style.tres" id="2_5qt7f"]
+[ext_resource type="PackedScene" uid="uid://fkqh36s4vl3p" path="res://menu/communicate/item/item_message.tscn" id="2_hgmra"]
[sub_resource type="QuadMesh" id="QuadMesh_tlsxo"]
@@ -16,22 +16,6 @@ shading_mode = 0
albedo_texture = SubResource("ViewportTexture_mko8a")
billboard_mode = 1
-[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dpele"]
-bg_color = Color(1, 1, 1, 1)
-corner_radius_top_left = 30
-corner_radius_top_right = 30
-corner_radius_bottom_right = 30
-corner_radius_bottom_left = 30
-
-[sub_resource type="Environment" id="Environment_iyxrx"]
-ambient_light_source = 2
-ambient_light_color = Color(1, 1, 1, 1)
-ambient_light_energy = 0.5
-
-[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ima0t"]
-corner_radius_bottom_right = 32
-corner_radius_bottom_left = 32
-
[node name="ItemBubble" type="MeshInstance3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
visible = false
@@ -44,47 +28,4 @@ disable_3d = true
transparent_bg = true
size = Vector2i(256, 256)
-[node name="ItemMessage" type="PanelContainer" parent="SubViewport"]
-auto_translate_mode = 2
-offset_right = 256.0
-offset_bottom = 256.0
-size_flags_vertical = 3
-theme_override_styles/panel = SubResource("StyleBoxFlat_dpele")
-
-[node name="VBoxContainer" type="VBoxContainer" parent="SubViewport/ItemMessage"]
-layout_mode = 2
-theme_override_constants/separation = 0
-
-[node name="SubViewportContainer" type="SubViewportContainer" parent="SubViewport/ItemMessage/VBoxContainer"]
-layout_mode = 2
-size_flags_vertical = 3
-
-[node name="SubViewport" type="SubViewport" parent="SubViewport/ItemMessage/VBoxContainer/SubViewportContainer"]
-own_world_3d = true
-transparent_bg = true
-handle_input_locally = false
-size = Vector2i(256, 224)
-render_target_update_mode = 4
-
-[node name="Camera3D" type="Camera3D" parent="SubViewport/ItemMessage/VBoxContainer/SubViewportContainer/SubViewport"]
-transform = Transform3D(1, 0, 0, 0, 0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 0.5, 1)
-projection = 1
-size = 0.6
-
-[node name="ItemBase" type="Node3D" parent="SubViewport/ItemMessage/VBoxContainer/SubViewportContainer/SubViewport"]
-
-[node name="DirectionalLight3D" type="DirectionalLight3D" parent="SubViewport/ItemMessage/VBoxContainer/SubViewportContainer/SubViewport"]
-transform = Transform3D(1, 0, 0, 0, 0.173648, 0.984808, 0, -0.984808, 0.173648, 0, 0, 0)
-light_energy = 0.5
-
-[node name="WorldEnvironment" type="WorldEnvironment" parent="SubViewport/ItemMessage/VBoxContainer/SubViewportContainer/SubViewport"]
-environment = SubResource("Environment_iyxrx")
-
-[node name="ProgressBar" type="ProgressBar" parent="SubViewport/ItemMessage/VBoxContainer"]
-custom_minimum_size = Vector2(0, 32)
-layout_mode = 2
-theme_override_styles/background = SubResource("StyleBoxFlat_ima0t")
-theme_override_styles/fill = ExtResource("2_5qt7f")
-step = 0.0
-value = 100.0
-show_percentage = false
+[node name="ItemMessage" parent="SubViewport" instance=ExtResource("2_hgmra")]