Wild flax: fibre plants in meadows and by the lake (2 fibre each)

This commit is contained in:
Paul Bailey
2026-11-04 18:12:56 +00:00
parent 0c18b6d49e
commit 80786ab796
3 changed files with 32 additions and 3 deletions

View File

@@ -25,6 +25,8 @@ func setup(id: String, mesh: Mesh, material: Material, radius: float) -> void:
add_child(cs)
func interact_prompt(_player: Node) -> String:
if item_id == "fiber" and not dropped:
return "Wild flax [E] Pick %d %s" % [amount, ItemDB.item_name(item_id).to_lower()]
return "[E] Pick up %s%s" % [ItemDB.item_name(item_id), " x%d" % amount if amount > 1 else ""]
func interact(player: Node) -> void:

View File

@@ -14,6 +14,7 @@ const ProcMesh = preload("res://scripts/world/proc_mesh.gd")
const ResourceNodeScript = preload("res://scripts/world/resource_node.gd")
const PickupScript = preload("res://scripts/world/pickup.gd")
const ForageScript = preload("res://scripts/world/forage.gd")
const ItemMeshes = preload("res://scripts/items/item_meshes.gd")
const CELL := 48.0
const GRASS_TILE := 12.0
@@ -590,10 +591,11 @@ func _scatter_pickups() -> void:
var rng := RandomNumberGenerator.new()
rng.seed = world_seed + 6
# Order matters: new kinds go at the END so existing saves keep their ids.
var want := {"stick": 260, "stone": 170, "flint": 80, "mushroom": 110, "feather": 70}
var radius: Dictionary = {"stick": 0.35, "stone": 0.25, "flint": 0.25, "mushroom": 0.25, "feather": 0.25}
var want := {"stick": 260, "stone": 170, "flint": 80, "mushroom": 110, "feather": 70, "fiber": 150}
var radius: Dictionary = {"stick": 0.35, "stone": 0.25, "flint": 0.25, "mushroom": 0.25, "feather": 0.25, "fiber": 0.45}
for id: String in want:
var mesh := ItemDB.mesh_for(id)
# Fibre grows as a plant (wild flax) you pick, 2 fibre a clump.
var mesh: Mesh = ItemMeshes.build("fiber_plant") if id == "fiber" else ItemDB.mesh_for(id)
var placed := 0
var tries := 0
while placed < want[id] and tries < 20000:
@@ -619,6 +621,10 @@ func _scatter_pickups() -> void:
chance = _forest(x, z) * 0.7 # deep forest only
"feather":
chance = 0.1 + (1.0 - _forest(x, z)) * 0.5 # open meadows
"fiber":
# Meadows, and thickest along the lake shore.
var wet := 1.0 - smoothstep(terrain.water_level + 0.5, terrain.water_level + 3.0, h)
chance = 0.05 + (1.0 - _forest(x, z)) * 0.45 + wet * 0.6
# A few right by the spawn so the first craft is quick.
if Vector2(x - _spawn.x, z - _spawn.z).length() < 18.0:
chance += 0.5
@@ -626,6 +632,8 @@ func _scatter_pickups() -> void:
continue
var pk: Area3D = PickupScript.new()
pk.setup(id, mesh, ItemDB.item_material(), radius[id])
if id == "fiber":
pk.amount = 2
pk.uid = "p%d" % pickups.size()
pickups[pk.uid] = pk
pk.taken_now.connect(_on_taken)