summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/game.gd7
-rw-r--r--client/game.tscn2
-rw-r--r--client/player/chat_bubble.tscn4
-rw-r--r--client/player/controllable_player.gd6
-rw-r--r--client/player/item_bubble.gd36
-rw-r--r--client/player/item_bubble.tscn74
-rw-r--r--client/player/player.gd6
7 files changed, 124 insertions, 11 deletions
diff --git a/client/game.gd b/client/game.gd
index 6f5f376e..0922e04c 100644
--- a/client/game.gd
+++ b/client/game.gd
@@ -151,17 +151,18 @@ func _ready():
mp.text_message.connect(func(player: int, text: String):
var p: Player = players[player]
- p.bubble.set_text(text)
+ p.chat_bubble.set_text(text)
)
mp.clear_message.connect(func(player: int):
var p: Player = players[player]
- p.bubble.remove_text()
+ p.item_bubble.remove_item()
+ p.chat_bubble.remove_text()
)
mp.item_message.connect(func(player: int, item: int):
var p: Player = players[player]
- p.bubble.set_text(item_names[item])
+ p.item_bubble.set_item(item_names[item])
)
mp.send_join(Global.profile["username"], Global.profile["character"])
diff --git a/client/game.tscn b/client/game.tscn
index 1d51e224..492176fc 100644
--- a/client/game.tscn
+++ b/client/game.tscn
@@ -6,7 +6,7 @@
[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="5_yg6cl"]
[ext_resource type="Script" path="res://multiplayer.gd" id="6_fbxu8"]
[ext_resource type="PackedScene" uid="uid://b4gone8fu53r7" path="res://map/map.tscn" id="6_prg6t"]
-[ext_resource type="PackedScene" path="res://menu/overlay.tscn" id="7_7xrr6"]
+[ext_resource type="PackedScene" uid="uid://bpikve6wlsjfl" path="res://menu/overlay.tscn" id="7_7xrr6"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_py7px"]
ground_bottom_color = Color(0.0826605, 0.065772, 0.0461518, 1)
diff --git a/client/player/chat_bubble.tscn b/client/player/chat_bubble.tscn
index 8d765156..0fb6330f 100644
--- a/client/player/chat_bubble.tscn
+++ b/client/player/chat_bubble.tscn
@@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://player/chat_bubble.gd" id="1_4v1cx"]
[ext_resource type="PackedScene" uid="uid://5rcfoyuiwuya" path="res://player/chat_message.tscn" id="2_lyyq0"]
-[sub_resource type="QuadMesh" id="QuadMesh_tlsxo"]
+[sub_resource type="QuadMesh" id="QuadMesh_u8lr5"]
size = Vector2(2, 0.5)
[sub_resource type="ViewportTexture" id="ViewportTexture_mko8a"]
@@ -22,7 +22,7 @@ billboard_mode = 1
[node name="ChatBubble" type="MeshInstance3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
visible = false
-mesh = SubResource("QuadMesh_tlsxo")
+mesh = SubResource("QuadMesh_u8lr5")
surface_material_override/0 = SubResource("StandardMaterial3D_5iy0t")
script = ExtResource("1_4v1cx")
diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd
index 007b10db..67a7ca09 100644
--- a/client/player/controllable_player.gd
+++ b/client/player/controllable_player.gd
@@ -41,14 +41,14 @@ func _ready():
game.mp.send_position(position_, rotation_)
)
super()
- bubble.submit_message.connect(submit_message)
+ chat_bubble.submit_message.connect(submit_message)
func _input(_event):
if Input.is_action_just_pressed("chat"):
if chat_open:
- bubble.stop_edit()
+ chat_bubble.stop_edit()
else:
- bubble.edit()
+ chat_bubble.edit()
chat_open = !chat_open
func _process(delta):
diff --git a/client/player/item_bubble.gd b/client/player/item_bubble.gd
new file mode 100644
index 00000000..e57fbace
--- /dev/null
+++ b/client/player/item_bubble.gd
@@ -0,0 +1,36 @@
+# Undercooked - a game about cooking
+# Copyright 2024 nokoe
+#
+# 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, version 3 of the License only.
+#
+# 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/>.
+#
+class_name ItemBubble
+extends MeshInstance3D
+
+signal submit_message
+
+@onready var base: Node3D = $SubViewport/ItemMessage/SubViewportContainer/SubViewport/ItemBase
+
+var item: Item
+
+func set_item(t: String):
+ visible = true
+ item = ItemFactory.produce(t, base)
+ base.add_child(item)
+
+func remove_item():
+ visible = false
+ item.queue_free()
+
+func _process(delta):
+ if item != null:
+ item.rotation.y += delta * TAU * .05
diff --git a/client/player/item_bubble.tscn b/client/player/item_bubble.tscn
new file mode 100644
index 00000000..c6365591
--- /dev/null
+++ b/client/player/item_bubble.tscn
@@ -0,0 +1,74 @@
+[gd_scene load_steps=7 format=3 uid="uid://cj777mi5nok6c"]
+
+[ext_resource type="Script" path="res://player/item_bubble.gd" id="1_84g24"]
+
+[sub_resource type="QuadMesh" id="QuadMesh_tlsxo"]
+
+[sub_resource type="ViewportTexture" id="ViewportTexture_mko8a"]
+viewport_path = NodePath("SubViewport")
+
+[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5iy0t"]
+resource_local_to_scene = true
+transparency = 1
+no_depth_test = true
+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
+
+[node name="ItemBubble" type="MeshInstance3D"]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
+visible = false
+mesh = SubResource("QuadMesh_tlsxo")
+surface_material_override/0 = SubResource("StandardMaterial3D_5iy0t")
+script = ExtResource("1_84g24")
+
+[node name="SubViewport" type="SubViewport" parent="."]
+disable_3d = true
+transparent_bg = true
+size = Vector2i(256, 256)
+
+[node name="ItemMessage" type="Panel" parent="SubViewport"]
+offset_right = 256.0
+offset_bottom = 256.0
+auto_translate = false
+theme_override_styles/panel = SubResource("StyleBoxFlat_dpele")
+
+[node name="SubViewportContainer" type="SubViewportContainer" parent="SubViewport/ItemMessage"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="SubViewport" type="SubViewport" parent="SubViewport/ItemMessage/SubViewportContainer"]
+own_world_3d = true
+transparent_bg = true
+handle_input_locally = false
+size = Vector2i(256, 256)
+render_target_update_mode = 4
+
+[node name="Camera3D" type="Camera3D" parent="SubViewport/ItemMessage/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/SubViewportContainer/SubViewport"]
+
+[node name="DirectionalLight3D" type="DirectionalLight3D" parent="SubViewport/ItemMessage/SubViewportContainer/SubViewport"]
+transform = Transform3D(1, 0, 0, 0, 0.173648, 0.984808, 0, -0.984808, 0.173648, 0, 0, 0)
+
+[node name="WorldEnvironment" type="WorldEnvironment" parent="SubViewport/ItemMessage/SubViewportContainer/SubViewport"]
+environment = SubResource("Environment_iyxrx")
diff --git a/client/player/player.gd b/client/player/player.gd
index 4806b19d..b20eba14 100644
--- a/client/player/player.gd
+++ b/client/player/player.gd
@@ -28,7 +28,8 @@ var position_ = Vector2(0, 0)
var position_anim = Vector2(0, 0)
var character: Character = preload("res://player/character/character.tscn").instantiate()
-var bubble: ChatBubble = preload("res://player/chat_bubble.tscn").instantiate()
+var chat_bubble: ChatBubble = preload("res://player/chat_bubble.tscn").instantiate()
+var item_bubble: ItemBubble = preload("res://player/item_bubble.tscn").instantiate()
var hand: Item = null
var hand_base: Node3D = Node3D.new()
@@ -47,7 +48,8 @@ func _init(_id: int, new_name: String, pos: Vector2, new_character_idx: int, new
hand_base.position = HAND_BASE_POSITION
add_child(hand_base)
- add_child(bubble)
+ add_child(chat_bubble)
+ add_child(item_bubble)
character_idx = new_character_idx