Species, weapons, maps, prices, rules and licences at run time; script AIs.
# content.species (id? ) → table|nil
Species of the registry. price is the licence price the menu shows: after the rules' priceScale (as content.price).
Parameter Type
id optional Species one species (default: all)
Returns
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}
copy for _, s in ipairs(content .species()) do if s.hunt then print (s.id, s.price) end end
# content.weapons (id? ) → table|nil
Weapons of the registry. price and ammoPrice are what the menu shows: after the rules' priceScale / ammoScale.
Parameter Type
id optional string
Returns
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}
# content.maps (id? ) → table|nil
Maps of the registry. price: after the rules' priceScale.
Parameter Type
id optional string
Returns
table|nil {id, terrain, name, difficulty, mod, builtin, hidden, price, unlocked, times, residents, huntable, icon, iconColor, info}
# content.currentMap () → string|nil
The map of the hunt being played.
# content.weaponInSlot (slot ) → string|nil
The weapon the hunter has in a slot this hunt.
Parameter Type
slotinteger
# content.rules () → table
The economy and hunt rules.
Returns
table {scoreMultiplier, unlicensedScore, comboBonus, flyerCredits, speciesPriceScale, weaponPriceScale, mapPriceScale, ammoScale, maxSpecies}
# content.define (kind , fields ) → string|nil
Adds or changes an entry at run time (new ones appear in the hunt menu).
Parameter Type
kindstring "species", "weapon", "map", "equipment" or "rules"
fieldstable the fields of the content pack JSON
Returns
string|nil the entry's id, or nil and an error
copy content .define("species" , {id = "night_raptor" , copy = "velociraptor" , name = "Night Raptor" , health = 12 , price = 300 })
content .define("rules" , {priceScale = 0.5 })
# content.price (kind , id ) → integer
A licence price as the menu shows it: after the rules' priceScale.
Parameter Type
kindstring
idstring
Returns
integer -1 = unknown
# content.setPrice (kind , id , price ) → boolean
Sets a licence price: the entry's own price, before the rules' priceScale (as price in its JSON).
Parameter Type
kindstring
idstring
priceinteger
# content.ammoPrice (weapon ) → integer
A weapon's ammunition price, after the rules' ammoScale.
Parameter Type
weaponstring
# content.setAmmoPrice (weapon , price ) → boolean
Sets it (before ammoScale).
Parameter Type
weaponstring
priceinteger
# content.balance (key ) → number
One of the game's balance values.
Parameter Type
keystring a balance value of the game, e.g. "RESUPPLIES_COST"
# content.unlocked (kind , id ) → boolean
Whether the player owns the licence.
Parameter Type
kindstring
idstring
# content.unlock (kind , id , on? )
Gives (or takes) a licence.
Parameter Type
kindstring
idstring
on optional boolean default true
# content.drive (species , fn )
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)).
Parameter Type
speciesSpecies
fnfunction|nil fn(e) with e.creature, e.dt; nil = the game's AI again
copy content .drive("gallimimus" , function (e)
local c = e.creature
c.yaw = c.yaw + 90 * e.dt -- they run in circles
c:move(600 * e.dt)
c:animate(e.dt)
end )
# content.reload ()
Reads every enabled mod's content packs again.
# content.report () → string
A report of the registry.
Returns
string one line per entry and the mods that set it
# content.aiNames () → table
The species whose AI a new species can use.
# content.equipment (id? ) → table|nil
since API 3
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.
Parameter Type
id optional string one item (default: all)
Returns
table|nil {id, name, info, icon, mod, builtin, hidden, price, scoreBonus, sight, smell, radar, tranquilizer, default, order, on, equipped}
copy for _, e in ipairs(content .equipment ()) do print (e.id, e.on , e.price) end
# content.equipped (id ) → boolean
since API 3
Whether the item is on in the hunt being played (false outside hunts and in observer mode): the place for effects of your own.
Parameter Type
idstring an equipment id
copy on ("hunt_start" , function ()
if content .equipped("night_goggles" ) then nightVision(true ) end
end )
# content.setEquipment (id , on ) → boolean
since API 3
Switches an item in the hunt menu (for the next hunt).
Parameter Type
idstring
onboolean
Returns
boolean true when it is so now