浏览代码

:beetle: Fix getting out shortcut permanent disappearance

DricomDragon 2 月之前
父节点
当前提交
45c803d75e
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 5 2
      godot/component/ui/input_prompts/prompt_container.gd
  2. 1 0
      godot/run/levels/infinite_level.tscn

+ 5 - 2
godot/component/ui/input_prompts/prompt_container.gd

@@ -3,6 +3,9 @@ extends Control
 ## Free itself when every prompt has been used
 
 
+## If true, automatically frees itself when there are no more input prompts among children
+@export var remove_when_prompts_depleted := true
+
 var _nb_prompts: int
 
 
@@ -35,10 +38,10 @@ func disable() -> void:
 	set_process_mode(Node.PROCESS_MODE_DISABLED)
 
 
-func remove_if_no_more_prompt():
+func remove_if_no_more_prompt() -> void:
 	_nb_prompts -= 1
 	print(_nb_prompts, " remaining prompts")
-	if _nb_prompts <= 0:
+	if _nb_prompts <= 0 and remove_when_prompts_depleted:
 		# Only label remaining
 		print("Destruction !")
 		queue_free()

+ 1 - 0
godot/run/levels/infinite_level.tscn

@@ -464,6 +464,7 @@ script = ExtResource("22_tmm3q")
 visible = false
 layout_mode = 2
 script = ExtResource("22_tmm3q")
+remove_when_prompts_depleted = false
 
 [node name="MovePrompt" parent="UI/InputPromptsCenter/InputPromptsCollection/WalkPrompts" instance=ExtResource("15_wc547")]
 layout_mode = 2