Tool prompts explain how to craft the missing tool

'Tree (needs a axe)' gave new players no way forward. The prompt now
shows the recipe (Tab to craft from 2 stick, 2 flint), or tells you to
select the tool if it's already in your bag.
This commit is contained in:
Paul Bailey
2026-11-04 00:37:04 +00:00
parent 4640f5e577
commit 2b1afc86ba
2 changed files with 10 additions and 2 deletions

View File

@@ -114,7 +114,7 @@ func harvest_hit(player: Node3D, node: Node3D, hit_point: Vector3) -> bool:
var held: Dictionary = ItemDB.get_item(player.held_item_id())
var tool: Dictionary = held.get("tool", {})
if tool.get("kind", "") != node.tool_kind or int(tool.get("tier", 0)) < node.min_tier:
notify.emit("Need a %s" % ("stone " + node.tool_kind))
notify.emit("Needs a %s (Tab to craft)" % ItemDB.item_name("stone_" + node.tool_kind))
return false
var drops: Dictionary = node.hit(float(tool.get("damage", 1.0)), hit_point, player.global_position)
for id in drops:

View File

@@ -38,7 +38,15 @@ func interact_prompt(player: Node) -> String:
var verb := "Chop" if kind == "tree" else "Mine"
if tool.get("kind", "") == tool_kind:
return "%s [LMB] %s" % [display_name(), verb]
return "%s (needs a %s)" % [display_name(), tool_kind]
# Tell new players how to get the tool, not just that they lack it.
var tool_id := "stone_" + tool_kind
var r: Dictionary = ItemDB.recipes.get(tool_id, {})
var parts: Array[String] = []
for id in r.get("inputs", {}):
parts.append("%d %s" % [int(r.inputs[id]), ItemDB.item_name(id).to_lower()])
if player.inventory.count(tool_id) > 0:
return "%s (select your %s on the hotbar)" % [display_name(), ItemDB.item_name(tool_id)]
return "%s (needs a %s: Tab to craft from %s)" % [display_name(), ItemDB.item_name(tool_id), ", ".join(parts)]
## Applies one hit. Returns the items earned by this hit.
func hit(damage: float, point: Vector3, from: Vector3) -> Dictionary: