aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/game.gd2
-rw-r--r--client/menu/character.gd12
-rw-r--r--client/player/character/character.gd76
-rw-r--r--client/player/character/character.tscn34
-rw-r--r--client/player/character/hairstyles/hair_1.res (renamed from client/player/character/hairstyles/hair.res)bin16938 -> 16938 bytes
-rw-r--r--client/player/character/headwear/cat_ears.gd14
-rw-r--r--client/player/character/headwear/devil_horn.res (renamed from client/player/character/headwear/horn.res)bin5892 -> 5892 bytes
-rw-r--r--client/player/character/headwear/devil_horns.tscn2
-rw-r--r--client/player/character/headwear/propeller_hat.tscn7
9 files changed, 74 insertions, 73 deletions
diff --git a/client/game.gd b/client/game.gd
index 37404b7a..b4b6f9df 100644
--- a/client/game.gd
+++ b/client/game.gd
@@ -248,7 +248,7 @@ func handle_packet(p):
if pinned:
push_error("Pinned text messages are currently not supported")
var player: Player = players[p.player]
- data.color = Character.COLORS[G.rem_euclid(player.character_style.color, Character.NUM_COLORS)]
+ data.color = Character.COLORS[G.rem_euclid(player.character_style.color, Character.COLORS.size())]
data.username = players[p.player].username
data.text = p.message.text if "text" in p.message else get_message_str(p.message)
diff --git a/client/menu/character.gd b/client/menu/character.gd
index f40aeffb..8650a30c 100644
--- a/client/menu/character.gd
+++ b/client/menu/character.gd
@@ -74,27 +74,27 @@ func _on_back_pressed():
func _on_character_back_pressed():
modify_style(func m(current_style: Dictionary):
- current_style.color = G.rem_euclid(current_style.color - 1, character.NUM_COLORS))
+ current_style.color = G.rem_euclid(current_style.color - 1, character.COLORS.size()))
func _on_character_forward_pressed():
modify_style(func m(current_style: Dictionary):
- current_style.color = G.rem_euclid(current_style.color + 1, character.NUM_COLORS))
+ current_style.color = G.rem_euclid(current_style.color + 1, character.COLORS.size()))
func _on_headwear_back_pressed() -> void:
modify_style(func m(current_style: Dictionary):
- current_style.headwear = G.rem_euclid(current_style.headwear - 1, character.NUM_HEADWEARS))
+ current_style.headwear = G.rem_euclid(current_style.headwear - 1, character.headwears.size()))
func _on_headwear_forward_pressed() -> void:
modify_style(func m(current_style: Dictionary):
- current_style.headwear = G.rem_euclid(current_style.headwear + 1, character.NUM_HEADWEARS))
+ current_style.headwear = G.rem_euclid(current_style.headwear + 1, character.headwears.size()))
func _on_hairstyle_back_pressed() -> void:
modify_style(func m(current_style: Dictionary):
- current_style.hairstyle = G.rem_euclid(current_style.hairstyle - 1, character.NUM_HAIRS))
+ current_style.hairstyle = G.rem_euclid(current_style.hairstyle - 1, character.hairstyles.size()))
func _on_hairstyle_forward_pressed() -> void:
modify_style(func m(current_style: Dictionary):
- current_style.hairstyle = G.rem_euclid(current_style.hairstyle + 1, character.NUM_HAIRS))
+ current_style.hairstyle = G.rem_euclid(current_style.hairstyle + 1, character.hairstyles.size()))
func modify_style(modifier: Callable):
var current_style: Dictionary = Global.get_profile("character_style")
diff --git a/client/player/character/character.gd b/client/player/character/character.gd
index ca8954c1..9cf63d33 100644
--- a/client/player/character/character.gd
+++ b/client/player/character/character.gd
@@ -23,6 +23,15 @@ const CUSTOMER_MAIN_MESH = preload("res://player/character/customer_body.res")
const WALK_ANIM_STRENGTH := 0.05
const WALK_ANIM_SPEED:= 15.0
+const BOT_COLOR := Color(0.349, 0.349, 0.349)
+const COLORS: Array[Color] = [
+ Color(0.204, 0.361, 0.624),
+ Color(0.568, 0.256, 0.602),
+ Color(0.575, 0.341, 0.117),
+ Color(0.3, 0.455, 0.221),
+ Color(0.101, 0.452, 0.521)
+]
+
var walking := false
var holding := false
var boosting := false
@@ -31,6 +40,22 @@ var was_boosting := boosting
var current_animation := "idle"
+var hairstyles: Array[Mesh]= [
+ preload("res://player/character/hairstyles/hair_1.res"),
+ preload("res://player/character/hairstyles/hair_2.res"),
+ preload("res://player/character/hairstyles/hair_3.res"),
+ ]
+
+var headwears: Array[PackedScene]= [
+ null,
+ preload("res://player/character/headwear/cat_ears.tscn"),
+ preload("res://player/character/headwear/propeller_hat.tscn"),
+ preload("res://player/character/headwear/devil_horns.tscn"),
+ ]
+
+@onready var headwear_parent: Node3D = $Main/HeadDefault/Headwear
+@onready var hair_mesh: MeshInstance3D = $Main/HeadDefault/HairMesh
+
@onready var hand_animations = $HandAnimations
@onready var main = $Main
@onready var tram = $Tram
@@ -41,21 +66,6 @@ var current_animation := "idle"
@onready var username_tag = $Username
@onready var tie = $Main/Tie
@onready var knife = $Main/HandRight/Knife
-@onready var cat_ears: CatEars = $Main/HeadDefault/CatEars
-@onready var propeller_hat = $Main/HeadDefault/PropellerHat
-@onready var devil_horns = $Main/HeadDefault/DevilHorns
-
-const NUM_COLORS = 5
-const NUM_HAIRS = 3
-const NUM_HEADWEARS = 4
-@onready var hairstyles := [$Main/HeadDefault/Hair, $Main/HeadDefault/Hair2, $Main/HeadDefault/Hair3]
-const COLORS: Array[Color] = [
- Color(0.204, 0.361, 0.624),
- Color(0.568, 0.256, 0.602),
- Color(0.575, 0.341, 0.117),
- Color(0.3, 0.455, 0.221),
- Color(0.101, 0.452, 0.521)
-]
@onready var head_default: MeshInstance3D = $Main/HeadDefault
@onready var head_robot: MeshInstance3D = $Main/HeadRobot
@@ -66,15 +76,7 @@ const COLORS: Array[Color] = [
func _ready():
play_animation("idle")
-var t := 0.0
func _process(delta):
- t += delta
- if walking:
- main_height_target = default_height + sin(t * WALK_ANIM_SPEED) * WALK_ANIM_STRENGTH
- cat_ears.ear_target = sin(t * WALK_ANIM_SPEED) * 0.075
- else:
- t = 0
- cat_ears.ear_target = 0.
main.position.y = G.interpolate(main.position.y, main_height_target, delta * 10.)
# Update animation:
@@ -96,6 +98,9 @@ func _process(delta):
was_boosting = boosting and walking
func set_style(style: Dictionary, character_class: String):
+ var hairstyle_idx := G.rem_euclid(style.hairstyle, hairstyles.size())
+ var headwear_idx := G.rem_euclid(style.headwear, headwears.size())
+
var is_human := character_class == "customer" || character_class == "chef"
main.mesh = CUSTOMER_MAIN_MESH if character_class == "customer" else DEFAULT_MAIN_MESH
@@ -104,17 +109,20 @@ func set_style(style: Dictionary, character_class: String):
head_default.visible = is_human
main.visible = character_class != "tram"
tram.visible = character_class == "tram"
- propeller_hat.visible = style.headwear == 1
- cat_ears.visible = style.headwear == 2
- devil_horns.visible = style.headwear == 3
- for h in hairstyles: h.hide()
- var my_hairstyle = hairstyles[G.rem_euclid(style.hairstyle, NUM_HAIRS)]
- if style.headwear != 1: # Propeller hat has no hair
- my_hairstyle.show()
- main.get_active_material(0).albedo_color = Color(0.349, 0.349, 0.349) if character_class == "bot" else COLORS[G.rem_euclid(style.color, NUM_COLORS)]
- if cat_ears.visible:
- cat_ears.set_inner_mat(main.get_active_material(0))
- cat_ears.set_outer_mat(my_hairstyle.get_active_material(0))
+
+ # Hairstyle
+ hair_mesh.mesh = hairstyles[hairstyle_idx]
+ hair_mesh.visible = headwear_idx != 2
+
+ # Headwear
+ for n in headwear_parent.get_children():
+ n.queue_free() # Remove previous headwear
+ var headwear := headwears[headwear_idx]
+ if headwear != null:
+ headwear_parent.add_child(headwear.instantiate())
+
+ # Torso color
+ main.get_active_material(0).albedo_color = BOT_COLOR if character_class == "bot" else COLORS[G.rem_euclid(style.color, COLORS.size())]
func play_animation(name_: String):
current_animation = name_
diff --git a/client/player/character/character.tscn b/client/player/character/character.tscn
index e14db09c..ccf987b9 100644
--- a/client/player/character/character.tscn
+++ b/client/player/character/character.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=32 format=3 uid="uid://b3hhir2fvnunu"]
+[gd_scene load_steps=26 format=3 uid="uid://b3hhir2fvnunu"]
[ext_resource type="Script" uid="uid://dwk3vd4nv2k65" path="res://player/character/character.gd" id="1_12lbh"]
[ext_resource type="ArrayMesh" uid="uid://bnmm01yjwultj" path="res://player/character/default/main.res" id="2_uovyg"]
@@ -6,17 +6,11 @@
[ext_resource type="ArrayMesh" uid="uid://r52cylox4imf" path="res://player/character/default/hand_left.res" id="4_tcrm3"]
[ext_resource type="PackedScene" uid="uid://cufype1bex3r3" path="res://map/tiles/knife.tscn" id="4_tjq3a"]
[ext_resource type="ArrayMesh" uid="uid://csryncouqhwp1" path="res://player/character/default/head.res" id="5_n1vl0"]
-[ext_resource type="ArrayMesh" uid="uid://bsxmxq4dfv2vy" path="res://player/character/hairstyles/hair.res" id="6_3uydp"]
-[ext_resource type="ArrayMesh" uid="uid://dx7jswwaesok4" path="res://player/character/hairstyles/hair_2.res" id="7_1403k"]
-[ext_resource type="ArrayMesh" uid="uid://c5qsthvtf3cta" path="res://player/character/hairstyles/hair_3.res" id="8_x5g32"]
[ext_resource type="ArrayMesh" uid="uid://c2qnwt44x8ujl" path="res://player/character/default/tie.res" id="9_kgric"]
-[ext_resource type="PackedScene" uid="uid://dspkdcg1ui6dl" path="res://player/character/headwear/cat_ears.tscn" id="10_8pcb3"]
[ext_resource type="AudioStream" uid="uid://bxiorkb4xb8t1" path="res://player/sounds/step1.ogg" id="10_qpd6x"]
[ext_resource type="PackedScene" uid="uid://c6sqsj7r03qp1" path="res://player/character/robot/head.tscn" id="10_w8s0d"]
[ext_resource type="AudioStream" uid="uid://l2fd8u7rq3cq" path="res://player/sounds/step2.ogg" id="11_2dmo8"]
-[ext_resource type="ArrayMesh" uid="uid://cxftkcxlde6m2" path="res://player/character/headwear/propeller.res" id="11_dmio0"]
[ext_resource type="AudioStream" uid="uid://d353uwy83crca" path="res://player/sounds/step3.ogg" id="12_bj5ue"]
-[ext_resource type="PackedScene" uid="uid://ciw1ngkslskaw" path="res://player/character/headwear/devil_horns.tscn" id="12_d80qf"]
[ext_resource type="Script" uid="uid://n4jwod1jfuiv" path="res://audio/play_random.gd" id="14_3rb6x"]
[ext_resource type="AudioStream" uid="uid://1jsqpnk3igj3" path="res://player/sounds/woosh1.ogg" id="14_ikcec"]
[ext_resource type="AudioStream" uid="uid://cwme7eatip0jc" path="res://player/sounds/woosh2.ogg" id="15_iv4wu"]
@@ -758,34 +752,12 @@ transform = Transform3D(0.75, 0, 0, 0, 0.75, 0, 0, 0, 0.75, 0, 1.25, 0)
mesh = ExtResource("5_n1vl0")
skeleton = NodePath("")
-[node name="Hair" type="MeshInstance3D" parent="Main/HeadDefault"]
+[node name="HairMesh" type="MeshInstance3D" parent="Main/HeadDefault"]
transform = Transform3D(1.06667, 0, 0, 0, 1.06667, 0, 0, 0, 1.06667, 0, 0.4, 0)
visible = false
-mesh = ExtResource("6_3uydp")
skeleton = NodePath("")
-[node name="Hair2" type="MeshInstance3D" parent="Main/HeadDefault"]
-transform = Transform3D(1.06667, 0, 0, 0, 1.06667, 0, 0, 0, 1.06667, 0, 0.4, 0)
-visible = false
-mesh = ExtResource("7_1403k")
-skeleton = NodePath("")
-
-[node name="Hair3" type="MeshInstance3D" parent="Main/HeadDefault"]
-transform = Transform3D(1.06667, 0, 0, 0, 1.06667, 0, 0, 0, 1.06667, 0, 0.4, 0)
-visible = false
-mesh = ExtResource("8_x5g32")
-skeleton = NodePath("")
-
-[node name="CatEars" parent="Main/HeadDefault" instance=ExtResource("10_8pcb3")]
-visible = false
-
-[node name="PropellerHat" type="MeshInstance3D" parent="Main/HeadDefault"]
-transform = Transform3D(0.3, 0, 0, 0, -0.00173314, -0.299995, 0, 0.299995, -0.00173314, 0, 0.165437, 0.442771)
-visible = false
-mesh = ExtResource("11_dmio0")
-
-[node name="DevilHorns" parent="Main/HeadDefault" instance=ExtResource("12_d80qf")]
-visible = false
+[node name="Headwear" type="Node3D" parent="Main/HeadDefault"]
[node name="Tie" type="MeshInstance3D" parent="Main"]
transform = Transform3D(0.125, 0, 0, 0, 0.125, 0, 0, 0, 0.125, 0, 0.47772, 0.445265)
diff --git a/client/player/character/hairstyles/hair.res b/client/player/character/hairstyles/hair_1.res
index bea01119..bea01119 100644
--- a/client/player/character/hairstyles/hair.res
+++ b/client/player/character/hairstyles/hair_1.res
Binary files differ
diff --git a/client/player/character/headwear/cat_ears.gd b/client/player/character/headwear/cat_ears.gd
index fbf2c8e2..19273243 100644
--- a/client/player/character/headwear/cat_ears.gd
+++ b/client/player/character/headwear/cat_ears.gd
@@ -1,5 +1,6 @@
# Hurry Curry! - a game about cooking
# Copyright 2025 nokoe
+# Copyright 2025 tpart
#
# 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
@@ -19,6 +20,8 @@ extends Node3D
const EAR_ROTATION := deg_to_rad(20.)
var ear_target := 0.
+@onready var character: Character = get_parent().get_parent().get_parent().get_parent()
+
func set_inner_mat(mat: BaseMaterial3D):
$Left.set_surface_override_material(1, mat)
$Right.set_surface_override_material(1, mat)
@@ -28,7 +31,18 @@ func set_outer_mat(mat: BaseMaterial3D):
$Left.set_surface_override_material(0, mat)
$Right.set_surface_override_material(0, mat)
+func _ready() -> void:
+ set_inner_mat(character.main.get_active_material(0))
+ set_outer_mat(character.hair_mesh.get_active_material(0))
+
+var t := 0.
func _process(delta: float) -> void:
if visible:
$Right.rotation.z = G.interpolate_angle($Right.rotation.z, ear_target + EAR_ROTATION, delta * 10.)
$Left.rotation.z = G.interpolate_angle($Left.rotation.z, PI + ear_target + EAR_ROTATION, delta * 10.)
+ if character.walking:
+ t += delta
+ ear_target = sin(t * character.WALK_ANIM_SPEED) * 0.075 if character.walking else 0.
+ else:
+ t = 0
+ ear_target = 0.
diff --git a/client/player/character/headwear/horn.res b/client/player/character/headwear/devil_horn.res
index aab67051..aab67051 100644
--- a/client/player/character/headwear/horn.res
+++ b/client/player/character/headwear/devil_horn.res
Binary files differ
diff --git a/client/player/character/headwear/devil_horns.tscn b/client/player/character/headwear/devil_horns.tscn
index 52dcdd77..d952b480 100644
--- a/client/player/character/headwear/devil_horns.tscn
+++ b/client/player/character/headwear/devil_horns.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://ciw1ngkslskaw"]
-[ext_resource type="ArrayMesh" uid="uid://mwaobrw3mab4" path="res://player/character/headwear/horn.res" id="1_kadxh"]
+[ext_resource type="ArrayMesh" uid="uid://mwaobrw3mab4" path="res://player/character/headwear/devil_horn.res" id="1_kadxh"]
[node name="DevilHorns" type="Node3D"]
diff --git a/client/player/character/headwear/propeller_hat.tscn b/client/player/character/headwear/propeller_hat.tscn
new file mode 100644
index 00000000..e913da9e
--- /dev/null
+++ b/client/player/character/headwear/propeller_hat.tscn
@@ -0,0 +1,7 @@
+[gd_scene load_steps=2 format=3 uid="uid://dd60wq65on6cf"]
+
+[ext_resource type="ArrayMesh" uid="uid://cxftkcxlde6m2" path="res://player/character/headwear/propeller.res" id="1_24m5a"]
+
+[node name="PropellerHat" type="MeshInstance3D"]
+transform = Transform3D(0.3, 0, 0, 0, -1.31134e-08, -0.3, 0, 0.3, -1.31134e-08, 0, 0.165, 0.45)
+mesh = ExtResource("1_24m5a")