Skip to content

Commit 871d68d

Browse files
committed
Use key map data from game in prompts instead of hardcoding it.
1 parent 503087b commit 871d68d

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

player/prompts.gd

+7-22
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,18 @@ func _process(delta: float) -> void:
1212
if text == "Welcome!":
1313
text = ""
1414
delay_time = 1
15-
elif (
16-
not Globals.player_has_done.has("mine_a_block")
17-
and (owner.get_node("Interaction Controller").left_hand_tool == Globals.Tools.MINE)
18-
):
15+
elif not Globals.player_has_done.has("mine_a_block") and (owner.get_node("Interaction Controller").left_hand_tool == Globals.Tools.MINE):
1916
text = "Left click to mine a block."
20-
elif (
21-
not Globals.player_has_done.has("place_a_block")
22-
and (owner.get_node("Interaction Controller").right_hand_tool == Globals.Tools.BUILD)
23-
):
17+
elif not Globals.player_has_done.has("place_a_block") and (owner.get_node("Interaction Controller").right_hand_tool == Globals.Tools.BUILD):
2418
text = "Right click to place a block."
2519
elif not Globals.player_has_done.has("press_build_button"):
26-
text = "Press 'b' to enter Build mode."
27-
elif (
28-
not Globals.player_has_done.has("scroll_crafting_items")
29-
and (owner.get_node("Interaction Controller").left_hand_tool == Globals.Tools.BUILD)
30-
):
20+
text = "Press '%s' to enter Build mode." % OS.get_keycode_string(InputMap.action_get_events("build")[0].physical_keycode)
21+
elif not Globals.player_has_done.has("scroll_crafting_items") and (owner.get_node("Interaction Controller").left_hand_tool == Globals.Tools.BUILD):
3122
text = "Use mouse wheel to select item to build."
32-
elif (
33-
not Globals.player_has_done.has("built_an_item")
34-
and (owner.get_node("Interaction Controller").left_hand_tool == Globals.Tools.BUILD)
35-
): # and in build mode
23+
elif not Globals.player_has_done.has("built_an_item") and (owner.get_node("Interaction Controller").left_hand_tool == Globals.Tools.BUILD): # and in build mode
3624
text = "Left click to place an item."
37-
elif (
38-
not Globals.player_has_done.has("returned_to_mining_mode")
39-
and (owner.get_node("Interaction Controller").left_hand_tool != Globals.Tools.MINE)
40-
):
41-
text = "Press 'v' to return to mining mode."
25+
elif not Globals.player_has_done.has("returned_to_mining_mode") and (owner.get_node("Interaction Controller").left_hand_tool != Globals.Tools.MINE):
26+
text = "Press '%s' to return to mining mode." % OS.get_keycode_string(InputMap.action_get_events("mine")[0].physical_keycode)
4227
else:
4328
text = ""
4429

0 commit comments

Comments
 (0)