P1 iron: nuggets, ore, clay, kiln, smelter, forge, iron tools and arrows, lantern, tool wear and repair
This commit is contained in:
@@ -478,6 +478,19 @@ func _scatter_rocks() -> void:
|
||||
|
||||
_bind_nodes(pending, _flush(groups, meshes, true, "Rocks"))
|
||||
|
||||
## 0..1: how close (x, z) is to the foot of the mountain rim, where scree
|
||||
## and iron collect. 1 within 6 m of the edge of the walkable area, 0 from
|
||||
## 30 m in.
|
||||
func _near_rim(x: float, z: float) -> float:
|
||||
if not terrain.inside_boundary(x, z, 6.0):
|
||||
return 1.0
|
||||
if terrain.inside_boundary(x, z, 30.0):
|
||||
return 0.0
|
||||
for m in [24.0, 18.0, 12.0]: # (inside at margin m = at least m metres from the edge)
|
||||
if terrain.inside_boundary(x, z, m):
|
||||
return 1.0 - (m - 6.0) / 24.0
|
||||
return 1.0
|
||||
|
||||
## Places one rock. Passing `pending` makes it a mineable boulder (if it's
|
||||
## inside the walkable area); otherwise it just gets plain collision.
|
||||
func _place_rock(groups: Dictionary, meshes: Array, hulls: Array, p: Vector2, h: float, n: Vector3,
|
||||
@@ -493,6 +506,12 @@ func _place_rock(groups: Dictionary, meshes: Array, hulls: Array, p: Vector2, h:
|
||||
shape.points = pts
|
||||
if pending != null and terrain.inside_boundary(p.x, p.y, 0.0):
|
||||
var node := _resource_node("rock", Transform3D(b, pos))
|
||||
# Rust-streaked boulders with iron ore in them: mostly near the
|
||||
# rim, a few anywhere. (From the position, so it's the same every
|
||||
# time, without disturbing the scatter's random numbers.)
|
||||
var roll := float(absi(hash(Vector2i(int(p.x * 10.0), int(p.y * 10.0)))) % 1000) / 1000.0
|
||||
if roll < 0.18 + _near_rim(p.x, p.y) * 0.6:
|
||||
node.make_iron(hulls[vi])
|
||||
var cs := CollisionShape3D.new()
|
||||
cs.shape = shape
|
||||
cs.basis = b.orthonormalized()
|
||||
@@ -591,8 +610,10 @@ 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, "fiber": 150}
|
||||
var radius: Dictionary = {"stick": 0.35, "stone": 0.25, "flint": 0.25, "mushroom": 0.25, "feather": 0.25, "fiber": 0.45}
|
||||
var want := {"stick": 260, "stone": 170, "flint": 80, "mushroom": 110, "feather": 70, "fiber": 150,
|
||||
"iron_nugget": 70, "clay": 60}
|
||||
var radius: Dictionary = {"stick": 0.35, "stone": 0.25, "flint": 0.25, "mushroom": 0.25, "feather": 0.25, "fiber": 0.45,
|
||||
"iron_nugget": 0.25, "clay": 0.3}
|
||||
for id: String in want:
|
||||
# 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)
|
||||
@@ -625,8 +646,17 @@ func _scatter_pickups() -> void:
|
||||
# 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
|
||||
"iron_nugget":
|
||||
# In the scree at the foot of the mountains (and on rocky slopes).
|
||||
chance = 0.02 + _near_rim(x, z) * 0.9 + (1.0 - n.y) * 1.5
|
||||
"clay":
|
||||
# The lake shore only.
|
||||
var lake: Vector2 = terrain.lake_center
|
||||
var by_lake: bool = Vector2(x - lake.x, z - lake.y).length() < terrain.lake_radius * 1.6
|
||||
var shore: float = 1.0 - smoothstep(terrain.water_level + 0.4, terrain.water_level + 1.8, h)
|
||||
chance = shore * 0.95 if by_lake else 0.0
|
||||
# A few right by the spawn so the first craft is quick.
|
||||
if Vector2(x - _spawn.x, z - _spawn.z).length() < 18.0:
|
||||
if Vector2(x - _spawn.x, z - _spawn.z).length() < 18.0 and not id in ["iron_nugget", "clay"]:
|
||||
chance += 0.5
|
||||
if keep > chance:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user