P1 iron: nuggets, ore, clay, kiln, smelter, forge, iron tools and arrows, lantern, tool wear and repair

This commit is contained in:
Paul Bailey
2026-11-05 00:31:07 +00:00
parent ab1f417c32
commit 24c280d885
24 changed files with 1334 additions and 43 deletions

View File

@@ -205,7 +205,7 @@ func _on_died(peer: int) -> void:
if not p.worn.is_empty() and p.inventory.add(p.worn, 1) == 0:
p.worn = ""
if p.cursor != null:
p.inventory.add(p.cursor.id, p.cursor.count)
p.inventory.add_stack(p.cursor)
p.cursor = null
var has_items := false
for st in p.inventory.slots:
@@ -225,7 +225,8 @@ func _on_died(peer: int) -> void:
var off := Vector3(rng.randf_range(-1.2, 1.2), 0.0, rng.randf_range(-1.2, 1.2))
var at: Vector3 = pos + off
at.y = w.terrain.sample_height(at.x, at.z) + 0.05
w.drop_item(st.id, int(st.count), Transform3D(Basis(Vector3.UP, rng.randf() * TAU), at))
w.drop_item(st.id, int(st.count), Transform3D(Basis(Vector3.UP, rng.randf() * TAU), at),
{"dur": int(st.dur)} if st.has("dur") else {})
p.inventory.load_data(Inventory.new(p.inventory.size()).to_data())
# ("keep": you keep everything.)
# They stay down on the death screen for a few seconds, then ask to respawn.
@@ -357,9 +358,10 @@ func _run(p: Node3D, what: String, a: Array) -> void:
# The inventory screen closed: what's on the cursor goes back in
# your bag, or at your feet if it's full.
if p.cursor != null:
var left: int = p.inventory.add(p.cursor.id, p.cursor.count)
var left: int = p.inventory.add_stack(p.cursor)
if left > 0:
w.drop_item(p.cursor.id, left, Transform3D(Basis(), p.global_position + Vector3(0, 0.1, 0)))
w.drop_item(p.cursor.id, left, Transform3D(Basis(), p.global_position + Vector3(0, 0.1, 0)),
{"dur": int(p.cursor.dur)} if p.cursor.has("dur") else {})
p.cursor = null
"debug_give":
if cheats and not ItemDB.get_item(_s(a, 0)).is_empty():
@@ -410,6 +412,14 @@ func _run(p: Node3D, what: String, a: Array) -> void:
Actions.cast_line(p, _eye(p) + dir * 0.6, dir, w)
"reel":
Actions.reel(p, w)
"repair":
var slot := _i(a, 0)
if slot >= 0 and slot < p.inventory.size():
Actions.repair(p, slot)
"debug_process":
if cheats:
for m in w.get_tree().get_nodes_in_group("processor"):
m.step(float(a[0]) if a.size() > 0 and (a[0] is float or a[0] is int) else 60.0)
"debug_spawn":
if cheats and Creature.KINDS.has(_s(a, 0)) and _s(a, 0) != "wolf" and _v(a, 1).is_finite():
w.creatures.spawn(_s(a, 0), _v(a, 1))