Anchor beetles to generated tree surfaces

This commit is contained in:
Alexander Sellite 2026-08-24 10:36:45 -04:00
parent f1c952f5d6
commit 5ed4cccf76
18 changed files with 446 additions and 71 deletions

View file

@ -10,6 +10,8 @@ catch_data = ExtResource("2_catch")
required_tool_id = &"crab_net"
spawn_anchor_set_id = &"starter_reachable_tree_trunks"
population = 3
spawn_anchor_occupancy_ratio = 0.35
maximum_anchor_population = 64
requires_sneaking = false
movement_speed = 0.0
roam_radius = 0.1

View file

@ -18,6 +18,11 @@ enum PresentationMode {
@export var spawn_anchor_set_id: StringName
@export_range(-100.0, 100.0, 0.01) var minimum_surface_y: float = 0.08
@export_range(0, 64, 1) var population: int = 0
## Anchored gatherables can scale with authored/generated attachment geometry.
## Zero preserves the fixed population above.
@export_range(0.0, 1.0, 0.01) var spawn_anchor_occupancy_ratio := 0.0
## Zero leaves the anchor count as the only ceiling.
@export_range(0, 256, 1) var maximum_anchor_population := 0
@export var presentation_mode: PresentationMode = PresentationMode.VISIBLE_CREATURE
@export var requires_sneaking: bool = true
@export_range(0.0, 120.0, 0.1) var active_lifetime_seconds: float = 0.0
@ -78,6 +83,10 @@ func is_valid() -> bool:
== FishDataType.CollectionMethod.DIGGING
)
and population > 0
and (
maximum_anchor_population == 0
or maximum_anchor_population >= population
)
and movement_parameters_valid
and _quality_multipliers_are_valid(
quality_movement_speed_multipliers
@ -102,6 +111,21 @@ func is_stationary_spawn() -> bool:
return is_stationary_hotspot() or not spawn_anchor_set_id.is_empty()
func target_population_for_anchor_count(anchor_count: int) -> int:
if spawn_anchor_set_id.is_empty() or spawn_anchor_occupancy_ratio <= 0.0:
return population
if anchor_count <= 0:
return 0
var target := maxi(
population,
ceili(float(anchor_count) * spawn_anchor_occupancy_ratio),
)
target = mini(target, anchor_count)
if maximum_anchor_population > 0:
target = mini(target, maximum_anchor_population)
return target
func can_be_scared() -> bool:
return not is_stationary_spawn() and scare_radius > 0.0