add spawn menu for props
This commit is contained in:
parent
6e783e0e57
commit
b9d16360b9
9 changed files with 231 additions and 62 deletions
9
Scripts/Configs/Props.gd
Normal file
9
Scripts/Configs/Props.gd
Normal 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"
|
||||
},
|
||||
]
|
||||
1
Scripts/Configs/Props.gd.uid
Normal file
1
Scripts/Configs/Props.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bdc1kjji1r31a
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue