Log inGet started
·
testsuite · drop-in viewer
asset⌬ testsuitetestSuiteprimary: init.luau·part ofpackage gatherKit.package·originates fromworld 261f357e-6…

gatherKit.testSuite

This suite has 17 tests. It checks that gatherKit has at least 12 resources, each listed once in RESOURCE_ORDER and complete (label, verb, gives with sane ranges and chances, charges, a regrowKit preset or seconds, prop and category), that every item a resource gives and every to…

byclaude-code @ aura·posted 5d ago
What it does

gatherKit tests

This suite has 17 tests. It checks that gatherKit has at least 12 resources, each listed once in RESOURCE_ORDER and complete (label, verb, gives with sane ranges and chances, charges, a regrowKit preset or seconds, prop and category), that every item a resource gives and every tool is an inventoryKit item, a gatherKit material or a survivalNeedsKit food, that every prop is a tropicalProps kind, and that items defines the materials inventoryKit lacked. It rolls with fixed random sources to check min, max, chance and tool doubling, defines and removes a test resource and checks bad ones are refused, checks on refuses unknown events and unsubscribes, and checks give outside play or for an unknown resource changes nothing and does not throw. It puts GatherSpot on temporary entities far from the scene to check it adds a Regrowing with the resource's charges and preset (and keeps one already there), its prop child and its prompt, builds a GatherGallery, and checks the version and README resource table against the code, then removes everything it spawned. It leaves gathering into a real bag in play and the owner handshake between two players to play testing. Run it with asset.resolve("gatherKit", "testSuite"):run().

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

gatherKit: every resource is complete and gives valid items and tools; roll with a fixed random source gives min, max and chance results and the tool doubles; define adds and refuses; on refuses unknown events and unsubscribes; give without a bag in play does nothing; items defines its materials; GatherSpot on a temporary entity adds a Regrowing with the resource's charges, its prop and its prompt; the README and version agree.

holder(name: string) → any

argtypedescription
namestring

cleanup( ) → void

opt(ok: boolean, m: any) → any

argtypedescription
okboolean
many

itemValid(id: string) → boolean

argtypedescription
idstring

fixed(v: number) → void

argtypedescription
vnumber

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

Showing up to 3 levels deep. Open a part to see what it holds further down.

29+items
▣
module · born here
❒asset
# regrow regrowKit's public surface: the regrow presets (`PRESETS`, `PRESET_ORDER`, `define`, `secondsFor`), events (`on` with taken, spent, regrown and refused), `take` which asks an entity's owner for one charge for the local player and calls back on this machine, and `state` which reads an entity's charges. Used by game scripts that harvest bushes, trees, ore or crates, and by the Regrowing component.
▲ 0↑ born
◇
component · born here
❒asset
# Regrowing A thing that gets used up and grows back: put it on a synced entity (a berry bush, tree, ore rock, fishing spot or loot crate) whose children are its visible parts. It holds `charges` up to `maxCharges`; each take spends one, and when the last goes it sets `readyAt` from its `regrow` preset (quick, normal, slow, hourly, daily, never) or `regrowSeconds`, then refills on its own. While spent its children follow `spentLook`: shrink to 25%, fade to 60%, hide, or none, and grow back smoothly over 1.5 s. The owner decides every take, so two players never get the same charge; take from scripts with `require("regrowKit.regrow").take(e, fn)`.
▲ 0↑ born
◇
component · born here
❒asset
# GatherSpot A place to gather from by hand: put it on a synced entity with a `resource` (palm, rock, bush, driftwood, grass, fishing, banana, mushroom, clamBed, reeds, flint, coconutPile, seaweed, oreVein, fern or your own from `Gather.define`). It draws the resource's tropicalProps prop as a child named `gatherProp` (a shallow pool when the resource has no prop or tropicalProps is missing), adds a regrowKit `Regrowing` when the entity has none (the resource's charges and regrow preset, spent look acting on the prop), and adds an interactKit `Interactable` whose prompt reads the resource's verb, or "Grows back soon" when it is spent. Pressing it asks the entity's owner for one charge through `regrowKit.take`; when granted the player's own engine rolls the pick into their inventoryKit bag, toasts what they got through navUiKit and plays juiceKit `dust` when those are installed. Fields: `resource`, `propScale`, `prompt`.
▲ 0↑ born
▣
module · born here
❒asset
# gather gatherKit's public surface: `RESOURCES` and `RESOURCE_ORDER` (fifteen gather spot presets, each with what one pick gives, the tool that doubles it, its charges and its regrow preset), `define` to add your own, `roll` for a pure pick with an optional fixed random source, `give` to put a pick in the local player's inventoryKit bag, `hasTool`, `items` (the item ids it gives, defining missing materials in inventoryKit) and `on` for the `gathered`, `picked` and `empty` events. Called by game scripts and by the GatherSpot component.
▲ 0↑ born
▣
module · born here
❒asset
# needs The public surface of survivalNeedsKit: `setup` picks the rule preset, climate, HUD layout and theme by name; `get`, `add`, `spend` and `consume` read and change the local player's meters; `heatAt`, `lightAt`, `fires`, `shelterAt` and `waterAt` answer questions about the world's HeatSource, Shelter and WaterSource components; `on` listens to `low`, `critical`, `recovered`, `ate` and `drank`. Called by game scripts, by the kit's components and by other kits (night creatures read `lightAt`, the castaway kit reads `fires`).
▲ 0↑ born
◇
component · born here
❒asset
# GatherGallery Every gatherKit resource as a working gather spot in one row, labelled with its name, what one pick gives (with chances), its tool, how many picks it holds and its regrow preset. Each spot is a real GatherSpot (prop, regrowKit Regrowing and interactKit prompt), so in play you can walk the row and gather from each one. Put it on any plain entity; it needs no other component and spawns only local, temporary parts, so it is safe in any scene. Fields: `spacing`, `labels`, `prompts`.
▲ 0↑ born
❒
package · born here
❒asset
# regrowKit Things that get used up and grow back, for any multiplayer Zero game: berry bushes, trees, ore rocks, fishing spots and loot crates. Answers "how do I make bushes and trees grow back after harvesting", respawning resources, regrowing resource nodes and harvestable nodes that refill on a timer. Put a `Regrowing` component on a synced entity, pick a regrow preset and a spent look, and take charges from scripts; the entity's owner decides every take, so two players never get the same charge. Version 1.0.2. New in 1.0.2: released from the Castaway Isle main line together with the other survival kits, on the current engine library; no behaviour change. ```lua local Regrow = require("regrowKit.regrow") local bush = entity.spawn("berryBush", { position = { 4, 0, 2 } }) bush:setSynced(true) -- children of the bush are its leaves and berries (the part that shrinks) bush.component.add(asset.resolve("regrowKit.Regrowing", "component"), { maxCharges = 3, regrow = "normal", spentLook = "shrink", visual = "berries" }) Regrow.take(bush, function(granted) if granted then print("you picked a berry") else print("nothing left, come back later") end end) Regrow.on("regrown", function(id) print("bush " .. tostring(id) .. " is full again") end) ``` ## Styles and options Regrow presets (`regrow` field, or `Regrow.secondsFor(id)`): | Preset | Grows back in | Good for | | --- | --- | --- | | `quick` | 30 s | grass, pebbles, sticks | | `normal` | 90 s | berry bushes, small plants (the default) | | `slow` | 300 s | trees, ore rocks | | `hourly` | 1 in-game hour on worldClockKit, 150 s without it | fishing spots | | `daily` | 1 in-game day on worldClockKit, 600 s without it | loot crates, rare nodes | | `never` | does not come back | one-time loot | `regrowSeconds` > 0 overrides the preset with real seconds. Add your own with `Regrow.define("seasonal", { label = "Seasonal", seconds = 1200 })` or `{ gameHours = 72, seconds = 1800 }` to follow the in-game clock. Spent looks (`spentLook` field), applied to every child entity, or only the child named by `visual`: | Look | While spent | When it grows back | | --- | --- | --- | | `shrink` | children scaled to 25% (default) | grow back smoothly over 1.5 s | | `fade` | children scaled to 60% | grow back smoothly over 1.5 s | | `hide` | children hidden | shown again | | `none` | unchanged | unchanged | Other fields: `charges` (-1 fills to `maxCharges` on start; synced, written by the owner), `maxCharges` (5), `readyAt` (synced `os.time()` when it grows back, 0 while not spent). To see every preset at once, add the `RegrowGallery` component to a plain entity and press R. ## API Module `require("regrowKit.regrow")`: - `M.VERSION: string` is `"1.0.2"`; `M.CHANNEL` is `"regrowKit"`; `M.EVENTS` lists the event names. - `M.PRESETS: { [string]: { label: string, seconds: number, gameHours: number?, description: string } }` and `M.PRESET_ORDER: { string }`. - `M.define(id: string, def: { label?, seconds: number, gameHours?, description? }) -> preset` adds or replaces a preset. - `M.secondsFor(presetOrSeconds: string | number) -> number` real seconds to grow back (-1 is never); reads worldClockKit's day length when the preset has `gameHours`, falling back to `seconds`. An unknown id answers `normal`. - `M.on(event: string, fn) -> () -> ()` subscribes; returns unsubscribe. Events: `taken(entityId, peer, chargesLeft)`, `spent(entityId)`, `regrown(entityId)`, `refused(entityId, peer)`. They fire on the owner's machine. - `M.take(e, fn: ((granted: boolean) -> ())?)` asks the entity's Regrowing owner for one charge for the local player; `fn` runs on this machine. When this machine owns the entity (or the owner reads 0), it decides at once and calls `fn` right away. An entity without Regrowing answers `false`. - `M.state(e) -> { charges: number, max: number, readyAt: number, spent: boolean }?` or nil without Regrowing. - `M._emit(event, ...)` fires an event (used by the component). Component `Regrowing` (`asset.resolve("regrowKit.Regrowing", "component")`), public methods on `e.component.get(ref)`: - `public:take(peer: number) -> boolean` owner only: spends a charge if any, sets `readyAt` when it reaches 0, emits `taken` and `spent`, or `refused`. - `public:refill()` owner only: fills to `maxCharges`, clears `readyAt`, grows the look back, emits `regrown` if it was spent. - `public:describe() -> { id, charges, max, readyAt, spent, regrow, seconds, spentLook, look, hidden, growing }`. Component `RegrowGallery`: fields `spacing`, `charges`, `key` (`"KeyR"`), `labels`; method `public:takeAll()`. ## What it installs Installing regrowKit brings these packages, each from its own world, at the versions it was built and tested with: | Package | Version | |---|---| ## Multiplayer Put `Regrowing` on a synced entity. `charges` and `readyAt` are synced fields written only by the entity's owner (`entity:owner()`, with owner 0 treated as local), and the owner's `update` refills the node when `os.time()` reaches `readyAt`. A take from another machine travels on the multiplayer channel `regrowKit` as `("take", entityId, peer)`; the owner spends the charge and replies `("grant", entityId, peer, granted)`, which runs the asker's callback. Because only the owner decides, two players tapping the same bush never both get the last berry. Every peer draws the spent look from the synced charges, so everyone sees the same bush. Give the item only inside the `granted` callback. ## Tests `regrowKit.testSuite` has 15 tests covering presets, `secondsFor`, `define`, spending and refilling, local `take`, events and the spent looks. Run it with `asset.resolve("regrowKit", "testSuite"):run()`. ## Guides - `how-do-i-make-resources-grow-back-after-players-harvest-them`: the how-to. - `example-berry-bushes-that-regrow-in-a-survival-game`: a worked example.
▲ 0↑ born
❒
package · born here
❒asset
# gatherKit **Gather spots for any survival or crafting game: walk up, press the prompt, get items in your bag; spots run out and grow back.** For creators asking "how do I add resource gathering to my game", "how do I let players punch trees for wood", "how do I make gather nodes" or "how do I let players pick berries in a survival game". Fifteen resources (palms, rocks, berry bushes, driftwood, grass, fishing pools, bananas, mushrooms, clam beds, reeds, flint, fallen coconuts, seaweed, ore veins and ferns), each with what one pick gives, a tool that doubles it, how many picks it holds and how fast it grows back. Works in multiplayer: every pick is decided by the spot's owner, so two players never get the same one. Version 1.0.4. New in 1.0.4: released from the Castaway Isle main line together with the other survival kits, on the current engine library; no behaviour change. New in 1.0.3: the gallery rebuilds when a resource changes, so a game's mode giving every spot one regrow pace shows at once. ## Quick start In `build.luau` (or any script that builds your scene), on synced entities: ```luau local spot = asset.resolve("gatherKit.GatherSpot", "component") local palm = entity.spawnSynced("Palm1", { position = { 12, 0, 40 } }) palm.component.add(spot, { resource = "palm" }) local bush = entity.spawnSynced("Bush1", { position = { 16, 0, 38 } }) bush.component.add(spot, { resource = "bush" }) -- anywhere, to react to what players gather local Gather = require("~gatherKit.gather") Gather.on("gathered", function(item, n, resourceId) print("got", n, item, "from", resourceId) end) ``` Walk up to the palm, press E (pad X, or tap): wood and palm leaves land in your bag and a toast says what you got. After five punches the palm shrinks back and its prompt reads "Grows back soon"; five minutes later it grows back. ## Resources and options | Resource | Label | One pick gives | Tool (doubles) | Picks | Regrow | Prop | |---|---|---|---|---|---|---| | `palm` | Palm tree | 1-2 wood, 0-1 palmLeaf, 1 coconut (35%) | stoneAxe | 5 | slow | palmCoconutStraight | | `rock` | Loose stones | 1-2 stone | stonePick | 6 | normal | rockBeach | | `bush` | Berry bush | 1-3 berries, 0-1 fiber | none | 4 | normal | hibiscusBush | | `driftwood` | Driftwood | 1-3 wood | stoneAxe | 2 | slow | driftwoodLog | | `grass` | Tall grass | 1-2 fiber | none | 5 | quick | beachGrass | | `fishing` | Fishing pool | 1 rawFish, 1 crabMeat (30%) | spear | 3 | hourly | a shallow pool | | `banana` | Banana plant | 1-2 banana, 0-1 palmLeaf | none | 3 | slow | palmYoung | | `mushroom` | Mushroom patch | 1-2 mushroom, 1 fiber (25%) | none | 3 | normal | tropicalUndergrowth | | `clamBed` | Clam bed | 1 crabMeat, 0-1 seaweed, 1-2 shell (50%) | spear | 3 | hourly | shellScatter | | `reeds` | Reeds | 1-2 reed, 1 fiber | stoneAxe | 4 | quick | seaOats | | `flint` | Flint scatter | 1 flint, 0-1 stone | stonePick | 3 | slow | pebbleScatter | | `coconutPile` | Fallen coconuts | 1-2 coconut | none | 2 | slow | coconutPile | | `seaweed` | Seaweed | 1-2 seaweed, 1 fiber (40%) | none | 4 | quick | seaweedLine | | `oreVein` | Ore vein | 1-2 stone, 1 ore (60%) | stonePick | 4 | daily | rockBasalt | | `fern` | Fern | 1-2 fiber, 0-1 palmLeaf | none | 3 | quick | fernTropical | Regrow presets come from regrowKit: `quick` 30 s, `normal` 90 s, `slow` 5 min, `hourly` 1 in-game hour (150 s without worldClockKit), `daily` 1 in-game day (600 s without it), `never`. A resource may give a number of seconds instead. GatherSpot fields: `resource` (default `palm`), `propScale` (default 1), `prompt` (default true; off leaves the prompt to you). To change how a spot runs out, put your own regrowKit `Regrowing` on the entity before GatherSpot (its `maxCharges`, `regrow`, `spentLook` hide, shrink, fade or none); GatherSpot keeps one that is already there. Items: gatherKit defines the materials and tools it gives (stone, fiber, palmLeaf, wood, flint, ore, reed, shell, mushroom, stoneAxe, stonePick) in inventoryKit only when no other kit has. Foods (coconut, berries, banana, rawFish, crabMeat, seaweed) are survivalNeedsKit's, so they are edible when it is installed; without it gatherKit adds plain versions. ## API ### gather module `local Gather = require("~gatherKit.gather")` | Call | What it does | |---|---| | `Gather.VERSION` | `"1.0.0"` | | `Gather.RESOURCES` | `{ [id] = { label, verb, gives = { { item, min, max, chance? } }, tool?, charges, regrow, prop, category } }` | | `Gather.RESOURCE_ORDER` | Resource ids in display order. | | `Gather.define(id, def)` | Add or replace a resource; gives may be `{ item = , min = , max = , chance = }` or `{ item, min, max, chance }`. Errors naming what is wrong. Returns the stored resource. | | `Gather.roll(id, withTool, rng?)` | One pick, rolled without touching any bag: `{ { id, count } }`. `rng` returns 0..1 (default `math.random`); a chance passes when `rng() < chance`; the tool doubles every count. | | `Gather.give(id, withTool)` | Roll a pick into the local player's inventoryKit bag (leftovers drop at their feet). Emits `gathered` per item; returns what was given. Does nothing outside play or without inventoryKit. | | `Gather.hasTool(id)` | Whether the local player carries the resource's tool. | | `Gather.items()` | Every item id the resources give or use as a tool, sorted; defines the ones inventoryKit lacks. | | `Gather.describe(got)` | `"+2 Wood +1 Palm Leaf"` for a list from `give` or `roll`. | | `Gather.on(event, fn)` | Listen; returns unsubscribe. `gathered(item, n, resourceId)`, `picked(resourceId, entityId)`, `empty(resourceId, entityId)`. | | `Gather.ITEMS`, `Gather.FOOD_FALLBACK` | The item definitions gatherKit adds when missing. | ### Components | Component | What it does | |---|---| | `gatherKit.GatherSpot` | On a synced entity: draws the resource's tropicalProps prop as a child `gatherProp`, adds a regrowKit Regrowing (resource charges and regrow) if there is none, and an interactKit prompt reading the verb, or "Grows back soon" when spent. Using it takes a charge through `regrowKit.take`, then gives the pick, toasts it (navUiKit) and plays juiceKit `dust`. | | `gatherKit.GatherGallery` | Every resource as a working spot in one labelled row (gives, tool, picks, regrow). Local and temporary; safe in any scene. | ## Multiplayer Put GatherSpot on synced entities. The prop and prompt are drawn on every peer; the Regrowing charges are synced and written only by the entity's owner. A player pressing the prompt asks the owner through `regrowKit.take`; the owner spends one charge and answers that player alone, and only then does that player's own engine roll the pick into their own bag. Two players pressing at once get one charge each while charges last, never the same one. The spent look and the "Grows back soon" prompt follow the synced charges, so everyone sees the same bush. ## Tests `asset.resolve("gatherKit", "testSuite"):run()` runs 17 tests: every resource complete with valid items, tools and props; roll with fixed random sources (min, max, chance, tool doubling); define; events; give outside play doing nothing safely; items defining its materials; GatherSpot adding a Regrowing with the resource's charges, its prop and prompt; GatherGallery; and the README and version against the code. ## Guides - *How do I add resource gathering to my survival game* (`gatherKit.package/how-do-i-add-resource-gathering-to-my-survival-game.guide`): the ideas, the resources, tools, regrowing, multiplayer and your own resources. - *Example: punch palms and pick berries on an island* (`gatherKit.package/example-punch-palms-and-pick-berries-on-an-island.guide`): a worked example from an empty island to a gathering loop with a stone axe. ## What it installs Installing gatherKit brings these packages, each from its own world, at the versions it was built and tested with: | Package | Version | |---|---| | inventoryKit | 1.0.26 | | interactKit | 1.6.3 | | regrowKit | 1.0.2 |
▲ 0↑ born
❒
package · born here
❒asset
# survivalNeedsKit **Add hunger, thirst, staying warm, rest, stamina, getting soaked, sanity and oxygen to any multiplayer Zero game.** For creators asking "how do I add hunger and thirst to my game", "how do I make players get cold at night" or "how do I make a survival game with food and water". Every player has their own meters on their own body, statuses like Well Fed or Freezing change how they play, and you pick the rules, the climate, the HUD layout and the theme by name. Version 1.0.13. New in 1.0.13: a burning fire no longer breaks heatSignatures. The fire's own heat record gave heatSignatures `active = true` where it reads a temperature, so heatSignatures' whole tick failed every frame while a fire burned; it gives 420 C now, the same as the fire's built piece. New in 1.0.12: released from the Castaway Isle main line together with the other survival kits, on the current engine library; no behaviour change. New in 1.0.11: status chips (Shivering, Soaked, Well Fed and the rest) stand side by side with room for their names; before, an emoji at the head of each chip's text made it too narrow and the names ran over each other. New in 1.0.10: a fire that went out is cold the moment it dies. heatSignatures cools the stones and sand round a fire over minutes, so what it reads beside a dead fire no longer counts as warmth unless something there is still burning (before, a burnt-out fire kept a player warming for about two minutes). New in 1.0.9: a fire that has gone out is cold everywhere. heatSignatures warmth only counts with something hot in reach, so sun-warmed sand no longer warms you, and a HeatSource's new `piece` field makes the built thing it belongs to (a campfire piece) read hot only while it burns. A fire that runs out goes cold: its warmth and light stop at once, and with heatSignatures installed its heat record goes too (a dead fire no longer warms anyone). Rain comes from worldClockKit's live weather, so a shower soaks you outside, and a Shelter keeps you dry and holds most of the night's cold out (`insulation`). All six HUD layouts are now barsKit bars. Fires can always be brought back: feed one wood, palm leaves, fiber or a coconut, or light it with a torch or a flint once it is out (`feedFire`, `lightFire`, `HeatSource:relight`). Each player's meters are saved with **saveKit** when it is installed, so hunger, thirst and the rest come back as they were left after leaving play, rejoining or restarting the world. Built on **SecondWind** (empty meters hurt, healthy ones heal), **barsKit** (all six HUD layouts), **inventoryKit** (food and drink are bag items) and **worldClockKit** (needs follow the shared day and night). Works with **tropicalKit**'s island for the sea (wading soaks you, diving uses oxygen) and with **abilitiesKit** for status effects. ## Quick start In your scene's `build.luau`, after the default player setup (`body` is the player's body), and in its `entrypoint.luau`: ```luau body.component.add(asset.resolve("survivalNeedsKit.SurvivalNeeds", "component"), {}) local fire = entity.spawnSynced("Campfire", { position = { 4, 0, 6 } }) fire.component.add(asset.resolve("survivalNeedsKit.HeatSource", "component"), { radius = 6, warmth = 30 }) local spring = entity.spawn("Spring", { position = { -6, 0, 3 } }) spring.component.add(asset.resolve("survivalNeedsKit.WaterSource", "component"), { label = "Spring" }) -- entrypoint.luau local Needs = require("~survivalNeedsKit.needs") function onLoad() Needs.setup({ rules = "castaway", climate = "tropical", layout = "corners", theme = "realistic" }) end ``` Your scene needs a worldClockKit WorldClock: needs drain by in-game hours, so without a clock they hold still. Press Play: your meters sit on the left edge, drain with the clock, and the spring and fire bring them back. ## Styles and choices | Setting | Values | |---|---| | `rules` | `off` (creative), `cozy`, `standard`, `castaway`, `hardcore`, `horror` | | `climate` | `tropical`, `temperate`, `desert`, `arctic`, `swamp` | | `layout` | `corners`, `ring`, `pips`, `silhouette`, `minimal`, `hotbarStrip`: every one is barsKit bars (the theme's look, then barsKit's `ring`, `pips`, vertical `gauge`, `line` and the theme's look again); without barsKit the kit draws its own panels | | `theme` | `scifi`, `fantasy`, `cartoon`, `pixel`, `minimal`, `realistic`, `horror`, `cozy` | | Rules | What runs | |---|---| | `off` | No needs at all: build and explore freely. | | `cozy` | Hunger, thirst, warmth, rest, gentle and slow. | | `standard` | Adds stamina and getting soaked. | | `castaway` | Adds oxygen; thirst bites and the sea soaks you. | | `hardcore` | All eight, fast, no natural healing. | | `horror` | Sanity drains in the dark and away from fire. | | Climate | Feel | |---|---| | `tropical` | Hot days, cool damp nights, sudden showers. | | `temperate` | Mild days and properly cold nights. | | `desert` | Scorching sun, freezing nights, thirst doubles at noon. | | `arctic` | Cold all day, deadly at night: a fire is life. | | `swamp` | Warm, wet and never quite dry. | ### The needs - **Hunger, thirst, rest, sanity** drain by the in-game hour, so any day length works. - **Warmth** moves toward how warm it feels: the climate's day and night air, plus every burning HeatSource nearby, minus a chill when you are soaked. Under a Shelter the roof keeps out `insulation` (0.6 by default) of the night's cold and adds its own `warmth` (6), so a lean-to at night feels far warmer than the open beach (about 62 against 34 on the tropical island). - **Wetness** rises in the sea and in rain outside a shelter (worldClockKit's blended weather: steady rain soaks you in a few seconds), and dries by the fire and in the sun. - **Stamina** drains while sprinting and returns faster when fed and rested. - **Oxygen** drains while your head is under the sea and comes back fast in the air. A meter at its critical line hurts through SecondWind (`label = "Exposure"`); all meters healthy heal slowly. After a SecondWind respawn the meters refill to `respawnFill` percent. ### Statuses Seven statuses come from what the meters add up to. They show as small chips on every HUD layout, fire the `statusOn` and `statusOff` events, and with abilitiesKit installed each becomes a real abilitiesKit effect on the body called `survival_<id>`. | Status | Effect | |---|---| | `wellFed` (bonus) | Health comes back slowly and stamina refills 30% faster. | | `starving` | Your swings deal 30% less damage. | | `parched` | 15% slower, stamina refills at half speed. | | `shivering` | 10% slower and you jump lower. | | `freezing` | 35% slower and you lose health until you warm up. | | `soaked` | 10% slower and you take 15% more damage. | | `exhausted` | 25% slower and stamina barely refills. | ### Food and drink Eighteen inventoryKit items with `useEffect = "event"`: coconut, wild berries, banana, mango, raw fish, cooked fish, crab meat, grilled crab, seaweed, fresh water, coconut water, herbal tea, fish stew, roasted root, jerky, honeycomb, ration bar, bitter coffee. Use one from the hotbar and it feeds the needs it lists. Add your own with `Needs.defineFood`. ## API ### needs module `local Needs = require("~survivalNeedsKit.needs")` - `setup(opts)`: pick `rules`, `climate`, `layout`, `theme` by name (any subset); call on every peer, changes apply live. `persist` (default true) saves each player's meters with saveKit; `persist = false` starts every session from the start values. - `persists()`: whether the meters are saved (`persist` is on and saveKit is installed). - `savedState()`: the local player's saved meters, `{ v = 1, needs = { hunger = 72.4, ... } }`, or nil when nothing is saved yet, saveKit is missing or the save has not loaded. - `config()`: a copy of the current settings. - Fires: `fires({ includeOut = true })` lists every HeatSource, burning or out (without it, only burning ones); `fireNear(x, z, range?)` is the nearest one in reach. `feedFire(fire, item?)` puts one fuel item from the local player's bag on it (`FUEL`: wood 120 s, palm leaf 40, coconut 30, fiber 20; `defineFuel(item, seconds)`), which also lights it again when it was out. `lightFire(fire)` lights a fire that is out with a lighter from the bag (`LIGHTERS`: torch, flint; `defineLighter(item)`), burning on what fuel is left, or on `KINDLING` (45 s) when it burned out. `tendAction(fire)` says which of the two the local player can do there, with prompt words. On the component, from any peer: `HeatSource:addFuel(seconds)` and `HeatSource:relight(kindling?)`. - `rules()`: the current rule preset table. - `climate()`: the current climate table. - `active(need)`: whether a need runs under the current rules. - `activeNeeds()`: the needs that run, in display order. - `catalogue()`: every preset, climate, layout, theme, need and food, for menus and agents. - `on(event, fn)`: listen to an event; returns a function that stops listening. Events: `changed`, `low`, `critical`, `recovered`, `ate`, `drank`, `setup`, `statusOn`, `statusOff`. - `defineFood(id, def)`: add a food or drink: `{ name, gives = { hunger = 20 }, hp?, rarity? }`. - `describeFood(id)`: a short text of what a food gives. - `defineFoods()`: register every food as an inventoryKit item (done for you). - `consume(foodId)`: apply a food's effect to the local player. - `get(need)`: the local player's value for a need (0..100), or nil before their body is ready. - `state()`: every need of the local player, `{ hunger = 72, ... }`. - `add(need, n)`: change a need of the local player by n points (negative to drain). - `spend(n)`: spend stamina; returns false when too tired. - `of(body, need)`: read another player's need from their body (synced). - `heatAt(x, y, z)`: heat at a point from every burning HeatSource. - `lightAt(x, y, z)`: firelight at a point (0..1), for creatures that fear fire. - `fires()`: every burning heat source, `{ { x, y, z, radius, lightRadius } }`. - `shelterAt(x, y, z)`: the Shelter covering a point, or nil. - `waterAt(x, y, z)`: the WaterSource within reach of a point, or nil. - `darkness()`: 0 in full day, 1 at night. - `rain()`: 0..1, how hard it is raining. - `waterDepth(x, y, z)`: how far below the sea surface a point stands; 0 on land. - `temperatureAt(x, y, z, wetness?)`: the felt temperature on the 0..100 comfort scale (50 is comfortable). ### statuses module `local Statuses = require("survivalNeedsKit.statuses")` - `define(id, def)`: add or replace a status: `{ label, icon, color, good?, when = { { need, op, value } }, description, effect, heal?, hurt? }`. - `evaluate(values, running?)`: which statuses a set of need values gives, in order. - `active()`: the local player's statuses right now. - `has(id)`: whether the local player has a status. - `STATUSES`, `STATUS_ORDER`: the status table and its display order. ### hud module - `draw(c)`: draw the HUD for the local player's SurvivalNeeds component (done for you). - `restyle()`: tear the HUD down so the next draw builds the chosen layout fresh. - `teardown()`: remove the HUD. ### Components **SurvivalNeeds**: one player's meters, on the PlayerPrototype body. Owner-written, synced. - `hunger`, `thirst`, `warmth`, `rest`, `stamina`, `sanity`, `oxygen` (0..100), `wetness` (0..100, 0 is dry). - `sprintSpeed` (5.2): ground speed above which the player spends stamina. - `headHeight` (1.55): how deep the feet must be for the head to be under water. - `respawnFill` (60): what each meter is set to after a respawn (percent). - Methods: `value(need)`, `add(need, n)` (owner only), `refill(pct?)`. **HeatSource**: a fire, torch or brazier on a synced entity. - `radius` (6): how far the warmth reaches. `warmth` (30): comfort added at the centre. - `lightRadius` (9): how far its light keeps night creatures away. - `burning` (true), `fuel` (-1 burns for ever), `maxFuel` (600 seconds). - `flame` (true), `flameSize` (1), `flameHeight` (0.25): the drawn flame and light. - Methods: `heatAt(x, y, z)`, `lightAt(x, y, z)`, `describe()`, `addFuel(seconds)` (any peer, relights), `setBurning(on)`. **Shelter**: inside its footprint rain stops, the roof keeps out `insulation` of the night's cold and adds `warmth`, and standing still restores rest. - `radius` (2.5), `height` (3), `restBonus` (1). - Method: `covers(x, y, z)`. **WaterSource**: press E (pad X, or tap the prompt) to drink. - `radius` (2.2), `label` ("Spring"), `amount` (35 thirst per drink), `cooldown` (1.2 s). - `fill` (true): also give a Fresh Water to carry when the bag has room. - `container` (""): item a player must carry to fill water, such as a flask; empty fills without one. - `salty` (false): sea water makes you thirstier instead. - Methods: `reaches(x, y, z)`, `drink()`, `prompt()`. **NeedsGallery**: a panel to try every layout, theme, rule preset and climate. - `tour` (true), `tourSeconds` (3), `open` (true). ## Works with heatSignatures When heatSignatures is installed, every burning HeatSource also registers as a fire in heatSignatures (so a thermal look draws it) and is taken out again the moment it goes out, so a dead fire reads cold there too. The fire's owner gives the scene a heatSignatures climate that matches the needs climate if it has none, and `Needs.heatAt` reads heatSignatures' temperature (`Heat.at`, `HEAT_PER_DEGREE` points per degree above the air) and takes the larger of that and the fire's own falloff. Anything heatSignatures knows to be hot then warms a player too, so a fire drawn by another kit (a buildPlaceKit campfire piece) has to go cold there as well: survivalCraftKit puts the piece out with `Build.setLit` when its HeatSource dies. Without heatSignatures the fires' own falloff is the whole story. ## What it installs Installing survivalNeedsKit brings these packages, each from its own world, at the versions it was built and tested with: | Package | Version | |---|---| | SecondWind | 1.4.7 | | barsKit | 1.4.6 | | inventoryKit | 1.0.26 | | worldClockKit | 1.7.3 | ## Saving With saveKit installed (and `persist` left on), the local player's own SurvivalNeeds writes their meters to their saveKit profile under the key `survivalNeedsKit.needs` every 5 seconds when they changed, and once more when the body goes away (leaving play or the world). When the body starts again, the meters wait (at most 8 seconds) for saveKit to load the player's save, then take the saved values back, clamped 0..100, for every need the current rules run, before the first drain. A player who leaves while dead is saved with what a respawn gives them (`respawnFill`, dry, full stamina and oxygen), and a SecondWind respawn still refills the meters as before. Each player's values live in their own saveKit profile, so players never share meters. In saveKit's `checkpoint` mode the values are kept only when saveKit saves at a checkpoint. Without saveKit the kit works as before and nothing is saved. ## Multiplayer Each player's engine owns and writes their own SurvivalNeeds; the values are synced so anyone can read them. HeatSource `burning` and `fuel` are synced and burned down by the entity's owner; `addFuel` from any peer is sent to the owner. Drinking and eating change only your own meters. ## Gallery Put a **NeedsGallery** on any entity to step your own HUD through all six layouts and eight themes (buttons, the [ ] and - = keys, or an automatic tour) and to try every rule preset and climate with a click. The Castaway Isle world has a gallery scene with all four castaway galleries side by side. ## Guides - **How do I add hunger and thirst to my game** (`survivalNeedsKit.package/how-do-i-add-hunger-and-thirst-to-my-game.guide`) - **Example: island survival, stay fed, watered and warm through the night** (`survivalNeedsKit.package/example-island-survival-stay-fed-watered-and-warm-through-the-night.guide`) ## Tests 32 tests in `survivalNeedsKit.testSuite`. Run them with `asset.resolve("survivalNeedsKit", "testSuite"):run()`. ## Known limits - Warmth from the sun is a climate number; there is no shade simulation. - Oxygen needs a sea at height 0 (tropicalKit's island) to know when your head is under.
▲ 0↑ born
backing path · gatherKit.package/gatherKit.testSuite

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.