Rockyherd
Based on game build 714014 | Last updated: 2026-03-07
Overview
rockyherd is a prefab container that acts as a herd spawner for Rocky entities. It maintains an instance of the herd component to track active Rocky members (with a maximum of 6) and uses the periodicspawner component to automatically spawn new Rockies at intervals, adjusted for season. It listens for seasonal changes to dynamically update spawn timing and enforces spawning rules such as maximum density within range and offscreen-only spawning.
Usage example
-- Spawning a new Rocky herd instance (typically done internally by the world generation system)
local herd = Prefab("rockyherd", fn, nil, prefabs)()
-- The prefab is not meant for manual instantiation by modders; it's used as a world entity.
Dependencies & tags
Components used: herd, periodicspawner, scaler
Tags: Adds herd, NOBLOCK, NOCLICK
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
gatherrange | number | TUNING.ROCKYHERD_RANGE | Radius around the herd centroid where Rockies may gather/spawn. |
maxsize | number | 6 | Maximum number of Rocky members allowed in this herd. |
membertag | string | "rocky" | Tag used to identify eligible member entities for this herd. |
Main functions
CanSpawn()
- Description: Determines whether a new Rocky should be spawned based on current herd state and world constraints. Called by
periodicspawnerbefore each potential spawn. - Parameters: None (accesses
inst.components.herdand global tuning values). - Returns:
trueif spawning is allowed;falseotherwise. - Error states: Returns
falseif the herd is full or if the number of existing Rockies in range meets or exceedsTUNING.ROCKYHERD_MAX_IN_RANGE.
OnSpawned(newent)
- Description: Handler called when a new Rocky entity is spawned. Adds the entity to the herd and initializes its scale.
- Parameters:
newent(entity instance) - the newly spawned Rocky entity. - Returns: Nothing.
- Error states: No effect if
inst.components.herdisnil.
SeasonalSpawningChanges(season)
- Description: Adjusts the spawner timing based on the current season. spring increases spawn rate (via
SpringGrowthMod). - Parameters:
season(string) – one of theSEASONS.*constants (e.g.,"SPRING","SUMMER"). - Returns: Nothing.
Events & listeners
- Listens to:
season(viaWatchWorldState) – triggersSeasonalSpawningChangeswhen the world season changes. - Pushes: None.