Types
The value types the API uses besides Lua's own.
# Creature
A handle to one creature of the hunt. See world for its fields and methods. Handles compare equal (==) when they are the same creature and can be table keys. A handle goes stale (c.valid == false) when the creature is removed or a new hunt begins; using a stale handle raises an error.
# Color
A colour: "#rgb", "#rrggbb", "#rrggbbaa" (hex), a name (white black red green blue yellow orange gray cyan magenta transparent), or a table {r = 1, g = 0.5, b = 0, a = 1} / {1, 0.5, 0, 1} with values 0-1.
# Species
A species: its id ("trex", Ice Age "mammoth"), its type number (24) or, since API 3, its handle (world.species("trex")). Each game has its own built-in species: the tables on the world page (game.id() tells which game a mod runs in); content packs add their own.
# Filter
Which creatures world.creatures, world.nearest and world.count look at: a species, or a table {species = "trex", radius = 5000, x = ..., z = ..., team = 1, dead = false, all = false} (every field optional).
# SpeciesHandle
A species of the game (world.species(id), since API 3): its definition, live. Writes act on every creature of the species (or the ones spawned next, as noted), survive spawns and the content registry's refreshes, and are undone when your mod unloads.
| Field |
Type |
Access |
|
id |
string |
read |
its id ("trex") |
type |
integer |
read |
its type number |
name |
string |
read |
its name in the game's language |
loaded |
boolean |
read |
its model is loaded |
predator |
boolean |
read |
a predator (World's table) |
animCount |
integer |
read |
animations of its model |
soundCount |
integer |
read |
sounds of its model |
health |
number |
read / write |
starting health: creatures spawned from now on (:applyToLiving() for the others) |
mass |
number |
read / write |
tons: trophy and binocular weight (x scale²), fight damage (live) |
size |
number |
read / write |
metres: trophy length (x scale) (live) |
radius |
number |
read / write |
body radius for the hunter's collision (live) |
score |
number |
read / write |
trophy points = credits (live, at trophy time) |
smell |
number |
read / write |
how well it smells the hunter (0.01 or more; live) |
sight |
number |
read / write |
how well it sees the hunter (0.01 or more; live) |
hearing |
number |
read / write |
never read by the game (kept for content packs; c.hearing is the creature's factor) |
carryHeight |
number |
read / write |
the drop ship's hover height over its body (the next pickup) |
scaleMin |
number |
read / write |
smallest size of new ones (scale = (scaleMin + random x scaleRange) x 64 / 55) |
scaleRange |
number |
read / write |
size spread of new ones |
flags |
integer |
read / write |
1 huntable, 2 dangerous, 4 flyer (0-7; live: later kills follow it) |
huntable |
boolean |
read / write |
flag 1 |
dangerous |
boolean |
read / write |
flag 2 |
flyer |
boolean |
read / write |
flag 4 |
callVariants |
integer |
read / write |
call sound variants a / b / c (1-3) |
| Method |
Returns |
|
s:anims() |
table |
Its animations (index 0 first). |
s:animFps(i, fps?) |
integer |
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. |
s:animSound(i, sound?) |
integer |
Reads or sets the sound an animation plays. |
s:applyToLiving() |
integer |
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. |
s:reset() |
|
The game's values again for everything scripts changed on this species. |
s:fields() |
table |
The members of its CharacterInfo (the raw layer). |
s:get(name) |
any |
One member. |
s:set(name, value) |
|
One member (through the overlay, journaled). |
# Weapon
A weapon definition (weapons.get(id), since API 3). Writes act at once unless noted and are undone when your mod unloads.
| Field |
Type |
Access |
|
id |
string |
read |
its id ("rifle") |
type |
integer |
read |
its type |
slot |
integer |
read |
the hunter's slot it takes |
name |
string |
read |
its name |
loaded |
boolean |
read |
its model is loaded |
power |
number |
read / write |
damage per pellet hit (x3 in Survive; live) |
precision |
number |
read / write |
spread x (2 - precision) (up to 2; live) |
pellets |
integer |
read / write |
traces per shot (1-64; live) |
loudness |
number |
read / write |
noise radius / 14592 (live) |
rate |
number |
read / write |
shots per second (the next shot) |
ammo |
integer |
read / write |
rounds per hunt (the next hunt, a resupply, a weapon given at run time) |
magazine |
integer |
read / write |
rounds per reload (the next reload) |
aimFov |
number |
read / write |
field of view while aiming, degrees (live) |
aimTime |
number |
read / write |
seconds of the aim zoom (live) |
| Method |
Returns |
|
w:reset() |
|
The game's values again. |
w:fields() |
table |
The members (the raw layer). |
w:get(name) |
any |
One member. |
w:set(name, value) |
|
One member (overlay, journaled). |
# WeaponSlot
One of the hunter's 8 weapon slots in this hunt (player.slot(n), player.weapons(), since API 3). Its values belong to the hunt (the next hunt starts fresh).
| Field |
Type |
Access |
|
slot |
integer |
read |
0-7 |
weapon |
Weapon |
read |
its weapon definition |
id |
string |
read |
its weapon's id |
current |
boolean |
read |
the weapon in hand |
available |
boolean |
read / write |
the hunter carries it this hunt; true gives it (its model loads, full ammunition), false takes it away |
state |
string |
read |
"hidden", "ready", "firing", "reloading", "taking", "hiding" |
ammo |
integer |
read / write |
rounds left (the loaded ones included) |
loaded |
integer |
read / write |
rounds loaded (0 to the magazine; 0 with rounds left reloads) |
magazine |
integer |
read |
its definition's magazine |
cooldown |
number |
read / write |
seconds before it can fire again |
sway |
number |
read / write |
aim sway (0-4; it grows while the weapon is held) |
aimYaw |
number |
read |
the sway added to a shot (radians) |
aimPitch |
number |
read |
the same, up / down |
| Method |
Returns |
|
slot:take() |
|
Takes it out (another weapon in hand is put away first: the game's own change, with its weapon_change event). |
slot:hide() |
|
Puts it away (the weapon in hand only). |
slot:reload() |
boolean |
Reloads the weapon in hand now (the game's reload, with its animation). |
slot:fire() |
boolean |
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). |
slot:fields() |
table |
The members of its Weapon struct (the raw layer). |
slot:get(name) |
any |
One member. |
slot:set(name, value) |
|
One member. |
# Weather
The loaded map's weather (world.weather, since API 3). Writes are journaled for this map: a new map starts with its own weather, and your mod's changes are undone when it unloads. Outside a hunt it reads nil (viewDistance excepted).
| Field |
Type |
Access |
|
fogStart |
number |
read / write |
where the distance fog starts (units) |
fogEnd |
number |
read / write |
where the fog is complete (units) |
skyColor |
Color |
read / write |
sky and clear colour, the fog colour of models; reads {r, g, b} (0-1) |
sunColor |
Color |
read / write |
sun light; the light of creatures and the hunter follows |
shadowColor |
Color |
read / write |
shadow light; the same |
skyPlaneColor |
Color |
read / write |
the sky plane's colour and opacity (maps with a sky sphere); reads {r, g, b, a} |
cloudsSpeed |
number |
read / write |
clouds speed factor |
snow |
number |
read / write |
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) |
viewDistance |
number |
read / write |
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 |
time |
string |
read |
"dawn", "day" or "night" (chosen when the map loads: world.nextTime) |
fogCount |
integer |
read |
the map's fog volumes |
waterCount |
integer |
read |
the map's water types |
| Method |
Returns |
|
weather:fog(i) |
number, boolean |
A fog volume of the map (poisonous fog hurts the hunter inside it). |
weather:setFog(i, altitude, poisonous?) |
|
Changes one. |
weather:water(i) |
table |
A water type. |
weather:setWater(i, color?, opacity?) |
|
Its colour and opacity (the level stays: collision and the AIs use it). |
weather:reset() |
|
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. |
weather:fields() |
table |
The members of Terrain and the snow (the raw layer). |
weather:get(name) |
any |
One member. |
weather:set(name, value) |
|
One member (journaled for this map). |
# Wind
The wind (world.wind, since API 3): smell, the compass arrow, Ice Age's snow drift.
| Field |
Type |
Access |
|
yaw |
number |
read / write |
the direction it blows towards (degrees, the yaw convention) |
speed |
number |
read / write |
its speed (the game keeps it in 4-18 unless locked; 0-100) |
locked |
boolean |
read / write |
the game's wind changes stop: yaw and speed stay as set (until your mod unloads) |
targetYaw |
number |
read |
where it turns to |
targetSpeed |
number |
read |
the speed it changes to |
dirX |
number |
read |
its direction (sin of the game's angle) |
dirZ |
number |
read |
the same, z |
| Method |
Returns |
|
wind:fields() |
table |
The members (the raw layer). |
wind:get(name) |
any |
One member. |
wind:set(name, value) |
|
One member. |
# HuntRules
Session versions of the hunt rules (hunt.rules, since API 3): set a field, nil puts the game's value back; all are undone when your mod unloads.
| Field |
Type |
Access |
|
relocateDelay |
number |
read / write |
seconds between relocations (60) |
evacuateDelay |
number |
read / write |
seconds before the evacuation ends the hunt (3.7) |
resupplyThreshold |
number |
read / write |
the RESUPPLY button shows below this share of the hunt's ammunition (0.67) |
resupplyInWater |
boolean |
read / write |
allow resupplies while the drop point is in water (false) |
scoreMultiplier |
number |
read / write |
every trophy's points (the content rules' score.multiplier) |
unlicensedScore |
number |
read / write |
points factor for a species without a licence this hunt |
comboBonus |
number |
read / write |
+ per trophy already taken this hunt |
flyerCredits |
integer |
read / write |
credits per shot flyer |
bonusCamouflage |
number |
read / write |
score bonus % with camouflage (balance SCORE_BONUS_CAMOUFLAGE) |
bonusScent |
number |
read / write |
with cover scent (SCORE_BONUS_COVER_SCENT) |
bonusTranquilizer |
number |
read / write |
with the tranquilizer (SCORE_BONUS_TRANQUILIZER) |
bonusNoRadar |
number |
read / write |
without the radar (SCORE_BONUS_NO_RADAR) |
# FieldInfo
One entry of a fields() list (the raw layer, since API 3).
| Field |
Type |
Access |
|
name |
string |
read |
the C++ member (m_unk94, pos.x, m_unk1644[2]) |
alias |
string? |
read |
the friendly name |
type |
string |
read |
"integer", "number", "boolean" or "string" |
access |
string |
read |
"r", "rw" or "rw!" (writable, but the game recomputes or eases it) |
offset |
integer |
read |
its offset in the struct |
min |
number? |
read |
smallest allowed value |
max |
number? |
read |
largest |
recomputed |
string? |
read |
what overwrites it |
note |
string? |
read |
what it does |
games |
string |
read |
"both", "dinohunter" or "iceage" |
# Zone
A handle to one zone: see zone for its fields and methods (z.name, z:contains(x, z) ...).
# Group
A handle to one herd, pack or group: see group for its fields and methods (g.leader, g:add(c) ...).
# ShaderWorld
The world effects (shader.world, since API 4): values the code inside every game shader uses. Set a field to change the picture at once; a value out of its range, an unknown name or a wrong type raises an error and changes nothing. Defaults in brackets: with all of them the picture is the game's own.
| Field |
Type |
Range |
|
exposure |
number |
-5 to 5 (0) |
brightness in stops: +1 doubles the light |
brightness |
number |
-1 to 1 (0) |
added to every colour (the game's colours are dark: small steps) |
contrast |
number |
0 to 4 (1) |
around mid grey |
saturation |
number |
0 to 4 (1) |
0 = grey |
gamma |
number |
0.05 to 5 (1) |
above 1 brightens the dark parts |
hue |
number |
-360 to 360 (0) |
hue shift in degrees |
temperature |
number |
-1 to 1 (0) |
cold (blue) to warm (orange) |
tint |
Color |
(orange) |
the tint's colour |
tintAmount |
number |
0 to 1 (0) |
how much of the tint |
pulse |
number |
0 to 1 (0) |
the light pulses by this much |
pulseSpeed |
number |
0 to 20 (1) |
pulses per second |
vision |
string |
"none" |
a vision mode: "none", "night", "thermal", "depth", "rainbow", "blueprint", "matrix" |
visionMix |
number |
0 to 1 (1) |
how much of the vision mode |
toon |
number |
0 to 16 (0) |
toon shading: this many light bands (0 = off) |
posterize |
number |
0 to 64 (0) |
colour levels per channel (0 = off) |
dither |
number |
0 to 4 (0) |
ordered dithering of the posterized levels |
sepia |
number |
0 to 1 (0) |
old photo |
invert |
number |
0 to 1 (0) |
negative |
fog |
Color |
(light grey) |
the colour of the API's fog (on top of the game's own fog) |
fogAmount |
number |
0 to 1 (0) |
how thick at fogEnd |
fogStart |
number |
0 to 100000 (3000) |
where it starts, in game units from the camera (128 = 1 m) |
fogEnd |
number |
0 to 100000 (18000) |
where it is thickest |
sonar |
Color |
(green) |
the sonar ring's colour |
sonarStrength |
number |
0 to 5 (0) |
a bright ring that runs out from the camera over the world |
sonarSpeed |
number |
0 to 50000 (5000) |
units per second |
sonarWidth |
number |
1 to 10000 (400) |
the ring's width in units |
depthRange |
number |
100 to 100000 (20000) |
the distance the depth vision and the sonar span |
wave |
number |
0 to 1 (0) |
the world waves up and down |
waveFrequency |
number |
0 to 100 (8) |
waves across the screen |
waveSpeed |
number |
0 to 50 (2) |
how fast they move |
curve |
number |
-5 to 5 (0) |
the world curves away (a tiny planet; negative: up like a bowl) |
wobble |
number |
0 to 5 (0) |
the view rocks from side to side |
twist |
number |
-5 to 5 (0) |
the view turns more with distance |
melt |
number |
0 to 2 (0) |
things drip down |
stretchX |
number |
0.1 to 5 (1) |
wider or narrower |
stretchY |
number |
0.1 to 5 (1) |
taller or flatter |
shake |
number |
0 to 5 (0) |
the picture shakes |
snap |
number |
0 to 1000 (0) |
PS1 style vertex snapping: the grid (80 = strong, 0 = off) |
| Method |
Returns |
|
t:get() |
table |
A plain table of the values. |
t:set(values) |
|
Several fields at once (each checked). |
t:reset() |
|
Every field back to its default. |
# ShaderScreen
The screen effects (shader.screen, since API 4), drawn over the finished picture in this order: mirror, flip, kaleidoscope, barrel, haze, jitter, VHS, pixelate, halftone, chromatic, blur, zoom blur, ghost, sharpen, bloom, outlines, scanlines, CRT mask, grain, vignette, letterbox.
| Field |
Type |
Range |
|
pixelate |
number |
0 to 64 (0) |
pixel size in screen pixels (2 or more) |
blur |
number |
0 to 16 (0) |
blur radius in pixels |
sharpen |
number |
0 to 5 (0) |
|
chromatic |
number |
0 to 32 (0) |
colour fringes towards the edges, in pixels |
bloom |
number |
0 to 4 (0) |
glow around bright parts |
bloomThreshold |
number |
0 to 1 (0.65) |
what counts as bright |
outlines |
number |
0 to 1 (0) |
edges drawn as lines |
outlineThreshold |
number |
0 to 2 (0.25) |
how strong an edge must be |
outlineColor |
Color |
(black) |
the lines' colour |
halftone |
number |
0 to 64 (0) |
newspaper dots of this size in pixels (2 or more) |
barrel |
number |
-2 to 3 (0) |
a curved CRT screen (positive) or a fisheye (negative) |
vignette |
number |
0 to 2 (0) |
darker corners |
grain |
number |
0 to 2 (0) |
film grain |
scanlines |
number |
0 to 1 (0) |
dark lines across |
crtMask |
number |
0 to 1 (0) |
the red, green and blue stripes of a CRT |
jitter |
number |
0 to 5 (0) |
lines shifted sideways |
haze |
number |
0 to 5 (0) |
heat haze |
ghost |
number |
0 to 100 (0) |
double vision: the second picture's offset in pixels |
zoomBlur |
number |
0 to 4 (0) |
blur out from the middle |
kaleidoscope |
number |
0 to 32 (0) |
mirrored segments (2 or more) |
letterbox |
number |
0 to 0.45 (0) |
black bars top and bottom (part of the height) |
mirror |
boolean |
(false) |
the left half mirrored to the right |
flip |
boolean |
(false) |
upside down |
vhs |
boolean |
(false) |
an old tape: wobble, smeared colour, a tracking band, noise, dropouts |
| Method |
Returns |
|
t:get() |
table |
A plain table of the values. |
t:set(values) |
|
Several fields at once (each checked). |
t:reset() |
|
Every field back to its default. |
# ShaderTargets
Which groups of the game's shaders the world effects change (shader.targets, since API 4).
| Field |
Type |
Range |
|
terrain |
boolean |
(true) |
the ground |
water |
boolean |
(true) |
|
models |
boolean |
(true) |
dinosaurs, animals, objects, the hunter's weapon |
plants |
boolean |
(true) |
grass, bushes and the other sprites |
sky |
boolean |
(true) |
|
particles |
boolean |
(true) |
blood, splashes, snow |
shadows |
boolean |
(false) |
shadows multiply what is under them: graded twice they get much darker |
interface |
boolean |
(false) |
the menus, the HUD and the compass |
| Method |
Returns |
|
t:get() |
table |
A plain table of the values. |
t:set(values) |
|
Several fields at once (each checked). |
t:reset() |
|
Every field back to its default. |
# PostShader
A post shader of your mod (shader.post, since API 4).
| Field |
Type |
Access |
|
enabled |
boolean |
read / write |
drawn (true when made) |
id |
integer |
read |
its number |
alive |
boolean |
read |
not removed |
| Method |
Returns |
|
fx:set(uniform, ...) |
|
Sets a uniform (float, vec2, vec3 or vec4 by the count); it keeps its value until set again. |
fx:remove() |
boolean |
Removes the post shader. |