add spawn menu for props
This commit is contained in:
parent
6e783e0e57
commit
b9d16360b9
9 changed files with 231 additions and 62 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue