---@meta
-- Carnivores modding API (Dinosaur Hunter HD and Ice Age; Windows, Linux and Android), for the Lua language server (VS Code: the 'Lua' extension).
-- Put this file into your workspace (or point Lua.workspace.library at it) for autocompletion and docs.

---@class Creature
---@field index integer its slot in the game's character list (reused by later creatures; prefer id)
---@field id integer a number unique to this creature while it exists: store it, find it again with world.byId
---@field valid boolean false once it was removed or a new hunt began (every other field then raises an error)
---@field alive boolean true while its health is above 0
---@field type integer the game's character type number
---@field species string the species id, e.g. "trex" (see the species table)
---@field name string the species' name in the game's language
---@field x number position
---@field y number height (its feet)
---@field z number position
---@field yaw number heading in degrees (same convention as player.yaw)
---@field health number health in the game's units (a T-Rex has 1024); setting 0 kills it through the game's death path (the kill event, its death animation, a body)
---@field maxHealth number its species' full health (or more, if it had more)
---@field scale number size factor: 1 = its model's size; trophies and the game's stats use it
---@field height number the height of its model at its scale
---@field anim integer the animation playing (0 = the first one of its model); setting it blends to the new one
---@field animTime number seconds into the current animation
---@field animLength number length of the current animation in seconds
---@field animName string name of the current animation in its model
---@field animCount integer how many animations its model has
---@field distance number|nil distance to the hunter on the ground (nil outside a hunt)
---@field team integer its team for world.fights (0 = none)
---@field target Creature|nil the creature it hunts (world fights; or c.target = other / c:attack(other): it goes after another creature with its own chase and attack, also while world.fights is off; nil stops it)
---@field attacking boolean creature fights: attacking right now
---@field fleeing boolean creature fights: running away
---@field kills integer creature fights: its kills
---@field damageDealt number creature fights: damage it dealt
---@field damageTaken number creature fights: damage it took
---@field state integer its AI's state number (species-specific; 0 = calm in most)
---@field afraid number its AI's fear timer in seconds (it flees while above 0)
---@field targetX number where its AI walks to (x); the AI may change it
---@field targetZ number where its AI walks to (z)
---@field ai boolean false = the game's AI no longer runs for it: your script moves and animates it
---@field predator boolean whether its species hunts
---@field possessed boolean whether the player drives it (c:possess())
---@field data table a table for your own data about this creature; dropped with the creature
---@field tint string|table|nil a colour laid over its model (team colours, glowing bosses); the alpha is the strength; nil = none
---@field speed number its time factor: its AI and animations run this much faster (2) or slower (0.5); 0 freezes it
---@field sight number how well it sees the hunter (1 = its species' normal, 2 = twice as far, 0.5 = half)
---@field smell number how well it smells the hunter
---@field hearing number how far it hears noises (0 = deaf)
---@field visible boolean drawn this frame (in view, near enough); the game recomputes it every frame
---@field swimming boolean swimming in deep water (its AI's flag)
---@field pitch number body pitch in degrees (the ground's slope; recomputed by its AI)
---@field roll number body roll in degrees (recomputed by its AI)
---@field targetYaw number the heading its AI turns to (degrees, the yaw convention)
---@field velocity number forward speed in units per second (its AI eases it to its animation's speed)
---@field turnRate number turn speed in degrees per second (eased by its AI)
---@field stuck integer its blocked-path counter: above 12 it takes a detour
---@field cameraDistance number distance to the camera, as the game measured it this frame
---@field blend table the animation blend: {anim, time, t, active}: the animation it blends from, its time, the blend clock (above 0.25 s the blend ends)
---@field huntable boolean its species gives a trophy
---@field dangerous boolean its species is dangerous (a call scares the others)
---@field flyer boolean its species flies (a credit per shot, no trophy)
---@field locked boolean trophy room: this trophy is locked
---@field bleeding number seconds of bleeding left (a wound adds 90; the blood trail)
---@field targetTime number seconds on its walk target (above 30 its AI picks a new one)
---@field skid table the skid after a hard turn at speed: {time (seconds), x, z} (raptors; Ice Age: Diatryma, Titanis)
---@field brain string|function|nil what runs in place of its species' AI: a species id (that species' own AI, when the animations line up: ai.compatible), "prey", "predator", "defender" (Ice Age-style brains for any species) or function(c, dt) (your own, once per frame; the game still bleeds it, scales it by c.speed, runs its fights and creature_after_ai); nil = its own. Dead creatures always use their own death. See the behaviour guide
---@field tame boolean it ignores the hunter: never notices, hunts, flees or attacks him (pets)
---@field mood string "calm", "alert" (it knows about the hunter), "hunt" (it chases him), "flee" (it runs from him) or "dead". Setting it is the safe way to steer its AI: "calm" calms it, "alert" alarms it as a noise would (it reacts as its species does), "hunt" sends it at the hunter (a plant eater whose AI only flees flees), "flee" makes it run (predators and charging animals run for 12 s)
---@field alerted boolean its AI knows about the hunter (alarm state or fear time)
---@field huntingPlayer boolean it chases the hunter right now (its AI's way leads at him)
---@field chaser Creature|nil the nearest creature hunting it (fights, c:attack)
---@field fightMode string|nil this frame's fight plan: "attack", "charge", "flank", "flee", "watch"; nil = none
---@field jumping boolean the leap of c:jump runs
---@field moveSpeed number how far its AI moves it per frame (1 = the game's, 0 = on the spot, 2 = twice as far; 0-10)
---@field turnSpeed number how fast its AI turns it (1 = the game's)
---@field animSpeed number how fast its animations play under its AI (1 = the game's; the movement stays)
---@field armor number the share of every damage it takes (1 = all, 0.5 = half, 0 = none), before the damage event
---@field canKillHunter boolean false: its attacks on the hunter miss (no creature_attack event)
local Creature = {}
--- It dies: the kill event (no killer), its death animation, a body. c:die names a killer or gives the trophy.
---@return boolean # false when it was not alive
function Creature:kill() end
--- It disappears (alive or a body).
---@return boolean # 
function Creature:remove() end
--- Moves it; its AI's walk target moves along.
---@param x number 
---@param z number 
---@param y? number height (default: the ground)
function Creature:teleport(x, z, y) end
--- Turns it towards a point.
---@param x number 
---@param z number 
function Creature:face(x, z) end
--- Moves it on the ground along its heading: for creatures whose AI you switched off.
---@param distance number units forward (negative = back)
---@param yaw? number direction (default: its heading)
function Creature:move(distance, yaw) end
--- Distance to another creature or a point.
---@param other Creature|number a creature, or x
---@param z? number z, when x was given
---@return number # distance on the ground
function Creature:distanceTo(other, z) end
--- Plays its current animation on: for creatures whose AI is off (with the AI on, the AI does this).
---@param dt? number seconds (default: this frame's)
---@return boolean # true when the animation wrapped around
function Creature:animate(dt) end
--- The names of its model's animations.
---@return table # names; names[i + 1] is animation i
function Creature:anims() end
--- Finds an animation by name.
---@param name string part of an animation name, e.g. "run" (case does not matter)
---@return integer|nil # the animation index
function Creature:findAnim(name) end
--- The player drives it: W/S, A/D turn, Shift runs, click attacks, Space jumps. Ends with world.unpossess() or its death.
---@return boolean # false when it cannot be possessed (dead, a flyer, not in a hunt)
function Creature:possess() end
--- The camera follows it (camera.follow).
---@param distance? number camera distance
function Creature:follow(distance) end
--- It notices danger (flees or attacks, as its species does).
---@param seconds? number how long it stays alarmed (default 20)
function Creature:alert(seconds) end
--- Plays one of its species' sounds where it stands.
---@param n integer the sound number in its model (0 = first)
---@param volume? number 0-1
function Creature:sound(n, volume) end
--- Where its head is on the screen, for labels.
---@return number? # screen x of the top of its head (nothing when behind the camera)
---@return number? # screen y
function Creature:screen() end
--- Its position in one call.
---@return number # x
---@return number # y
---@return number # z
function Creature:pos() end
--- Every member of the creature's struct. The raw layer: every member of the game's struct by its C++ name (m_unk94) or its friendly alias (velocity). fields() describes them (FieldInfo): name, alias, type, access (r, rw, or rw! = writable but the game recomputes or eases it), offset, min, max, recomputed (what overwrites it), note, games. Writes are checked: type, range and the field's own rule (an animation of its species, a time inside it ...); a bad value raises an error and changes nothing.
---@return table # a list of FieldInfo
function Creature:fields() end
--- Reads one member as the game stores it (radians, units per ms ...).
---@param name string a member ("m_unk94") or its alias ("velocity")
---@return any # its raw value
function Creature:get(name) end
--- Writes one member. Fields the game recomputes every frame are read-only (r); rw! ones take the value, but the game eases them back (an impulse). Health goes through c.health (the death path).
---@param name string a member or its alias
---@param value any checked: type, range, the field's rule
function Creature:set(name, value) end
--- One frame of walking toward a point the way the game's AIs walk: way finding around trees, rocks and water (LookForAWay; when the way stays blocked, by a cliff or a slope too steep, it turns aside for a moment before aiming at the point again, as the AIs do), turning, speeding up and slowing down, the terrain collision and tilt, its walk animation with its sound. Call it every frame (from a brain or a frame handler) for a creature whose AI you replaced.
---@param x number 
---@param z number 
---@param opts? table arrive (the radius it stops within, default 300), speed (units per second, default its species' walk), water (true: it may walk into water)
---@return number # distance left
---@return boolean # arrived (it stands there, playing its idles)
function Creature:walkTo(x, z, opts) end
--- As c:walkTo, running.
---@param x number 
---@param z number 
---@param opts? table as c:walkTo
---@return number # distance left
---@return boolean # arrived
function Creature:runTo(x, z, opts) end
--- One frame standing: it slows down and plays its calm idles (another one now and then, with its sound); species without idles finish their step and hold it (ai.setIdles names some for them).
function Creature:idle() end
--- Turns it toward a point by at most this frame's share.
---@param x number 
---@param z number 
---@param degreesPerSecond? number default 180
---@return number # degrees still to turn
function Creature:turnToward(x, z, degreesPerSecond) end
--- The game's own test (AI_CheckAfraid) for this creature now: the distance, where it looks, the wind, cover between them, camouflage and cover scent, its species' senses and c.sight / c.smell. It changes nothing.
---@return boolean # it sees the hunter
---@return boolean # it smells him
---@return number # the sight measure (below 1 = noticed)
---@return number # the smell measure
function Creature:senses() end
--- Whether it sees the hunter now (c:senses).
---@return boolean # 
function Creature:sees() end
--- Whether it smells the hunter now (c:senses).
---@return boolean # 
function Creature:smells() end
--- Whether a noise reaches it (the game's test for shots, with c.hearing).
---@param radius number how far the noise carries (a rifle shot: about 14600)
---@param x? number where the noise is (default: the hunter)
---@param y? number 
---@param z? number 
---@return boolean # 
function Creature:hears(radius, x, y, z) end
--- The game's attack: when the hunter is within reach of its mouth it turns to him, plays its attack and kills him (AddDeadBody: creature_attack and player_death fire; god mode and c.canKillHunter apply).
---@param force? boolean true: from any distance
---@return boolean # true when it attacked (he was within reach)
function Creature:attackHunter(force) end
--- It goes after another creature with its own chase and attack (the fights' code), also while world.fights is off; the victim reacts as in fights (flees, fights back). It ends when either dies or is removed. The same as c.target = other; it works for creatures run by their AI or by a brain that calls c:stockAI().
---@param other Creature|nil the victim; nil stops
---@return boolean # false when one of them cannot fight
function Creature:attack(other) end
--- A bite from a script, for creatures you drive: its attack animation now and the damage at once (creature_attack, creature_damage, damage, kill).
---@param other Creature the victim
---@param damage? number default: a strong bite of its species
---@return boolean # true when the victim was within reach of its mouth
function Creature:bite(other, damage) end
--- It takes a hit as from a shot: the damage event, its health, the alarm (it flees or attacks as its species does) and a blood trail; at 0 it dies through the death path.
---@param amount number damage in the game's health units
---@param opts? table attacker (a Creature), byHunter (the hunter's kill: trophy), calm (no alarm), bleed (default true: a blood trail)
---@return number # the damage it took (after c.armor and the damage event)
function Creature:hurt(amount, opts) end
--- It dies through the game's path: the kill event, its death animation, a body; the hunter's kill takes the trophy (the drop ship comes, trophy fires).
---@param opts? table killer (a Creature), byHunter (the hunter's kill: trophy, credits, statistics), trophy (the trophy whoever killed it)
---@return boolean # false when it was not alive
function Creature:die(opts) end
--- Picks a new walk target the way its AI does (a good place within the radius: no steep slope, trees or water).
---@param radius? number default 8048
---@return number? # x of its new walk target
---@return number? # z
function Creature:wander(radius) end
--- Sets its walk target that far away from a point, as the AIs flee. With its own AI combine it with c.mood = "flee"; a brain then runs there with c:runTo(c.targetX, c.targetZ).
---@param x number 
---@param z number 
---@param distance? number default 2048
---@return number # x of its walk target
---@return number # z
function Creature:fleeFrom(x, z, distance) end
--- The creatures near it.
---@param radius number 
---@param filter? string|table a species id, or {species =, predator = true / false, dead = true}
---@return table # the creatures around it (not itself), nearest first
function Creature:nearby(radius, filter) end
--- Its jump / lunge animation with a leap forward (raptors, the Allosaurus, the Spinosaurus, Ice Age's Diatryma ...). Its AI, or c:walkTo / c:runTo, carry the leap on.
---@return boolean # false when its species has no jump
function Creature:jump() end
--- Its roar animation and sound (its AI pauses meanwhile); species without a roar call out with a sound of their own.
---@param face? Creature turn to this creature while roaring
---@return boolean # false when it has neither a roar nor a call sound
function Creature:roar(face) end
--- One frame of its species' own AI, from inside a brain: the game drives it when your brain has nothing better to do (its fights work then too).
---@param species? string|integer another species whose AI it runs (the animations must line up)
---@return boolean # 
function Creature:stockAI(species) end
--- What it means to the hunter now.
---@return table # {predator, attacks, hunting, alerted, mood, distance, heading (1 = it faces the hunter), closing (units per second toward him), eta (seconds, while closing)}
function Creature:threat() end
--- Whether it knows about the hunter, and what told it.
---@return string? # "sight", "smell", "hearing", "shot", "hurt", "attack", "near", "script" or "unknown"; nothing while it is calm
function Creature:awareOfHunter() end

---@class Zone
---@field name string its name (unique: a zone made with a name that exists replaces that one)
---@field kind string "circle", "box", "polygon" or "map" (a terrain region)
---@field valid boolean false once it was removed (or the scripts were reloaded)
---@field id integer a number for it
---@field hunterInside boolean the hunter is in it right now
---@field active boolean it exists on this hunt's map (areas / maps)
---@field mod string the mod that made it
---@field x number? circle: its middle (writable)
---@field z number? circle: its middle (writable)
---@field radius number? circle: its radius (writable: a ring that shrinks, a camp that moves; who is inside is kept, and the next frame fires zone_enter / zone_leave for what the new circle takes in or leaves out)
local Zone = {}
--- Whether a point is in the zone: its shape and all its conditions.
---@param x number 
---@param z number 
---@param y? number a height for the height range (default: the ground)
---@return boolean # 
function Zone:contains(x, z, y) end
--- The creatures in the zone (living ones by default).
---@param filter? string|table a species, or {species =, team =, dead =, all =}
---@return table # a list of Creature
function Zone:creatures(filter) end
--- How many creatures are in the zone.
---@param filter? string|table as z:creatures
---@return integer # 
function Zone:count(filter) end
--- A random point of the zone that meets its conditions and these.
---@param opts? table conditions as world.randomPoint (on land by default)
---@return number? # x
---@return number? # z
function Zone:randomPoint(opts) end
--- Its middle.
---@return number # x
---@return number # z
function Zone:center() end
--- The box around it.
---@return number # x1
---@return number # z1
---@return number # x2
---@return number # z2
function Zone:bounds() end
--- Moves or resizes a circle zone in one call (as writing z.x, z.z, z.radius).
---@param fields table {x =, z =, radius =}, any of them
function Zone:set(fields) end
--- Removes the zone (as zone.remove(z)).
---@return boolean # false when it was removed already
function Zone:remove() end

---@class Group
---@field id integer a number for it
---@field valid boolean false once it was disbanded (also: a new hunt, a reload for a script's group)
---@field kind string "herd", "pack" or "group"
---@field name string a name (default: kind and id)
---@field state string "calm", "alert", "flee", "hunt", "feed" (a pack at its kill), "regroup" or "home" (walking back to its territory)
---@field formation string "loose", "line", "column", "wedge", "circle" or "free"
---@field size integer how many members
---@field leader Creature|nil the member the others follow; set it to another creature (it joins first)
---@field members table a list of its creatures, the leader first
---@field target Creature|string|nil what a pack hunts: a creature, "hunter", or nil
---@field territory string|nil its home zone's name; set a Zone, a name or nil
---@field rule string|nil the population that placed it (nil: a script made it)
local Group = {}
--- Adds a creature (it leaves its old group).
---@param c Creature 
---@return boolean # 
function Group:add(c) end
--- Takes a creature out of the group.
---@param c Creature 
---@return boolean # 
function Group:remove(c) end
--- Whether a creature is a member.
---@param c Creature 
---@return boolean # 
function Group:has(c) end
--- Changes behaviour options.
---@param opts table options, as group.create's
function Group:set(opts) end
--- As if a member noticed the threat: the group reacts (a herd flees, a pack hunts the hunter).
---@param threat? Creature|string a creature, or "hunter" / nil for the hunter
function Group:alert(threat) end
--- The group flees together.
---@param from? Creature|string a creature, or "hunter" / nil
function Group:flee(from) end
--- The group hunts: it spreads around the target, then attacks in turns while the others circle.
---@param target? Creature|string a creature, or "hunter" / nil
function Group:hunt(target) end
--- Ends a flight or a hunt; the members calm down.
function Group:calm() end
--- The leader walks there (the others follow), then roams again.
---@param x number 
---@param z number 
function Group:moveTo(x, z) end
--- The middle of its members.
---@return number # x
---@return number # z
function Group:center() end
--- Where that member should be now (its place in the formation): for script-driven members.
---@param c Creature a member
---@return number? # x
---@return number? # z
function Group:slot(c) end
--- Ends the group (the creatures stay).
function Group:disband() end

---@class Event
---@field name string
---@field cancelled boolean|nil
---@field [string] any

---@class SpeciesHandle
---@field id string its id ("trex")
---@field type integer its type number
---@field name string its name in the game's language
---@field loaded boolean its model is loaded
---@field predator boolean a predator (World's table)
---@field animCount integer animations of its model
---@field soundCount integer sounds of its model
---@field health number starting health: creatures spawned from now on (:applyToLiving() for the others)
---@field mass number tons: trophy and binocular weight (x scale²), fight damage (live)
---@field size number metres: trophy length (x scale) (live)
---@field radius number body radius for the hunter's collision (live)
---@field score number trophy points = credits (live, at trophy time)
---@field smell number how well it smells the hunter (0.01 or more; live)
---@field sight number how well it sees the hunter (0.01 or more; live)
---@field hearing number never read by the game (kept for content packs; c.hearing is the creature's factor)
---@field carryHeight number the drop ship's hover height over its body (the next pickup)
---@field scaleMin number smallest size of new ones (scale = (scaleMin + random x scaleRange) x 64 / 55)
---@field scaleRange number size spread of new ones
---@field flags integer 1 huntable, 2 dangerous, 4 flyer (0-7; live: later kills follow it)
---@field huntable boolean flag 1
---@field dangerous boolean flag 2
---@field flyer boolean flag 4
---@field callVariants integer call sound variants a / b / c (1-3)
local SpeciesHandle = {}
--- Its animations (index 0 first).
---@return table # {index, name, fps, frames, length, sound}...
function SpeciesHandle:anims() end
--- Reads or sets an animation's speed; its length follows and the creatures playing it stay inside it. The AIs' walking speeds are their own: a faster walk animation slides less or more.
---@param i integer an animation
---@param fps? number frames per second (1-1000)
---@return integer # its fps
function SpeciesHandle:animFps(i, fps) end
--- Reads or sets the sound an animation plays.
---@param i integer an animation
---@param sound? integer a sound of its model, -1 = none
---@return integer # the sound
function SpeciesHandle:animSound(i, sound) end
--- The living creatures of the species take its current health and size: each keeps its share of full health and its size relative to the species' average.
---@return integer # how many creatures changed
function SpeciesHandle:applyToLiving() end
--- The game's values again for everything scripts changed on this species.
function SpeciesHandle:reset() end
--- The members of its CharacterInfo (the raw layer).
---@return table # FieldInfo list
function SpeciesHandle:fields() end
--- One member.
---@param name string 
---@return any # 
function SpeciesHandle:get(name) end
--- One member (through the overlay, journaled).
---@param name string 
---@param value any 
function SpeciesHandle:set(name, value) end

---@class Weapon
---@field id string its id ("rifle")
---@field type integer its type
---@field slot integer the hunter's slot it takes
---@field name string its name
---@field loaded boolean its model is loaded
---@field power number damage per pellet hit (x3 in Survive; live)
---@field precision number spread x (2 - precision) (up to 2; live)
---@field pellets integer traces per shot (1-64; live)
---@field loudness number noise radius / 14592 (live)
---@field rate number shots per second (the next shot)
---@field ammo integer rounds per hunt (the next hunt, a resupply, a weapon given at run time)
---@field magazine integer rounds per reload (the next reload)
---@field aimFov number field of view while aiming, degrees (live)
---@field aimTime number seconds of the aim zoom (live)
local Weapon = {}
--- The game's values again.
function Weapon:reset() end
--- The members (the raw layer).
---@return table # 
function Weapon:fields() end
--- One member.
---@param name string 
---@return any # 
function Weapon:get(name) end
--- One member (overlay, journaled).
---@param name string 
---@param value any 
function Weapon:set(name, value) end

---@class WeaponSlot
---@field slot integer 0-7
---@field weapon Weapon its weapon definition
---@field id string its weapon's id
---@field current boolean the weapon in hand
---@field available boolean the hunter carries it this hunt; true gives it (its model loads, full ammunition), false takes it away
---@field state string "hidden", "ready", "firing", "reloading", "taking", "hiding"
---@field ammo integer rounds left (the loaded ones included)
---@field loaded integer rounds loaded (0 to the magazine; 0 with rounds left reloads)
---@field magazine integer its definition's magazine
---@field cooldown number seconds before it can fire again
---@field sway number aim sway (0-4; it grows while the weapon is held)
---@field aimYaw number the sway added to a shot (radians)
---@field aimPitch number the same, up / down
local WeaponSlot = {}
--- Takes it out (another weapon in hand is put away first: the game's own change, with its weapon_change event).
function WeaponSlot:take() end
--- Puts it away (the weapon in hand only).
function WeaponSlot:hide() end
--- Reloads the weapon in hand now (the game's reload, with its animation).
---@return boolean # false when it cannot (not in hand, not ready, full, nothing left)
function WeaponSlot:reload() end
--- Fires the weapon in hand through the game's Weapon_Fire: its rate, ammunition, recoil and shot event. The shot goes from the hunter's eyes along player.yaw() / player.pitch() as they are now, so player.setYaw / setPitch just before it in the same frame count; it spreads as the weapon does, and the kick of the shot before lifts it for a moment (weapons.spreadScale(0), weapons.recoilScale(0) for exact scripted shots).
---@return boolean # true when it fired
function WeaponSlot:fire() end
--- The members of its Weapon struct (the raw layer).
---@return table # 
function WeaponSlot:fields() end
--- One member.
---@param name string 
---@return any # 
function WeaponSlot:get(name) end
--- One member.
---@param name string 
---@param value any 
function WeaponSlot:set(name, value) end

---@class Weather
---@field fogStart number where the distance fog starts (units)
---@field fogEnd number where the fog is complete (units)
---@field skyColor string|table sky and clear colour, the fog colour of models; reads {r, g, b} (0-1)
---@field sunColor string|table sun light; the light of creatures and the hunter follows
---@field shadowColor string|table shadow light; the same
---@field skyPlaneColor string|table the sky plane's colour and opacity (maps with a sky sphere); reads {r, g, b, a}
---@field cloudsSpeed number clouds speed factor
---@field snow number snow, 0-1: in Ice Age the map's snow_density; in Dinosaur Hunter (since API 4; nil before) the weather's snowfall, 0 until a mod sets it (weather.snow fades it)
---@field viewDistance number how far creatures are drawn and the world is culled (19456; lower only, 512 or more; set fogEnd below it to hide the edge; nil = the game's). Kept for later hunts until your mod unloads
---@field time string "dawn", "day" or "night" (chosen when the map loads: world.nextTime)
---@field fogCount integer the map's fog volumes
---@field waterCount integer the map's water types
local Weather = {}
--- A fog volume of the map (poisonous fog hurts the hunter inside it).
---@param i integer 1 to fogCount
---@return number # its height (map units)
---@return boolean # poisonous
function Weather:fog(i) end
--- Changes one.
---@param i integer 
---@param altitude number 
---@param poisonous? boolean 
function Weather:setFog(i, altitude, poisonous) end
--- A water type.
---@param i integer 1 to waterCount
---@return table # {level, opacity, color = {r, g, b}}
function Weather:water(i) end
--- Its colour and opacity (the level stays: collision and the AIs use it).
---@param i integer 
---@param color? string|table 
---@param opacity? number 0-1
function Weather:setWater(i, color, opacity) end
--- The map's own weather again while your mod keeps running: every script change of the weather (fog, colours, fog volumes, waters, snow, viewDistance; your mod's and other mods') is undone, as when the scripts unload.
function Weather:reset() end
--- The members of Terrain and the snow (the raw layer).
---@return table # 
function Weather:fields() end
--- One member.
---@param name string 
---@return any # 
function Weather:get(name) end
--- One member (journaled for this map).
---@param name string 
---@param value any 
function Weather:set(name, value) end

---@class Wind
---@field yaw number the direction it blows towards (degrees, the yaw convention)
---@field speed number its speed (the game keeps it in 4-18 unless locked; 0-100)
---@field locked boolean the game's wind changes stop: yaw and speed stay as set (until your mod unloads)
---@field targetYaw number where it turns to
---@field targetSpeed number the speed it changes to
---@field dirX number its direction (sin of the game's angle)
---@field dirZ number the same, z
local Wind = {}
--- The members (the raw layer).
---@return table # 
function Wind:fields() end
--- One member.
---@param name string 
---@return any # 
function Wind:get(name) end
--- One member.
---@param name string 
---@param value any 
function Wind:set(name, value) end

---@class HuntRules
---@field relocateDelay number seconds between relocations (60)
---@field evacuateDelay number seconds before the evacuation ends the hunt (3.7)
---@field resupplyThreshold number the RESUPPLY button shows below this share of the hunt's ammunition (0.67)
---@field resupplyInWater boolean allow resupplies while the drop point is in water (false)
---@field scoreMultiplier number every trophy's points (the content rules' score.multiplier)
---@field unlicensedScore number points factor for a species without a licence this hunt
---@field comboBonus number + per trophy already taken this hunt
---@field flyerCredits integer credits per shot flyer
---@field bonusCamouflage number score bonus % with camouflage (balance SCORE_BONUS_CAMOUFLAGE)
---@field bonusScent number with cover scent (SCORE_BONUS_COVER_SCENT)
---@field bonusTranquilizer number with the tranquilizer (SCORE_BONUS_TRANQUILIZER)
---@field bonusNoRadar number without the radar (SCORE_BONUS_NO_RADAR)
local HuntRules = {}

---@class FieldInfo
---@field name string the C++ member (m_unk94, pos.x, m_unk1644[2])
---@field alias string? the friendly name
---@field type string "integer", "number", "boolean" or "string"
---@field access string "r", "rw" or "rw!" (writable, but the game recomputes or eases it)
---@field offset integer its offset in the struct
---@field min number? smallest allowed value
---@field max number? largest
---@field recomputed string? what overwrites it
---@field note string? what it does
---@field games string "both", "dinohunter" or "iceage"
local FieldInfo = {}

---@class ShaderWorld
---@field exposure number brightness in stops: +1 doubles the light
---@field brightness number added to every colour (the game's colours are dark: small steps)
---@field contrast number around mid grey
---@field saturation number 0 = grey
---@field gamma number above 1 brightens the dark parts
---@field hue number hue shift in degrees
---@field temperature number cold (blue) to warm (orange)
---@field tint string|table the tint's colour
---@field tintAmount number how much of the tint
---@field pulse number the light pulses by this much
---@field pulseSpeed number pulses per second
---@field vision string a vision mode: "none", "night", "thermal", "depth", "rainbow", "blueprint", "matrix"
---@field visionMix number how much of the vision mode
---@field toon number toon shading: this many light bands (0 = off)
---@field posterize number colour levels per channel (0 = off)
---@field dither number ordered dithering of the posterized levels
---@field sepia number old photo
---@field invert number negative
---@field fog string|table the colour of the API's fog (on top of the game's own fog)
---@field fogAmount number how thick at fogEnd
---@field fogStart number where it starts, in game units from the camera (128 = 1 m)
---@field fogEnd number where it is thickest
---@field sonar string|table the sonar ring's colour
---@field sonarStrength number a bright ring that runs out from the camera over the world
---@field sonarSpeed number units per second
---@field sonarWidth number the ring's width in units
---@field depthRange number the distance the depth vision and the sonar span
---@field wave number the world waves up and down
---@field waveFrequency number waves across the screen
---@field waveSpeed number how fast they move
---@field curve number the world curves away (a tiny planet; negative: up like a bowl)
---@field wobble number the view rocks from side to side
---@field twist number the view turns more with distance
---@field melt number things drip down
---@field stretchX number wider or narrower
---@field stretchY number taller or flatter
---@field shake number the picture shakes
---@field snap number PS1 style vertex snapping: the grid (80 = strong, 0 = off)
local ShaderWorld = {}
--- A plain table of the values.
---@return table # every field's value
function ShaderWorld:get() end
--- Several fields at once (each checked).
---@param values table {field = value, ...}
function ShaderWorld:set(values) end
--- Every field back to its default.
function ShaderWorld:reset() end

---@class ShaderScreen
---@field pixelate number pixel size in screen pixels (2 or more)
---@field blur number blur radius in pixels
---@field sharpen number 
---@field chromatic number colour fringes towards the edges, in pixels
---@field bloom number glow around bright parts
---@field bloomThreshold number what counts as bright
---@field outlines number edges drawn as lines
---@field outlineThreshold number how strong an edge must be
---@field outlineColor string|table the lines' colour
---@field halftone number newspaper dots of this size in pixels (2 or more)
---@field barrel number a curved CRT screen (positive) or a fisheye (negative)
---@field vignette number darker corners
---@field grain number film grain
---@field scanlines number dark lines across
---@field crtMask number the red, green and blue stripes of a CRT
---@field jitter number lines shifted sideways
---@field haze number heat haze
---@field ghost number double vision: the second picture's offset in pixels
---@field zoomBlur number blur out from the middle
---@field kaleidoscope number mirrored segments (2 or more)
---@field letterbox number black bars top and bottom (part of the height)
---@field mirror boolean the left half mirrored to the right
---@field flip boolean upside down
---@field vhs boolean an old tape: wobble, smeared colour, a tracking band, noise, dropouts
local ShaderScreen = {}
--- A plain table of the values.
---@return table # every field's value
function ShaderScreen:get() end
--- Several fields at once (each checked).
---@param values table {field = value, ...}
function ShaderScreen:set(values) end
--- Every field back to its default.
function ShaderScreen:reset() end

---@class ShaderTargets
---@field terrain boolean the ground
---@field water boolean 
---@field models boolean dinosaurs, animals, objects, the hunter's weapon
---@field plants boolean grass, bushes and the other sprites
---@field sky boolean 
---@field particles boolean blood, splashes, snow
---@field shadows boolean shadows multiply what is under them: graded twice they get much darker
---@field interface boolean the menus, the HUD and the compass
local ShaderTargets = {}
--- A plain table of the values.
---@return table # every field's value
function ShaderTargets:get() end
--- Several fields at once (each checked).
---@param values table {field = value, ...}
function ShaderTargets:set(values) end
--- Every field back to its default.
function ShaderTargets:reset() end

---@class PostShader
---@field enabled boolean drawn (true when made)
---@field id integer its number
---@field alive boolean not removed
local PostShader = {}
--- Sets a uniform (float, vec2, vec3 or vec4 by the count); it keeps its value until set again.
---@param uniform string a uniform of the shader
---@param ... any 1 to 4 numbers, or a table {x, y, ...} / a colour table
function PostShader:set(uniform, ...) end
--- Removes the post shader.
---@return boolean # whether it was there
function PostShader:remove() end

--- Writes a line to the console ( ) and the game's log, prefixed with your mod's id: [mymod] hello.
---@param ... any values, converted with tostring and separated by spaces
function print(...) end
--- Loads a Lua file of your mod once and returns its result; later calls return the same value. The module runs in your mod's sandbox (its globals are your globals).
---@param name string a module of your mod: "util" loads util.lua, "ai.raptor" loads ai/raptor.lua (or ai/raptor/init.lua); "@othermod/name" loads a module from another enabled mod's folder
---@return any # what the module returned (true when it returned nothing)
function require(name) end
--- Compiles Lua code from a string (text only, never binary chunks).
---@param text string Lua source code
---@param chunkname? string name shown in error messages
---@param mode? string ignored: only text is accepted
---@param env? table the chunk's global table (default: your sandbox)
---@return function|nil # the compiled chunk
---@return string? # the error when it does not compile
function load(text, chunkname, mode, env) end
--- Short for events.on: listen for a game event or a custom one.
---@param event string an event name (see Events)
---@param handler function called with the event table
---@param priority? integer higher runs earlier (default 0)
---@return integer # the listener id (for events.off)
function on(event, handler, priority) end
--- Readable text of any value, with tables expanded: handy with print and in the console.
---@param value any anything
---@param depth? integer how deep tables are expanded (default 3)
---@return string # readable text
function inspect(value, depth) end
--- A minimal class helper. Call the class to make an instance; init is its constructor; Class.super is the parent.
---@param parent? table a class to inherit from
---@return table # the new class
function class(parent) end
--- The safe subset of Lua's collectgarbage.
---@param option? string "count" (default), "step" or "collect"
---@return number # Lua memory in KB for "count"
function collectgarbage(option) end

events = {}
--- Calls handler(e) every time the event happens.
---@param event string the event name
---@param handler fun(e: Event) fn(e)
---@param priority? integer higher runs earlier (default 0)
---@return integer # listener id
function events.on(event, handler, priority) end
--- Like events.on, but only for the next time the event happens.
---@param event string the event name
---@param handler fun(e: Event) fn(e)
---@param priority? integer higher runs earlier
---@return integer # listener id
function events.once(event, handler, priority) end
--- Stops a listener.
---@param id integer a listener id from on / once / keys.bind
---@return boolean # true when it was listening
function events.off(id) end
--- Fires a custom event at every mod's listeners, synchronously. e.name is set to the event name.
---@param event string a custom event name, e.g. "mymod:wave"
---@param data? table the event table handlers get (a new one when left out)
---@return table # the event table after every handler ran (read what they set)
function events.emit(event, data) end
--- Whether anybody listens: skip building expensive event data nobody wants.
---@param event string the event name
---@return boolean # true when some mod listens
function events.has(event) end

game = {}
--- Which game the mod runs in. Each game is its own copy of the program, so this never changes while a mod runs. Use it to pick species and texts in a mod made for both games.
---@return string # "dinohunter" (Carnivores: Dinosaur Hunter HD) or "iceage" (Carnivores: Ice Age)
function game.id() end
--- Which screen the game is on.
---@return string # the current stage: menu_main, menu_hunt, menu_options, menu_more, menu_help, menu_about, menu_shop, loading, hunt, menu_privacy, privacy_terms, privacy_policy (or none)
function game.stage() end
--- Whether a hunt is running.
---@return boolean # true while hunting (the hunter exists)
function game.inHunt() end
--- The hunt's map.
---@return integer # the area chosen in the hunt menu: 0 to 6 (Dinosaur Hunter), 0 to 4 (Ice Age)
function game.area() end
--- The game version.
---@return string # "2.0.1-pc"
function game.version() end
--- The version of this API. It grows by one with every release that adds to it; nothing is removed. A mod that needs newer functions says so in mod.json ("api": 2); older games then show why it does not run.
---@return integer # the modding API's version (3 in this release)
function game.apiVersion() end
--- Slow motion or fast forward for the whole game (creatures, the hunter, animations, timers of the game).
---@param factor? number 0.05 to 4; 1 = normal
---@return number # the factor
function game.timeScale(factor) end
--- One of the game's texts in the current (or a given) language.
---@param key string a key of the game's strings.csv, e.g. "STR_T_REX"
---@param language? string "en", "de", "fr", "es" ...
---@return string|nil # the text, nil when there is no such key
function game.text(key, language) end
--- Replaces one of the game's texts (menus, messages, names). Texts the game shows from now on use it; menus already built show it the next time they are made. Letters outside Latin-1 become ? (the game's fonts lack them).
---@param key string 
---@param text string|nil the new text; nil = the original again
function game.setText(key, text) end
--- The game's language.
---@return string # "en", "de", "fr", "es" ...
function game.language() end
--- The operating system.
---@return string # "linux" or "windows"
function game.platform() end
--- The window size in UI units (the coordinates of draw. and ui.window).
---@return number # width
---@return number # height
function game.screen() end
--- Whether the hunt is paused.
---@return boolean # true while the game menu (pause) is open
function game.paused() end
--- The game's time step of the last frame (0 while paused).
---@return number # seconds
function game.dt() end
--- The hunt's shooting statistics.
---@return integer # shots fired this hunt
---@return integer # shots that hit
function game.shots() end
--- Shows a short message at the bottom right (the same as ui.toast).
---@param text string the message
---@param seconds? number how long it shows (default 4)
---@param color? string|table text colour (default white)
function game.message(text, seconds, color) end
--- Where a world point appears on the screen, for labels and markers.
---@param x number world x
---@param y number world y (height)
---@param z number world z
---@return number? # screen x (nothing when the point is behind the camera or not in a hunt)
---@return number? # screen y
function game.project(x, y, z) end
--- The definition changes the scripts made (species, weapons, weather, rules, overrides ...), each with the value before the first change and the mods that made it. They are undone when the scripts unload.
---@return table # {what, original, mods}...
function game.changes() end

player = {}
--- Whether the hunter exists.
---@return boolean # true in a hunt
function player.exists() end
--- The hunter's position.
---@return number # x
---@return number # y (the ground under him)
---@return number # z
function player.pos() end
--- Moves the hunter. player.setPos(x, z) puts him on the ground there.
---@param x number 
---@param y number height; with two arguments (x, z) he stands on the ground
---@param z number 
function player.setPos(x, y, z) end
--- Moves the hunter to x, z on the ground.
---@param x number 
---@param z number 
function player.teleport(x, z) end
--- Where the hunter looks (the heading).
---@return number # degrees 0-360
function player.yaw() end
--- Turns the hunter.
---@param yaw number degrees
function player.setYaw(yaw) end
--- How far up or down he looks.
---@return number # degrees, + up / - down
function player.pitch() end
--- Tilts the view.
---@param pitch number degrees (-89 to 89)
function player.setPitch(pitch) end
--- The unit direction he looks along, on the ground.
---@return number # dx
---@return number # dz
function player.forward() end
--- The hunter's health.
---@return number # current health
function player.health() end
--- Sets his health (he dies only by the game's own causes).
---@param health number above 0, at most player.maxHealth()
function player.setHealth(health) end
--- The hunter's full health (128). Since API 3 a value sets it until your mod unloads: regeneration goes up to it and each hunt starts with it.
---@param health? number since API 3: his full health from now on (1-100000); nil = 128 again
---@return number # his full health
function player.maxHealth(health) end
--- Whether the hunter is alive (false outside a hunt).
---@return boolean # 
function player.alive() end
--- The current weapon.
---@return integer # the weapon slot in hand, -1 = none
function player.weapon() end
--- A weapon's ammunition; nothing outside a hunt, without a weapon in hand, or for the photo camera.
---@param slot? integer a weapon slot (default: the one in hand)
---@return integer? # the ammunition left (what the HUD shows)
---@return integer? # the rounds loaded
function player.ammo(slot) end
--- What is under the crosshair: a ray from the hunter's eyes along his view.
---@param distance? number how far to look (default 20000)
---@return string? # "terrain", "water", "object" or "creature" (nothing when nothing is hit)
---@return number? # x of the point hit
---@return number? # y
---@return number? # z
---@return Creature? # the creature hit
function player.aim(distance) end
--- Where the hunter's eyes (the camera) are.
---@return number # x
---@return number # y
---@return number # z
function player.eye() end
--- The player's credits (the hunt menu's money).
---@return integer # 
function player.credits() end
--- Gives or takes credits (kept with the game's save): rewards, shops, bets.
---@param n integer credits to give; negative takes (not below 0)
---@return integer # the new amount
function player.addCredits(n) end
--- The camouflage item: creatures see the hunter worse.
---@param on? boolean switch it on / off
---@return boolean # whether it is on
function player.camouflage(on) end
--- The cover-scent item: creatures smell the hunter worse.
---@param on? boolean switch it on / off
---@return boolean # whether it is on
function player.scent(on) end
--- A weapon slot of the hunter (player.weapon() stays the slot number).
---@param n? integer a slot 0-7 (default: the weapon in hand)
---@return WeaponSlot|nil # nil without a weapon
function player.slot(n) end
--- The slots he carries this hunt.
---@return table # WeaponSlot list in the chooser's order
function player.weapons() end
--- Changes the weapon through the game's own change (the one in hand is put away first; weapon_change fires).
---@param n integer a slot he carries
function player.setWeapon(n) end
--- How fast he moves (the game's own velocities).
---@return number # forward (units/s)
---@return number # sideways
---@return number # vertical
function player.velocity() end
--- Swimming.
---@return boolean # 
function player.swimming() end
--- Under water (drowning, no call, weapon put away).
---@return boolean # 
function player.underwater() end
--- Standing in water.
---@return boolean # 
function player.inWater() end
--- How long he has been under water.
---@return number # seconds
function player.breath() end
--- Looking through a scope.
---@return boolean # 
function player.scoped() end
--- The creature under the binocular or camera crosshair.
---@return Creature|nil # 
function player.scanned() end
--- After his death: what killed him (nothing while he lives).
---@return string? # the species id, "drowning" or "fog"
---@return Creature? # the creature
function player.killer() end
--- The evacuation runs.
---@return boolean # 
function player.evacuating() end
--- A relocation runs.
---@return boolean # 
function player.relocating() end
--- A recoil kick of the camera.
---@param amount number camera units (a rifle shot: 64)
function player.kick(amount) end
--- Launches him upwards (gravity takes him).
---@param speed? number upward speed (default: his standing jump, 800 x jumpPower)
function player.jump(speed) end
--- A factor on his walking and swimming speed. Kept until your mod unloads (every hunt); nil puts the game's value back.
---@param k? number 0-20 (nil = 1)
---@return number # 
function player.speed(k) end
--- A factor on the forward speed factor (balance PLAYER_FORWARD_SPEED_SCALE). Kept until your mod unloads (every hunt); nil puts the game's value back.
---@param k? number 0-20
---@return number # 
function player.runScale(k) end
--- A factor on his jumps (800 + forward speed x 800). Kept until your mod unloads (every hunt); nil puts the game's value back.
---@param k? number 0-20
---@return number # 
function player.jumpPower(k) end
--- Gravity (3000). Kept until your mod unloads (every hunt); nil puts the game's value back.
---@param g? number units/s² (0-100000)
---@return number # 
function player.gravity(g) end
--- His standing eye height (256). 180 or lower is a crouch: creatures see him worse (the game's own rule), shots start lower. Kept until your mod unloads (every hunt); nil puts the game's value back.
---@param h? number 16-2048
---@return number # 
function player.eyeHeight(h) end
--- Regeneration (4/s). Kept until your mod unloads (every hunt); nil puts the game's value back.
---@param r? number health per second
---@return number # 
function player.regenRate(r) end
--- Health lost per second under water (12). Kept until your mod unloads (every hunt); nil puts the game's value back.
---@param r? number 
---@return number # 
function player.drownRate(r) end
--- Health lost per second in poisonous fog (64). Kept until your mod unloads (every hunt); nil puts the game's value back.
---@param r? number 
---@return number # 
function player.fogRate(r) end
--- Starts the evacuation as the in-game menu's exit does (credits are paid at its end).
---@return boolean # true when it started
---@return string? # why not
function player.evacuate() end
--- Relocates him as the map's RELOCATE button: the cooldown, a relocation of the profile (Dinosaur Hunter), the fade. The target is kept inside the map.
---@param x number 
---@param z number 
---@return boolean # true when it started
---@return string? # why not
function player.relocate(x, z) end
--- A resupply as the RESUPPLY button (one of hunt.resupplies; not in water unless hunt.rules.resupplyInWater).
---@return boolean # true when the supply ship comes
---@return string? # why not
function player.resupply() end
--- Every member of the hunter's struct (the raw layer).
---@return table # FieldInfo list
function player.fields() end
--- One member (nothing outside a hunt).
---@param name string 
---@return any # 
function player.get(name) end
--- One member (health: above 0, at most maxHealth).
---@param name string 
---@param value any 
function player.set(name, value) end

world = {}
--- Adds a creature. Species the hunt did not load are loaded first (a short pause). Fires spawn.
---@param species string|integer species id or type, e.g. "trex"
---@param x number 
---@param z number (it stands on the ground)
---@param yaw? number heading in degrees (default: facing the hunter)
---@return Creature|nil # the new creature, nil when it could not be added (logged)
function world.spawn(species, x, z, yaw) end
--- Adds a creature in front of the hunter, facing him.
---@param species string|integer species id or type
---@param distance? number units in front of the hunter (default 1500)
---@return Creature|nil # 
function world.spawnNear(species, distance) end
--- The point on the ground in front of the hunter.
---@param distance? number default 1000
---@return number # x
---@return number # y (ground)
---@return number # z
function world.inFront(distance) end
--- Finds creatures: living ones by default; dead = true for bodies only, all = true for both. Distances are from x, z when given, else from the hunter.
---@param filter? string|integer|table species id, or {species=, radius=, x=, z=, team=, dead=, all=}
---@return table # a list of Creature, nearest first
function world.creatures(filter) end
--- The nearest matching creature.
---@param filter? string|integer|table as world.creatures
---@return Creature|nil # 
function world.nearest(filter) end
--- How many living (or matching) creatures there are.
---@param filter? string|integer|table as world.creatures
---@return integer # 
function world.count(filter) end
--- The creature in a slot (see Creature.index).
---@param index integer a character index
---@return Creature|nil # 
function world.get(index) end
--- Finds a creature again by its id.
---@param id integer a Creature.id
---@return Creature|nil # nil when it no longer exists
function world.byId(id) end
--- Every living creature dies.
function world.killAll() end
--- Every living creature disappears (bodies stay).
function world.removeAll() end
--- Every dead body disappears.
function world.clearBodies() end
--- Creature fights: predators hunt the nearest prey (or other predators), creatures with teams hunt every other team. Bites deal damage over time; creature_damage fires for each.
---@param on? boolean switch
---@return boolean # whether creatures fight
function world.fights(on) end
--- Every creature's team back to 0.
function world.clearTeams() end
--- God mode: the hunter takes no damage and cannot die.
---@param on? boolean switch
---@return boolean # 
function world.god(on) end
--- Creatures do not notice the hunter (no sight, smell or hearing).
---@param on? boolean switch
---@return boolean # 
function world.invisible(on) end
--- Every creature stands still; the hunter still moves.
---@param on? boolean switch
---@return boolean # 
function world.frozen(on) end
--- The creature the player drives (c:possess).
---@return Creature|nil # 
function world.possessed() end
--- Back to the hunter.
function world.unpossess() end
--- Terrain height.
---@param x number 
---@param z number 
---@return number # the ground height there
function world.ground(x, z) end
--- Water at a point.
---@param x number 
---@param z number 
---@return number? # the water surface height, nothing on dry land
function world.water(x, z) end
--- Every species of this game that can be spawned (content packs' too). Ice Age's list has its animals, Dinosaur Hunter's the dinosaurs (the species tables below). Since API 3, world.species(id) returns the species itself, to read and change (SpeciesHandle).
---@param id? string|integer since API 3: one species
---@return table|SpeciesHandle # without id: a list of {id, type, name, predator, loaded}; with id: the species
function world.species(id) end
--- What a straight line hits first (the game's own shot tracer): line of sight, explosions, lasers.
---@param x1 number 
---@param y1 number 
---@param z1 number 
---@param x2 number 
---@param y2 number 
---@param z2 number 
---@return string? # "terrain", "water", "object" or "creature"; nothing when the line is free
---@return number? # x of the point hit
---@return number? # y
---@return number? # z
---@return Creature? # the creature hit
function world.trace(x1, y1, z1, x2, y2, z2) end
---@type Weather
world.weather = nil -- The loaded map's weather (fields and methods on the Types page).
---@type Wind
world.wind = nil -- The wind.
--- The loaded map's time of day.
---@return string? # "dawn", "day" or "night"
function world.time() end
--- The time of day of the hunts loaded from now on (switching it in a running hunt would need the sky, shadows and sounds loaded again). Kept until your mod unloads.
---@param t? string "dawn", "day", "night"; nil = the hunt menu's choice
---@return string? # 
function world.nextTime(t) end
--- A random point of the map (or of a zone) that meets the conditions: on land by default, never in water.
---@param opts? table conditions, all optional: zone (a Zone or its name), water = true (in water; default: on land), nearWater / awayFromWater (distances), minHeight / maxHeight (ground height), maxSlope, minHunterDistance / maxHunterDistance, species (a place that species can stand on, the game's own test)
---@return number? # x
---@return number? # z (nothing when no point was found)
function world.randomPoint(opts) end
--- How steep the ground is at a point.
---@param x number 
---@param z number 
---@return number # ground rise per unit (0 flat, 1 = 45 degrees)
function world.slope(x, z) end
--- Whether there is water within radius of a point.
---@param x number 
---@param z number 
---@param radius? number default 1024
---@return boolean # 
function world.nearWater(x, z, radius) end

camera = {}
--- The camera follows a creature; the mouse orbits around it. The hunter moves with the camera, so creatures may notice him: combine with world.invisible. When it ends (camera.follow(nil), the creature is gone, the scripts unload), the hunter stays where the camera took him: move him back yourself (player.teleport) if he should be where he was.
---@param creature Creature|nil nil = the hunter's own view again
---@param distance? number distance behind it
function camera.follow(creature, distance) end
--- The creature the camera follows.
---@return Creature|nil # 
function camera.following() end
--- Distance of the follow camera (default 1500 plus the creature's size).
---@param distance? number new distance
---@return number # the distance
function camera.distance(distance) end
--- Slowly circles the followed creature (for showcases).
---@param degreesPerSecond number 0 = off
function camera.orbit(degreesPerSecond) end

ui = {}
--- A window. Call it from a draw handler every frame it should show.
---@param title string window title (also its identity)
---@param fn function draws the widgets
---@param options? table x, y, w, h (first placement; with fixed = true every frame), alpha, closable, noTitle, noResize, noMove, noScroll, autoResize, noBackground, noInput, noCollapse, noFocus
---@return boolean # false when the player closed it (closable windows)
function ui.window(title, fn, options) end
--- Adds a tab to the mod menu (F1). Call once (e.g. at load); the function runs every frame the tab is shown. Calling again with the same title replaces it.
---@param title string tab title
---@param fn function draws the tab's widgets
function ui.panel(title, fn) end
--- Removes one of your mod menu tabs.
---@param title string 
function ui.removePanel(title) end
--- Shows the mouse cursor during a hunt (mouse look pauses) so your windows can be clicked.
---@param on boolean 
function ui.cursor(on) end
--- A short message at the bottom right.
---@param text string 
---@param seconds? number default 4
---@param color? string|table 
function ui.toast(text, seconds, color) end
--- Whether the mod menu (F1) is open.
---@return boolean # 
function ui.menuOpen() end
--- The window size in UI units.
---@return number # width
---@return number # height
function ui.screen() end
--- A line of text.
---@param ... any values joined by spaces
function ui.text(...) end
--- Coloured text.
---@param color string|table 
---@param text string 
function ui.textColored(color, text) end
--- Text wrapped at the window edge.
---@param text string 
function ui.textWrapped(text) end
--- Greyed-out text (hints).
---@param text string 
function ui.textDisabled(text) end
--- A bullet point.
---@param text string 
function ui.bullet(text) end
--- A separator line with a title.
---@param text string 
function ui.heading(text) end
--- A button.
---@param label string 
---@param w? number width
---@param h? number height
---@return boolean # true the frame it was clicked
function ui.button(label, w, h) end
--- A small button that fits into a line of text.
---@param label string 
---@return boolean # clicked
function ui.smallButton(label) end
--- A checkbox.
---@param label string 
---@param value boolean current value
---@return boolean # the value (changed when clicked)
---@return boolean # true when it changed
function ui.checkbox(label, value) end
--- A radio button.
---@param label string 
---@param active boolean whether this option is the chosen one
---@return boolean # clicked
function ui.radio(label, active) end
--- A slider for numbers.
---@param label string 
---@param value number 
---@param min number 
---@param max number 
---@param format? string printf format, default "%.2f"
---@return number # the value
---@return boolean # changed
function ui.slider(label, value, min, max, format) end
--- A slider for whole numbers.
---@param label string 
---@param value integer 
---@param min integer 
---@param max integer 
---@return integer # value
---@return boolean # changed
function ui.sliderInt(label, value, min, max) end
--- A number changed by dragging.
---@param label string 
---@param value number 
---@param speed? number per pixel dragged (default 1)
---@param min? number 
---@param max? number 
---@return number # value
---@return boolean # changed
function ui.drag(label, value, speed, min, max) end
--- A text field (up to 4095 bytes).
---@param label string 
---@param text? string current text
---@param hint? string grey text while empty
---@return string # the text
---@return boolean # changed
function ui.input(label, text, hint) end
--- A multi-line text field (16 KB).
---@param label string 
---@param text? string 
---@param w? number 
---@param h? number 
---@return string # text
---@return boolean # changed
function ui.inputMultiline(label, text, w, h) end
--- A number field.
---@param label string 
---@param value number 
---@param step? number +/- buttons step (default 1)
---@return number # value
---@return boolean # changed
function ui.inputNumber(label, value, step) end
--- A whole-number field.
---@param label string 
---@param value integer 
---@param step? integer 
---@return integer # value
---@return boolean # changed
function ui.inputInt(label, value, step) end
--- A drop-down list.
---@param label string 
---@param index integer the chosen item, 1-based
---@param items table a list of strings
---@return integer # the chosen index
---@return boolean # changed
function ui.combo(label, index, items) end
--- A clickable line (lists).
---@param label string 
---@param selected? boolean shown highlighted
---@return boolean # clicked
function ui.selectable(label, selected) end
--- A colour picker.
---@param label string 
---@param color string|table current colour
---@return table # {r, g, b, a} 0-1
---@return boolean # changed
function ui.color(label, color) end
--- A progress bar.
---@param fraction number 0-1
---@param label? string text on the bar
---@param w? number width
function ui.progress(fraction, label, w) end
--- A horizontal line.
function ui.separator() end
--- The next widget goes on the same line.
---@param offset? number x position
---@param spacing? number 
function ui.sameLine(offset, spacing) end
--- A little vertical space.
function ui.spacing() end
--- An empty line.
function ui.newLine() end
--- Indents the following widgets.
---@param w? number 
function ui.indent(w) end
--- Undoes ui.indent.
---@param w? number 
function ui.unindent(w) end
--- Empty space of a size.
---@param w number 
---@param h number 
function ui.dummy(w, h) end
--- A collapsible section header.
---@param label string 
---@param open? boolean open at first
---@return boolean # true while open
function ui.collapsing(label, open) end
--- A tree node.
---@param label string 
---@param fn function draws the children
---@param open? boolean open at first
---@return boolean # open
function ui.tree(label, fn, open) end
--- A tab bar.
---@param id string 
---@param fn function calls ui.tab for each tab
function ui.tabs(id, fn) end
--- One tab, inside ui.tabs.
---@param label string 
---@param fn function draws the tab
---@return boolean # true while this tab is shown
function ui.tab(label, fn) end
--- A table.
---@param id string 
---@param columns integer 1-64
---@param fn function fills it with ui.nextRow / ui.nextColumn
---@param headers? table column titles
function ui.table(id, columns, fn, headers) end
--- Starts a table row (and its first cell).
function ui.nextRow() end
--- Moves to the next cell of the row.
---@return boolean # whether the cell is visible
function ui.nextColumn() end
--- A scrolling region inside a window.
---@param id string 
---@param w? number 0 = all
---@param h? number 0 = all
---@param fn function 
---@param border? boolean 
function ui.child(id, w, h, fn, border) end
--- Groups widgets (so ui.sameLine treats them as one).
---@param fn function 
function ui.group(fn) end
--- Widgets inside get a separate identity (loops with repeated labels).
---@param id any 
---@param fn function 
function ui.id(id, fn) end
--- A popup, opened with ui.openPopup.
---@param id string 
---@param fn function 
---@return boolean # open
function ui.popup(id, fn) end
--- Opens a popup.
---@param id string 
function ui.openPopup(id) end
--- Closes the popup the code runs in.
function ui.closePopup() end
--- A tooltip for the last widget when hovered.
---@param text string 
function ui.tooltip(text) end
--- Whether the mouse is over the last widget.
---@return boolean # 
function ui.hovered() end
--- Whether the last widget was clicked.
---@return boolean # 
function ui.clicked() end
--- Width of the next widget.
---@param w number 
function ui.width(w) end
--- Text size of the current window.
---@param factor number 
function ui.scale(factor) end
--- Space left in the window.
---@return number # width
---@return number # height
function ui.available() end
--- An image as a widget.
---@param file string a PNG or TGA file of your mod (path in its folder), or a game file by name
---@param w? number width (default: the image's)
---@param h? number height (default: keeps the shape)
---@return boolean # false when the image could not be loaded (logged once)
function ui.image(file, w, h) end

draw = {}
--- Text with a soft shadow. In the gui event with the game's fonts, size = the text height in game units (default the font's).
---@param x number 
---@param y number 
---@param text any 
---@param color? string|table default white
---@param size? number font size (default the UI font)
---@param align? string "left" (default), "center" or "right" of x
---@param font? string in the gui event: one of the game's fonts (ofs15 default, ofs13, lith18, ccra14)
function draw.text(x, y, text, color, size, align, font) end
--- The size text would take.
---@param text string 
---@param size? number 
---@param font? string one of the game's fonts: the size in game units
---@return number # width
---@return number # height
function draw.textSize(text, size, font) end
--- A line.
---@param x1 number 
---@param y1 number 
---@param x2 number 
---@param y2 number 
---@param color? string|table 
---@param thickness? number default 1
function draw.line(x1, y1, x2, y2, color, thickness) end
--- A rectangle outline.
---@param x number 
---@param y number 
---@param w number 
---@param h number 
---@param color? string|table 
---@param thickness? number 
---@param rounding? number corner radius
function draw.rect(x, y, w, h, color, thickness, rounding) end
--- A filled rectangle.
---@param x number 
---@param y number 
---@param w number 
---@param h number 
---@param color? string|table 
---@param rounding? number 
function draw.fillRect(x, y, w, h, color, rounding) end
--- A circle outline.
---@param x number 
---@param y number 
---@param r number radius
---@param color? string|table 
---@param thickness? number 
function draw.circle(x, y, r, color, thickness) end
--- A filled circle.
---@param x number 
---@param y number 
---@param r number 
---@param color? string|table 
function draw.fillCircle(x, y, r, color) end
--- A filled triangle (arrows, markers).
---@param x1 number 
---@param y1 number 
---@param x2 number 
---@param y2 number 
---@param x3 number 
---@param y3 number 
---@param color? string|table 
function draw.fillTriangle(x1, y1, x2, y2, x3, y3, color) end
--- A filled bar: health bars, progress.
---@param x number 
---@param y number 
---@param w number 
---@param h number 
---@param fraction number 0-1
---@param color? string|table default green
---@param background? string|table default translucent black
function draw.bar(x, y, w, h, fraction, color, background) end
--- The screen size in UI units.
---@return number # width
---@return number # height
function draw.screen() end
--- Draws an image: PNG (any common kind, not interlaced) or TGA. Loaded on first use and kept.
---@param file string a PNG or TGA file of your mod (path in its folder), or a game file by name
---@param x number 
---@param y number 
---@param w? number width (default: the image's)
---@param h? number height (default: keeps the shape)
---@param color? string|table tint, and alpha for transparency
---@return boolean # false when the image could not be loaded (logged once)
function draw.image(file, x, y, w, h, color) end
--- An image's size in pixels (nothing when it cannot be loaded).
---@param file string 
---@return integer? # width
---@return integer? # height
function draw.imageSize(file) end
--- Draws one of the game's sprites. In the gui event in game units, inside the game's GUI; in the draw event in UI units, as large as the game shows it, over everything.
---@param name string a sprite of the game (ui/.cfg: button_dino_active_9, icon_radar ...), of your sprite file, or a .tga file
---@param x number left edge (centre with center = true)
---@param y number top edge
---@param options? table scale, w, h (size), color (tint), angle (degrees), center, flipX, flipY, layer (gui pass)
function draw.sprite(name, x, y, options) end
--- A sprite's size (as menu.spriteSize).
---@param name string 
---@return number|nil # width in game units
---@return number|nil # height
function draw.spriteSize(name) end

hud = {}
--- Hides parts of the game's HUD.
---@param name string an element, or "all"
---@param ... any more elements
function hud.hide(name, ...) end
--- Shows hidden parts again.
---@param name string an element, or "all"
---@param ... any more elements
function hud.show(name, ...) end
--- Whether a part is shown.
---@param name string an element
---@return boolean # 
function hud.shown(name) end
--- Moves a part of the HUD by dx, dy from its own place (0, 0 puts it back); without dx, dy it only returns the offset.
---@param name string a movable element
---@param dx? number to the right
---@param dy? number down
---@return number # dx
---@return number # dy
function hud.offset(name, dx, dy) end
--- Makes a part of the HUD bigger or smaller; without a factor it only returns it. The compass grows away from its corner, texts and bars around their own place.
---@param name string a movable element
---@param factor? number its size: 1 = normal (0.25 to 4)
---@return number # the factor
function hud.scale(name, factor) end
--- Every element, for menus that list them.
---@return table # {{name, description, movable, shown, scale}, ...}
function hud.elements() end
--- Shows every part, normal size, in its own place.
function hud.reset() end
--- Opens the hunt's menu (ESCAPE / RESTART / OPTIONS), like Esc. Not while the hunter is dead or being evacuated.
---@return boolean # whether the menu is open now
function hud.openMenu() end
--- Closes the hunt's menu.
---@return boolean # whether it was open
function hud.closeMenu() end
--- Whether the hunt's menu is open.
---@return boolean # 
function hud.menuOpen() end

sound = {}
--- Plays a sound for the hunter (not positioned).
---@param file string a .wav file name
---@param volume? number 0-1 (default 1)
---@return boolean # false when it could not be played
function sound.play(file, volume) end
--- Plays a sound at a point of the world.
---@param file string 
---@param x number 
---@param y number 
---@param z number 
---@param volume? number 
---@param radius? number how far it carries (default 8000)
---@return boolean # 
function sound.playAt(file, x, y, z, volume, radius) end

keys = {}
--- Calls fn when the key goes down. The game does not see the key, unless fn returns false. With touch, a phone shows an on-screen button for the key (see touch.button); the PC only has the key.
---@param key string key name
---@param fn function fn(e), the key event
---@param options? integer|table a priority, or a table: priority, touch (a touch.button options table: on a phone a button that presses this key; since API 3)
---@return integer # listener id (events.off)
function keys.bind(key, fn, options) end
--- Whether a key is held right now.
---@param key string key name
---@return boolean # true while held
function keys.down(key) end
--- Mouse position and buttons.
---@return number # x
---@return number # y
---@return boolean # left button
---@return boolean # right
---@return boolean # middle
function keys.mouse() end
--- The player's keys for one of the game's actions.
---@param action string a game action: "fire", "jump", "map" ... (see above)
---@return string? # the first key / button, e.g. "Mouse Left" or "Space"
---@return string? # the second one
function keys.binding(action) end

touch = {}
--- Adds an on-screen button (Android). It needs a key, an onTap function, or both. Without x and y it takes the next free place along the right edge, under the game's own buttons there, with the other buttons placed that way (a column further left when one is full); x / y below 0 count from the right / bottom edge.
---@param options table label (text), key (a key name: a tap presses it, the mod's keys.bind runs), onTap (fn(id): called on a tap), x, y, size (default 72) or w, h (mod pixels), when ("hunt", "menus", "always")
---@return integer # button id
function touch.button(options) end
--- Removes a button.
---@param id integer a button id
---@return boolean # true when it was there
function touch.remove(id) end
--- Changes a button's text (a toggle can show its state).
---@param id integer a button id
---@param text string 
function touch.label(id, text) end
--- Whether touch buttons show here.
---@return boolean # true on a phone, where the buttons show
function touch.available() end

timer = {}
--- Runs fn once after a delay.
---@param seconds number 
---@param fn function fn(id)
---@return integer # timer id
function timer.after(seconds, fn) end
--- Runs fn again and again. A failing repeating timer is stopped.
---@param seconds number interval
---@param fn function fn(id)
---@return integer # timer id
function timer.every(seconds, fn) end
--- Stops a timer.
---@param id integer 
---@return boolean # true when it was running
function timer.cancel(id) end
--- Seconds since the scripts started.
---@return number # seconds
function timer.now() end

mod = {}
---@type string
mod.id = nil -- your mod's id: its folder or zip name
---@type string
mod.name = nil -- the name from mod.json
---@type string
mod.version = nil -- the version from mod.json
---@type table
mod.exports = nil -- what other mods get with mods.get("yourid"): put functions and data here
---@type table
mod.settings = nil -- the current values of your settings (see mod.setting)
--- Declares a setting the player can change in the mod menu's Settings tab. Values are saved; read them from mod.settings (always current); the setting event tells you when one changed.
---@param key string 
---@param default boolean|number|string its type sets the widget
---@param options? table label, help (tooltip), min + max (a slider), options (a list of strings: a drop-down)
---@return any # the current value (saved from earlier, or the default)
function mod.setting(key, default, options) end
--- Saves data for your mod (JSON in the game's save folder, moddata/<id>.json). One value; use a table for many.
---@param value any tables, strings, numbers, booleans
---@return boolean|nil # true, or nil and an error
function mod.save(value) end
--- Loads what mod.save saved.
---@return any # what mod.save saved, nil when nothing
function mod.load() end
--- Reads a file of your mod (e.g. JSON data).
---@param path string relative to your mod's folder
---@return string|nil # the contents
---@return string? # error
function mod.read(path) end
--- Whether your mod has the file.
---@param path string 
---@return boolean # 
function mod.exists(path) end
--- Lists files of your mod.
---@param folder? string default: the mod's folder
---@return table # names, sorted; folders end in /
function mod.files(folder) end
--- Writes a file into your mod's data folder (moddata/<id>/ in the save folder): logs, exported data, many save slots.
---@param name string a file name, may contain folders: "maps/arena1.json"
---@param text string the contents (text or binary, up to 16 MB)
---@return boolean|nil # true, or nil and an error
function mod.writeData(name, text) end
--- Reads a file of your data folder.
---@param name string 
---@return string|nil # 
function mod.readData(name) end
--- Deletes a file of your data folder.
---@param name string 
---@return boolean # 
function mod.deleteData(name) end
--- Lists the files of your data folder.
---@return table # names (with folders), sorted
function mod.dataFiles() end

mods = {}
--- Another script mod's exports (call it in or after mods_loaded).
---@param id string a mod id
---@return table|nil # its mod.exports
function mods.get(id) end
--- Every installed mod made for this game (the mods folder is shared; another game's mods are not listed).
---@return table # a list of {id, name, version, author, description, games, enabled, scripted, loaded, files, problems}; games (since API 2): the mod.json "games" list; problems (API 3): what keeps the mod from working, as its files show (the Mods screen's warnings)
function mods.list() end
--- Whether a mod is installed and on.
---@param id string 
---@return boolean # 
function mods.has(id) end
--- Reloads every script mod at the next frame (as F9).
function mods.reload() end

net = {}
--- Whether the player allowed your mod to use the network.
---@return boolean # 
function net.allowed() end
--- Asks the player for permission (once; the answer is remembered and changeable in F1 → Network). net_consent tells the answer.
---@param reason? string shown to the player
---@return boolean # true when already allowed
function net.request(reason) end
--- Hosts a session.
---@param port? integer UDP port (default 27015)
---@param name? string your player name (default: the Network tab's)
---@param maxPlayers? integer default 8
---@return boolean|nil # true, or nil and an error
function net.host(port, name, maxPlayers) end
--- Joins a session. Asynchronous: net_joined for peer 0 means you are in; net_left for peer 0 carries the reason it failed.
---@param address string IPv4 address or host name
---@param port? integer default 27015
---@param name? string your player name
---@return boolean|nil # true when the attempt started, or nil and an error
function net.join(address, port, name) end
--- Leaves the session (the host ends it for everyone).
function net.leave() end
--- The host removes a player.
---@param peer integer 
---@param reason? string 
function net.kick(peer, reason) end
--- Hosting, joining or joined.
---@return boolean # 
function net.active() end
--- Hosting, or accepted by the host.
---@return boolean # 
function net.connected() end
--- Whether this game hosts.
---@return boolean # 
function net.isHost() end
--- Your player id.
---@return integer # your id (0 = host), -1 outside a session
function net.self() end
--- Your player name.
---@return string # 
function net.name() end
--- The UDP port in use.
---@return integer # 
function net.port() end
--- The last error.
---@return string # 
function net.error() end
--- Everyone in the session, you included.
---@return table # a list of {id, name, ping, host, self}
function net.peers() end
--- Traffic statistics.
---@param peer? integer one player (default: all traffic)
---@return table # {ping, bytesSent, bytesReceived, packetsSent, packetsReceived, resends, sendRate, receiveRate}
function net.stats(peer) end
--- Sends a message.
---@param to integer|nil a player id, nil = everyone else
---@param topic string your message name, e.g. "mymod:score"
---@param data any string, number, boolean or table (as JSON)
---@param reliable? boolean default true; false for small, frequent state
---@return boolean|nil # true, or nil and an error
function net.send(to, topic, data, reliable) end
--- Listens for messages of one topic.
---@param topic string 
---@param fn function fn(e): e.from, e.topic, e.data, e.reliable
---@param priority? integer 
---@return integer # listener id (events.off)
function net.on(topic, fn, priority) end
--- Asks the local network for games (answers in net.lanGames a moment later).
---@param port? integer default 27015
---@return boolean|nil # 
function net.discover(port) end
--- Games found on the local network.
---@return table # a list of {address, port, name, players, maxPlayers}
function net.lanGames() end
--- The automatic sync of creatures, players and hits (switch it on in every game).
---@param on? boolean 
---@return boolean # whether the automatic sync is on
function net.sync(on) end
--- Tunes the automatic sync.
---@param settings? table {rate, nearRadius, sweepSeconds, hits, hunters}
---@return table # the current settings
function net.syncSettings(settings) end
--- Whether creatures notice and attack the other players too (default on).
---@param on? boolean 
---@return boolean # 
function net.huntRemotes(on) end
--- Whether this game shows the host's creatures.
---@return boolean # 
function net.mirroring() end
--- The figure of another player in your game.
---@param peer integer 
---@return Creature|nil # 
function net.standIn(peer) end
--- The player a figure stands for (nil: a normal creature).
---@param c Creature 
---@return integer|nil # 
function net.standInPeer(c) end
--- Another player's latest state.
---@param peer integer 
---@return table|nil # {x, y, z, yaw, pitch, weapon, health, inHunt, hidden}
function net.remoteHunter(peer) end
--- The creature's index in the host's game: the same number in every game.
---@param c Creature 
---@return integer|nil # 
function net.hostIndex(c) end
--- This game's handle for the host's creature.
---@param hostIndex integer 
---@return Creature|nil # 
function net.creature(hostIndex) end
--- Host: the player whose shot last hurt it.
---@param c Creature 
---@return integer|nil # 
function net.lastHitBy(c) end
--- Your own sync: the creatures' state.
---@param filter? table {huntableOnly, aliveOnly, radius}
---@return table # chunks (strings) to send
function net.packCreatures(filter) end
--- Your own sync: follow the host's creatures.
---@param chunk string 
---@return integer # creatures in it, -1 = not applicable
function net.applyCreatures(chunk) end
--- Your own sync: your hunter's state.
---@return string # 
function net.packHunter() end
--- Your own sync: show a player's figure.
---@param peer integer 
---@param data string 
---@return boolean # 
function net.applyHunter(peer, data) end
--- Your own sync: a hit for the host.
---@param c Creature 
---@param damage number 
---@param kill boolean 
---@return string # 
function net.packHit(c, damage, kill) end
--- Host: apply a player's hit.
---@param peer integer 
---@param data string 
---@return boolean # 
function net.applyHit(peer, data) end
---@type integer
net.defaultPort = nil -- 27015

content = {}
--- Species of the registry. price is the licence price the menu shows: after the rules' priceScale (as content.price).
---@param id? string|integer one species (default: all)
---@return table|nil # info, or a list of them: {id, type, name, ai, file, mod, builtin, scripted, hunt, hidden, price, unlocked, health, mass, size, radius, score, smell, hearing, sight, scaleMin, scaleRange, huntable, predator, flying, maps, spawnWeight, icon, iconColor, info}
function content.species(id) end
--- Weapons of the registry. price and ammoPrice are what the menu shows: after the rules' priceScale / ammoScale.
---@param id? string 
---@return table|nil # {id, type, slot, base, file, name, mod, builtin, hidden, price, ammoPrice, unlocked, power, precision, pellets, loudness, rate, ammo, magazine, aimFov, aimTime, icon, iconColor, info}
function content.weapons(id) end
--- Maps of the registry. price: after the rules' priceScale.
---@param id? string 
---@return table|nil # {id, terrain, name, difficulty, mod, builtin, hidden, price, unlocked, times, residents, huntable, icon, iconColor, info}
function content.maps(id) end
--- The map of the hunt being played.
---@return string|nil # 
function content.currentMap() end
--- The weapon the hunter has in a slot this hunt.
---@param slot integer 
---@return string|nil # 
function content.weaponInSlot(slot) end
--- The economy and hunt rules.
---@return table # {scoreMultiplier, unlicensedScore, comboBonus, flyerCredits, speciesPriceScale, weaponPriceScale, mapPriceScale, ammoScale, maxSpecies}
function content.rules() end
--- Adds or changes an entry at run time (new ones appear in the hunt menu).
---@param kind string "species", "weapon", "map", "equipment" or "rules"
---@param fields table the fields of the content pack JSON
---@return string|nil # the entry's id, or nil and an error
function content.define(kind, fields) end
--- A licence price as the menu shows it: after the rules' priceScale.
---@param kind string 
---@param id string 
---@return integer # -1 = unknown
function content.price(kind, id) end
--- Sets a licence price: the entry's own price, before the rules' priceScale (as price in its JSON).
---@param kind string 
---@param id string 
---@param price integer 
---@return boolean # 
function content.setPrice(kind, id, price) end
--- A weapon's ammunition price, after the rules' ammoScale.
---@param weapon string 
---@return integer # 
function content.ammoPrice(weapon) end
--- Sets it (before ammoScale).
---@param weapon string 
---@param price integer 
---@return boolean # 
function content.setAmmoPrice(weapon, price) end
--- One of the game's balance values.
---@param key string a balance value of the game, e.g. "RESUPPLIES_COST"
---@return number # 
function content.balance(key) end
--- Sets a balance value.
---@param key string 
---@param value number 
---@return boolean # 
function content.setBalance(key, value) end
--- Whether the player owns the licence.
---@param kind string 
---@param id string 
---@return boolean # 
function content.unlocked(kind, id) end
--- Gives (or takes) a licence.
---@param kind string 
---@param id string 
---@param on? boolean default true
function content.unlock(kind, id, on) end
--- Replaces the AI of every creature of a species with your function, every frame. Move and animate the creature there (c:move, c.yaw, c.anim, c:animate(e.dt)).
---@param species string|integer 
---@param fn function|nil fn(e) with e.creature, e.dt; nil = the game's AI again
function content.drive(species, fn) end
--- Reads every enabled mod's content packs again.
function content.reload() end
--- A report of the registry.
---@return string # one line per entry and the mods that set it
function content.report() end
--- The species whose AI a new species can use.
---@return table # species ids
function content.aiNames() end
--- Equipment of the registry: the game's camouflage, cover_scent, tranquilizer and radar, and the mods' items. on: switched on in the hunt menu; equipped: on in the hunt being played.
---@param id? string one item (default: all)
---@return table|nil # {id, name, info, icon, mod, builtin, hidden, price, scoreBonus, sight, smell, radar, tranquilizer, default, order, on, equipped}
function content.equipment(id) end
--- Whether the item is on in the hunt being played (false outside hunts and in observer mode): the place for effects of your own.
---@param id string an equipment id
---@return boolean # 
function content.equipped(id) end
--- Switches an item in the hunt menu (for the next hunt).
---@param id string 
---@param on boolean 
---@return boolean # true when it is so now
function content.setEquipment(id, on) end

json = {}
--- Lua value to JSON text.
---@param value any 
---@param pretty? boolean indented
---@return string # 
function json.encode(value, pretty) end
--- JSON text to a Lua value.
---@param text string JSON (comments and trailing commas allowed)
---@return any # the value, nil on error
---@return string? # error
function json.decode(text) end

--- v limited to lo..hi.
---@param v number 
---@param lo number 
---@param hi number 
---@return number # 
function math.clamp(v, lo, hi) end
--- Linear blend from a to b.
---@param a number 
---@param b number 
---@param t number 0-1
---@return number # 
function math.lerp(a, b, t) end
--- Rounds to the nearest step.
---@param v number 
---@param step? number default 1
---@return number # 
function math.round(v, step) end
--- The sign.
---@param v number 
---@return integer # -1, 0 or 1
function math.sign(v) end
--- Distance on the ground.
---@param x1 number 
---@param z1 number 
---@param x2 number 
---@param z2 number 
---@return number # 
function math.dist(x1, z1, x2, z2) end
--- Distance in 3D.
---@param x1 number 
---@param y1 number 
---@param z1 number 
---@param x2 number 
---@param y2 number 
---@param z2 number 
---@return number # 
function math.dist3(x1, y1, z1, x2, y2, z2) end
--- The yaw that looks from point 1 to point 2.
---@param x1 number 
---@param z1 number 
---@param x2 number 
---@param z2 number 
---@return number # degrees
function math.yaw(x1, z1, x2, z2) end
--- The direction of a yaw.
---@param yaw number degrees
---@return number # dx
---@return number # dz
function math.forward(yaw) end
--- The shortest turn from yaw a to yaw b.
---@param a number 
---@param b number 
---@return number # -180..180
function math.angleDiff(a, b) end
--- Splits a string.
---@param s string 
---@param sep? string default ","
---@param plain? boolean false = sep is a Lua pattern
---@return table # the parts
function string.split(s, sep, plain) end
--- Without spaces at both ends.
---@param s string 
---@return string # 
function string.trim(s) end
--- 
---@param s string 
---@param prefix string 
---@return boolean # 
function string.startsWith(s, prefix) end
--- 
---@param s string 
---@param suffix string 
---@return boolean # 
function string.endsWith(s, suffix) end
--- A shallow copy.
---@param t table 
---@return table # 
function table.copy(t) end
--- A full copy (nested tables too).
---@param t table 
---@return table # 
function table.deepcopy(t) end
--- The keys as a list.
---@param t table 
---@return table # 
function table.keys(t) end
--- The values as a list.
---@param t table 
---@return table # 
function table.values(t) end
--- Number of entries (any keys).
---@param t table 
---@return integer # 
function table.count(t) end
--- 
---@param t table 
---@param value any 
---@return any # its key, nil when absent
function table.find(t, value) end
--- 
---@param t table 
---@param value any 
---@return boolean # 
function table.contains(t, value) end
--- 
---@param t table a list
---@param fn function fn(value, index) -> new value
---@return table # 
function table.map(t, fn) end
--- 
---@param t table a list
---@param fn function fn(value, index) -> keep?
---@return table # 
function table.filter(t, fn) end
--- 
---@param t table a list
---@return table # the same list, shuffled
function table.shuffle(t) end

weapons = {}
--- A weapon definition.
---@param id string|integer a weapon id ("rifle") or type
---@return Weapon # 
function weapons.get(id) end
--- Every weapon of the content registry.
---@return table # Weapon list
function weapons.list() end
--- A factor on every shot's spread (0 = dead accurate). Kept until your mod unloads.
---@param k? number 0-100 (nil = 1)
---@return number # 
function weapons.spreadScale(k) end
--- A factor on the shot's range (76 cells).
---@param k? number 0.01-10
---@return number # 
function weapons.rangeScale(k) end
--- A factor on the camera kick of each shot.
---@param k? number 0-100
---@return number # 
function weapons.recoilScale(k) end

equipment = {}
--- Camouflage: creatures see the hunter worse.
---@param on? boolean 
---@return boolean # 
function equipment.camouflage(on) end
--- Cover scent: creatures smell him worse.
---@param on? boolean 
---@return boolean # 
function equipment.scent(on) end
--- Radar: the map shows the hunt's species (no no-radar bonus).
---@param on? boolean 
---@return boolean # 
function equipment.radar(on) end
--- Tranquilizer: kills are sleep (no blood, no drop ship; some AIs have their own death).
---@param on? boolean 
---@return boolean # 
function equipment.tranquilizer(on) end
--- The binoculars up.
---@param on? boolean 
---@return boolean # 
function equipment.binoculars(on) end
--- Observer mode (camera only; chosen when the hunt starts).
---@return boolean # 
function equipment.observer() end
--- The double-score purchase (read only).
---@return boolean # 
function equipment.doubleScore() end

hunt = {}
--- Credits earned this hunt (paid when he evacuates alive).
---@param n? integer 
---@return integer # 
function hunt.credits(n) end
--- Seconds before the next relocation.
---@param s? number 
---@return number # 
function hunt.relocateCooldown(s) end
--- Resupplies left (Dinosaur Hunter: the profile's count; Ice Age: one per hunt).
---@param n? integer 
---@return integer # 
function hunt.resupplies(n) end
--- Relocations left (Dinosaur Hunter: the profile's count).
---@param n? integer 
---@return integer? # nil in Ice Age (not counted)
function hunt.relocations(n) end
--- The call (decoy): which species it imitates.
---@param species? string|integer one of hunt.licensed()
---@return string? # the call's species
function hunt.call(species) end
--- Seconds before the next call (3 after one).
---@param s? number 
---@return number # 
function hunt.callCooldown(s) end
--- Trophies taken this hunt.
---@return integer # 
function hunt.trophyCount() end
--- This hunt's trophies.
---@return table # {species, weapon, pose, points, scale, distance}...
function hunt.trophies() end
--- This hunt's statistics.
---@return table # {shots, hits, hunted, mapOpened, binoculars, calls, relocations, resupplies, timeAlive, distanceWalked, distanceSwum, weapons = {{shots, hits}...}, bySpecies}
function hunt.stats() end
--- The species licensed for this hunt.
---@return table # species ids
function hunt.licensed() end
--- The trophy drop ship.
---@return table # {state = "idle" | "approaching" | "lowering" | "lifting" | "leaving", carrying, queue, x, y, z}
function hunt.ship() end
--- The supply ship and its bag.
---@return table # {state = "none" | "approaching" | "dropped", bag = "none" | "falling" | "ground", inProgress, x, y, z}
function hunt.supply() end
--- Survive mode's state (Dinosaur Hunter; nil otherwise).
---@return table? # {wave, score, kills, killScore, accuracyBonus, time, nextWave}
function hunt.survive() end
--- A balance value of the game for this session (content.setBalance is the permanent one). Only values the game reads when used act at once (SCORE_BONUS_, RESUPPLIES_COST, RELOCATIONS_COST, PLAYER_FORWARD_SPEED_SCALE); undone when your mod unloads.
---@param key string a balance value ("SCORE_BONUS_CAMOUFLAGE")
---@param value? number nil = the game's
---@return number? # 
function hunt.balance(key, value) end
---@type HuntRules
hunt.rules = nil -- Session rules: relocation and evacuation delays, the resupply threshold and water rule, the score rules and the equipment bonuses.
--- Every member of the hunt state (Game, the characters manager, the hunt GUI: the raw layer).
---@return table # FieldInfo list
function hunt.fields() end
--- One member.
---@param name string 
---@return any # 
function hunt.get(name) end
--- One member.
---@param name string 
---@param value any 
function hunt.set(name, value) end

profile = {}
--- The credits (player.credits / addCredits too).
---@param n? integer 0-999999999
---@return integer # 
function profile.credits(n) end
--- Relocations owned (Ice Age does not use them).
---@param n? integer 
---@return integer # 
function profile.relocations(n) end
--- Resupplies owned (Ice Age gives one per hunt).
---@param n? integer 
---@return integer # 
function profile.resupplies(n) end
--- The trophy room's trophies.
---@return table # {slot, species, weapon, time, points, scale, range, locked}...
function profile.trophies() end
--- Lifetime statistics.
---@return table # {timePlayed, distance, shots, hits, surviveScore, surviveWaves, surviveTime}
function profile.stats() end
--- Every member of the profile (the raw layer).
---@return table # FieldInfo list
function profile.fields() end
--- One member.
---@param name string 
---@return any # 
function profile.get(name) end
--- One member (logged).
---@param name string 
---@param value any 
function profile.set(name, value) end

ai = {}
--- What c.brain takes besides a function.
---@return table # the brain names: "prey", "predator", "defender" and every species id of this game
function ai.brains() end
--- Whether the creature can run that species' AI: its model needs at least as many animations (the species is loaded when the hunt did not), and flyers and walkers do not mix. The generic brains fit every creature.
---@param c Creature 
---@param brain string|integer|string a species or a brain name
---@return boolean # 
---@return string? # why not
function ai.compatible(c, brain) end
--- c.brain = brain, with a way past the compatibility check.
---@param c Creature 
---@param brain any as c.brain
---@param force? boolean skip the animation check (at your own risk)
function ai.setBrain(c, brain, force) end
--- Every creature of the species runs this brain (a creature's own c.brain comes first).
---@param species string|integer 
---@param brain any as c.brain; nil = the species' own again
---@param force? boolean skip the animation check
function ai.setSpeciesBrain(species, brain, force) end
--- One frame of a brain, from inside your own: mix behaviours.
---@param c Creature 
---@param brain string|integer|string a species, "prey", "predator" or "defender"
function ai.run(c, brain) end
--- A species' animations and speeds as its AI uses them.
---@param c Creature|string|integer 
---@return table? # {walk, run, idle, roar, kill, jump (missing = none), walkSpeed, runSpeed (units per second, x scale), idles (a list), predator, attacks, flyer}
function ai.anims(c) end
--- The calm idles c:idle plays for this species (and ai.anims(...).idles, the possession's standing) instead of its AI's list. Species whose AI never stands (Dinosaur Hunter's raptors, the Allosaurus) have none; their models often have spare animations. A content pack's species uses its AI species' list unless it has its own. Undone when the scripts unload (listed in game.changes()).
---@param species string|integer 
---@param anims table|nil animation numbers; nil = its AI's own list again
function ai.setIdles(species, anims) end
--- Its AI's raw state (c.mood is the readable one).
---@param c Creature 
---@return string # "calm", "alarmed", "noticed" or "looking"
---@return integer # the raw state
---@return number # fear seconds
function ai.state(c) end
--- Starts an AI frame: remembers its animation and time (for phaseChanging) and the distances the helpers read. Call it once per frame before the other helpers.
---@param c Creature 
---@param front? number where the hunter is measured from, ahead of its feet
---@return number # distance to its walk target
---@return number # distance to the hunter
function ai.begin(c, front) end
--- The blend and the clock of its current animation (the AIs' loop flag).
---@param c Creature 
---@return boolean # the animation looped (time to pick the next one)
function ai.animate(c) end
--- AIGen_PhaseChanging: switches to the animation with the game's blend and plays its sound.
---@param c Creature 
---@param phase? integer the animation to play from now
---@param blend? boolean carry the step over (walk <-> run)
---@param soundChance? number -1 = its sound every time
function ai.phaseChanging(c, phase, blend, soundChance) end
--- AIGen_RotationToTargetAlpha: turns it toward its target heading (selectWay sets it).
---@param c Creature 
---@param rotate? boolean default true
---@param slowPhase? integer it turns slower in this animation
---@param minSpeed? number default 0.4
---@param k? number default 1.5
---@param afraidK? number default 1.5
---@param mode? integer 0-3: how quickly it gets into the turn
---@return number # degrees still to turn
function ai.rotate(c, rotate, slowPhase, minSpeed, k, afraidK, mode) end
--- AIGen_ThinkSpeed: speeds up or slows down to speed, moves it along its heading with the terrain collision and tilts it to the ground.
---@param c Creature 
---@param speed number units per ms (x scale): the Wolf walks 0.32, runs 2.048
---@param phase? integer its walk animation (it leans in turns)
---@param gammaK? number 
---@param gammaK2? number 
---@param glim? number 
function ai.thinkSpeed(c, speed, phase, gammaK, gammaK2, glim) end
--- AIGen_SelectWay: its heading toward its walk target, around obstacles and water.
---@param c Creature 
---@param playerR? number default 2048
---@param wobble? boolean 
---@param wobbleFreq? number 
---@param wobbleAmp? number 
---@param water? boolean avoid water (default true)
---@param maxTries? integer 
---@param waitBase? integer 
---@param waitRnd? number 
function ai.selectWay(c, playerR, wobble, wobbleFreq, wobbleAmp, water, maxTries, waitBase, waitRnd) end
--- AIGen_ExploreArea: wandering.
---@param c Creature 
---@param radius? number default 8048
---@return boolean # false when it reached its target and picked a new one
function ai.exploreArea(c, radius) end
--- AIGen_Eat: kills the hunter when he is within reach of its mouth (AddDeadBody).
---@param c Creature 
---@param stop? boolean 
---@param state? integer 
---@param phase? integer its attack animation
---@param deadPhase? integer the hunter's death animation
function ai.eat(c, stop, state, phase, deadPhase) end
--- LookForAWay: turns its target heading away from obstacles.
---@param c Creature 
---@param water? boolean avoid water
---@param objects? boolean avoid trees and rocks
---@return number # the free heading it found (yaw)
function ai.lookForAWay(c, water, objects) end
--- MoveCharacter: a step with the terrain collision (it slides along steep slopes).
---@param c Creature 
---@param dx number 
---@param dz number 
---@param water? boolean 
function ai.moveCharacter(c, dx, dz, water) end
--- ThinkY_Beta_Gamma: its height on the ground and its tilt along the slope.
---@param c Creature 
---@param blook? number 
---@param glook? number 
---@param blim? number 
---@param glim? number 
function ai.tilt(c, blook, glook, blim, glim) end
--- IsGoodPlaceForCharacter: a place its AI would walk to (no steep slope, water or trees).
---@param x number 
---@param z number 
---@param species? string|integer 
---@return boolean # 
function ai.goodPlace(x, z, species) end

menu = {}
--- A button of the game's own kind in that menu: its sprite, its font and its touch (the label lights up while pressed). In the hunt's menu (game) a cell like ESCAPE / RESTART / OPTIONS that slides in with them.
---@param where string a menu (main, more, hunt_area, hunt_species, hunt_weapon, game) or a page id
---@param label string the text on it
---@param fn? function fn(item), called when it is pressed
---@param options? table x, y, scale, textScale, color, textColor, font, order, visible, enabled, sound, sprite (main: button_med_01..04, more and pages: button_med_02, hunt pages: button_small_02), pressedSprite
---@return table # the item
function menu.button(where, label, fn, options) end
--- A text in one of the game's fonts (default ofs15).
---@param where string a menu or a page id
---@param text string UTF-8; \n breaks lines
---@param options? table x, y, scale, textScale, color, textColor, font, order, visible, enabled, sound, width (wraps the text), align ("left", "center" (default), "right")
---@return table # the item
function menu.text(where, text, options) end
--- A picture: one of the game's sprites (menu cells, icons, buttons, backgrounds) or your own.
---@param where string a menu or a page id
---@param sprite string a sprite of the game (ui/.cfg), of your sprite file (menu.loadSprites), or a .tga file of your mod
---@param options? table x, y, scale, textScale, color, textColor, font, order, visible, enabled, sound
---@return table # the item
function menu.image(where, sprite, options) end
--- A list of rows to pick from; the picked one in the game's gold. More rows than fit: small arrows page through them.
---@param where string a menu or a page id
---@param rows table the rows' texts
---@param fn? function fn(index, text, item) when a row is picked
---@param options? table x, y, scale, textScale, color, textColor, font, order, visible, enabled, sound, width (240), rows (shown at once, 6), rowHeight, selected (index)
---@return table # the item
function menu.list(where, rows, fn, options) end
--- A whole screen in the game's style: its background, a red title, a BACK button at the game's place (Esc and the Android back button close it too), and the items you add. Opened over any menu or the hunt (which waits meanwhile); pages opened from a page stack. The same id again returns that page with its options changed.
---@param id string your page's id (prefix it with your mod's)
---@param options? table title, background (a sprite, default the MORE screen's; false: the screen dimmed), back (false: no BACK button; a string: its label), top (the first automatic row, default 64), onOpen(page), onClose(page), onBack(page) (return false to stay open), draw(page) (draw. in game units, every frame)
---@return table # the page
function menu.page(id, options) end
--- Opens a page.
---@param page string|table a page or its id
---@param options? table fade (default true: the game's black fade)
function menu.open(page, options) end
--- Closes a page (back to what was under it).
---@param page? string|table a page (default: the one on top)
function menu.close(page) end
--- Where the player is.
---@return string|nil # the open page's id, else the menu shown (main, more, hunt_area ..., game), nil elsewhere
function menu.current() end
--- Hides one of the game's buttons (it takes no presses either) until menu.show or the scripts reload.
---@param where string a menu
---@param name string one of the game's buttons there (see above)
function menu.hide(where, name) end
--- Shows a button menu.hide hid.
---@param where string 
---@param name string 
function menu.show(where, name) end
--- Moves one of the game's buttons (with its icon); without x, y it goes back. The hunt's menu cells can only be hidden.
---@param where string 
---@param name string 
---@param x? number its new centre
---@param y? number 
function menu.move(where, name, x, y) end
--- The game's buttons of a menu, where they are now.
---@param where string a menu
---@return table # {{name, x, y, w, h, shown, text}, ...}: centre and size in game units
function menu.buttons(where) end
--- Every hidden or moved game button back as the game has it.
function menu.reset() end
--- The screen in game units (0, 0 before menu_ready).
---@return number # width in game units
---@return number # height (320 on screens 3:2 and wider)
function menu.screen() end
--- The hunt menu's choice as it stands: what the next hunt would be. price: licences (Dinosaur Hunter) or what the hunt costs against the credits (Ice Age); ammoPrice: paid when the hunt starts (Dinosaur Hunter: ammunition and equipment).
---@return table # {map, time ("dawn" "day" "night"), observer, species = {ids}, weapons = {ids}, equipment = {ids}, price, ammoPrice}
function menu.selection() end
--- Loads your own sprites (a texture and the rectangles in it, as the game's ui/.cfg); then they are known by name to menu.image, draw.sprite, sprite = options ([the format](../guides/formats.html#menu-and-hud-art-sprite-cfg)).
---@param file string a sprite file (.cfg, the game's format) of your mod
---@return integer # how many sprites it added
function menu.loadSprites(file) end
--- A sprite's size (nothing when there is no such sprite).
---@param name string a sprite
---@return number|nil # width in game units
---@return number|nil # height
function menu.spriteSize(name) end
--- The size a text takes in one of the game's fonts.
---@param text string 
---@param font? string default ofs15
---@param size? number text height in game units
---@return number # width
---@return number # height
function menu.textSize(text, font, size) end

zone = {}
--- Makes a zone (or replaces the zone of that name).
---@param def table the zone: name, a shape (circle = {x, z, radius}, box = {x1, z1, x2, z2}, polygon = {{x, z}, ...}, or none: the whole map), conditions (water = true / land = true, nearWater, awayFromWater, minHeight / maxHeight of the ground, maxSlope, minY / maxY of what is tested), areas / maps (only on these maps), tracking (hunter = false, creatures = true or {species = {...}, team = n, group = id, predator = bool})
---@return Zone # 
function zone.create(def) end
--- A circle zone. Also zone.circle{name =, x =, z =, radius =, ...}.
---@param name string 
---@param x number 
---@param z number 
---@param radius number 
---@param opts? table more of the definition (conditions, tracking)
---@return Zone # 
function zone.circle(name, x, z, radius, opts) end
--- A box zone (corners in any order).
---@param name string 
---@param x1 number 
---@param z1 number 
---@param x2 number 
---@param z2 number 
---@param opts? table more of the definition
---@return Zone # 
function zone.box(name, x1, z1, x2, z2, opts) end
--- A polygon zone.
---@param name string 
---@param points table {{x, z}, {x, z}, ...}: at least 3 corners
---@param opts? table more of the definition
---@return Zone # 
function zone.polygon(name, points, opts) end
--- A terrain region: the whole map where the conditions hold.
---@param name string 
---@param opts table its conditions (water, nearWater, minHeight ...)
---@return Zone # 
function zone.terrain(name, opts) end
--- A zone by name.
---@param name string|Zone 
---@return Zone|nil # 
function zone.get(name) end
--- Every zone (of every mod, also the ones of other maps).
---@return table # a list of Zone
function zone.list() end
--- Removes a zone.
---@param zone string|Zone 
---@return boolean # false when there was no such zone
function zone.remove(zone) end
--- The zones of this map that contain a point.
---@param x number 
---@param z number 
---@return table # a list of Zone
function zone.at(x, z) end

group = {}
--- Makes a group of creatures.
---@param def table kind ("herd", "pack" or "group"), members = {creatures}, leader = a creature (default: the first member), name, and any options (see the guide): formation, spacing, spread, sharedAlert, flee ("together", "own", false), hunt, huntHunter, prey = {species}, huntRange, surround, attackers, turnTime, ring, territory (a Zone or its name), leash, avoid = {zones}, regroup, wary, drive, feedTime, huntCooldown
---@return Group # 
function group.create(def) end
--- The group a creature belongs to.
---@param c Creature 
---@return Group|nil # 
function group.of(c) end
--- A group by id or name.
---@param id integer|string an id or a name
---@return Group|nil # 
function group.get(id) end
--- Every group.
---@return table # a list of Group
function group.list() end

population = {}
--- Adds a population rule (or replaces the rule with that id).
---@param def table the rule: id, species, areas / maps, time, chance, groups, size (or count), herd / pack / group, where, mode, respawn, cap, speciesCap, territory, avoid (the guide has them all)
---@return string # its id
function population.add(def) end
--- Removes a rule (its creatures stay).
---@param id string 
---@return boolean # 
function population.remove(id) end
--- Every rule, with what it does in this hunt.
---@return table # a list of {id, species, mod, active, living, target, cap, replace, respawned}
function population.list() end
--- One rule.
---@param id string 
---@return table|nil # as population.list's entries
function population.get(id) end
--- The rule's living creatures.
---@param id string 
---@return table # a list of Creature
function population.members(id) end
--- How many of the rule's creatures live.
---@param id string 
---@return integer # 
function population.count(id) end
--- Places groups of a rule now (where its rule says; respecting its caps).
---@param id string 
---@param groups? integer default 1
---@return integer # creatures placed
function population.spawn(id, groups) end

shader = {}
---@type ShaderWorld
shader.world = nil -- The world effects (fields on the Types page).
---@type ShaderScreen
shader.screen = nil -- The screen effects.
---@type ShaderTargets
shader.targets = nil -- Which shader groups the world effects change.
--- Adds a fragment shader of your own over the picture, after the screen effects (several run in the order they were added). Before your code it gets uniform sampler2D screen; (the picture so far), varying vec2 uv; (0-1, bottom left), uniform vec2 resolution; (pixels) and uniform float time; (seconds, back to 0 every 10 minutes), and the precision; your line 1 is the first line of source in error messages. Declare more uniforms and set them with fx:set. It stays until removed or your mod unloads (dropping the handle does not remove it).
---@param source string a GLSL ES 1.00 fragment shader (it gets screen, uv, resolution, time)
---@param name? string for the log (default: your mod's id)
---@return PostShader? # the post shader, or nil
---@return string? # the compile or link error
function shader.post(source, name) end
--- The game's shader files that are loaded (the game loads them at start).
---@return table # the loaded shader files: {"sh_gui_sprite.fsh", ...}
function shader.files() end
--- The game's shader programs: their files and the target group (shader.targets) they belong to.
---@return table # {{name, vertex, fragment, target}, ...}
function shader.programs() end
--- A shader file's GLSL as the game uses it now (a mod's change included; without the API's own code).
---@param file string a loaded shader file, e.g. "sh_world_water.fsh"
---@return string # its GLSL
function shader.source(file) end
--- The shader file's GLSL as the game loaded it.
---@param file string 
---@return string # 
function shader.original(file) end
--- Replaces a game shader file while the game runs. The uniform and attribute names the game sets (input_mvp, input_texture ...) must stay. A source that does not compile or link is refused and the game keeps the shader it had. The world effects still work with your source (they wrap its main). Undone when your mod unloads.
---@param file string a loaded shader file
---@param source string its new GLSL
---@return boolean # true: every program with the file uses it now
---@return string? # the error when it was refused
function shader.setSource(file, source) end
--- The game's own GLSL for the file again.
---@param file string 
---@return boolean # 
---@return string? # error
function shader.revert(file) end
--- Everything back at once: world and screen effects, targets, every post shader and changed shader file (every mod's).
function shader.reset() end

weather = {}
--- Fades the weather to a preset (or to the values of a table) over seconds. A table without preset changes only the values it names; with one, it is the preset with those values changed (current().preset is "custom" then). In a hunt: the weather belongs to the loaded map (outside a hunt it raises an error).
---@param preset string|table a preset's name, or a table: preset (optional: the start) and any of fogStart, fogEnd (units), skyColor, sunColor, shadowColor, skyPlaneColor (Color), cloudsSpeed, cover (0-1), rain (0-1), snow (0-1), lightning (strikes per minute, 0-60)
---@param seconds? number the fade, 0-3600 (default 0: at once)
function weather.set(preset, seconds) end
--- The weather now: the last preset set (map before any), the seconds left of the fade, every value as it is at this moment and target, where the fade goes. The colours are the weather's own; world.weather reads what is drawn (with the rain's light and the lightning's flash on top).
---@return table|nil # {preset, fade, fogStart, fogEnd, skyColor, sunColor, shadowColor, skyPlaneColor, cloudsSpeed, cover, rain, snow, lightning, target = {...}}; nil outside a hunt
function weather.current() end
--- The presets: map, clear, overcast, fog, rain, storm, snow, blizzard.
---@return table # the preset names
function weather.presets() end
--- Back to the map's own weather (the map preset), at once or in a fade. In a hunt: the weather belongs to the loaded map (outside a hunt it raises an error).
---@param seconds? number the fade (default 0)
function weather.reset(seconds) end
--- The rain: weather.rain() reads it, weather.rain(0.8, 20) fades it. Rain on a bright sky brings its own darker light and clouds; the presets rain and storm come with their own sky.
---@param intensity? number 0-1; nil: none (the map's)
---@param seconds? number the fade
---@return number # the rain now
function weather.rain(intensity, seconds) end
--- The snowfall, in both games (Ice Age: the map's own snow; Dinosaur Hunter: the same snowfall made for it).
---@param amount? number 0-1 (1: 2048 flakes, as Ice Age's snow_density); nil: the map's
---@param seconds? number the fade
---@return number # the snow now
function weather.snow(amount, seconds) end
--- Random lightning: strikes per minute (on average), each anywhere from about a hundred metres to three kilometres away. The lightning event comes before each.
---@param perMinute? number 0-60; nil: none
---@param seconds? number the fade
---@return number # strikes per minute now
function weather.lightning(perMinute, seconds) end
--- The clouds that hide the sky, drawn in the sky colour (1: the sky is the fog's colour). Rain and snow bring some by themselves.
---@param amount? number 0-1; nil: none
---@param seconds? number the fade
---@return number # the cover now
function weather.cover(amount, seconds) end
--- A lightning strike now: the flash, the bolt from the clouds, and its thunder after distance / 128 / 343 seconds (sound at 343 m/s). Works in any weather. In a hunt: the weather belongs to the loaded map (outside a hunt it raises an error).
---@param x? number where (default: a random place around the hunter)
---@param z? number 
---@return table|nil # {x, z, distance, delay}: distance in units, delay = seconds until the thunder; nil when a lightning handler cancelled it
function weather.strike(x, z) end

