add spawn menu for props

This commit is contained in:
KawaiiZenbo 2025-10-25 16:07:28 -07:00
parent 6e783e0e57
commit b9d16360b9
9 changed files with 231 additions and 62 deletions

View file

@ -5,27 +5,27 @@
[ext_resource type="Texture2D" uid="uid://bwhgy4u37jmo1" path="res://UI/TransportControls/Pause.png" id="4_j5gkc"]
[ext_resource type="Texture2D" uid="uid://xllpr3qc064c" path="res://UI/TransportControls/Play.png" id="5_4hvdi"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cp535"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fxnf3"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_esrnp"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_okjcw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5t5ap"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_j5gkc"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4hvdi"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_76ga2"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ausu3"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_x8byx"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_b5eqy"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_x8byx"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ausu3"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_76ga2"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4hvdi"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_j5gkc"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5t5ap"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_okjcw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_esrnp"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fxnf3"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cp535"]
[node name="InGameMenu" type="Control"]
layout_mode = 3
@ -51,7 +51,7 @@ anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 60.0
offset_top = -380.0
offset_top = -432.0
offset_right = 324.0
offset_bottom = -64.0
grow_vertical = 0
@ -88,20 +88,29 @@ offset_right = 260.0
offset_bottom = 208.0
text = "Flow Controls"
[node name="ExitMenuButton" type="Button" parent="Buttons"]
[node name="SpawnMenuButton" type="Button" parent="Buttons"]
layout_mode = 0
offset_left = 4.0
offset_top = 212.0
offset_right = 260.0
offset_bottom = 260.0
text = "Exit to Menu"
text = "Spawn Menu
"
[node name="ExitButton" type="Button" parent="Buttons"]
[node name="ExitMenuButton" type="Button" parent="Buttons"]
layout_mode = 0
offset_left = 4.0
offset_top = 264.0
offset_right = 260.0
offset_bottom = 312.0
text = "Exit to Menu"
[node name="ExitButton" type="Button" parent="Buttons"]
layout_mode = 0
offset_left = 4.0
offset_top = 316.0
offset_right = 260.0
offset_bottom = 364.0
text = "Exit to Desktop"
[node name="TransportControls" type="Panel" parent="."]
@ -110,9 +119,9 @@ anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 60.0
offset_top = -476.0
offset_top = -524.0
offset_right = 324.0
offset_bottom = -388.0
offset_bottom = -436.0
grow_vertical = 0
[node name="ShowLabel" type="Label" parent="TransportControls"]
@ -189,17 +198,17 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/focus = SubResource("StyleBoxEmpty_cp535")
theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_fxnf3")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_esrnp")
theme_override_styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_okjcw")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_5t5ap")
theme_override_styles/hover_mirrored = SubResource("StyleBoxEmpty_j5gkc")
theme_override_styles/hover = SubResource("StyleBoxEmpty_4hvdi")
theme_override_styles/pressed_mirrored = SubResource("StyleBoxEmpty_76ga2")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ausu3")
theme_override_styles/normal_mirrored = SubResource("StyleBoxEmpty_b5eqy")
theme_override_styles/normal = SubResource("StyleBoxEmpty_x8byx")
theme_override_styles/normal_mirrored = SubResource("StyleBoxEmpty_b5eqy")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ausu3")
theme_override_styles/pressed_mirrored = SubResource("StyleBoxEmpty_76ga2")
theme_override_styles/hover = SubResource("StyleBoxEmpty_4hvdi")
theme_override_styles/hover_mirrored = SubResource("StyleBoxEmpty_j5gkc")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_5t5ap")
theme_override_styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_okjcw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_esrnp")
theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_fxnf3")
theme_override_styles/focus = SubResource("StyleBoxEmpty_cp535")
[node name="DialogPanel" type="Panel" parent="FlowControlsScreen"]
layout_mode = 1
@ -270,17 +279,17 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/focus = SubResource("StyleBoxEmpty_cp535")
theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_fxnf3")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_esrnp")
theme_override_styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_okjcw")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_5t5ap")
theme_override_styles/hover_mirrored = SubResource("StyleBoxEmpty_j5gkc")
theme_override_styles/hover = SubResource("StyleBoxEmpty_4hvdi")
theme_override_styles/pressed_mirrored = SubResource("StyleBoxEmpty_76ga2")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ausu3")
theme_override_styles/normal_mirrored = SubResource("StyleBoxEmpty_b5eqy")
theme_override_styles/normal = SubResource("StyleBoxEmpty_x8byx")
theme_override_styles/normal_mirrored = SubResource("StyleBoxEmpty_b5eqy")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ausu3")
theme_override_styles/pressed_mirrored = SubResource("StyleBoxEmpty_76ga2")
theme_override_styles/hover = SubResource("StyleBoxEmpty_4hvdi")
theme_override_styles/hover_mirrored = SubResource("StyleBoxEmpty_j5gkc")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_5t5ap")
theme_override_styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_okjcw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_esrnp")
theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_fxnf3")
theme_override_styles/focus = SubResource("StyleBoxEmpty_cp535")
[node name="DialogPanel" type="Panel" parent="CosmeticsScreen"]
layout_mode = 1
@ -326,6 +335,81 @@ offset_bottom = -4.0
max_value = 0.0
step = 1.0
[node name="SpawnMenu" type="Control" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ColorRect" type="ColorRect" parent="SpawnMenu"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.121569, 0.121569, 0.121569, 0.501961)
[node name="InputEater" type="Button" parent="SpawnMenu"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/normal = SubResource("StyleBoxEmpty_x8byx")
theme_override_styles/normal_mirrored = SubResource("StyleBoxEmpty_b5eqy")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ausu3")
theme_override_styles/pressed_mirrored = SubResource("StyleBoxEmpty_76ga2")
theme_override_styles/hover = SubResource("StyleBoxEmpty_4hvdi")
theme_override_styles/hover_mirrored = SubResource("StyleBoxEmpty_j5gkc")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_5t5ap")
theme_override_styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_okjcw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_esrnp")
theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_fxnf3")
theme_override_styles/focus = SubResource("StyleBoxEmpty_cp535")
[node name="DialogPanel" type="Panel" parent="SpawnMenu"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 64.0
offset_right = -64.0
offset_bottom = -64.0
grow_horizontal = 2
grow_vertical = 2
[node name="SpawnButton" type="Button" parent="SpawnMenu/DialogPanel"]
layout_mode = 1
anchors_preset = -1
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -154.0
offset_top = -52.0
offset_right = -4.0
offset_bottom = -4.0
grow_horizontal = 2
grow_vertical = 2
text = "Spawn"
[node name="ItemList" type="ItemList" parent="SpawnMenu/DialogPanel"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 4.0
offset_top = 4.0
offset_right = -4.0
offset_bottom = -56.0
same_column_width = true
fixed_icon_size = Vector2i(64, 64)
[node name="LoadShowScreen" type="Control" parent="."]
visible = false
layout_mode = 1
@ -351,17 +435,17 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/focus = SubResource("StyleBoxEmpty_cp535")
theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_fxnf3")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_esrnp")
theme_override_styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_okjcw")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_5t5ap")
theme_override_styles/hover_mirrored = SubResource("StyleBoxEmpty_j5gkc")
theme_override_styles/hover = SubResource("StyleBoxEmpty_4hvdi")
theme_override_styles/pressed_mirrored = SubResource("StyleBoxEmpty_76ga2")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ausu3")
theme_override_styles/normal_mirrored = SubResource("StyleBoxEmpty_b5eqy")
theme_override_styles/normal = SubResource("StyleBoxEmpty_x8byx")
theme_override_styles/normal_mirrored = SubResource("StyleBoxEmpty_b5eqy")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_ausu3")
theme_override_styles/pressed_mirrored = SubResource("StyleBoxEmpty_76ga2")
theme_override_styles/hover = SubResource("StyleBoxEmpty_4hvdi")
theme_override_styles/hover_mirrored = SubResource("StyleBoxEmpty_j5gkc")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_5t5ap")
theme_override_styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_okjcw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_esrnp")
theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_fxnf3")
theme_override_styles/focus = SubResource("StyleBoxEmpty_cp535")
[node name="DialogPanel" type="Panel" parent="LoadShowScreen"]
layout_mode = 1
@ -498,6 +582,7 @@ filters = PackedStringArray("*.ust")
[connection signal="pressed" from="Buttons/LoadShowButton" to="." method="_on_load_show_button_pressed"]
[connection signal="pressed" from="Buttons/CosmeticsButton" to="." method="_on_cosmetics_button_pressed"]
[connection signal="pressed" from="Buttons/FlowControlsButton" to="." method="_on_flow_controls_button_pressed"]
[connection signal="pressed" from="Buttons/SpawnMenuButton" to="." method="_on_spawn_menu_button_pressed"]
[connection signal="pressed" from="Buttons/ExitMenuButton" to="." method="_on_exit_menu_button_pressed"]
[connection signal="pressed" from="Buttons/ExitButton" to="." method="_on_exit_button_pressed"]
[connection signal="pressed" from="TransportControls/StopButton" to="." method="_on_stop_button_pressed"]
@ -507,6 +592,8 @@ filters = PackedStringArray("*.ust")
[connection signal="value_changed" from="FlowControlsScreen/DialogPanel/VScrollBar" to="." method="_on_flow_v_scroll_bar_value_changed"]
[connection signal="pressed" from="CosmeticsScreen/InputEater" to="." method="_on_input_eater_pressed"]
[connection signal="value_changed" from="CosmeticsScreen/DialogPanel/VScrollBar" to="." method="_on_cosmetics_v_scroll_bar_value_changed"]
[connection signal="pressed" from="SpawnMenu/InputEater" to="." method="_on_input_eater_pressed"]
[connection signal="pressed" from="SpawnMenu/DialogPanel/SpawnButton" to="." method="_on_spawn_button_pressed"]
[connection signal="pressed" from="LoadShowScreen/InputEater" to="." method="_on_input_eater_pressed"]
[connection signal="pressed" from="LoadShowScreen/DialogPanel/InBrowseButton" to="." method="_on_in_browse_button_pressed"]
[connection signal="pressed" from="LoadShowScreen/DialogPanel/CancelButton" to="." method="_on_cancel_button_pressed"]

9
Scripts/Configs/Props.gd Normal file
View file

@ -0,0 +1,9 @@
extends Node
var SpawnableProps = [
{
"name": "90s Showroom Chair",
"path": "res://Scenes/Props/Physics/ShowroomChair.tscn",
"icon": "res://UI/PropIcons/ShowroomChair.png"
},
]

View file

@ -0,0 +1 @@
uid://bdc1kjji1r31a

View file

@ -18,6 +18,9 @@ var stage
func _ready() -> void:
stage = FreeRoamMaps.MapIndex[get_node("../").current_map]["stage"]
for prop in Props.SpawnableProps:
$SpawnMenu/DialogPanel/ItemList.add_item(prop["name"], load(prop["icon"]))
if (GlobalVariables.shadows == 0):
get_tree().set_group("lights", "shadow_enabled", false)
@ -106,6 +109,7 @@ func _on_input_eater_pressed() -> void:
$CosmeticsScreen.visible = false
$FlowControlsScreen.visible = false
$LoadShowScreen.visible = false
$SpawnMenu.visible = false
func _on_cosmetics_v_scroll_bar_value_changed(value: float) -> void:
$CosmeticsScreen/DialogPanel/InvisibleMask/CosmeticsHandle.position.y = value * -44
@ -244,3 +248,16 @@ func _input(event: InputEvent) -> void:
elif event.is_action_pressed("freeroam_transport_stop"):
_on_stop_button_pressed()
func _on_spawn_button_pressed() -> void:
if (!$SpawnMenu/DialogPanel/ItemList.is_anything_selected()): return
var selectedIndex = $SpawnMenu/DialogPanel/ItemList.get_selected_items()[0]
var spawningProp = load(Props.SpawnableProps[selectedIndex]["path"]).instantiate()
var vector = get_node("../Camera/SpawnPosition").global_position
spawningProp.position = vector
get_tree().root.add_child(spawningProp)
func _on_spawn_menu_button_pressed() -> void:
$BG.visible = false
$SpawnMenu.visible = true

View file

@ -46,7 +46,7 @@ var hrx: float = 0
var hry: float = 0
var hrz: float = 0
@onready var interactRay = $Camera/Interact
@onready var interactRay = $Camera/InteractRay
@onready var camera: Camera3D = $Camera
func _ready() -> void:
@ -75,40 +75,46 @@ func _unhandled_input(event: InputEvent) -> void:
release_mouse()
$InGameMenu.visible = true
$InGameMenu/Buttons/ReturnButton.grab_focus()
pass
elif event.is_action_pressed(&"freeroam_debug_menu"):
$DebugMenu.visible = !$DebugMenu.visible
elif event.is_action_pressed(&"freeroam_respawn"):
if (!interact): return
self.position = startPosition
walk_vel = Vector3(0, 0, 0)
jump_vel = Vector3(0, 0, 0)
grav_vel = Vector3(0, 0, 0)
elif event.is_action_pressed(&"freeroam_flashlight_zoom_in"):
if (!interact): return
if ($Camera/Flashlight.visible):
if ($Camera/Flashlight.spot_angle > 2):
$Camera/Flashlight.spot_angle -= 2
$FlashlightSizeSFX.pitch_scale = sqrt($Camera/Flashlight.spot_angle)-0.5
$FlashlightSizeSFX.play()
elif event.is_action_pressed(&"freeroam_flashlight_zoom_out"):
if (!interact): return
if ($Camera/Flashlight.visible):
if ($Camera/Flashlight.spot_angle < 88):
$Camera/Flashlight.spot_angle += 2
$FlashlightSizeSFX.pitch_scale = sqrt($Camera/Flashlight.spot_angle)-0.5
$FlashlightSizeSFX.play()
elif event.is_action_pressed(&"freeroam_flashlight_zoom_reset"):
if (!interact): return
if ($Camera/Flashlight.visible):
$Camera/Flashlight.spot_angle = 30
$FlashlightSizeSFX.pitch_scale = sqrt($Camera/Flashlight.spot_angle)-0.5
$FlashlightSizeSFX.play()
elif event.is_action_pressed(&"freeroam_camera_zoom_in"):
if (!interact): return
if ($Camera.fov > 2):
$Camera.fov -= 2
camera_sens = maxf(camera_sens - 0.1, 0.1)
elif event.is_action_pressed(&"freeroam_camera_zoom_out"):
if (!interact): return
if ($Camera.fov < 178):
$Camera.fov += 2
camera_sens = minf(camera_sens + 0.1, 3)
elif event.is_action_pressed(&"freeroam_camera_zoom_reset"):
if (!interact): return
$Camera.fov = GlobalVariables.FOV
camera_sens = 3

View file

@ -35,10 +35,18 @@ spot_range = 1000.0
spot_angle = 30.0
spot_angle_attenuation = 0.25
[node name="Interact" type="RayCast3D" parent="Camera"]
[node name="InteractRay" type="RayCast3D" parent="Camera"]
target_position = Vector3(0, 0, -2.5)
hit_back_faces = false
[node name="SpawnPosition" type="Node3D" parent="Camera"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5)
[node name="PropPusher" type="Node" parent="." node_paths=PackedStringArray("controller")]
script = ExtResource("8_7v0xc")
controller = NodePath("..")
enabled = true
[node name="DebugMenu" parent="." instance=ExtResource("3_ejydr")]
visible = false
mouse_filter = 2
@ -60,8 +68,3 @@ volume_db = -5.0
[node name="FlashlightOffSFX" type="AudioStreamPlayer" parent="."]
stream = ExtResource("7_7v0xc")
volume_db = -5.0
[node name="PropPusher" type="Node" parent="." node_paths=PackedStringArray("controller")]
script = ExtResource("8_7v0xc")
controller = NodePath("..")
enabled = true

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bp252o6sk3x6w"
path="res://.godot/imported/ShowroomChair.png-b1ca893b2aee37a2971a0f466c407651.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UI/PropIcons/ShowroomChair.png"
dest_files=["res://.godot/imported/ShowroomChair.png-b1ca893b2aee37a2971a0f466c407651.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

View file

@ -27,6 +27,7 @@ Stages="*res://Scripts/Configs/Stages.gd"
FreeRoamMaps="*res://Scripts/Configs/FreeRoamMaps.gd"
GlobalVariables="*res://Scripts/Configs/GlobalVariables.gd"
RandomMovements="*res://Scripts/RandomMovements.gd"
Props="*res://Scripts/Configs/Props.gd"
[display]
@ -572,6 +573,11 @@ freeroam_throw_prop={
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
]
}
freeroam_prop_menu={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
]
}
[physics]