init commit

This commit is contained in:
Jill 2021-11-03 07:34:38 +03:00
commit 582b925d4a
121 changed files with 25247 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
out

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "isaac-typescript-definitions"]
path = isaac-typescript-definitions
url = https://github.com/IsaacScript/isaac-typescript-definitions

152
index.js Normal file
View File

@ -0,0 +1,152 @@
const fs = require('fs/promises');
const path = require('path');
const { inspect } = require('util');
const chalk = require('chalk');
const declarationsPath = path.resolve(__dirname, './isaac-typescript-definitions/typings/');
const outPath = path.resolve(__dirname, './out/');
function transpile(parsed, indent, prefix) {
let global = false;
indent = indent || 0;
const type = parsed[0];
const d = parsed[1];
let n = '\n' + ' '.repeat(indent); // newline
switch (type) {
case 'namespace':
global = true;
case 'interface':
return `---@class ${d.name}\n${global ? '' : '__class_'}${d.name} = {}${n}${d.contents.map(c => transpile(c, indent, `${global ? '' : '__class_'}${d.name}`)).join(n)}\n`;
case 'function':
return `${d.arguments.map(p => `---@param ${p.name.replace('?', '')} ${p.type}${n}`).join('')}---@return ${d.returns}${n}function ${prefix ? prefix + ':' : ''}${d.name}(${d.arguments.map(a => a.name.replace('?', '')).join(', ')}) end`;
case 'const':
return `---@type ${d.type}${n}${prefix ? prefix + '.' : ''}${d.name} = nil`;
case 'enum':
return `${prefix ? prefix + '.' : ''}${d.name} = {${n} ${d.contents.map(c => `${c.name} = ${c.value}`).join(`,${n} `)}${n}}`;
}
return '';
}
/**
* @param {string} code
*/
function parse(code) {
// console.log(code);
// we're left with code containing "declare" statements
// other code will pass stuff in here recursively, but the declare doesnt _really_ matter
// were gonna end up with an ast of sorts anyways as a result, which we can then use instead of declares
// sanitize stuff
code = code.split('\n').filter(c => !c.trim().startsWith('//')).join('\n');
// remove /* */ style comments, for now
code = code.replace(/\/\*(.*?)(?=\*\/)/gs, '');
const elements = [];
// look for interfaces
let interfaceFreeCode = code;
const interface = /interface (\w+) ?{([^}]*)}/g;
while ((match = interface.exec(code)) !== null) {
interfaceFreeCode = interfaceFreeCode.replace(match[0], '');
elements.push(['interface', {name: match[1], contents: parse(match[2])}]);
}
code = interfaceFreeCode;
// look for namespaces
let namespaceFreeCode = code;
const namespace = /namespace (\w+) ?{([^}]*)}/g;
while ((match = namespace.exec(code)) !== null) {
namespaceFreeCode = namespaceFreeCode.replace(match[0], '');
elements.push(['namespace', {name: match[1], contents: parse(match[2])}]);
}
code = namespaceFreeCode;
// look for functions
let functionFreeCode = code;
const functions = /(function)?\s(\w+)\s*\(([^;]*)\)(\s*:\s*([\w\[\]]+))?/g; // wow this sucks
while ((match = functions.exec(code)) !== null) {
functionFreeCode = functionFreeCode.replace(match[0], '');
let arguments = match[3].split(',').map(s => {
const split = s.split(':').map(s => s.trim());
return {type: split[1], name: split[0]}
}).filter(c => c.type && c.name);
elements.push(['function', {name: match[2], arguments: arguments, returns: match[5]}]);
}
code = functionFreeCode;
// looks for enums
let enumFreeCode = code;
const enums = /enum (\w+) ?{([^}]*)}/g;
while ((match = enums.exec(code)) !== null) {
enumFreeCode = enumFreeCode.replace(match[0], '');
elements.push(['enum', {name: match[1], contents: match[2].split(',').filter(c => c.split('=').length === 2).map(c => {return {name: c.split('=')[0].trim(), value: c.split('=')[1].trim()}})}]);
}
code = enumFreeCode;
// looks for constants / properties
let constFreeCode = code;
const consts = /(\w+)\s*:\s*(\w+)/g;
while ((match = consts.exec(code)) !== null) {
constFreeCode = constFreeCode.replace(match[0], '');
elements.push(['const', {name: match[1], type: match[2]}]);
}
code = constFreeCode;
return elements;
}
(async () => {
let timeParsing = 0;
let timeTotal = 0;
try {
const d = await fs.lstat(outPath)
if (!d.isDirectory()) throw new Error(`${outPath} exists, and isn't a directory!`);
} catch(err) {
if (err.code === 'ENOENT') {
await fs.mkdir(outPath);
} else {
console.error(err);
process.exit();
}
}
const files = await fs.readdir(declarationsPath);
for (const f of files) {
const filePath = path.resolve(declarationsPath, f);
const stat = await fs.lstat(filePath);
if (stat.isFile() && f) {
const file = await fs.readFile(filePath, 'utf8');
let startParse = Date.now();
const parsed = parse(file);
console.log(` parsed ${chalk.magentaBright(parsed.length)} elements from ${chalk.cyanBright(f)}`);
timeParsing += Date.now() - startParse;
if (parsed.length === 0) {
console.log(`${chalk.redBright('!')} no elements parsed, ${chalk.gray('not writing anything')}`);
continue;
}
const transpiled = parsed.map(p => transpile(p)).join('\n').trim();
console.log(` transpiled w/ final length of ${chalk.magentaBright(transpiled.length + ' chars')}`);
timeTotal += Date.now() - startParse;
if (transpiled.length === 0) {
console.log(`${chalk.redBright('!')} nothing transpiled, ${chalk.gray('not writing anything')}`);
continue;
}
//console.log(inspect(parsed, false, 10));
const luaFilename = f.replace('.d.ts', '.lua');
await fs.writeFile(path.resolve(outPath, luaFilename), '--[[\n' + inspect(parsed, false, null) + '\n]]\n\n' + transpiled);
console.log(` wrote ${chalk.cyanBright(luaFilename)}`);
}
}
console.log(`\nfinished transpiling in ${chalk.magentaBright(timeTotal + 'ms')} ${chalk.gray(`(${Math.floor(timeParsing/timeTotal * 1000 + 0.5) / 10}% spent parsing)`)}`);
console.log(`check ${chalk.cyanBright(outPath)}`);
})();

View File

@ -0,0 +1,442 @@
{
"version": "0.2",
"words": [
"abplus",
"actiontrigger",
"adderline",
"adjacentcoords",
"akeldama",
"algiz",
"allownonmain",
"allowwispspawn",
"anims",
"ansuz",
"apollyons",
"armyfly",
"ashpit",
"athame",
"attackfly",
"azazels",
"babys",
"backasswards",
"backsplit",
"baphomet",
"batterycharge",
"batterydischarge",
"beelzeblub",
"berkano",
"bffs",
"bigchest",
"bigspider",
"binky",
"blackhole",
"blackjudas",
"blackpowder",
"blankface",
"bloaty",
"blobby",
"blockbreak",
"bloodbank",
"bloodshoot",
"blub",
"bluebaby",
"bluebabys",
"bluefly",
"bluewomb",
"bnot",
"bogo",
"bombchest",
"bombdrop",
"bomberang",
"bombgagger",
"bombplaced",
"boomfly",
"bossdeath",
"bosspool",
"bossrush",
"brainer",
"brimtech",
"bshl",
"bshr",
"btmills",
"bulletpoint",
"bumbino",
"bumbo",
"burstsplit",
"buttlicker",
"cache",
"cadavra",
"cadetblue",
"cambion",
"camelcase",
"camillo",
"camo",
"cantripped",
"carbattery",
"cardpillused",
"cardtype",
"castleportcullis",
"chdir",
"childs",
"CHUBBER",
"clickety",
"colostomia",
"cooldown",
"coplayer",
"cpad",
"crackwave",
"crafter",
"crossfade",
"customvardata",
"cutscene",
"cutscenes",
"cyclopia",
"daddylonglegs",
"dagaz",
"datagrams",
"dataminer",
"decap",
"derp",
"devilroom",
"diah",
"dimedrop",
"dimepickup",
"dinf",
"dinga",
"dont",
"doorslot",
"doorslots",
"dople",
"doublepack",
"dpad",
"dukie",
"ecoli",
"ehwaz",
"eid's",
"entcoll",
"errorbuzz",
"eternalchest",
"eternalfly",
"evillaugh",
"evis",
"exlax",
"explosivo",
"explossion",
"eyepatch",
"fadein",
"fartigan",
"fartwave",
"fcuk",
"firedeath",
"firedelay",
"fistpound",
"fistuloid",
"flaminghopper",
"forestboss",
"forgotten's",
"friendball",
"gamekid",
"gaper",
"gaper's",
"gascan",
"gello",
"getpeername",
"getsockname",
"gettime",
"giga",
"goldenbomb",
"goldenkey",
"goldentroll",
"gooattach",
"goodeath",
"greedmode",
"gridcoll",
"grident",
"GRIDENTITY",
"gridpivot",
"gridsize",
"gridspawn",
"gridx",
"gridy",
"groundpound",
"grroowl",
"guppys",
"gurdy",
"gurg",
"gurglings",
"haemo",
"haemolacria",
"hagalaz",
"halfsec",
"hauntedchest",
"heartin",
"heartout",
"hellboss",
"hematemesis",
"hematemisis",
"hemoptysis",
"holyroom",
"holywater",
"horf",
"hornfel",
"humbleing",
"hushy",
"hydrobounce",
"hypercoagulation",
"icongroup",
"iconpositioncenter",
"iconpositions",
"isaacdies",
"isaacs",
"isaacscript",
"isdoor",
"itemactivated",
"itempools",
"itemrecharge",
"itemsdropped",
"itemstate",
"iwata",
"jera",
"joinmultiplayer",
"keybind",
"keyfamiliar",
"keypickup",
"killswitch",
"kineti",
"knockback",
"krampus",
"lachryphagy",
"largeiconpositioncenter",
"largeiconpositions",
"larryjr",
"laserring",
"lasershot",
"lavaball",
"lemegeton",
"leprocy",
"lerp",
"lightbolt",
"lockedchest",
"lokii",
"lokis",
"longlegs",
"lost's",
"luadebug",
"luamod",
"luarun",
"luckypenny",
"luckypickup",
"ludovico",
"maggotcharge",
"maggy",
"maggys",
"maxs",
"meatheadshoot",
"meconium",
"megablast",
"megachest",
"membrain",
"menuback",
"menuconfirm",
"menudown",
"menuexit",
"menuleft",
"menult",
"menuright",
"menurt",
"menutab",
"menuup",
"mercurius",
"migan",
"mimicchest",
"minecart",
"miniboss",
"minisaac",
"ministro",
"mockulus",
"modconfig",
"modder",
"momschest",
"monstro",
"monstros",
"montezumas",
"moter",
"mothershadow",
"mrmaw",
"mucormycosis",
"mult",
"necro",
"necronomicon",
"neptunus",
"nickeldrop",
"nickelpickup",
"noanim",
"noannouncer",
"nocostume",
"nokill",
"nopits",
"notchedaxe",
"npcs",
"nullitems",
"oldchest",
"onans",
"orangedots",
"ouroboros",
"outro",
"parasitoid",
"peffect",
"pennydrop",
"pennypickup",
"percs",
"perthro",
"pillcard",
"pilleffect",
"pitsonly",
"playdough",
"playerform",
"playerobjects",
"playeronly",
"playstation",
"pnpify",
"polty",
"polycephalus",
"poofer",
"poopitem",
"poot",
"pooter",
"popout",
"powerup",
"pupula",
"pushable",
"pyro",
"quadsplit",
"quakey",
"questionmark",
"raglich",
"ragling",
"receivefrom",
"redchest",
"reddots",
"redheart",
"redlightning",
"REDSKULL",
"reimplement",
"removeactive",
"respawn",
"respawning",
"robo",
"rockb",
"rockt",
"roid",
"roomshape",
"roomshapes",
"roomtypes",
"roundy",
"samsons",
"sarisia",
"satans",
"saturnus",
"savy",
"schythe",
"screem",
"secretroom",
"Semivisited",
"sendto",
"setpeername",
"settimeout",
"shakey",
"shellgame",
"shoop",
"shootdown",
"shootleft",
"shootright",
"shootup",
"shopitem",
"shotspeed",
"sidewave",
"skinball",
"slotspawn",
"soulhearts",
"specialrooms",
"spiderbaby",
"spikeball",
"spikedchest",
"spindown",
"spitty",
"spity",
"splurt",
"spritesheet",
"spritesheets",
"squeezy",
"stageapi",
"stagetype",
"starflash",
"steamapps",
"stickynickel",
"stompy",
"stonehead",
"stoneshoot",
"sucky",
"summonable",
"summonsound",
"sumptorium",
"superbum",
"supergreed",
"superholy",
"supertroll",
"suplex",
"synthoil",
"tammys",
"tarboy",
"tarotcard",
"tearcolor",
"tearflag",
"tearimpacts",
"technote",
"telepills",
"teleporter",
"teleporting",
"texel",
"textbox",
"theforgotten",
"thelost",
"thesoul",
"throwablebomb",
"thumbsdown",
"thumbsup",
"tinytoma",
"tmtrainer",
"treasurel",
"treasureroom",
"triachnid",
"trisagion",
"tropicamide",
"tstl",
"turdlet",
"turdling",
"turnbull",
"ultragreed",
"ultrapride",
"ultrasecret",
"unregisters",
"userdata",
"vasculitis",
"verysmall",
"vurp",
"waka",
"walkingboil",
"waterthrashing",
"whitepony",
"willo",
"wizoob",
"wofsauge's",
"woodenchest",
"woom",
"wotl",
"xxxxxxxxl",
"yarnpkg",
"ybab",
"zamiel",
"zamiell"
]
}

View File

@ -0,0 +1,66 @@
// This is the configuration file for ESLint, the TypeScript linter
// https://eslint.org/docs/user-guide/configuring
module.exports = {
extends: [
// The linter base is the shared IsaacScript config
// https://github.com/IsaacScript/eslint-config-isaacscript/blob/main/base.js
"eslint-config-isaacscript/base",
],
parserOptions: {
// ESLint needs to know about the project's TypeScript settings in order for TypeScript-specific
// things to lint correctly
// We do not point this at "./tsconfig.json" because certain files (such at this file) should be
// linted but not included in the actual project output
project: "./tsconfig.eslint.json",
},
rules: {
// Documentation: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
// We want class and interface definitions to be alphabetically ordered so that they match the
// Isaac documentation
"@typescript-eslint/member-ordering": [
"warn",
{
default: {
order: "alphabetically",
},
interfaces: {
memberTypes: ["method", "field"],
order: "alphabetically",
},
},
],
// Documentation:
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md
// Defined at:
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.ts
// ark120202, the author of TypeScriptToLua, recommends using triple-slash directives
"@typescript-eslint/triple-slash-reference": "off",
// Documentation:
// https://github.com/eslint/eslint/blob/master/docs/rules/no-bitwise.md
// Defined at:
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
// Isaac enums use bitwise operators (e.g. "EntityFlag")
"no-bitwise": "off",
// Documentation:
// https://eslint.org/docs/rules/no-underscore-dangle
// Defined at:
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
// We keep the Airbnb specification but allow calling functions that overload Lua operators:
// https://moddingofisaac.com/docs/class_vector.html
"no-underscore-dangle": [
"error",
{
allow: ["__add", "__sub", "__mul", "__div", "__unm", "__len"],
allowAfterThis: false,
allowAfterSuper: false,
enforceInMethodNames: true,
},
],
},
};

View File

@ -0,0 +1,2 @@
# Prevent Windows systems from cloning this repository with "\r\n" line endings
core.autocrlf=false

View File

@ -0,0 +1,48 @@
name: CI
on: [push, pull_request]
jobs:
build_and_lint:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
# The default version is 14
# The ESLint config requires Node 16 to work properly
node-version: '16'
- name: Retrieve the cached "node_modules" directory (if present)
uses: actions/cache@v2
id: node-cache
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies (if the cached directory was not found)
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Test to see if the project compiles
run: bash build.sh
- name: Perform automated checks
run: bash lint.sh
discord:
name: Discord Failure Notification
needs: [build_and_lint]
if: always() # This is needed to always run this job, even if the other jobs fail
runs-on: ubuntu-latest
steps:
- uses: technote-space/workflow-conclusion-action@v2
- if: env.WORKFLOW_CONCLUSION != 'success' && env.WORKFLOW_CONCLUSION != 'cancelled'
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ env.WORKFLOW_CONCLUSION }}
title: ""

124
isaac-typescript-definitions/.gitignore vendored Normal file
View File

@ -0,0 +1,124 @@
# ------------------------------
# GitHub Node.gitignore template
# https://github.com/github/gitignore/blob/master/Node.gitignore
# ------------------------------
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# IDEA
.idea

View File

@ -0,0 +1,16 @@
// This is the configuration file for Prettier, the auto-formatter
// https://prettier.io/docs/en/configuration.html
module.exports = {
// https://prettier.io/docs/en/options.html#trailing-commas
// The default is "es5" - Trailing commas where valid in ES5 (objects, arrays, etc.)
// However, always having trailing commas is objectively better
// The Airbnb style guide agrees:
// https://github.com/airbnb/javascript#commas--dangling
// Prettier itself also acknowledges Nik Graf's blog in their official blog:
// https://prettier.io/blog/2020/03/21/2.0.0.html#change-default-value-for-trailingcomma-to-es5-6963httpsgithubcomprettierprettierpull6963-by-fiskerhttpsgithubcomfisker
// https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8
// Prettier will change the default in the future:
// https://github.com/prettier/prettier/issues/9369
trailingComma: "all",
endOfLine: "lf",
};

View File

@ -0,0 +1,10 @@
// These are Visual Studio Code extensions that are intended to be used with this particular
// repository
// https://go.microsoft.com/fwlink/?LinkId=827846
{
"recommendations": [
"dbaeumer.vscode-eslint", // The TypeScript linter
"streetsidesoftware.code-spell-checker", // A spell-checker extension based on cspell
"typescript-to-lua.vscode-typescript-to-lua", // The TypeScriptToLua extension
]
}

View File

@ -0,0 +1,43 @@
// These are Visual Studio Code settings that should apply to this particular repository
{
// ----------------
// Vanilla settings
// ----------------
// This matches the Airbnb JavaScript style guide
"editor.rulers": [100],
"editor.tabSize": 2,
// Linux line endings are used in this project
"files.eol": "\n",
// Automatically removing all trailing whitespace when saving a file
"files.trimTrailingWhitespace": true,
// Configure glob patterns for excluding files and folders in full text searches and quick open
"search.exclude": {
"**/dist/**/*.js": true,
},
// -----------------------
// JavaScript / TypeScript
// -----------------------
// By default, VSCode will not automatically fill-in function arguments
"javascript.suggest.completeFunctionCalls": true,
"typescript.suggest.completeFunctionCalls": true,
// Automatically run the formatter when a JavaScript or TypeScript file is saved
"[javascript]": {
"editor.codeActionsOnSave": [
"source.fixAll.eslint",
],
"editor.tabSize": 2,
},
"[typescript]": {
"editor.codeActionsOnSave": [
"source.fixAll.eslint",
],
"editor.tabSize": 2,
},
}

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -0,0 +1,9 @@
[![npm version](https://img.shields.io/npm/v/isaac-typescript-definitions.svg)](https://www.npmjs.com/package/isaac-typescript-definitions)
# isaac-typescript-definitions
These are TypeScript definitions for [The Binding of Isaac: Repentance](https://store.steampowered.com/app/1426300/The_Binding_of_Isaac_Repentance/).
[IsaacScript](https://isaacscript.github.io/) mods are automatically configured to use these definitions.
<br />

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e # Exit on any errors
# Get the directory of this script
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR"
npx tsc --noEmit

View File

@ -0,0 +1,28 @@
#!/bin/bash
set -e # Exit on any errors
# Get the directory of this script
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# The latest version of some ESLint plugins require Node.js v16
NODE_VERSION=$(node --version | cut -c 2-3)
if (($NODE_VERSION < 16)); then
echo "error: requires Node.js version 16"
exit 1
fi
cd "$DIR"
# Step 1 - Use ESLint to lint the TypeScript
# Since all ESLint errors are set to warnings,
# we set max warnings to 0 so that warnings will fail in CI
npx eslint --max-warnings 0 typings
# Step 2 - Spell check every file using cspell
# We use no-progress and no-summary because we want to only output errors
npx cspell --no-progress --no-summary "typings/**/*.ts"
npx cspell --no-progress --no-summary "scripts/**/*.py"
echo "Success!"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
{
"name": "isaac-typescript-definitions",
"version": "1.0.244",
"description": "TypeScript definitions for The Binding of Isaac: Repentance",
"keywords": [
"isaac",
"rebirth",
"afterbirth",
"repentance"
],
"homepage": "https://github.com/IsaacScript/isaac-typescript-definitions#readme",
"bugs": {
"url": "https://github.com/IsaacScript/isaac-typescript-definitions/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/IsaacScript/isaac-typescript-definitions.git"
},
"license": "GPL-3.0",
"author": "Zamiell",
"types": "typings/index.d.ts",
"dependencies": {
"lua-types": "2.11.0"
},
"devDependencies": {
"isaacscript-lint": "^1.0.63",
"typescript": "^4.4.4"
}
}

View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e # Exit on any errors
# Get the directory of this script
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR"
pip install publish-npm --upgrade --quiet
publish-npm "$@"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
import os
import pathlib
import re
import sys
# We parse the "enums.lua" file directly because the documentation has bugs
def main():
# Get the path of the current script's directory
# https://stackoverflow.com/questions/5137497/find-current-directory-and-files-directory
dir_path = os.path.dirname(os.path.realpath(__file__))
enum_lua_path = os.path.join(dir_path, "enums.lua")
with open(enum_lua_path, "r") as enum_lua_io:
enum_lua = enum_lua_io.read()
typescript = ""
for line in enum_lua.split("\n"):
match1 = re.match(r"(\w+) = {", line)
if match1:
# New enum definition
if typescript != "":
typescript += "}\n\n"
typescript += "declare enum " + match1[1] + " {\n"
else:
line = line.split("--")[0] # Remove any Lua comments
match2 = re.match(r"\s*(\w+) = (.+)", line)
if match2:
entry_name = match2[1].strip()
entry_definition = match2[2].strip().strip(",").strip()
match3 = re.match(r"(\d+)<<(\d+)", entry_definition)
if match3:
entry_definition = match3[1] + " << " + match3[2]
typescript += " " + entry_name + " = " + entry_definition + ",\n"
typescript += "}\n"
enums_d_path = os.path.join(dir_path, "..", "typings", "enums.d.ts")
# pathlib.Path(enums_d_path).touch() # Create it if it does not already exist
with open(enums_d_path, "w") as f:
f.write(typescript)
print("Success.")
if __name__ == "__main__":
main()

View File

@ -0,0 +1,11 @@
// A special TypeScript project file, used by ESLint only
{
"extends": "./tsconfig.json",
"include": [
// These must match the base the "include" setting in the base "tsconfig.json" file
"./typings/**/*.ts",
// These are ESLint-only inclusions
"./.eslintrc.js",
],
}

View File

@ -0,0 +1,26 @@
// The configuration file for TypeScript
{
// We extend the standard IsaacScript compiler flags
// https://github.com/IsaacScript/isaacscript-tsconfig/blob/main/tsconfig.common.json
"extends": "isaacscript-tsconfig/tsconfig.common.json",
// https://www.typescriptlang.org/docs/handbook/compiler-options.html
"compilerOptions": {
// "target" specifies the ECMAScript target version
// By default, it is "ES3"
"target": "ESNext",
// We use TypeScript definitions for the Lua standard library
// https://github.com/TypeScriptToLua/lua-types
"types": ["lua-types/5.3"],
// The "lua-types" library requires Node module resolution
// By default, it is "Classic"
"moduleResolution": "Node",
},
// A list of the TypeScript files to compile
"include": [
"./typings/**/*.ts",
],
}

View File

@ -0,0 +1,16 @@
declare interface ActiveItemDesc {
BatteryCharge: int;
Charge: int;
Item: CollectibleType | int;
/** How close the item is to gaining another charge (0-1 range, used by 4.5 Volt). */
PartialCharge: float;
/**
* Number of frames before an item with a timed cooldown can recharge again.
* (Used by Spin To Win to pause its recharge after fully discharging it.)
*/
TimedRechargeCooldown: int;
/**
* Holds extra information for some active items (such as the number of uses for Jar of Wisps)
*/
VarData: int;
}

View File

@ -0,0 +1,26 @@
declare function BitSet128(this: void, l: int, h: int): BitSet128;
declare interface BitSet128 {
// If you call these methods directly, the game will crash; see the below methods instead
/*
__band(right: BitSet128): BitSet128;
__bnot(right: BitSet128): BitSet128;
__bor(right: BitSet128 | TearFlags): BitSet128;
__bshl(right: BitSet128): BitSet128;
__bshr(right: BitSet128): BitSet128;
__eq(right: BitSet128): boolean; // eslint-disable-line no-underscore-dangle
__le(right: BitSet128): boolean; // eslint-disable-line no-underscore-dangle
__lt(right: BitSet128): boolean; // eslint-disable-line no-underscore-dangle
*/
// These are used to transpile:
// tearFlags.bor(TearFlags.TEAR_SPECTRAL)
// to:
// tearFlags | TearFlags.TEAR_SPECTRAL
// https://typescripttolua.github.io/docs/advanced/language-extensions/#operator-map-types
band: LuaBitwiseAndMethod<BitSet128 | TearFlags, BitSet128>;
bnot: LuaBitwiseNotMethod<BitSet128 | TearFlags>;
bor: LuaBitwiseOrMethod<BitSet128 | TearFlags, BitSet128>;
bshl: LuaBitwiseLeftShiftMethod<BitSet128 | TearFlags, BitSet128>;
bshr: LuaBitwiseRightShiftMethod<BitSet128 | TearFlags, BitSet128>;
}

View File

@ -0,0 +1,6 @@
declare interface CardConfigList {
/** This function is bugged and returns useless userdata. */
Get(idx: int): never;
readonly Size: int;
}

View File

@ -0,0 +1,45 @@
/**
* @param r
* @param g
* @param b
* @param a Default is 1.
* @param ro Default is 0, range is 0-1.
* @param go Default is 0, range is 0-1.
* @param bo Default is 0, range is 0-1.
*/
declare function Color(
this: void,
r: float,
g: float,
b: float,
a?: float,
ro?: int,
go?: int,
bo?: int,
): Color;
declare interface Color {
Reset(): void;
SetColorize(red: float, green: float, blue: float, amount: float): void;
SetOffset(redOffset: float, greenOffset: float, blueOffset: float): void;
SetTint(
redTint: float,
greenTint: float,
blueTint: float,
alphaTint: float,
): void;
A: float;
B: float;
BO: float;
G: float;
GO: float;
R: float;
RO: float;
}
declare namespace Color {
function Lerp(this: void, m1: Color, m2: Color, t: float): Color;
const Default: Color;
}

View File

@ -0,0 +1,5 @@
declare interface CostumeConfigList {
Get(idx: int): ItemConfigCostume | undefined;
readonly Size: int;
}

View File

@ -0,0 +1,5 @@
declare interface EffectList {
Get(idx: int): TemporaryEffect | undefined;
Size: int;
}

View File

@ -0,0 +1,126 @@
declare interface Entity {
AddBurn(source: EntityRef, duration: int, damage: float): void;
AddCharmed(source: EntityRef, duration: int): void;
AddConfusion(source: EntityRef, duration: int, ignoreBosses: boolean): void;
AddEntityFlags(entityFlags: EntityFlag): void;
AddFear(source: EntityRef, duration: int): void;
AddFreeze(source: EntityRef, duration: int): void;
AddHealth(hitPoints: float): void;
AddMidasFreeze(source: EntityRef, duration: int): void;
AddPoison(source: EntityRef, duration: int, damage: float): void;
AddShrink(source: EntityRef, duration: int): void;
AddSlowing(
source: EntityRef,
duration: int,
slowValue: float,
slowColor: Color,
): void;
AddVelocity(velocity: Vector): void;
BloodExplode(): void;
// CanShutDoors is deliberately not implemented here because it conflicts with
// EntityNPC.CanShutDoors
// CanShutDoors(): boolean;
ClearEntityFlags(entityFlags: EntityFlag): void;
CollidesWithGrid(): boolean;
Die(): void;
Exists(): boolean;
GetBossID(): BossIDs | int;
GetColor(): Readonly<Color>;
GetData(): Record<string, unknown>;
GetDropRNG(): RNG;
GetEntityFlags(): EntityFlag;
GetLastChild(): Entity;
GetLastParent(): Entity;
GetSprite(): Sprite;
HasCommonParentWithEntity(other: Entity): boolean;
HasEntityFlags(entityFlags: EntityFlag): boolean;
HasFullHealth(): boolean;
HasMortalDamage(): boolean;
IsActiveEnemy(includeDead: boolean): boolean;
IsBoss(): boolean;
IsDead(): boolean;
IsEnemy(): boolean;
IsFlying(): boolean;
IsFrame(frame: int, offset: int): boolean;
IsInvincible(): boolean;
IsVisible(): boolean;
IsVulnerableEnemy(): boolean;
Kill(): void;
MultiplyFriction(value: float): void;
PostRender(): void;
Remove(): void;
RemoveStatusEffects(): void;
Render(offset: Vector): void;
RenderShadowLayer(offset: Vector): boolean;
/**
*
* @param color
* @param duration
* @param priority
* @param fadeout Default value is false.
* @param share Default value is false.
*/
SetColor(
color: Color,
duration: int,
priority: int,
fadeout?: boolean,
share?: boolean,
): void;
SetSize(size: float, sizeMulti: Vector, numGridCollisionPoints: int): void;
SetSpriteFrame(animationName: string, frameNum: int): void;
SetSpriteOverlayFrame(animationName: string, frameNum: int): void;
TakeDamage(
damage: float,
damageFlags: int,
source: EntityRef,
damageCountdown: int,
): boolean;
ToBomb(): EntityBomb | undefined;
ToEffect(): EntityEffect | undefined;
ToFamiliar(): EntityFamiliar | undefined;
ToKnife(): EntityKnife | undefined;
ToLaser(): EntityLaser | undefined;
ToNPC(): EntityNPC | undefined;
ToPickup(): EntityPickup | undefined;
ToPlayer(): EntityPlayer | undefined;
ToProjectile(): EntityProjectile | undefined;
ToTear(): EntityTear | undefined;
Update(): void;
Child: Entity | undefined;
CollisionDamage: float;
DepthOffset: float;
readonly DropSeed: int;
EntityCollisionClass: EntityCollisionClass;
FlipX: boolean;
readonly FrameCount: int;
Friction: float;
GridCollisionClass: EntityGridCollisionClass;
HitPoints: float;
readonly Index: int;
readonly InitSeed: int;
Mass: float;
MaxHitPoints: float;
Parent: Entity | undefined;
Position: Vector;
readonly PositionOffset: Readonly<Vector>;
RenderZOffset: int;
Size: float;
SizeMulti: Vector;
readonly SpawnGridIndex: int;
SpawnerEntity: Entity | undefined;
SpawnerType: EntityType | int;
SpawnerVariant: int;
readonly SplatColor: Readonly<Color>;
SpriteOffset: Vector;
SpriteRotation: float;
SpriteScale: Vector;
SubType: int;
Target: Entity | undefined;
readonly TargetPosition: Readonly<Vector>;
readonly Type: EntityType | int;
Variant: int;
Velocity: Vector;
Visible: boolean;
}

View File

@ -0,0 +1,27 @@
declare interface EntityBomb extends Entity {
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
AddTearFlags(flags: TearFlags): void;
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
ClearTearFlags(flags: TearFlags): void;
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
HasTearFlags(flags: TearFlags): boolean;
SetExplosionCountdown(countdown: int): void;
ExplosionDamage: float;
/**
* Be aware that this is really a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
Flags: int;
IsFetus: boolean;
RadiusMultiplier: float;
}

View File

@ -0,0 +1,24 @@
declare interface EntityEffect extends Entity {
FollowParent(parent: Entity): void;
SetDamageSource(entityType: EntityType | int): void;
SetRadii(min: float, max: float): void;
SetTimeout(timeout: int): void;
DamageSource: EntityType | int;
FallingAcceleration: float;
FallingSpeed: float;
IsFollowing: boolean;
LifeSpan: int;
MaxRadius: float;
MinRadius: float;
ParentOffset: Vector;
Rotation: float;
Scale: float;
State: int;
Timeout: int;
m_Height: float;
}
declare namespace EntityEffect {
function IsPlayerCreep(this: void, variant: int): boolean;
}

View File

@ -0,0 +1,64 @@
declare interface EntityFamiliar extends Entity {
AddCoins(value: int): void;
AddHearts(hearts: int): void;
AddKeys(keys: int): void;
AddToDelayed(): void;
AddToFollowers(): void;
AddToOrbit(layer: int): void;
FireProjectile(direction: Vector): EntityTear;
FollowParent(): void;
FollowPosition(position: Vector): void;
GetOrbitPosition(position: Vector): Vector;
MoveDelayed(numFrames: int): void;
MoveDiagonally(speed: float): void;
/**
* @param maxDistance
* @param frameInterval Default is 13.
* @param flags Default is 0.
* A combination of the following flags (none of these are set by default):
* 1: Allow switching to a better target even if we already have one
* 2: Don't prioritize enemies that are close to our owner
* 4: Prioritize enemies with higher HP
* 8: Prioritize enemies with lower HP
* 16: Give lower priority to our current target
* (this makes us more likely to switch between targets)
* @param coneDir Default is Vector.Zero.
* If ~= Vector.Zero, searches for targets in a cone pointing in this direction.
* @param coneAngle Default is 15.
* If ConeDir ~= Vector.Zero, sets the half angle of the search cone in degrees
* (45 results in a search angle of 90 degrees).
*/
PickEnemyTarget(
maxDistance: float,
frameInterval?: int,
flags?: int,
coneDir?: Vector,
coneAngle?: float,
): void;
PlayChargeAnim(direction: Direction): void;
PlayFloatAnim(direction: Direction): void;
PlayShootAnim(direction: Direction): void;
RecalculateOrbitOffset(layer: int, add: boolean): int;
RemoveFromDelayed(): void;
RemoveFromFollowers(): void;
RemoveFromOrbit(): void;
Shoot(): void;
Coins: int;
FireCooldown: int;
HeadFrameDelay: int;
Hearts: int;
Keys: int;
LastDirection: Direction;
MoveDirection: Direction;
OrbitAngleOffset: float;
OrbitDistance: Vector;
Player: EntityPlayer;
RoomClearCount: int;
ShootDirection: Direction;
State: int;
}
declare namespace EntityFamiliar {
function GetOrbitDistance(this: void, layer: int): Vector;
}

View File

@ -0,0 +1,37 @@
declare interface EntityKnife extends Entity {
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
AddTearFlags(flags: TearFlags): void;
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
ClearTearFlags(flags: TearFlags): void;
GetKnifeDistance(): float;
GetKnifeVelocity(): float;
GetRenderZ(): int;
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
HasTearFlags(flags: TearFlags): boolean;
IsFlying(): boolean;
Reset(): void;
SetPathFollowSpeed(speed: float): void;
Shoot(charge: float, range: float): void;
Charge: float;
MaxDistance: float;
PathFollowSpeed: float;
PathOffset: float;
Rotation: float;
RotationOffset: float;
Scale: float;
/**
* Be aware that this is really a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
TearFlags: int;
}

View File

@ -0,0 +1,86 @@
declare interface EntityLaser extends Entity {
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
AddTearFlags(flags: TearFlags): void;
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
ClearTearFlags(flags: TearFlags): void;
GetEndPoint(): Readonly<Vector>;
// GetNonOptimizedSamples(): Readonly<HomingLaserSampleList>; // HomingLaser is not implemented
GetRenderZ(): int;
// GetSamples(): Readonly<HomingLaserSampleList>; // HomingLaser is not implemented
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
HasTearFlags(flags: TearFlags): boolean;
IsCircleLaser(): boolean;
IsSampleLaser(): boolean;
SetActiveRotation(
delay: int,
angleDegrees: float,
rotationSpeed: float,
timeoutComplete: boolean,
): void;
SetBlackHpDropChance(chance: float): void;
// SetHomingType(laserHomingType: LaserHomingType): void; // LaserHomingType is not implemented
SetMaxDistance(distance: float): void;
SetMultidimensionalTouched(value: boolean): void;
SetOneHit(value: boolean): void;
SetTimeout(value: int): void;
Angle: float;
AngleDegrees: float;
BlackHpDropChance: float;
BounceLaser: Entity;
CurveStrength: float;
DisableFollowParent: boolean;
EndPoint: Vector;
FirstUpdate: boolean;
GridHit: boolean;
// HomingLaser: HomingLaser; // HomingLaser is not implemented
// HomingType: LaserHomingType; // LaserHomingType is not implemented
IsActiveRotating: boolean;
LaserLength: float;
LastAngleDegrees: float;
MaxDistance: float;
OneHit: boolean;
ParentOffset: Vector;
Radius: float;
RotationDegrees: float;
RotationDelay: int;
RotationSpd: float;
// SampleLaser: boolean; // Should use IsSampleLaser() instead
Shrink: boolean;
StartAngleDegrees: float;
/**
* Be aware that this is really a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
TearFlags: int;
Timeout: int;
}
declare namespace EntityLaser {
function CalculateEndPoint(
this: void,
start: Vector,
dir: Vector,
positionOffset: Vector,
parent: Entity,
margin: float,
): Vector;
function ShootAngle(
this: void,
variant: LaserVariant | int,
sourcePos: Vector,
angleDegrees: float,
timeout: int,
posOffset: Vector,
source: Entity,
): EntityLaser;
}

View File

@ -0,0 +1,5 @@
declare interface EntityList {
Get(idx: int): Entity | undefined;
readonly Size: int;
}

View File

@ -0,0 +1,97 @@
declare interface EntityNPC extends Entity {
AnimWalkFrame(
horizontalAnim: string,
verticalAnim: string,
speedThreshold: float,
): void;
CalcTargetPosition(distanceLimit: float): Vector;
CanBeDamagedFromVelocity(velocity: Vector): boolean;
CanReroll(): boolean;
FireBossProjectiles(
numProjectiles: int,
targetPos: Vector,
trajectoryModifier: float,
projectileParams: ProjectileParams,
): EntityProjectile;
FireProjectiles(
position: Vector,
velocity: Vector,
projectilesMode: ProjectilesMode,
projectileParams: ProjectileParams,
): void;
GetAliveEnemyCount(): int;
GetBossColorIdx(): int;
GetChampionColorIdx(): ChampionColor;
GetPlayerTarget(): Entity;
IsBoss(): boolean;
IsChampion(): boolean;
KillUnique(): void;
/**
* @param seed
* @param championColor The type of champion to turn this enemy into.
* (-1 results in a random champion type.)
* Default is -1.
* @param init Set to true when called while initializing the enemy, false otherwise.
* Default is false.
*/
MakeChampion(
seed: int,
championColorIdx?: ChampionColor,
init?: boolean,
): void;
MakeSplat(size: float): EntityEffect;
Morph(
entityType: EntityType | int,
variant: int,
subType: int,
championColorIdx: ChampionColor,
): boolean;
PlaySound(
soundEffect: SoundEffect | int,
volume: float,
frameDelay: int,
loop: boolean,
pitch: float,
): void;
QueryNPCsGroup(groupIdx: int): EntityList;
QueryNPCsSpawnerType(
spawnerType: EntityType | int,
entityType: EntityType | int,
onlyEnemies: boolean,
): EntityList;
QueryNPCsType(entityType: EntityNPC, variant: int): EntityList;
ResetPathFinderTarget(): void;
// EntityNPC.CanShutDoors conflicts with Entity.CanShutDoors(),
// but the latter is deliberately not implemented so that we can use the property in EntityNPC
CanShutDoors: boolean;
readonly ChildNPC: Readonly<EntityNPC>;
EntityRef: Entity;
GroupIdx: int;
I1: int;
I2: int;
readonly ParentNPC: Readonly<EntityNPC>;
Pathfinder: PathFinder;
ProjectileCooldown: int;
ProjectileDelay: int;
Scale: float;
/**
* This has a type of `NpcState | int` so that other enums can be used to represent more specific
* entities.
*/
State: NpcState | int;
StateFrame: int;
V1: Vector;
V2: Vector;
}
declare namespace EntityNPC {
function ThrowSpider(
this: void,
position: Vector,
spawner: Entity,
targetPos: Vector,
big: boolean,
yOffset: float,
): EntityNPC;
}

View File

@ -0,0 +1,49 @@
declare interface EntityPickup extends Entity {
AppearFast(): void;
CanReroll(): boolean;
GetCoinValue(): int;
IsShopItem(): boolean;
/**
* @param entityType
* @param variant
* @param subType
* @param keepPrice Default is false.
* @param keepSeed If set to true, keeps the initial RNG seed of the pickup instead of rerolling
* it. Default is false.
* @param ignoreModifiers If set to true, ignores item effects that might turn this pickup into
* something other than the specified variant and subtype. Default is false.
*/
Morph(
entityType: EntityType | int,
variant: int,
subType: int,
keepPrice?: boolean,
keepSeed?: boolean,
ignoreModifiers?: boolean,
): void;
PlayDropSound(): void;
PlayPickupSound(): void;
/**
* @param player Default is undefined.
*/
TryOpenChest(player?: EntityPlayer): boolean;
AutoUpdatePrice: boolean;
Charge: int;
/**
* Any non-zero value causes the item to form an option group with any other item with the same
* OptionsPickupIndex value.
*
* When an item belonging to an option group is picked up, all other items belonging to the same
* group disappear.
*
* 0 is the default value and means the item doesn't belong to any group.
*/
OptionsPickupIndex: int;
Price: int;
ShopItemId: int;
State: int;
Timeout: int;
Touched: boolean;
Wait: int;
}

View File

@ -0,0 +1,882 @@
declare interface EntityPlayer extends Entity {
/** 1 unit is half a heart. Remove them with negative numbers. */
AddBlackHearts(blackHearts: int): void;
/** This adds Tainted Bethany's blood charges. Only works on Tainted Bethany. */
AddBloodCharge(num: int): void;
/**
* @param amount
* @param position
* @param target This argument is not optional. If you want to spawn a fly without a target, then
* you must explicitly pass undefined.
*/
AddBlueFlies(
amount: int,
position: Vector,
target: Entity | undefined,
): Entity;
AddBlueSpider(position: Vector): Entity;
/** Remove them with negative numbers. */
AddBombs(amount: int): void;
/** Remove them with negative numbers. */
AddBoneHearts(hearts: int): void;
/** Remove them with negative numbers. */
AddBrokenHearts(hearts: int): void;
/**
* Used to specify the kinds of stats that should be evaluated the next time `EvaluateCache()` is
* run.
*/
AddCacheFlags(cacheFlags: CacheFlag): void;
AddCard(card: Card | int): void;
/** Remove them with negative numbers. */
AddCoins(amount: int): void;
/**
* @param collectibleType
* @param charge Default is 0.
* @param firstTimePickingUp Setting this to false will not spawn or add consumables for the item
* and will not cause it to count towards transformations. Default is true.
* @param activeSlot Sets the active slot this collectible should be added to.
* Default is ActiveSlot.SLOT_PRIMARY.
* @param varData Sets the variable data for this collectible (this is used to store extra data
* for some active items like the number of uses for Jar of Wisps).
* Default is 0.
*/
AddCollectible(
collectibleType: CollectibleType | int,
charge?: int,
firstTimePickingUp?: boolean,
activeSlot?: ActiveSlot,
varData?: int,
): void;
AddControlsCooldown(cooldown: int): void;
AddCostume(itemConfigItem: ItemConfigItem, itemStateOnly: boolean): void;
/**
* Disables all item effects similarly to the abandoned mineshaft in Mines II.
* This also temporarily removes consumables and pocket items.
*/
AddCurseMistEffect(): void;
AddDeadEyeCharge(): void;
AddDollarBillEffect(): void;
/** Remove them with negative numbers. */
AddEternalHearts(eternalHearts: int): void;
/** Spawns a friendly dip from Dirty Mind. */
AddFriendlyDip(subType: DipFamiliarSubType, position: Vector): EntityFamiliar;
/**
* Turns the given number of bombs into giga bombs.
* This does not actually increase the number of bombs held. To actually add bombs, AddBombs()
* should be called first.
*
* @param num
*/
AddGigaBombs(num: int): void;
/** Remove them with negative numbers. */
AddGoldenBomb(): void;
AddGoldenHearts(hearts: int): void;
AddGoldenKey(): void;
/**
* Adds red hearts to the player if there are any empty heart containers. 1 unit is half a heart.
* Remove health with negative numbers.
*/
AddHearts(hearts: int): void;
/**
* Spawns a Lemegeton wisp.
*
* @param subType The ID of the passive item to mimic.
* @param position
* @param adjustOrbitLayer Default is false.
*/
AddItemWisp(
subType: int,
position: Vector,
adjustOrbitLayer?: boolean,
): EntityFamiliar;
AddJarFlies(flies: int): void;
AddJarHearts(hearts: int): void;
/** Remove them with negative numbers. */
AddKeys(amount: int): void;
/**
* Adds heart containers to the player. 2 units is a full heart container.
* Remove them with negative numbers.
*/
AddMaxHearts(maxHearts: int, ignoreKeeper: boolean): void;
/**
* Spawns a mini Isaac from Giant Cell.
*
* @param position
* @param playAnim If false, skips the appear animation for the familiars.
*/
AddMinisaac(position: Vector, playAnim?: boolean): EntityFamiliar;
AddNullCostume(nullItemID: NullItemID | int): void;
AddPill(pillColor: PillColor | int): void;
AddPlayerFormCostume(playerForm: PlayerForm): void;
AddPrettyFly(): void;
/**
* Remove them with negative numbers.
*
* @param hearts Rotten hearts must be specified in a multiple of 2.
* For example, `AddRottenHearts(4)` will add 2 rotten hearts.
*/
AddRottenHearts(hearts: int): void;
/** This adds Bethany's soul heart charges. Only works on Bethany. */
AddSoulCharge(num: int): void;
/** 1 unit is half a heart. Remove them with negative numbers. */
AddSoulHearts(soulHearts: int): void;
/** Spawns a defensive fly from The Swarm. */
AddSwarmFlyOrbital(position: Vector): EntityFamiliar;
/**
* - If the player does not have any open trinket slots, this function will do nothing.
* - If the player has an open trinket slot but already has a trinket, the new trinket will go to
* the first slot and the existing trinket will get pushed back to the second slot.
* - If you provide an argument of 0 or an otherwise invalid trinket ID, the game will crash.
*
* @param trinketType
* @param firstTimePickingUp Setting this to false will not spawn or add pickups for the item
* and will not cause it to count towards transformations. Default is true.
*/
AddTrinket(
trinketType: TrinketType | int,
firstTimePickingUp?: boolean,
): void;
/**
* Spawns a Book of Virtues wisp.
*
* @param subType The ID of the active item to spawn a wisp from. Wisps with a special ID (for
* example "s0" in wisps.xml) can be spawned with the subtype 65536 + X where X is the number
* after the "s".
* @param position
* @param adjustOrbitLayer If true, allows wisps to spawn outside of their usual orbit if their
* assigned orbit is full. Default is false.
* @param dontUpdate If true, the spawned wisp will not update immediately. This allows certain
* properties to be set on the first frame before the wisp is fully initialized. Default is false.
*/
AddWisp(
subType: int,
position: Vector,
adjustOrbitLayer?: boolean,
dontUpdate?: boolean,
): EntityFamiliar;
/**
* Play the animation that is normally played at the beginning of a stage.
* Also plays the associated sound effect.
*/
AnimateAppear(): void;
/**
* @param card
* @param playerAnimationName Default is "Pickup".
*/
AnimateCard(
card: Card | int,
playerAnimationName?: PlayerItemAnimation,
): void;
/**
* @param collectibleType
* @param playerAnimationName Default is "Pickup".
* @param spriteAnimationName Default is "PlayerPickupSparkle".
*/
AnimateCollectible(
collectibleType: CollectibleType | int,
playerItemAnimation?: PlayerItemAnimation,
collectibleAnimation?: CollectibleAnimation,
): void;
/** Play the "thumbs up" animation. */
AnimateHappy(): void;
/** Play the animation where Isaac steps into a beam of light (e.g. at the end of Womb 2). */
AnimateLightTravel(): void;
/**
* @param pillColor
* @param playerAnimationName Default is "Pickup".
*/
AnimatePill(
pillColor: PillColor | int,
playerAnimationName?: PlayerItemAnimation,
): void;
AnimatePitfallIn(): void;
AnimatePitfallOut(): void;
/**
* Play the animation where Isaac holds his head in his hands.
* Also plays the associated sound effect.
*/
AnimateSad(): void;
AnimateTeleport(up: boolean): void;
AnimateTrapdoor(): void;
/**
* @param trinketType
* @param playerAnimationName Default is "Pickup".
* @param spriteAnimationName Default is "PlayerPickupSparkle".
*/
AnimateTrinket(
trinketType: TrinketType | int,
playerAnimationName?: PlayerItemAnimation,
spriteAnimationName?: string,
): void;
AreControlsEnabled(): boolean;
AreOpposingShootDirectionsPressed(): boolean;
/**
* @param collectibleType Default is CollectibleType.COLLECTIBLE_NULL.
*/
CanAddCollectible(collectibleType?: CollectibleType): boolean;
/** Returns true if the player can pick up black hearts, false otherwise. */
CanPickBlackHearts(): boolean;
/** Returns true if the player can pick up bone hearts, false otherwise. */
CanPickBoneHearts(): boolean;
/** Returns true if the player can pick up golden hearts, false otherwise. */
CanPickGoldenHearts(): boolean;
/** Returns true if the player can pick up red hearts, false otherwise. */
CanPickRedHearts(): boolean;
/** Returns true if the player can pick up rotten hearts, false otherwise. */
CanPickRottenHearts(): boolean;
/** Returns true if the player can pick up soul hearts, false otherwise. */
CanPickSoulHearts(): boolean;
CanPickupItem(): boolean;
CanShoot(): boolean;
/**
* When the player presses the different shoot buttons, Isaac will normally turn his head to face
* the direction that he is supposed to shoot in. This returns true if head will react to
* shooting, false otherwise.
*/
CanTurnHead(): boolean;
/**
* This will attempt to merge forms when called on characters like Jacob and Esau.
* This currently does not work correctly when changing from/to certain characters.
* (i.e. Tainted Isaac)
*/
ChangePlayerType(type: PlayerType): void;
/**
* @param familiarVariant
* @param targetCount
* @param rng
* @param sourceItem The item this type of familiar was created by. Default is undefined.
* @param familiarSubType The subtype of the familiar to check (-1 matches any subtype). Default
* is -1.
*/
CheckFamiliar(
familiarVariant: FamiliarVariant | int,
targetCount: int,
rng: RNG,
sourceItem?: ItemConfigItem,
familiarSubType?: int,
): void;
ClearCostumes(): void;
ClearDeadEyeCharge(): void;
/** Called automatically by the game when the player exits a room. */
ClearTemporaryEffects(): void;
/**
* Sets the charge of the active item to 0 without triggering the active item effect.
*
* @param activeSlot Default is ActiveSlot.SLOT_PRIMARY.
*/
DischargeActiveItem(activeSlot?: ActiveSlot): void;
DoZitEffect(direction: Vector): void;
DonateLuck(luck: int): void;
DropPocketItem(pocketItemSlot: PocketItemSlot, position: Vector): void;
DropTrinket(dropPos: Vector, replaceTick: boolean): void;
/**
* Triggers the MC_EVALUATE_CACHE callback. Before calling this function, you need to set the
* appropriate cache flags by using the `AddCacheFlag()` method.
*/
EvaluateItems(): void;
/**
* @param position
* @param velocity
* @param source Default is undefined.
*/
FireBomb(position: Vector, velocity: Vector, source?: Entity): EntityBomb;
/**
* @param direction
* @param source Default is undefined.
* @param damageMultiplier Default is 1.
*/
FireBrimstone(
direction: Vector,
source?: Entity,
damageMultiplier?: float,
): EntityLaser;
FireDelayedBrimstone(angle: float, parent: Entity): EntityLaser;
/**
* @param parent
* @param rotationOffset Default is 0.
* @param cantOverwrite Default is false.
* @param subType Default is 0.
* @param variant Default is 0.
*/
FireKnife(
parent: Entity,
rotationOffset?: float,
cantOverwrite?: boolean,
subType?: int,
variant?: int,
): EntityKnife;
/**
* @param position
* @param velocity
* @param canBeEye Default is true.
* @param noTractorBeam Default is false.
* @param canTriggerStreakEnd Default is true.
* @param source Default is undefined.
* @param damageMultiplier Default is 1.
*/
FireTear(
position: Vector,
velocity: Vector,
canBeEye?: boolean,
noTractorBeam?: boolean,
canTriggerStreakEnd?: boolean,
source?: Entity,
damageMultiplier?: float,
): EntityTear;
/**
* @param position
* @param laserOffset
* @param direction
* @param leftEye
* @param oneHit Default is false.
* @param source Default is undefined.
* @param damageMultiplier Default is 1.
*/
FireTechLaser(
position: Vector,
laserOffset: LaserOffset,
direction: Vector,
leftEye: boolean,
oneHit?: boolean,
source?: Entity,
damageMultiplier?: float,
): EntityLaser;
/**
* @param position
* @param direction
* @param radius
* @param source Default is undefined.
* @param damageMultiplier Default is 1.
*/
FireTechXLaser(
position: Vector,
direction: Vector,
radius: float,
source?: Entity,
damageMultiplier?: float,
): EntityLaser;
FlushQueueItem(): boolean;
/**
* @param activeSlot Default is ActiveSlot.SLOT_PRIMARY.
* @param force If set, items will always be charged even if they normally cannot be recharged by
* batteries.
*/
FullCharge(activeSlot?: ActiveSlot, force?: boolean): boolean;
/**
* @param activeSlot Default is ActiveSlot.SLOT_PRIMARY.
*/
GetActiveCharge(activeSlot?: ActiveSlot): int;
/**
* Returns 0 if no item is held.
*
* @param activeSlot Default is ActiveSlot.SLOT_PRIMARY.
*/
GetActiveItem(activeSlot?: ActiveSlot): CollectibleType | int;
/**
* Returns 0 if there is no active item in the specified slot.
*
* @param activeSlot Default is ActiveSlot.SLOT_PRIMARY.
*/
GetActiveSubCharge(activeSlot?: ActiveSlot): int;
GetActiveWeaponEntity(): Entity;
GetAimDirection(): Readonly<Vector>;
GetBabySkin(): BabySubType | int;
/**
* @param activeSlot Default is ActiveSlot.SLOT_PRIMARY.
*/
GetBatteryCharge(activeSlot?: ActiveSlot): int;
/** This returns the bit mask for which soul hearts are black hearts. */
GetBlackHearts(): int;
/** This gets Tainted Bethany's blood charges. */
GetBloodCharge(): int;
/**
* There is no separate BombFlags enum, so bombs use tear flags.
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
GetBombFlags(): int;
/**
* There is no separate BombFlags enum, so bombs use tear flags.
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
GetBombVariant(
tearFlags: TearFlags,
forceSmallBomb: boolean,
): BombVariant | int;
GetBoneHearts(): int;
GetBrokenHearts(): int;
/** Returns 0 if there is no card. */
GetCard(pocketItemSlot: PocketItemSlot): Card | int;
GetCardRNG(card: Card | int): RNG;
GetCollectibleCount(): int;
/**
* @param collectibleType
* @param onlyCountTrueItems If set to true, the function only counts collectibles that the player
* actually owns and ignores things like Lilith's Incubus, items granted by 3 Dollar Bill, and so
* forth.
*/
GetCollectibleNum(
collectibleType: CollectibleType | int,
ignoreModifiers?: boolean,
): int;
GetCollectibleRNG(collectibleType: CollectibleType | int): RNG;
GetCostumeNullPos(
nullFrameName: string,
headScale: boolean,
direction: Vector,
): Vector;
GetDamageCooldown(): int;
/** This returns the number of blood charges when called on Tainted Bethany, 0 otherwise. */
GetEffectiveBloodCharge(): int;
GetEffectiveMaxHearts(): int;
/** This returns the number of soul charges when called on Bethany, 0 otherwise. */
GetEffectiveSoulCharge(): int;
GetEffects(): TemporaryEffects;
GetEternalHearts(): int;
GetExtraLives(): int;
GetFireDirection(): Direction;
GetFlyingOffset(): Vector;
GetGoldenHearts(): int;
GetGreedDonationBreakChance(): float;
GetHeadDirection(): Direction;
GetHeartLimit(): int;
/**
* Returns the amount of red hearts the player has inside their heart containers and bone hearts.
* 1 unit is half a heart.
*/
GetHearts(): int;
GetItemState(): int;
GetJarFlies(): int;
GetJarHearts(): int;
GetLaserOffset(laserOffset: LaserOffset, direction: Vector): Vector;
GetLastActionTriggers(): int;
GetLastDamageFlags(): DamageFlag;
GetLastDamageSource(): Readonly<EntityRef>;
GetLastDirection(): Readonly<Vector>;
/**
* - When called on Jacob or Esau, returns Jacob.
* - When called on Tainted Forgotten or Tainted Forgotten's Soul, returns Tainted Forgotten.
* - When called on any other character, returns that character.
*/
GetMainTwin(): EntityPlayer;
/**
* Returns the amount of heart containers that the player has. 1 unit is half a heart container.
*/
GetMaxHearts(): int;
/**
* Returns the maximum number of pocket items + pocket actives that the player can currently hold.
*
* - Usually, this will return 1.
* - If the player has Belly Button, Starter Deck, or Little Baggy, it will increment the number
* by 1.
* - If the player has a pocket active item, it will increment the number by 1.
* - If the player has a dice from the Dice Bag trinket, it will increment the number by 1.
* - The maximum number this can return is 4.
*/
GetMaxPocketItems(): int;
/**
* Returns the maximum number of trinkets that the player can currently hold. Usually, this will
* return 1, but the player can hold up to 2 trinkets under certain conditions (e.g. having Mom's
* Purse).
*/
GetMaxTrinkets(): int;
/**
* Returns the current passive item mimicked by Modeling Clay
* (or COLLECTIBLE_NULL if no effect is being mimicked).
*/
GetModelingClayEffect(): CollectibleType;
GetMovementDirection(): Direction;
GetMovementInput(): Vector;
GetMovementJoystick(): Vector;
GetMovementVector(): Readonly<Vector>;
/**
* Note that the only thing that you can do with MultiShotParams is feed it to the
* `EntityPlayer.GetMultiShotPositionVelocity()` method.
*
* @param weaponType Default is WeaponType.WEAPON_TEARS.
*/
GetMultiShotParams(weaponType?: WeaponType): MultiShotParams;
GetMultiShotPositionVelocity(
loopIndex: int,
weaponType: WeaponType,
shotDirection: Vector,
shotSpeed: float,
multiShotParams: MultiShotParams,
): PosVel;
/**
* Normally, this function returns the player. However, in some cases, NPCs can be redirected to
* attack another target, in which case this function will return the alternate target
* (e.g. after using Best Friend).
*/
GetNPCTarget(): Entity;
/** Returns e.g. "Isaac", "Cain", etc. */
GetName(): string;
GetNumBlueFlies(): int;
GetNumBlueSpiders(): int;
GetNumBombs(): int;
GetNumCoins(): int;
/** Returns the number of giga bombs held. */
GetNumGigaBombs(): int;
GetNumKeys(): int;
/**
* - When called on Jacob, returns Esau.
* - When called on Esau, returns Jacob.
* - When called on Tainted Forgotten, returns Tainted Forgotten's Soul.
* - When called on Tainted Forgotten's Soul, returns Tainted Forgotten.
* - When called on any other character, returns undefined.
*/
GetOtherTwin(): EntityPlayer | undefined;
/** Returns 0 if there is no pill. */
GetPill(pocketItemSlot: PocketItemSlot): PillColor | int;
GetPillRNG(pillEffect: PillEffect | int): RNG;
GetPlayerType(): PlayerType | int;
// GetPocketItem(slotID: int): Readonly<PlayerPocketItem>; // PlayerPocketItem is not implemented
/**
* Returns the joystick direction that drives player movement, taking into account certain
* modifiers like disabled controls and seed effects.
*/
GetRecentMovementVector(): Readonly<Vector>;
/**
* This returns the actual number of rotten hearts.
* (For example, this returns 2 if the player has 2 rotten hearts.)
*/
GetRottenHearts(): int;
GetShootingInput(): Vector;
GetShootingJoystick(): Vector;
GetSmoothBodyRotation(): float;
/** This gets Bethany's soul heart charges. */
GetSoulCharge(): int;
/**
* 1 unit is half a heart. Black hearts count toward this total.
* Remove them with negative numbers.
*/
GetSoulHearts(): int;
/**
* - When on The Forgotten, returns the player object for The Soul.
* - When on The Soul, returns the player object for The Forgotten.
* - Otherwise, returns undefined.
*/
GetSubPlayer(): EntityPlayer | undefined;
/**
* Used for tear parameters that are calculated on hit (e.g. Tough Love, Common Cold),
*
* @param weaponType
* @param damageScale Default is 1.
* @param tearDisplacement Default is 1.
* @param source Default is undefined.
*/
GetTearHitParams(
weaponType: WeaponType,
damageScale?: float,
tearDisplacement?: int,
source?: Entity,
): TearParams;
GetTearMovementInheritance(shotDirection: Vector): Vector;
GetTearPoisonDamage(): float;
GetTearRangeModifier(): int;
GetTotalDamageTaken(): int;
GetTractorBeam(): Entity;
/** Returns 0 if there is no trinket. */
GetTrinket(trinketSlot: TrinketSlot): int;
/**
* This is the number of times that the trinket effect is applied.
* Returns 0 if the player does not have the particular trinket.
*/
GetTrinketMultiplier(trinketType: TrinketType | int): int;
GetTrinketRNG(trinketType: TrinketType | int): RNG;
GetVelocityBeforeUpdate(): Readonly<Vector>;
GetZodiacEffect(): ZodiacCollectibles;
/**
* @param collectibleType
* @param ignoreModifiers If set to true, only counts collectibles the player actually owns and
* ignores effects granted by items like Zodiac, 3 Dollar Bill and Lemegeton. Default is false.
*/
HasCollectible(
collectibleType: CollectibleType | int,
ignoreModifiers?: boolean,
): boolean;
/** Returns true if the player's item effects are currently being disabled. */
HasCurseMistEffect(): boolean;
HasFullHearts(): boolean;
HasFullHeartsAndSoulHearts(): boolean;
HasGoldenBomb(): boolean;
HasGoldenKey(): boolean;
/**
* @param damageFlag Default is 0.
*/
HasInvincibility(damageFlag?: DamageFlag): boolean;
HasPlayerForm(playerForm: PlayerForm): boolean;
HasTimedItem(): boolean;
/**
* @param trinketType
* @param ignoreModifiers If set to true, only counts trinkets the player actually holds and
* ignores effects granted by other items. Default is false.
*/
HasTrinket(
trinketType: TrinketType | int,
ignoreModifiers?: boolean,
): boolean;
HasWeaponType(weaponType: WeaponType): boolean;
InitBabySkin(): void;
IsBlackHeart(heart: int): boolean;
IsBoneHeart(heartSlot: int): boolean;
/**
* In a multiplayer game, if a player dies, they will return as a tiny ghost. This method returns
* true if the player is a co-op ghost.
*/
IsCoopGhost(): boolean;
IsExtraAnimationFinished(): boolean;
IsFullSpriteRendering(): boolean;
IsHeldItemVisible(): boolean;
/* Is the player holding up an item (card/collectible/etc)? */
IsHoldingItem(): boolean;
IsItemQueueEmpty(): boolean;
IsP2Appearing(): boolean;
IsPosInSpotLight(position: Vector): boolean;
/** Returns true for The Soul. Otherwise, returns false. */
IsSubPlayer(): boolean;
/**
* @param activeSlot Default is ActiveSlot.SLOT_PRIMARY.
*/
NeedsCharge(activeSlot?: ActiveSlot): boolean;
PlayExtraAnimation(animation: string): void;
QueueExtraAnimation(animation: string): void;
/**
* When the player touches a collectible item, they are not granted it immediately. Instead, the
* item is a queue for the duration of the animation where the player holds the item above their
* head. When the animation is finished, the item(s) in the queue will be granted. This method
* adds a new item to the item queue. If the player is not currently playing an animation, then
* the queued item will simply be awarded instantly.
*
* @param itemConfigItem
* @param charge Default is 0.
* @param touched Default is false.
* @param golden Default is false.
* @param varData Default is false.
*/
QueueItem(
itemConfigItem: ItemConfigItem,
charge?: int,
touched?: boolean,
golden?: boolean,
varData?: int,
): void;
RemoveBlackHeart(blackHeart: int): void;
RemoveBlueFly(): void;
RemoveBlueSpider(): void;
/**
* @param collectibleType
* @param ignoreModifiers Ignores collectible effects granted by other items (i.e. Void).
* Default is false.
* @param activeSlot Sets the active slot this collectible should be removed from.
* Default is ActiveSlot.SLOT_PRIMARY.
* @param removeFromPlayerForm If successfully removed and part of a transformation, decrease that
* transformation's counter by 1. Default is true.
*/
RemoveCollectible(
collectibleType: CollectibleType | int,
ignoreModifiers?: boolean,
activeSlot?: ActiveSlot,
removeFromPlayerForm?: boolean,
): void;
RemoveCostume(itemConfigItem: ItemConfigItem): void;
/**
* Re-enables item effects removed by AddCurseMistEffect().
* Also attempts to restore consumables and pocket items removed by AddCurseMistEffect().
*/
RemoveCurseMistEffect(): void;
RemoveGoldenBomb(): void;
RemoveGoldenKey(): void;
/** Removes player-specific costumes like Magdalene's hair or Cain's eyepatch. */
RemoveSkinCostume(): void;
RenderBody(position: Vector): void;
RenderGlow(position: Vector): void;
RenderHead(position: Vector): void;
RenderTop(position: Vector): void;
ReplaceCostumeSprite(
itemConfigItem: ItemConfigItem,
spritePath: string,
spriteID: int,
): void;
ResetDamageCooldown(): void;
ResetItemState(): void;
RespawnFamiliars(): void;
Revive(): void;
/**
* @param charge
* @param activeSlot Default is ActiveSlot.SLOT_PRIMARY.
*/
SetActiveCharge(charge: int, activeSlot?: ActiveSlot): void;
/** This sets Tainted Bethany's blood charges. Only works on Tainted Bethany. */
SetBloodCharge(num: int): void;
SetCard(pocketItemSlot: PocketItemSlot, card: Card | int): void;
SetFullHearts(): void;
SetMinDamageCooldown(damageCooldown: int): void;
SetPill(pocketItemSlot: PocketItemSlot, pillColor: PillColor | int): void;
/**
* Sets the player's pocket active item to the given active item.
* Items added to SLOT_POCKET2 will always be removed upon being used.
*
* @param collectibleType
* @param slot Can be either ActiveSlot.SLOT_POCKET or ActiveSlot.SLOT_POCKET2. Default is ActiveSlot.SLOT_POCKET.
* @param keepInPools If true, the item will not be removed from the item pools. Default is false.
*/
SetPocketActiveItem(
collectibleType: CollectibleType,
slot?: ActiveSlot,
keepInPools?: boolean,
): void;
SetShootingCooldown(cooldown: int): void;
/**
* This sets Bethany's soul heart charges.
*
* @param num
*/
SetSoulCharge(num: int): void;
SetTargetTrapDoor(trapDoor: GridEntity): void;
ShootRedCandle(direction: Vector): void;
SpawnMawOfVoid(timeout: int): EntityLaser;
StopExtraAnimation(): void;
SwapActiveItems(): void;
ThrowBlueSpider(position: Vector, target: Vector): Entity;
/**
* Spawns a friendly dip (from Dirty Mind) and throws it towards the specified target.
*
* @param subType
* @param position
* @param target If Vector.Zero, throws the spawned dip in a random direction. Default is
* Vector.Zero.
*/
ThrowFriendlyDip(
subType: DipFamiliarSubType,
position: Vector,
target?: Vector,
): EntityFamiliar;
/**
* If holding an entity, throws it in the specified direction and returns it. Otherwise, returns
* undefined.
*
* @param velocity
*/
ThrowHeldEntity(velocity: Vector): Entity;
/**
* Triggers the extra effect granted by Book of Virtues for the given active item.
*
* @param collectibleType Default is CollectibleType.COLLECTIBLE_NULL.
*/
TriggerBookOfVirtues(collectibleType?: CollectibleType): void;
/**
* Attempts to pick up the given entity, returns true on success.
* Currently only works with some entity types (mainly bombs and enemies).
*/
TryHoldEntity(entity: Entity): boolean;
TryHoldTrinket(trinketType: TrinketType | int): boolean;
/**
* @param collectibleType
* @param keepPersistent If set to false, this method will only remove temporary costumes.
*/
TryRemoveCollectibleCostume(
collectibleType: CollectibleType | int,
keepPersistent: boolean,
): void;
TryRemoveNullCostume(nullItemID: NullItemID | int): void;
/**
* Will remove the specified trinket, if it exists. This will also remove The Tick and smelted
* trinkets.
*
* @param trinketType If you provide an argument of 0 or an otherwise invalid trinket ID, the game
* will crash.
* @returns Whether or not the specified trinket was removed successfully.
*/
TryRemoveTrinket(trinketType: TrinketType | int): boolean;
TryRemoveTrinketCostume(trinketType: TrinketType | int): void;
TryUseKey(): boolean;
UpdateCanShoot(): void;
/**
* @param collectibleType
* @param useFlag Default is 0.
* @param activeSlot The active slot this item was used from.
* (Set to -1 if this item wasn't triggered by any active slot.)
* Default is ActiveSlot.SLOT_PRIMARY.
*/
UseActiveItem(
collectibleType: CollectibleType | int,
useFlag?: UseFlag,
activeSlot?: ActiveSlot,
): void;
/**
* @param collectibleType
* @param showAnim
* @param keepActiveItem
* @param allowNonMainPlayer
* @param toAddCostume
* @param activeSlot The active slot this item was used from.
* (Set to -1 if this item wasn't triggered by any active slot.)
* Default is ActiveSlot.SLOT_PRIMARY.
*/
UseActiveItem(
collectibleType: CollectibleType | int,
showAnim: boolean,
keepActiveItem: boolean,
allowNonMainPlayer: boolean,
toAddCostume: boolean,
activeSlot?: ActiveSlot,
): void;
/**
* @param card
* @param useFlag Default is 0.
*/
UseCard(card: Card | int, useFlag?: UseFlag): void;
/**
* @param pillEffect
* @param pillColor
* @param useFlag Default is 0.
*/
UsePill(
pillEffect: PillEffect | int,
pillColor: PillColor | int,
useFlag?: UseFlag,
): void;
WillPlayerRevive(): boolean;
BabySkin: BabySubType | int;
/** Only change this in the EvaluateCache callback. */
CanFly: boolean;
readonly ControllerIndex: ControllerIndex;
ControlsCooldown: int;
ControlsEnabled: boolean;
/** Only change this in the EvaluateCache callback. */
Damage: float;
FireDelay: int;
// readonly FriendBallEnemy: Readonly<EntityDesc>; // EntityDesc is not implemented
HeadFrameDelay: int;
ItemHoldCooldown: int;
LaserColor: Color;
/** Only change this in the EvaluateCache callback. */
Luck: float;
/** Only change this in the EvaluateCache callback. */
MaxFireDelay: int;
/** Only change this in the EvaluateCache callback. */
MoveSpeed: float;
QueuedItem: QueueItemData;
/** Only change this in the EvaluateCache callback. */
ShotSpeed: float;
SpriteScale: Vector;
TearColor: Color;
TearFallingAcceleration: float;
/** Only change this in the EvaluateCache callback. */
TearFallingSpeed: float;
/**
* Only change this in the EvaluateCache callback.
* Be aware that this is really a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
TearFlags: int;
/**
* This is equal to the range stat multiplied by -1.
* Only change this in the EvaluateCache callback.
*/
TearHeight: float;
readonly TearsOffset: Readonly<Vector>;
}

View File

@ -0,0 +1,25 @@
declare interface EntityProjectile extends Entity {
AddChangeFlags(flags: int): void;
AddFallingAccel(value: float): void;
AddFallingSpeed(value: float): void;
AddHeight(value: float): void;
AddProjectileFlags(flags: ProjectileFlags): void;
AddScale(value: float): void;
ClearProjectileFlags(flags: int): void;
HasProjectileFlags(flags: int): void;
Acceleration: float;
ChangeFlags: ProjectileFlags;
ChangeTimeout: int;
ChangeVelocity: float;
CurvingStrength: float;
Damage: float;
DepthOffset: float;
FallingAccel: float;
FallingSpeed: float;
Height: float;
HomingStrength: float;
ProjectileFlags: ProjectileFlags;
Scale: float;
WiggleFrameOffset: int;
}

View File

@ -0,0 +1,7 @@
declare function EntityPtr(this: void, entity: Entity): EntityPtr;
declare interface EntityPtr {
SetReference(ref: Entity): void;
readonly Ref: Entity | undefined;
}

View File

@ -0,0 +1,12 @@
declare function EntityRef(this: void, entity: Entity | undefined): EntityRef;
declare interface EntityRef {
Entity: Entity;
IsCharmed: boolean;
IsFriendly: boolean;
Position: Vector;
SpawnerType: EntityType | int;
SpawnerVariant: int;
Type: EntityType | int;
Variant: int;
}

View File

@ -0,0 +1,56 @@
declare interface EntityTear extends Entity {
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
AddTearFlags(flags: TearFlags): void;
ChangeVariant(newVariant: TearVariant | int): void;
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
ClearTearFlags(flags: TearFlags): void;
/**
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
HasTearFlags(flags: TearFlags): boolean;
ResetSpriteScale(): void;
SetDeadEyeIntensity(intensity: float): void;
SetKnockbackMultiplier(multiplier: float): void;
SetParentOffset(offset: Vector): void;
SetWaitFrames(value: int): void;
readonly BaseDamage: float;
readonly BaseScale: float;
Bounced: boolean;
CanTriggerStreakEnd: boolean;
ContinueVelocity: Vector;
FallingAcceleration: float;
FallingSpeed: float;
Height: float;
HomingFriction: float;
KnockbackMultiplier: float;
ParentOffset: Vector;
readonly PosDisplacement: Readonly<Vector>;
Rotation: float;
Scale: float;
StickDiff: Vector;
StickTarget: Entity;
StickTimer: int;
/**
* Be aware that this is really a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
TearFlags: int;
/**
* - In each run, the game keeps track of how many tears have been fired by the player in total.
* This is used for items such as Lead Pencil.
* - TearIndex represents this tear counter.
* - It is 0-indexed, meaning that the first tear fired by the player on a run will have a
* TearIndex of 0, the second tear fired by the player on a run will have a TearIndex of 1,and so
* on.
*/
readonly TearIndex: int;
WaitFrames: int;
}

View File

@ -0,0 +1,75 @@
declare function Font(this: void): Font;
declare interface Font {
/**
* @param str
* @param positionX
* @param positionY
* @param renderColor
* @param boxWidth Default is 0.
* @param center Default is false.
*/
DrawString(
str: string,
positionX: float,
positionY: float,
renderColor: KColor,
boxWidth?: int,
center?: boolean,
): void;
/**
* @param str
* @param positionX
* @param positionY
* @param scaleX
* @param scaleY
* @param renderColor
* @param boxWidth Default is 0.
* @param center Default is false.
*/
DrawStringScaled(
str: string,
positionX: float,
positionY: float,
scaleX: float,
scaleY: float,
renderColor: KColor,
boxWidth?: int,
center?: boolean,
): void;
DrawStringScaledUTF8(
str: string,
positionX: float,
positionY: float,
scaleX: float,
scaleY: float,
renderColor: KColor,
boxWidth: int,
center: boolean,
): void;
/**
* @param str
* @param positionX
* @param positionY
* @param renderColor
* @param boxWidth Default is 0.
* @param center Default is false.
*/
DrawStringUTF8(
str: string,
positionX: float,
positionY: float,
renderColor: KColor,
boxWidth?: int,
center?: boolean,
): void;
GetBaselineHeight(): int;
GetCharacterWidth(character: string): int;
GetLineHeight(): int;
GetStringWidth(str: string): int;
GetStringWidthUTF8(str: string): int;
IsLoaded(): boolean;
Load(filePath: string): boolean;
SetMissingCharacter(missingCharacter: int): void;
Unload(): void;
}

View File

@ -0,0 +1,242 @@
declare interface Game {
AddDevilRoomDeal(): void;
AddEncounteredBoss(entityType: EntityType | int, variant: int): void;
AddPixelation(duration: int): void;
AddStageWithoutDamage(): void;
AddStageWithoutHeartsPicked(): void;
AddTreasureRoomsVisited(): void;
/**
* There is no separate BombFlags enum, so bombs use tear flags.
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*
* @param position
* @param damage
* @param radius
* @param lineCheck Default is true.
* @param source Default is undefined.
* @param tearFlags Default is TearFlags.TEAR_NORMAL.
* @param damageFlags Default is DamageFlag.DAMAGE_EXPLOSION.
* @param damageSource Default is false.
*/
BombDamage(
position: Vector,
damage: float,
radius: float,
lineCheck?: boolean,
source?: Entity,
tearFlags?: int,
damageFlags?: DamageFlag,
damageSource?: boolean,
): void;
/**
* There is no separate BombFlags enum, so bombs use tear flags.
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*
* @param position
* @param damage
* @param tearFlags Default is TearFlags.TEAR_NORMAL.
* @param color Default is Color.Default.
* @param source Default is undefined.
* @param radiusMult Default is 1.
* @param lineCheck Default is true.
* @param damageSource Default is false.
* @param damageFlags Default is DamageFlag.DAMAGE_EXPLOSION.
*/
BombExplosionEffects(
position: Vector,
damage: float,
tearFlags?: int,
color?: Color,
source?: Entity,
radiusMult?: float,
lineCheck?: boolean,
damageSource?: boolean,
damageFlags?: DamageFlag,
): void;
/**
* There is no separate BombFlags enum, so bombs use tear flags.
* Be aware that this really takes a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*
* @param position
* @param radius
* @param tearFlags
* @param source Default is undefined.
* @param radiusMult Default is 1.
*/
BombTearflagEffects(
position: Vector,
radius: float,
tearFlags: int,
source?: Entity,
radiusMult?: float,
): void;
ButterBeanFart(
position: Vector,
radius: float,
source: Entity,
showEffect: boolean,
doSuperKnockback: boolean,
): void;
/**
* @param roomIndex
* @param dimension Default is Dimension.CURRENT.
*/
ChangeRoom(roomIndex: int, dimension?: Dimension): void;
CharmFart(position: Vector, radius: float, source: Entity): void;
ClearDonationModAngel(): void;
ClearDonationModGreed(): void;
ClearStagesWithoutDamage(): void;
ClearStagesWithoutHeartsPicked(): void;
Darken(darkness: float, timeout: int): void;
DonateAngel(donate: int): void;
DonateGreed(donate: int): void;
End(ending: Ending): void;
Fadein(speed: float): void;
Fadeout(speed: float, fadeoutTarget: FadeoutTarget): void;
/**
* @param position
* @param radius Default is 85.
* @param source Default is undefined.
* @param fartScale Default is 1.
* @param fartSubType Default is 0
* @param fartColor Default is Color.Default.
*/
Fart(
position: Vector,
radius?: float,
source?: Entity,
fartScale?: float,
fartSubType?: int,
fartColor?: Color,
): void;
FinishChallenge(): void;
// GetAmbush(): Ambush; // Ambush is not implemented
GetDarknessModifier(): float;
GetDevilRoomDeals(): int;
GetDonationModAngel(): int;
GetDonationModGreed(): int;
GetFont(): Font;
GetFrameCount(): int;
GetGreedBossWaveNum(): int;
GetGreedWavesNum(): int;
// GetItemOverlay(): ItemOverlay; // ItemOverlay is not implemented
GetHUD(): HUD;
GetItemPool(): ItemPool;
/** This function is bugged and returns useless userdata. */
GetLastDevilRoomStage(fakeArg: never): LevelStage;
GetLastLevelWithDamage(): LevelStage;
GetLastLevelWithoutHalfHp(): LevelStage;
GetLevel(): Level;
GetNearestPlayer(position: Vector): EntityPlayer;
GetNumEncounteredBosses(): int;
GetNumPlayers(): int;
/** Use `Isaac.GetPlayer()` instead of this function. */
GetPlayer(fakeArg: never): EntityPlayer | undefined;
GetRandomPlayer(position: Vector, radius: float): EntityPlayer;
GetRoom(): Room;
GetScreenShakeCountdown(): Readonly<int>;
GetSeeds(): Seeds;
GetStagesWithoutDamage(): int;
GetStagesWithoutHeartsPicked(): int;
GetStateFlag(gameStateFlag: GameStateFlag): boolean;
GetTargetDarkness(): float;
GetTreasureRoomVisitCount(): int;
GetVictoryLap(): int;
HasEncounteredBoss(entityType: EntityType | int, variant: int): boolean;
HasHallucination(): int;
IsGreedMode(): boolean;
IsPaused(): boolean;
MoveToRandomRoom(IAmErrorRoom: boolean, seed: int): void;
NextVictoryLap(): void;
Render(): void;
RerollEnemy(entity: Entity): boolean;
RerollLevelCollectibles(): void;
RerollLevelPickups(seed: int): void;
SetLastDevilRoomStage(levelStage: LevelStage): void;
SetLastLevelWithDamage(levelStage: LevelStage): void;
SetLastLevelWithoutHalfHp(levelStage: LevelStage): void;
SetStateFlag(gameStateFlag: GameStateFlag, val: boolean): void;
ShakeScreen(timeout: int): void;
ShowFortune(): void;
/**
* @param frameCount
* @param hallucinationBackdrop Default is BackdropType.NUM_BACKDROPS.
*/
ShowHallucination(
frameCount: int,
hallucinationBackdropType?: BackdropType,
): void;
ShowRule(): void;
Spawn(
entityType: EntityType | int,
variant: int,
position: Vector,
velocity: Vector,
spawner: Entity | undefined,
subType: int,
seed: int,
): Entity;
/*
SpawnEntityDesc(
entityDesc: EntityDesc, // EntityDesc is not implemented
position: Vector,
spawner: Entity,
): EntityNPC;
*/
/**
* @param position
* @param effectVariant
* @param numParticles
* @param speed
* @param color Default is Color.Default.
* @param height Default is 100000.
* @param subType Default is 0.
*/
SpawnParticles(
position: Vector,
effectVariant: EffectVariant | int,
numParticles: int,
speed: float,
color?: Color,
height?: float,
subType?: int,
): void;
/**
* You have to set Level.LeaveDoor to an appropriate value before using this function. Otherwise,
* you will be sent to the wrong room. (For teleports, set it to -1.)
*
* @param roomIndex
* @param direction
* @param roomTransition Default is RoomTransitionAnim.WALK.
* @param player Default is undefined.
* @param dimension Default is Dimension.CURRENT.
*/
StartRoomTransition(
roomIndex: int,
direction: Direction,
roomTransitionAnim?: RoomTransitionAnim,
player?: EntityPlayer,
dimension?: Dimension,
): void;
StartStageTransition(
sameStage: boolean,
stageTransition: StageTransition,
): void;
Update(): void;
/**
* @param position
* @param force Default is 10.
* @param radius Default is 250.
*/
UpdateStrangeAttractor(position: Vector, force?: float, radius?: float): void;
BlueWombParTime: int;
BossRushParTime: int;
Challenge: Challenge | int;
readonly Difficulty: Difficulty;
readonly ScreenShakeOffset: Readonly<Vector>;
TimeCounter: int;
}

View File

@ -0,0 +1,35 @@
declare interface GridEntity {
Destroy(immediate: boolean): boolean;
GetGridIndex(): int;
/** The RNG returned is a reference (i.e. not a copy). */
GetRNG(): RNG;
GetSaveState(): GridEntityDesc;
/** The Sprite returned is a reference (i.e. not a copy). */
GetSprite(): Sprite;
GetType(): GridEntityType | int;
GetVariant(): int;
Hurt(damage: int): boolean;
Init(seed: int): void;
PostInit(): void;
Render(offset: Vector): void;
SetType(gridEntityType: GridEntityType): void;
SetVariant(variant: int): void;
ToDoor(): GridEntityDoor | undefined;
ToPit(): GridEntityPit | undefined;
ToPoop(): GridEntityPoop | undefined;
ToPressurePlate(): GridEntityPressurePlate | undefined;
ToRock(): GridEntityRock | undefined;
ToSpikes(): GridEntitySpikes | undefined;
ToTNT(): GridEntityTNT | undefined;
Update(): void;
CollisionClass: GridCollisionClass;
/**
* Use the `GetSaveState()` method instead of accessing Desc directly, as it is a deprecated
* property.
*/
Desc: never; // GridEntityDesc;
readonly Position: Readonly<Vector>;
State: int;
VarData: int;
}

View File

@ -0,0 +1,10 @@
declare interface GridEntityDesc {
Initialized: boolean;
SpawnCount: int;
SpawnSeed: int;
State: int;
Type: GridEntityType | int;
VarData: int;
VariableSeed: int;
Variant: int;
}

View File

@ -0,0 +1,33 @@
declare interface GridEntityDoor extends GridEntity {
Bar(): void;
CanBlowOpen(): boolean;
Close(force: boolean): void;
GetSpriteOffset(): Readonly<Vector>;
IsBusted(): boolean;
IsKeyFamiliarTarget(): boolean;
IsLocked(): boolean;
IsOpen(): boolean;
IsRoomType(roomType: RoomType): boolean;
IsTargetRoomArcade(): boolean;
Open(): void;
SetLocked(locked: boolean): void;
SetRoomTypes(currentRoomType: RoomType, targetRoomType: RoomType): void;
SpawnDust(): void;
TryBlowOpen(fromExplosion: boolean, source: Entity): boolean;
TryUnlock(player: EntityPlayer, force: boolean): boolean;
Busted: boolean;
CloseAnimation: string;
CurrentRoomType: RoomType;
Direction: Direction;
ExtraSprite: Sprite;
ExtraVisible: boolean;
LockedAnimation: string;
OpenAnimation: string;
OpenLockedAnimation: string;
// PreviousState: State; // State is not implemented (it is userdata and not an int)
PreviousVariant: DoorVariant;
Slot: DoorSlot;
TargetRoomIndex: int;
TargetRoomType: RoomType;
}

View File

@ -0,0 +1,7 @@
declare interface GridEntityPit extends GridEntity {
MakeBridge(bridgeSource: GridEntity | undefined): void;
SetLadder(value: boolean): void;
UpdateCollision(): void;
HasLadder: boolean;
}

View File

@ -0,0 +1,9 @@
declare interface GridEntityPoop extends GridEntity {
ReduceSpawnRate(): void;
RespawnRedPoop(): void;
ReducedSpawnRate: boolean;
ReviveTimer: int;
StateAnimation: string;
UnderPlayer: boolean;
}

View File

@ -0,0 +1,7 @@
declare interface GridEntityPressurePlate extends GridEntity {
Reward(): void;
GreedModeRNG: RNG;
NextGreedAnimation: string;
TimerPlate: Sprite;
}

View File

@ -0,0 +1,10 @@
declare interface GridEntityRock extends GridEntity {
GetBigRockFrame(): int;
GetRubbleAnim(): string;
SetBigRockFrame(frame: int): void;
UpdateAnimFrame(): void;
Anim: string;
FrameCnt: int;
RubbleAnim: string;
}

View File

@ -0,0 +1,3 @@
declare interface GridEntitySpikes extends GridEntity {
Timeout: int;
}

View File

@ -0,0 +1,3 @@
declare interface GridEntityTNT extends GridEntity {
FrameCnt: int;
}

View File

@ -0,0 +1,47 @@
declare interface HUD {
/**
* Causes the charge bar of the active item in the specified slot to blink as if it had gained
* charges.
*
* @param player
* @param slot Default is ActiveSlot.SLOT_PRIMARY.
*/
FlashChargeBar(player: EntityPlayer, slot?: ActiveSlot): void;
/**
* Forces the specified active item slot to update. This might be useful for functions that modify
* an active item slot without directly giving or removing items.
*
* @param player
* @param slot Default is ActiveSlot.SLOT_PRIMARY
*/
InvalidateActiveItem(player: EntityPlayer, slot?: ActiveSlot): void;
/**
* Forces the crafting output from Bag of Crafting to update.
*
* @param player
*/
InvalidateCraftingItem(player: EntityPlayer): void;
IsVisible(): boolean;
SetVisible(visible: boolean): void;
/**
* Accepts a sequence of up to 32 strings, where each string is a line of text.
* Passing more than 7 lines will result in them not being displayed properly since the fortune
* paper does not dynamically stretch to accommodate the extra lines yet.
*
* @param text
*/
ShowFortuneText(...text: string[]): void;
/**
* Shows the pickup text for the specified item as if it was picked up by the specified player.
*/
ShowItemText(player: EntityPlayer, item: ItemConfigItem): void;
/**
* Shows a custom pickup text.
*
* @param name
* @param description Default is "".
* @param paper If set to true, displays the description on a small piece of paper, similar to
* curses. Default is false.
*/
ShowItemText(name: string, description?: string, paper?: boolean): void;
}

View File

@ -0,0 +1,18 @@
export {};
declare global {
/** @noSelf */
namespace Input {
function GetActionValue(action: ButtonAction, controllerID: int): float;
function GetButtonValue(button: Keyboard, controllerID: int): float;
function GetMousePosition(gameCoords: boolean): Vector;
function IsActionPressed(action: ButtonAction, controllerID: int): boolean;
function IsActionTriggered(
action: ButtonAction,
controllerID: int,
): boolean;
function IsButtonPressed(button: Keyboard, controllerID: int): boolean;
function IsButtonTriggered(button: Keyboard, controllerID: int): boolean;
function IsMouseBtnPressed(button: Mouse): boolean;
}
}

View File

@ -0,0 +1,262 @@
export {};
declare global {
/** @noSelf */
namespace Isaac {
/**
* Your mod can't do much of anything unless you attach some callback functions that can run
* code when certain things happen. The different types of callbacks are represented in the
* ModCallbacks enum.
*
* Some callbacks take an optional third argument to specify that you only want it the function
* to fire on a specific thing. For example:
* ```
* mod.AddCallback(
* ModCallbacks.MC_POST_EFFECT_UPDATE,
* postEffectUpdatePoof01,
* EffectVariant.POOF01,
* )
* ```
*/
function AddCallback(
mod: Mod,
callbackID: ModCallbacks,
callbackFn: () => void,
entityID?: int,
): void;
/**
* @returns The pill color.
*/
function AddPillEffectToPool(pillEffect: PillEffect | int): PillColor | int;
/**
* Puts a string into the debug console. (You can open the debug console with the tilde key.)
*/
function ConsoleOutput(text: string): void;
function CountBosses(): int;
function CountEnemies(): int;
/**
* This function is currently bugged (i.e. in Repentance v820) and should not be used.
* In the meantime, use "FindByType()" as a workaround.
*
* @param spawner
* @param entityType Default is EntityType.ENTITY_NULL.
* @param variant Specifying -1 will return all variants. Default is -1.
* @param subType Specifying -1 will return all subtypes. Default is -1.
*/
function CountEntities(
fakeArg: never,
spawner: Entity | undefined,
entityType?: EntityType | int,
variant?: int,
subType?: int,
): int;
/**
* Prints a string to the "log.txt" file. By default, the file is located at:
* `C:\Users\[YourUsername]\Documents\My Games\Binding of Isaac Repentance\log.txt`
*/
function DebugString(msg: string): Mod;
/** Executes a command on the debug console. */
function ExecuteCommand(command: string): string;
function Explode(
position: Vector,
source: Entity | undefined,
damage: float,
): void;
/**
* @param entityType
* @param variant Default is -1.
* @param subType Default is -1.
* @param cache Default is false.
* @param ignoreFriendly Default is false.
*/
function FindByType(
entityType: EntityType | int,
variant?: int,
subType?: int,
cache?: boolean,
ignoreFriendly?: boolean,
): Entity[];
/**
* Beware:
* - this function does not work in the PostNewRoom callback
* - it excludes effects, even when the effect partition is selected
* - it can exclude dead enemies
*
* It is recommended to never use this function and instead use `Isaac.FindByType()` or
* `Isaac.GetRoomEntities()`.
*
* @param position
* @param radius
* @param partitions Default is 0xFFFFFFFF.
*/
function FindInRadius(
position: Vector,
radius: float,
partitions?: int,
): Entity[];
/** Returns -1 if no card with the specified name was found. */
function GetCardIdByName(cardName: string): Card | int;
/** Returns 0 if the current run is not a challenge. */
function GetChallenge(): Challenge | int;
/** Returns -1 if the specified challenge name does not exist. */
function GetChallengeIdByName(challengeName: string): Challenge | int;
/** Returns -1 if no costume with the specified name was found. */
function GetCostumeIdByPath(path: string): int;
/** Returns -1 if no curse with the specified name was found. */
function GetCurseIdByName(curseName: string): LevelCurse | int;
/** Returns 0 if no entity with the specified name was found. */
function GetEntityTypeByName(entityName: string): EntityType | int;
/** Returns -1 if no entity with the specified name was found. */
function GetEntityVariantByName(entityName: string): int;
/**
* Returns the amount of render frames that have passed since the game was open.
* The counter for this increases even when the game is paused or when you are in the main menu.
* Since Isaac frames are equal to render frames, 60 frames equals 1 second.
* Note that these frames are completely different from the frames returned from
* `Game().GetFrameCount()` and other functions.
*/
function GetFrameCount(): int;
function GetFreeNearPosition(position: Vector, step: float): Vector;
function GetItemConfig(): ItemConfig;
/** Returns -1 if no collectible with the specified name was found. */
function GetItemIdByName(entityName: string): CollectibleType | int;
/** Returns -1 if no music with the specified name was found. */
function GetMusicIdByName(musicName: string): Music | int;
/** Returns -1 if no pill with the specified name was found. */
function GetPillEffectByName(pillName: string): PillEffect | int;
/**
* With no argument, it returns the 0th player.
* For the purposes of this definition, we assume that the 0th player always exists.
* However, if called in the menu, this function will return undefined, so beware.
*/
function GetPlayer(): EntityPlayer;
/**
* For the purposes of this definition, we assume that the 0th player always exists.
* However, if called in the menu, this function will return undefined, so beware.
*/
function GetPlayer(playerID: 0): EntityPlayer;
/**
* Before using the EntityPlayer object, you should check to see if it is equal to undefined and
* handle the error case.
*/
function GetPlayer(playerID: int): EntityPlayer | undefined;
/**
* Returns -1 if the specified character does not exist.
*
* @param playerName
* @param tainted Default is false.
*/
function GetPlayerTypeByName(
playerName: string,
tainted?: boolean,
): PlayerVariant | int;
/**
* Returns a random position in the current room in world coordinates (not render coordinates).
*/
function GetRandomPosition(): Vector;
/**
* This function is very expensive and is the main cause of lag in mods across the Isaac
* ecosystem. Be careful about calling this multiple times per frame.
*/
function GetRoomEntities(): Entity[];
/** Returns -1 if no sound with the specified name was found. */
function GetSoundIdByName(soundName: string): SoundEffect | int;
/**
* Returns the width of the given string in pixels based on the "terminus8" font.
* (This is the same font used in the `Isaac.RenderText()` function.)
*/
function GetTextWidth(str: string): int;
/**
* Returns the current time in milliseconds since the program was launched.
* (This is simply a mapping to "os.clock()".)
*/
function GetTime(): int;
/** Returns -1 if the specified trinket was not found. */
function GetTrinketIdByName(trinketName: string): TrinketType | int;
/**
* @param gridEntityType
* @param variant
* @param position
* @param forced Forced has no effect and will not override a grid entity on the given location.
* Remove any existing grid entities first.
*/
function GridSpawn(
gridEntityType: GridEntityType | int,
variant: int,
position: Vector,
forced: boolean,
): GridEntity;
/**
* Returns true if your mod has data stored from the `Isaac.SaveModData()` function.
* (This corresponds to "save#.dat" files existing in the mod's save data folder.)
*/
function HasModData(mod: Mod): boolean;
/**
* Returns a string that was stored in a "save#.dat" file from the `Isaac.SaveModData()`
* function. If there is no "save#.dat" file for your mod, this function will return an empty
* string. There are 3 "save#.dat" files, one per save slot. The number will be determined
* automatically by the game. In Repentance, these files are located in the "data" folder next
* to the "mods" folder.
*/
function LoadModData(mod: Mod): string;
// function RegisterMod(mod: Mod, modName: string, APIVersion: int): void; // Should use the global RegisterMod() instead
function RemoveCallback(
mod: Mod,
callbackID: ModCallbacks,
callbackFn: () => void,
): void;
/**
* Will delete a "save#.dat" file, if it exists. For more information, see the
* `Isaac.SaveModData()` function.
*/
function RemoveModData(mod: Mod): void;
function RenderScaledText(
str: string,
x: float,
y: float,
scaleX: float,
scaleY: float,
r: float,
g: float,
b: float,
a: float,
): void;
function RenderText(
str: string,
x: float,
y: float,
r: float,
g: float,
b: float,
a: float,
): void;
/**
* Stores a string in a "save#.dat" file for persistent storage across game invocations.
* There are 3 "save#.dat" files, one per save slot. The number will be determined automatically
* by the game. In Repentance, these files are located in the "data" folder next to the "mods"
* folder.
*/
function SaveModData(mod: Mod, data: string): void;
function ScreenToWorld(position: Vector): Vector;
function ScreenToWorldDistance(position: Vector): Vector;
function Spawn(
entityType: EntityType | int,
entityVariant: int,
entitySubType: int,
position: Vector,
velocity: Vector,
spawner: Entity | undefined,
): Entity;
/**
* Converts a game Vector (i.e. `entity.Position`) to a render Vector used for drawing sprites
* and text to the screen at fixed positions.
*/
function WorldToRenderPosition(position: Vector): Vector;
/**
* Converts a game Vector (i.e. `entity.Position`) to a screen Vector used for drawing sprites
* and text next to an entity.
*/
function WorldToScreen(position: Vector): Vector;
function WorldToScreenDistance(position: Vector): Vector;
}
}

View File

@ -0,0 +1,46 @@
declare interface ItemConfig {
/** Returns undefined if the card was not found. */
GetCard(card: Card | int): Readonly<ItemConfigCard> | undefined;
GetCards(): Readonly<CardConfigList>;
/** Returns undefined if the collectible type was not found. */
GetCollectible(
collectibleType: CollectibleType | int,
): Readonly<ItemConfigItem> | undefined;
GetCollectibles(): Readonly<ItemConfigList>;
// CostumeConfigList is bugged and always returns a list of size 0
// GetCostumes(): Readonly<CostumeConfigList>;
/** Returns undefined if the item was not found. */
GetNullItem(
nullItemID: NullItemID | int,
): Readonly<ItemConfigItem> | undefined;
GetNullItems(): Readonly<ItemConfigList>;
/** Returns undefined if the pill effect was not found. */
GetPillEffect(
pillEffect: PillEffect | int,
): Readonly<ItemConfigPillEffect> | undefined;
GetPillEffects(): Readonly<PillConfigList>;
/** Returns undefined if the trinket was not found. */
GetTrinket(
trinketType: TrinketType | int,
): Readonly<ItemConfigItem> | undefined;
GetTrinkets(): Readonly<ItemConfigList>;
// In the "enums.lua" file, the ItemConfig class is extended with many members:
// - ItemConfig.CHARGE_*
// - ItemConfig.TAG_*
// - ItemConfig.CARDTYPE_*
// In IsaacScript, these are instead implemented as enums, since it is cleaner
// See ItemConfigChargeType, ItemConfigTag, and ItemConfigCardType respectively
}
// The static methods in this class can only be called by a global variable
// e.g. ItemConfig.Config.IsValidCollectible(1)
declare namespace ItemConfig {
/**
* This method does not work properly for modded items, so it should never be used.
* Instead, use "GetCollectible(collectibleType) !== undefined".
*/
function IsValidCollectible(fakeArg: never): boolean;
function ShouldAddCostumeOnPickup(): boolean;
}

View File

@ -0,0 +1,8 @@
declare interface ItemConfigCard {
AchievementID: int;
Description: string;
GreedModeAllowed: boolean;
HudAnim: string;
ID: int;
Name: string;
}

View File

@ -0,0 +1,12 @@
// This class is unused because "ItemConfig.GetCostumes()" is broken
declare interface ItemConfigCostume {
Anm2Path: string;
HasOverlay: boolean;
HasSkinAlt: boolean;
ID: int;
IsFlying: boolean;
OverwriteColor: boolean;
Priority: int;
SkinColor: Color;
}

View File

@ -0,0 +1,37 @@
declare interface ItemConfigItem {
HasTags(tags: ItemConfigTag): boolean;
IsCollectible(): boolean;
IsNull(): boolean;
IsTrinket(): boolean;
AchievementID: int;
AddBlackHearts: int;
AddBombs: int;
AddCoins: int;
AddCostumeOnPickup: boolean;
AddHearts: int;
AddKeys: int;
AddMaxHearts: int;
AddSoulHearts: int;
CacheFlags: CacheFlag;
ChargeType: ItemConfigChargeType;
ClearEffectsOnRemove: boolean;
readonly Costume: Readonly<ItemConfigCostume>;
Description: string;
DevilPrice: int;
Discharged: boolean;
GfxFileName: string;
Hidden: boolean;
ID: int;
InitCharge: int;
MaxCharges: int;
MaxCooldown: int;
Name: string;
PassiveCache: boolean;
PersistentEffect: boolean;
Quality: int;
ShopPrice: int;
Special: boolean;
Tags: int;
Type: ItemType;
}

View File

@ -0,0 +1,9 @@
declare interface ItemConfigList {
/**
* ItemConfigList is bugged such that using the "Get()" method returns Lua userdata.
* This userdata cannot be used for anything. Instead, use "ItemConfig.GetCollectible()".
*/
Get(fakeArg: never, idx: int): ItemConfigItem;
Size: int;
}

View File

@ -0,0 +1,6 @@
declare interface ItemConfigPillEffect {
AchievementID: int;
GreedModeAllowed: boolean;
ID: int;
Name: string;
}

View File

@ -0,0 +1,44 @@
declare interface ItemPool {
AddBibleUpgrade(add: int, itemPoolType: ItemPoolType): void;
AddRoomBlacklist(collectibleType: CollectibleType | int): void;
ForceAddPillEffect(pillEffect: PillEffect | int): PillColor | int;
GetCard(
seed: int,
playing: boolean,
rune: boolean,
onlyRunes: boolean,
): Card | int;
/**
* @param itemPoolType
* @param decrease Default is false.
* @param seed Default is Random().
* @param defaultItem Default is CollectibleType.COLLECTIBLE_NULL.
*/
GetCollectible(
itemPoolType: ItemPoolType,
decrease?: boolean,
seed?: int,
defaultItem?: CollectibleType,
): CollectibleType | int;
GetLastPool(): ItemPoolType;
GetPill(seed: int): PillColor | int;
/**
* @param pillColor
* @param player Default is undefined.
*/
GetPillEffect(
pillColor: PillColor | int,
player?: EntityPlayer,
): PillEffect | int;
GetPoolForRoom(roomType: RoomType, seed: int): ItemPoolType;
/**
* @param dontAdvanceRNG Default is false.
*/
GetTrinket(dontAdvanceRNG?: boolean): TrinketType | int;
IdentifyPill(pillColor: PillColor | int): void;
IsPillIdentified(pillColor: PillColor | int): boolean;
RemoveCollectible(collectibleType: CollectibleType | int): boolean;
RemoveTrinket(trinketType: TrinketType | int): boolean;
ResetRoomBlacklist(): void;
ResetTrinkets(): void;
}

View File

@ -0,0 +1,14 @@
declare function KColor(
this: void,
r: float,
g: float,
b: float,
a: float,
): KColor;
declare interface KColor {
Alpha: float;
Blue: float;
Green: float;
Red: float;
}

View File

@ -0,0 +1,105 @@
declare interface Level {
AddAngelRoomChance(chance: float): void;
AddCurse(levelCurse: LevelCurse | int, showName: boolean): void;
ApplyBlueMapEffect(): void;
ApplyCompassEffect(persistent: boolean): void;
ApplyMapEffect(): void;
CanOpenChallengeRoom(roomIndex: int): boolean;
CanSpawnDevilRoom(): boolean;
CanStageHaveCurseOfLabyrinth(levelStage: LevelStage): boolean;
/**
* @param roomIndex
* @param dimension Default is Dimension.CURRENT.
*/
ChangeRoom(roomIndex: int, dimension?: Dimension): void;
DisableDevilRoom(): void;
ForceHorsemanBoss(seed: int): boolean;
GetAbsoluteStage(): LevelStage;
GetAngelRoomChance(): float;
GetCanSeeEverything(): boolean;
GetCurrentRoom(): Room;
/**
* Note that this returns a read-only copy of the RoomDescriptor object and writing to any of its
* properties will fail. If you need to update anything in this object, use the
* `GetRoomByIdx(currentRoomIndex)` method instead.
*/
GetCurrentRoomDesc(): RoomDescriptorReadOnly;
GetCurrentRoomIndex(): int;
GetCurseName(): string;
GetCurses(): LevelCurse | int;
GetDevilAngelRoomRNG(): RNG;
GetDungeonPlacementSeed(): int;
GetEnterPosition(): Vector;
GetHeartPicked(): boolean;
GetLastBossRoomListIndex(): int;
GetLastRoomDesc(): RoomDescriptorReadOnly;
/**
* @param levelStage Default value is the current stage.
* @param stageType Default value is the current stage type.
* @param curses Default value is the current curses.
* @param infiniteLevel Default value is the current infinite level setting.
* @param dyslexia Default value is the current dyslexia setting.
*/
GetName(
levelStage?: LevelStage,
stageType?: StageType,
curses?: int,
infiniteLevel?: int,
dyslexia?: boolean,
): string;
GetNonCompleteRoomIndex(): int;
GetPreviousRoomIndex(): int;
GetRandomRoomIndex(IAmErrorRoom: boolean, seed: int): int;
/**
* @param roomIdx
* @param dimension Default is Dimension.CURRENT.
*/
GetRoomByIdx(roomIndex: int, dimension?: Dimension): RoomDescriptor;
GetRoomCount(): int;
GetRooms(): RoomList;
GetStage(): LevelStage;
GetStageType(): StageType;
GetStartingRoomIndex(): int;
GetStateFlag(levelStateFlag: LevelStateFlag): boolean;
HasBossChallenge(): boolean;
InitializeDevilAngelRoom(forceAngel: boolean, forceDevil: boolean): void;
IsAltStage(): boolean;
IsDevilRoomDisabled(): boolean;
IsNextStageAvailable(): boolean;
/**
* @param roomType
* @param visited
* @param rng
* @param ignoreGroup If set to true, includes rooms that do not have the same group ID as the
* current room. Default is false.
*/
QueryRoomTypeIndex(
roomType: RoomType,
visited: boolean,
rng: RNG,
ignoreGroup?: boolean,
): int;
RemoveCompassEffect(): void;
/** This is currently bugged and maps internally to "RemoveCurse()". The old "RemoveCurses()" is not currently accessible. */
RemoveCurses(levelCurse: LevelCurse | int): void;
SetCanSeeEverything(value: boolean): void;
SetHeartPicked(): void;
SetNextStage(): void;
SetRedHeartDamage(): void;
SetStage(levelStage: LevelStage, stageType: StageType): void;
SetStateFlag(levelStateFlag: LevelStateFlag, val: boolean): void;
ShowMap(): void;
ShowName(sticky: boolean): void;
UncoverHiddenDoor(currentRoomIdx: int, doorSlot: DoorSlot): void;
Update(): void;
/**
* Call this method to update the mini-map after changing the `DisplayFlags` property of a room.
*/
UpdateVisibility(): void;
DungeonReturnPosition: Vector;
DungeonReturnRoomIndex: int;
EnterDoor: int;
GreedModeWave: int;
LeaveDoor: int;
}

View File

@ -0,0 +1,371 @@
/**
* The Lua object corresponding to this interface is defined as a local variable in the
* "scripts/main.lua" file.
*/
declare interface Mod {
AddCallback<T extends keyof CallbackParameters>(
modCallbacks: T,
...args: CallbackParameters[T]
): void;
HasData(): boolean;
LoadData(): string;
RemoveCallback(callbackID: ModCallbacks, callback: () => void): void;
RemoveData(): void;
SaveData(data: string): void;
Name: string;
}
/* eslint-disable @typescript-eslint/member-ordering */
interface CallbackParameters {
[ModCallbacks.MC_NPC_UPDATE]: [
callback: (npc: EntityNPC) => void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_POST_UPDATE]: [callback: () => void];
[ModCallbacks.MC_POST_RENDER]: [callback: () => void];
[ModCallbacks.MC_USE_ITEM]: [
callback: (
collectibleType: CollectibleType | int,
rng: RNG,
player: EntityPlayer,
useFlags: int,
activeSlot: int,
customVarData: int,
) =>
| boolean
| { Discharge: boolean; Remove: boolean; ShowAnim: boolean }
| void,
collectibleType?: CollectibleType | int,
];
[ModCallbacks.MC_POST_PEFFECT_UPDATE]: [
callback: (player: EntityPlayer) => void,
playerType?: PlayerType,
];
[ModCallbacks.MC_USE_CARD]: [
callback: (card: Card | int, player: EntityPlayer, useFlags: int) => void,
card?: Card | int,
];
[ModCallbacks.MC_FAMILIAR_UPDATE]: [
callback: (familiar: EntityFamiliar) => void,
familiarVariant?: FamiliarVariant | int,
];
[ModCallbacks.MC_FAMILIAR_INIT]: [
callback: (familiar: EntityFamiliar) => void,
familiarVariant?: FamiliarVariant | int,
];
[ModCallbacks.MC_EVALUATE_CACHE]: [
callback: (player: EntityPlayer, cacheFlag: CacheFlag) => void,
cacheFlag?: CacheFlag,
];
[ModCallbacks.MC_POST_PLAYER_INIT]: [
callback: (player: EntityPlayer) => void,
playerVariant?: PlayerVariant,
];
[ModCallbacks.MC_USE_PILL]: [
callback: (
pillEffect: PillEffect | int,
player: EntityPlayer,
useFlags: int,
) => void,
pillEffect?: PillEffect | int,
];
[ModCallbacks.MC_ENTITY_TAKE_DMG]: [
callback: (
tookDamage: Entity,
damageAmount: float,
damageFlags: DamageFlag,
damageSource: EntityRef,
damageCountdownFrames: int,
) => boolean | void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_POST_CURSE_EVAL]: [callback: (curses: int) => int | void];
[ModCallbacks.MC_INPUT_ACTION]: [
callback: (
entity: Entity | undefined,
inputHook: InputHook,
buttonAction: ButtonAction,
) => boolean | float | void,
inputHook?: InputHook,
];
[ModCallbacks.MC_POST_GAME_STARTED]: [
callback: (isContinued: boolean) => void,
];
[ModCallbacks.MC_POST_GAME_END]: [callback: (isGameOver: boolean) => void];
[ModCallbacks.MC_PRE_GAME_EXIT]: [callback: (shouldSave: boolean) => void];
[ModCallbacks.MC_POST_NEW_LEVEL]: [callback: () => void];
[ModCallbacks.MC_POST_NEW_ROOM]: [callback: () => void];
[ModCallbacks.MC_GET_CARD]: [
callback: (
rng: RNG,
card: Card | int,
includePlayingCards: boolean,
includeRunes: boolean,
onlyRunes: boolean,
) => Card | int | void,
];
[ModCallbacks.MC_GET_SHADER_PARAMS]: [
callback: (shaderName: string) => Record<string, unknown> | void,
];
[ModCallbacks.MC_EXECUTE_CMD]: [
callback: (command: string, parameters: string) => void,
];
[ModCallbacks.MC_PRE_USE_ITEM]: [
callback: (
collectibleType: CollectibleType | int,
rng: RNG,
player: EntityPlayer,
useFlags: int,
activeSlot: int,
customVarData: int,
) => boolean | void,
collectibleType?: CollectibleType | int,
];
[ModCallbacks.MC_PRE_ENTITY_SPAWN]: [
callback: (
entityType: EntityType | int,
variant: int,
subType: int,
position: Vector,
velocity: Vector,
spawner: Entity,
initSeed: int,
) => [EntityType | int, int, int, int] | void,
];
[ModCallbacks.MC_POST_FAMILIAR_RENDER]: [
callback: (entityFamiliar: EntityFamiliar, renderOffset: Vector) => void,
familiarVariant?: FamiliarVariant | int,
];
[ModCallbacks.MC_PRE_FAMILIAR_COLLISION]: [
callback: (
familiar: EntityFamiliar,
collider: Entity,
low: boolean,
) => boolean | void,
familiarVariant?: FamiliarVariant | int,
];
[ModCallbacks.MC_POST_NPC_INIT]: [
callback: (npc: EntityNPC) => void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_POST_NPC_RENDER]: [
callback: (npc: EntityNPC, renderOffset: Vector) => void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_POST_NPC_DEATH]: [
callback: (npc: EntityNPC) => void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_PRE_NPC_COLLISION]: [
callback: (
npc: EntityNPC,
collider: Entity,
low: boolean,
) => boolean | void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_POST_PLAYER_UPDATE]: [
callback: (player: EntityPlayer) => void,
playerVariant?: PlayerVariant,
];
[ModCallbacks.MC_POST_PLAYER_RENDER]: [
callback: (player: EntityPlayer, renderOffset: Vector) => void,
playerVariant?: PlayerVariant,
];
[ModCallbacks.MC_PRE_PLAYER_COLLISION]: [
callback: (
player: EntityPlayer,
collider: Entity,
low: boolean,
) => boolean | void,
playerVariant?: PlayerVariant,
];
[ModCallbacks.MC_POST_PICKUP_INIT]: [
callback: (pickup: EntityPickup) => void,
pickupVariant?: PickupVariant | int,
];
[ModCallbacks.MC_POST_PICKUP_UPDATE]: [
callback: (pickup: EntityPickup) => void,
pickupVariant?: PickupVariant | int,
];
[ModCallbacks.MC_POST_PICKUP_RENDER]: [
callback: (pickup: EntityPickup, renderOffset: Vector) => void,
pickupVariant?: PickupVariant | int,
];
[ModCallbacks.MC_POST_PICKUP_SELECTION]: [
callback: (
pickup: EntityPickup,
variant: PickupVariant | int,
subType: int,
) => [PickupVariant | int, int] | void,
];
[ModCallbacks.MC_PRE_PICKUP_COLLISION]: [
callback: (
pickup: EntityPickup,
collider: Entity,
low: boolean,
) => boolean | void,
pickupVariant?: PickupVariant | int,
];
[ModCallbacks.MC_POST_TEAR_INIT]: [
callback: (tear: EntityTear) => void,
tearVariant?: TearVariant | int,
];
[ModCallbacks.MC_POST_TEAR_UPDATE]: [
callback: (tear: EntityTear) => void,
tearVariant?: TearVariant | int,
];
[ModCallbacks.MC_POST_TEAR_RENDER]: [
callback: (tear: EntityTear, renderOffset: Vector) => void,
tearVariant?: TearVariant | int,
];
[ModCallbacks.MC_PRE_TEAR_COLLISION]: [
callback: (
tear: EntityTear,
collider: Entity,
low: boolean,
) => boolean | void,
tearVariant?: TearVariant | int,
];
[ModCallbacks.MC_POST_PROJECTILE_INIT]: [
callback: (projectile: EntityProjectile) => void,
projectileVariant?: ProjectileVariant | int,
];
[ModCallbacks.MC_POST_PROJECTILE_UPDATE]: [
callback: (projectile: EntityProjectile) => void,
projectileVariant?: ProjectileVariant | int,
];
[ModCallbacks.MC_POST_PROJECTILE_RENDER]: [
callback: (projectile: EntityProjectile, renderOffset: Vector) => void,
projectileVariant?: ProjectileVariant | int,
];
[ModCallbacks.MC_PRE_PROJECTILE_COLLISION]: [
callback: (
projectile: EntityProjectile,
collider: Entity,
low: boolean,
) => boolean | void,
projectileVariant?: ProjectileVariant | int,
];
[ModCallbacks.MC_POST_LASER_INIT]: [
callback: (laser: EntityLaser) => void,
laserVariant?: LaserVariant | int,
];
[ModCallbacks.MC_POST_LASER_UPDATE]: [
callback: (laser: EntityLaser) => void,
laserVariant?: LaserVariant | int,
];
[ModCallbacks.MC_POST_LASER_RENDER]: [
callback: (laser: EntityLaser, renderOffset: Vector) => void,
laserVariant?: LaserVariant | int,
];
[ModCallbacks.MC_POST_KNIFE_INIT]: [
callback: (knife: EntityKnife) => void,
knifeSubType?: int,
];
[ModCallbacks.MC_POST_KNIFE_UPDATE]: [
callback: (knife: EntityKnife) => void,
knifeSubType?: int,
];
[ModCallbacks.MC_POST_KNIFE_RENDER]: [
callback: (knife: EntityKnife, renderOffset: Vector) => void,
knifeSubType?: int,
];
[ModCallbacks.MC_PRE_KNIFE_COLLISION]: [
callback: (
knife: EntityKnife,
collider: Entity,
low: boolean,
) => boolean | void,
knifeSubType?: int,
];
[ModCallbacks.MC_POST_EFFECT_INIT]: [
callback: (effect: EntityEffect) => void,
effectVariant?: EffectVariant | int,
];
[ModCallbacks.MC_POST_EFFECT_UPDATE]: [
callback: (effect: EntityEffect) => void,
effectVariant?: EffectVariant | int,
];
[ModCallbacks.MC_POST_EFFECT_RENDER]: [
callback: (effect: EntityEffect, renderOffset: Vector) => void,
effectVariant?: EffectVariant | int,
];
[ModCallbacks.MC_POST_BOMB_INIT]: [
callback: (bomb: EntityBomb) => void,
bombVariant?: BombVariant | int,
];
[ModCallbacks.MC_POST_BOMB_UPDATE]: [
callback: (bomb: EntityBomb) => void,
bombVariant?: BombVariant | int,
];
[ModCallbacks.MC_POST_BOMB_RENDER]: [
callback: (bomb: EntityBomb, renderOffset: Vector) => void,
bombVariant?: BombVariant | int,
];
[ModCallbacks.MC_PRE_BOMB_COLLISION]: [
callback: (
bomb: EntityBomb,
collider: Entity,
low: boolean,
) => boolean | void,
bombVariant?: BombVariant | int,
];
[ModCallbacks.MC_POST_FIRE_TEAR]: [callback: (tear: EntityTear) => void];
[ModCallbacks.MC_PRE_GET_COLLECTIBLE]: [
callback: (
itemPoolType: ItemPoolType,
decrease: boolean,
seed: int,
) => CollectibleType | int | void,
];
[ModCallbacks.MC_POST_GET_COLLECTIBLE]: [
callback: (
collectibleType: CollectibleType | int,
itemPoolType: ItemPoolType,
decrease: boolean,
seed: int,
) => CollectibleType | int | void,
];
[ModCallbacks.MC_GET_PILL_COLOR]: [
callback: (seed: int) => PillColor | int | void,
];
[ModCallbacks.MC_GET_PILL_EFFECT]: [
callback: (
pillEffect: PillEffect | int,
pillColor: PillColor | int,
) => PillEffect | int | void,
];
[ModCallbacks.MC_GET_TRINKET]: [
callback: (
trinketType: TrinketType | int,
rng: RNG,
) => TrinketType | int | void,
];
[ModCallbacks.MC_POST_ENTITY_REMOVE]: [
callback: (entity: Entity) => void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_POST_ENTITY_KILL]: [
callback: (entity: Entity) => void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_PRE_NPC_UPDATE]: [
callback: (npc: EntityNPC) => boolean | void,
entityType?: EntityType | int,
];
[ModCallbacks.MC_PRE_SPAWN_CLEAN_AWARD]: [
callback: (rng: RNG, spawnPosition: Vector) => boolean | void,
];
[ModCallbacks.MC_PRE_ROOM_ENTITY_SPAWN]: [
callback: (
entityType: EntityType | int,
variant: int,
subType: int,
gridIndex: int,
seed: int,
) => [EntityType | int, int, int] | void,
];
}
/* eslint-enable @typescript-eslint/member-ordering */

View File

@ -0,0 +1,6 @@
/**
* - This method is userdata and has no bindings associated with it.
* - It can be retrieved by using the `EntityPlayer.GetMultiShotParams()` method.
* - It can be fed to the `EntityPlayer.GetMultiShotPositionVelocity()` method.
*/
declare interface MultiShotParams {} // eslint-disable-line @typescript-eslint/no-empty-interface

View File

@ -0,0 +1,49 @@
declare function MusicManager(this: void): MusicManager;
declare interface MusicManager {
/**
* @param music
* @param fadeRate Default is 0.08.
*/
Crossfade(music: Music | int, fadeRate?: float): void;
Disable(): void;
/**
* @param layerID Default is 0.
*/
DisableLayer(layerID?: int): void;
Enable(): void;
/**
* @param layerID Default is 0.
* @param instant Default is false.
*/
EnableLayer(layerID?: int, instant?: boolean): void;
/**
* @param music
* @param volume Default is 1.
* @param fadeRate Default is 0.08.
*/
Fadein(music: Music | int, volume?: float, fadeRate?: float): void;
/**
* @param fadeRate Default is 0.08.
*/
Fadeout(fadeRate?: float): void;
GetCurrentMusicID(): Music | int;
GetQueuedMusicID(): Music | int;
IsEnabled(): boolean;
/**
* @param layerID Default is 0.
*/
IsLayerEnabled(layerID?: int): boolean;
Pause(): void;
PitchSlide(targetPitch: float): void;
Play(music: Music | int, volume: float): void;
Queue(music: Music | int): void;
ResetPitch(): void;
Resume(): void;
UpdateVolume(): void;
/**
* @param targetVolume
* @param fadeRate Default is 0.08.
*/
VolumeSlide(targetVolume: float, fadeRate?: float): void;
}

View File

@ -0,0 +1,20 @@
declare interface PathFinder {
EvadeTarget(targetPos: Vector): void;
FindGridPath(
position: Vector,
speed: float,
pathMarker: int,
useDirectPath: boolean,
): void;
GetEvadeMovementCountdown(): int;
GetGridIndex(): int;
HasDirectPath(): boolean;
HasPathToPos(position: Vector, ignorePoop: boolean): boolean;
MoveRandomly(ignoreStatusEffects: boolean): boolean;
MoveRandomlyAxisAligned(speed: float, ignoreStatusEffects: boolean): void;
MoveRandomlyBoss(ignoreStatusEffects: boolean): void;
Reset(): void;
ResetMovementTarget(): void;
SetCanCrushRocks(value: boolean): void;
UpdateGridIndex(): void;
}

View File

@ -0,0 +1,5 @@
declare interface PillConfigList {
Get(idx: int): ItemConfigPillEffect | undefined;
readonly Size: int;
}

View File

@ -0,0 +1,4 @@
declare interface PosVel {
Position: Vector;
Vector: Vector;
}

View File

@ -0,0 +1,27 @@
declare function ProjectileParams(this: void): ProjectileParams;
declare interface ProjectileParams {
Acceleration: float;
BulletFlags: int;
ChangeFlags: ProjectileFlags;
ChangeTimeout: int;
ChangeVelocity: float;
CircleAngle: float;
Color: Color;
CurvingStrength: float;
DepthOffset: float;
DotProductLimit: float;
FallingAccelModifier: float;
FallingSpeedModifier: float;
FireDirectionLimit: Vector;
GridCollision: boolean;
HeightModifier: float;
HomingStrength: float;
PositionOffset: Vector;
Scale: float;
Spread: float;
TargetPosition: Vector;
Variant: ProjectileVariant | int;
VelocityMulti: float;
WiggleFrameOffset: int;
}

View File

@ -0,0 +1,5 @@
declare interface QueueItemData {
Charge: int;
Item: ItemConfigItem | undefined;
Touched: boolean;
}

View File

@ -0,0 +1,19 @@
declare function RNG(this: void): RNG;
declare interface RNG {
GetSeed(): int;
Next(): int;
/**
* Generates a random float between 0 and 1.
* It is inclusive on the bottom and exclusive on the top.
*/
RandomFloat(): float;
/**
* Generates a random integer between 0 and max - 1. For example, `rng.RandomInt(4)` will return
* either 0, 1, 2, or 3.
*
* @param max
*/
RandomInt(max: int): int;
SetSeed(seed: int, shiftIdx: int): void;
}

View File

@ -0,0 +1,158 @@
declare interface Room {
/**
* @param position1
* @param position2
* @param lineCheckMode
* @param gridPathThreshold Default is 0.
* @param ignoreWalls Default is false.
* @param ignoreCrushable Default is false.
* @returns 2 values:
* 1) boolean: true if there are no obstructions between Pos1 and Pos2, false otherwise
* 2) Vector: first hit position from pos1 to pos2 (returns pos2 if the line didn't hit anything)
*/
CheckLine(
position1: Vector,
position2: Vector,
lineCheckMode: LineCheckMode,
gridPathThreshold?: int,
ignoreWalls?: boolean,
ignoreCrushable?: boolean,
): LuaMultiReturn<[boolean, Vector]>;
DamageGrid(index: int, damage: int): boolean;
DestroyGrid(index: int, immediate: boolean): boolean;
EmitBloodFromWalls(duration: int, count: int): void;
/**
* @param position
* @param initialStep Default is 0.
* @param avoidActiveEntities Default is false.
* @param allowPits Default is false.
*/
FindFreePickupSpawnPosition(
position: Vector,
initialStep?: float,
avoidActiveEntities?: boolean,
allowPits?: boolean,
): Vector;
FindFreeTilePosition(position: Vector, distanceThreshold: float): Vector;
GetAliveBossesCount(): int;
GetAliveEnemiesCount(): int;
GetAwardSeed(): int;
GetBackdropType(): BackdropType;
GetBossID(): BossIDs | int;
GetBottomRightPos(): Vector;
GetBrokenWatchState(): int;
GetCenterPos(): Vector;
GetClampedGridIndex(position: Vector): int;
GetClampedPosition(position: Vector, margin: float): Vector;
GetDecorationSeed(): int;
GetDeliriumDistance(): int;
GetDevilRoomChance(): float;
GetDoor(doorSlot: DoorSlot): GridEntityDoor | undefined;
GetDoorSlotPosition(doorSlot: DoorSlot): Vector;
GetDungeonRockIdx(): int;
/**
* Using this method can cause the game to crash, so it is forbidden.
* Use "Isaac.GetRoomEntities()" instead.
*/
GetEntities(fakeArg: never): EntityList;
GetFrameCount(): int;
GetGridCollision(gridIndex: int): GridCollisionClass;
GetGridCollisionAtPos(position: Vector): GridCollisionClass;
GetGridEntity(gridIndex: int): GridEntity | undefined;
GetGridEntityFromPos(position: Vector): GridEntity | undefined;
GetGridHeight(): int;
GetGridIndex(position: Vector): int;
GetGridPath(index: int): int;
GetGridPathFromPos(position: Vector): int;
GetGridPosition(gridIndex: int): Vector;
GetGridSize(): int;
/** Note that if you call this in the main menu, the game will sometimes crash. */
GetGridWidth(): int;
GetLaserTarget(position: Vector, direction: Vector): Vector;
GetLightingAlpha(): float;
// GetLRoomAreaDesc(): LRoomAreaDesc; // LRoomAreaDesc is not implemented
// GetLRoomTileDesc(): LRoomTileDesc; // LRoomTileDesc is not implemented
GetNextShockwaveId(): int;
GetRandomPosition(margin: float): Vector;
GetRandomTileIndex(seed: int): int;
GetRedHeartDamage(): boolean;
GetRenderScrollOffset(): Readonly<Vector>;
GetRenderSurfaceTopLeft(): Readonly<Vector>;
GetRoomConfigStage(): int;
GetRoomShape(): RoomShape;
GetSecondBossID(): BossIDs | int;
GetSeededCollectible(seed: int): CollectibleType | int;
GetShopLevel(): int;
GetSpawnSeed(): int;
GetTintedRockIdx(): int;
GetTopLeftPos(): Vector;
GetType(): RoomType;
HasSlowDown(): boolean;
HasTriggerPressurePlates(): boolean;
HasWater(): boolean;
HasWaterPits(): boolean;
IsAmbushActive(): boolean;
IsAmbushDone(): boolean;
IsClear(): boolean;
IsCurrentRoomLastBoss(): boolean;
IsDoorSlotAllowed(doorSlot: DoorSlot): boolean;
IsFirstEnemyDead(): boolean;
IsFirstVisit(): boolean;
IsInitialized(): boolean;
IsLShapedRoom(): boolean;
IsPositionInRoom(position: Vector, margin: float): boolean;
IsSacrificeDone(): boolean;
KeepDoorsClosed(): void;
MamaMegaExplossion(): void;
PlayMusic(): void;
RemoveDoor(doorSlot: DoorSlot): void;
RemoveGridEntity(
gridIndex: int,
pathTrail: int,
keepDecoration: boolean,
): void;
Render(): void;
RespawnEnemies(): void;
ScreenWrapPosition(position: Vector, margin: float): Vector;
SetAmbushDone(value: boolean): void;
SetBrokenWatchState(state: int): void;
SetCardAgainstHumanity(): void;
SetClear(clear: boolean): void;
SetFirstEnemyDead(value: boolean): void;
SetFloorColor(floorColor: Color): void;
SetGridPath(index: int, value: int): boolean;
SetRedHeartDamage(): void;
SetSacrificeDone(done: boolean): void;
SetShockwaveParam(shockwaveID: int, shockwaveParams: ShockwaveParams): void;
SetSlowDown(duration: int): void;
SetWallColor(wallColor: Color): void;
ShopReshuffle(keepCollectibleIdx: boolean, reselectSaleItem: boolean): void;
ShopRestockFull(): void;
ShopRestockPartial(): void;
SpawnClearAward(): void;
SpawnGridEntity(
gridIndex: int,
gridEntityType: GridEntityType | int,
variant: int,
seed: int,
varData: int,
): boolean;
/**
* This function was updated to take two arguments in Repentance. The reason for this is that
* bridges can be spike bridges, so the specifying the type of rock is necessary.
*/
TryMakeBridge(pit: GridEntity, rock: GridEntity): boolean;
TryPlaceLadder(
playerPos: Vector,
playerVelocity: Vector,
ladder: Entity,
): void;
TrySpawnBlueWombDoor(firstTime: boolean, ignoreTime: boolean): boolean;
TrySpawnBossRushDoor(ignoreTime: boolean): boolean;
TrySpawnDevilRoomDoor(animate: boolean): boolean;
TrySpawnMegaSatanRoomDoor(): boolean;
TrySpawnTheVoidDoor(): boolean;
TurnGold(): void;
Update(): void;
WorldToScreenPosition(worldPos: Vector): Vector;
}

View File

@ -0,0 +1,22 @@
// This is "RoomConfig::Room" in the docs
declare interface RoomConfig {
/**
* This is not the same thing as the Difficulty enum.
* Each room has an arbitrarily set difficulty of 0, 1, 2, 5, or 10.
*/
Difficulty: int;
Doors: int;
Height: int;
InitialWeight: float;
Name: string;
Shape: RoomShape;
SpawnCount: int;
Spawns: SpawnList;
StageID: StageID;
Subtype: int;
Type: RoomType;
Variant: int;
Weight: float;
Width: int;
}

View File

@ -0,0 +1,6 @@
declare interface RoomConfigEntry {
Subtype: int;
Type: EntityType;
Variant: int;
Weight: int;
}

View File

@ -0,0 +1,8 @@
declare interface RoomConfigSpawn {
PickEntry(r: float): Readonly<RoomConfigEntry>;
EntryCount: int;
SumWeights: float;
X: int;
Y: int;
}

View File

@ -0,0 +1,30 @@
declare interface RoomDescriptor {
// AllowedDoors: DoorSet; // DoorSet is not implemented
AwardSeed: int;
ChallengeDone: boolean;
Clear: boolean;
ClearCount: int;
Data: RoomConfig | undefined;
DecorationSeed: int;
DeliriumDistance: int;
/**
* A composition of zero or more DisplayFlag. After modifying this value, you must call
* `Level.UpdateVisibility()` for it to take effect.
*/
DisplayFlags: int;
GridIndex: int;
HasWater: boolean;
ListIndex: int;
NoReward: boolean;
OverrideData: RoomConfig;
PitsCount: int;
PoopCount: int;
PressurePlatesTriggered: boolean;
SacrificeDone: boolean;
SafeGridIndex: int;
ShopItemDiscountIdx: int;
ShopItemIdx: int;
SpawnSeed: int;
SurpriseMiniboss: boolean;
VisitedCount: int;
}

View File

@ -0,0 +1,122 @@
// This is the same thing as the RoomDescriptor class, but every value is marked as being read only
declare interface RoomDescriptorReadOnly {
// AllowedDoors: DoorSet; // DoorSet is not implemented
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
AwardSeed: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
ChallengeDone: Readonly<boolean>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
Clear: Readonly<boolean>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
ClearCount: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
Data: Readonly<RoomConfig> | Readonly<undefined>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
DecorationSeed: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
DeliriumDistance: Readonly<int>;
/**
* A composition of zero or more DisplayFlag.
*
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
DisplayFlags: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
GridIndex: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
HasWater: Readonly<boolean>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
ListIndex: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
NoReward: Readonly<boolean>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
OverrideData: Readonly<RoomConfig>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
PitsCount: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
PoopCount: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
PressurePlatesTriggered: Readonly<boolean>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
SacrificeDone: Readonly<boolean>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
SafeGridIndex: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
ShopItemDiscountIdx: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
ShopItemIdx: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
SpawnSeed: Readonly<int>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
SurpriseMiniboss: Readonly<boolean>;
/**
* To set this property, get a writable copy of the RoomDescriptor by using the
* `Level.GetRoomByIdx()` method.
*/
VisitedCount: Readonly<int>;
}

View File

@ -0,0 +1,5 @@
declare interface RoomList {
Get(idx: int): RoomDescriptor | undefined;
Size: int;
}

View File

@ -0,0 +1,32 @@
declare function SFXManager(this: void): SFXManager;
declare interface SFXManager {
AdjustPitch(soundEffect: SoundEffect | int, pitch: float): void;
AdjustVolume(soundEffect: SoundEffect | int, volume: float): void;
GetAmbientSoundVolume(soundEffect: SoundEffect | int): float;
IsPlaying(soundEffect: SoundEffect | int): boolean;
/**
* @param soundEffect
* @param volume Default is 1.
* @param frameDelay Default is 2.
* @param loop Default is false.
* @param pitch Default is 1.
* @param pan Default is 0.
*/
Play(
soundEffect: SoundEffect | int,
volume?: float,
frameDelay?: int,
loop?: boolean,
pitch?: float,
pan?: float,
): void;
Preload(soundEffect: SoundEffect | int): void;
SetAmbientSound(
soundEffect: SoundEffect | int,
volume: float,
pitch: float,
): void;
Stop(soundEffect: SoundEffect | int): void;
StopLoopingSounds(): void;
}

View File

@ -0,0 +1,32 @@
declare interface Seeds {
AddSeedEffect(seedEffect: SeedEffect): void;
CanAddSeedEffect(seedEffect: SeedEffect): boolean;
ClearSeedEffects(): void;
ClearStartSeed(): void;
CountSeedEffects(): int;
ForgetStageSeed(levelStage: LevelStage): void;
GetNextSeed(): int;
GetPlayerInitSeed(): int;
GetStageSeed(levelStage: LevelStage): int;
GetStartSeed(): int;
GetStartSeedString(): string;
HasSeedEffect(seedEffect: SeedEffect): boolean;
IsCustomRun(): boolean;
IsInitialized(): boolean;
IsSeedComboBanned(seedEffect1: SeedEffect, seedEffect2: SeedEffect): boolean;
RemoveBlockingSeedEffects(seedEffect: SeedEffect): void;
RemoveSeedEffect(seedEffect: SeedEffect): void;
Reset(): void;
Restart(challenge: Challenge | int): void;
SetStartSeed(startSeed: string): void;
}
declare namespace Seeds {
function CountUnlockedSeedEffects(this: void): int;
function GetSeedEffect(this: void, str: string): SeedEffect;
function InitSeedInfo(this: void): void;
function IsSpecialSeed(this: void, str: string): boolean;
function IsStringValidSeed(this: void, str: string): boolean;
function Seed2String(this: void, seed: int): string;
function String2Seed(this: void, str: string): int;
}

View File

@ -0,0 +1,8 @@
declare interface ShockwaveParams {
Age: int;
LifeSpan: int;
Position: Vector;
Strength: float;
Time: float;
TimeDT: float;
}

View File

@ -0,0 +1,5 @@
declare interface SpawnList {
Get(idx: int): RoomConfigSpawn | undefined;
Size: int;
}

View File

@ -0,0 +1,64 @@
declare function Sprite(this: void): Sprite;
declare interface Sprite {
GetAnimation(): string;
GetDefaultAnimation(): string;
GetDefaultAnimationName(): Readonly<string>;
GetFilename(): string;
GetFrame(): int;
GetLayerCount(): int;
GetOverlayAnimation(): string;
GetOverlayFrame(): int;
GetTexel(samplePos: Vector, renderPos: Vector, alphaThreshold: float): KColor;
IsEventTriggered(eventName: string): boolean;
IsFinished(animationName: string): boolean;
IsLoaded(): boolean;
IsOverlayFinished(animationName: string): boolean;
IsOverlayPlaying(animationName: string): boolean;
IsPlaying(animationName: string): boolean;
Load(filename: string, loadGraphics: boolean): void;
LoadGraphics(): void;
Play(animationName: string, force: boolean): void;
PlayOverlay(animationName: string, force: boolean): void;
PlayRandom(seed: int): void;
Reload(): void;
RemoveOverlay(): void;
Render(
position: Vector,
topLeftClamp: Vector,
bottomRightClamp: Vector,
): void;
/**
* @param layerID
* @param position
* @param topLeftClamp Default is Vector.Zero.
* @param bottomRightClamp Default is Vector.Zero.
*/
RenderLayer(
layerID: int,
position: Vector,
topLeftClamp?: Vector,
bottomRightClamp?: Vector,
): void;
ReplaceSpritesheet(layerID: int, pngFilename: string): void;
Reset(): void;
SetAnimation(animationName: string): boolean;
SetFrame(frameNum: int): void;
SetFrame(animationName: string, frameNum: int): void;
SetLastFrame(): void;
SetLayerFrame(layerID: int, frameNum: int): void;
SetOverlayAnimation(animationName: string): boolean;
SetOverlayFrame(animationName: string, frameNum: int): void;
SetOverlayRenderPriority(renderFirst: boolean): void;
Stop(): void;
Update(): void;
WasEventTriggered(eventName: string): boolean;
Color: Color;
FlipX: boolean;
FlipY: boolean;
Offset: Vector;
PlaybackSpeed: float;
Rotation: float;
Scale: Vector;
}

View File

@ -0,0 +1,13 @@
declare interface TearParams {
BombVariant: int;
TearColor: Color;
TearDamage: float;
/**
* Be aware that this is really a BitSet128 instead of an integer.
* However, all of the TearFlags enums values use BitSet128 constructors.
*/
TearFlags: int;
TearHeight: float;
TearScale: float;
TearVariant: TearVariant | int;
}

View File

@ -0,0 +1,5 @@
declare interface TemporaryEffect {
Cooldown: int;
Count: int;
Item: ItemConfigItem;
}

View File

@ -0,0 +1,67 @@
declare interface TemporaryEffects {
/**
* This method is currently bugged in v820. Do not use this method, as it will semi-reliably crash
* the game.
*
* @param collectibleType
* @param addCostume Default is true.
* @param count Default is 1.
*/
AddCollectibleEffect(
fakeArg: never,
collectibleType: CollectibleType | int,
addCostume?: boolean,
count?: int,
): void;
/**
* @param nullItemID
* @param addCostume
* @param count Default is 1.
*/
AddNullEffect(
nullItemID: NullItemID | int,
addCostume: boolean,
count?: int,
): void;
/**
* @param trinketType
* @param addCostume
* @param count Default is 1.
*/
AddTrinketEffect(
trinketType: TrinketType | int,
addCostume: boolean,
count?: int,
): void;
ClearEffects(): void;
GetCollectibleEffect(
collectibleType: CollectibleType | int,
): Readonly<TemporaryEffect>;
GetCollectibleEffectNum(collectibleType: CollectibleType | int): int;
GetEffectsList(): Readonly<EffectList>;
GetNullEffect(nullItemID: NullItemID | int): Readonly<TemporaryEffect>;
GetNullEffectNum(nullItemID: NullItemID | int): int;
GetTrinketEffect(trinketType: TrinketType | int): Readonly<TemporaryEffect>;
GetTrinketEffectNum(trinketType: TrinketType | int): int;
HasCollectibleEffect(collectibleType: CollectibleType | int): boolean;
HasNullEffect(nullItemID: NullItemID | int): boolean;
HasTrinketEffect(trinketType: TrinketType | int): boolean;
/**
* @param collectibleType
* @param count Use -1 to remove all instances. Default is 1.
*/
RemoveCollectibleEffect(
collectibleType: CollectibleType | int,
count?: int,
): void;
/**
* @param nullItemID
* @param count Use -1 to remove all instances. Default is 1.
*/
RemoveNullEffect(nullItemID: NullItemID | int, count?: int): void;
/**
* @param trinketType
* @param count Use -1 to remove all instances. Default is 1.
*/
RemoveTrinketEffect(trinketType: TrinketType | int, count?: int): void;
}

View File

@ -0,0 +1,56 @@
declare function Vector(this: void, x: float, y: float): Vector;
declare interface Vector {
Clamp(minX: float, minY: float, maxX: float, maxY: float): void;
Clamped(minX: float, minY: float, maxX: float, maxY: float): Vector;
Cross(secondVector: Vector): float;
Distance(secondVector: Vector): float;
DistanceSquared(secondVector: Vector): float;
Dot(secondVector: Vector): float;
/**
* The game returns degrees in the following format:
*
* - Right: 0
* - Up: -90
* - Left: 180
* - Down: 90
*/
GetAngleDegrees(): float;
Length(): float;
LengthSquared(): float;
Lerp(secondVector: Vector, t: float): Vector;
Normalize(): void;
Normalized(): Vector;
Resize(newLength: float): void;
Resized(newLength: float): Vector;
Rotated(angleDegrees: float): Vector;
/** Use the "add()" method instead. */
__add(right: never): Vector;
/** Use the "div()" method instead. */
__div(modifier: never): Vector;
/** Use the "mul()" method instead. */
__mul(modifier: never): Vector;
/** Use the "sub()" method instead. */
__sub(right: never): Vector;
// Not implemented since it can cause the game to crash
// __unm(right: never): Vector;
X: float;
Y: float;
// Helper functions for adding and so forth
// https://typescripttolua.github.io/docs/advanced/language-extensions/#operator-map-types
add: LuaAdditionMethod<Vector, Vector>;
// Vector multiplication was extended to allow Vectors in Repentance
// However, this functionality does not apply to division
div: LuaDivisionMethod<number, Vector>;
mul: LuaMultiplicationMethod<number | Vector, Vector>;
sub: LuaSubtractionMethod<Vector, Vector>;
}
declare namespace Vector {
function FromAngle(this: void, angleDegrees: float): Vector;
const One: Vector;
const Zero: Vector;
}

View File

@ -0,0 +1,5 @@
declare interface VectorList {
Get(idx: int): Vector | undefined;
readonly Size: int;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,398 @@
// Enums from the "resources/scripts/enums.lua" file
// (flags only)
declare enum EntityFlag {
FLAG_NO_STATUS_EFFECTS = 1,
FLAG_NO_INTERPOLATE = 1 << 1,
FLAG_APPEAR = 1 << 2,
FLAG_RENDER_FLOOR = 1 << 3,
FLAG_NO_TARGET = 1 << 4,
FLAG_FREEZE = 1 << 5,
FLAG_POISON = 1 << 6,
FLAG_SLOW = 1 << 7,
FLAG_CHARM = 1 << 8,
FLAG_CONFUSION = 1 << 9,
FLAG_MIDAS_FREEZE = 1 << 10,
FLAG_FEAR = 1 << 11,
FLAG_BURN = 1 << 12,
FLAG_RENDER_WALL = 1 << 13,
FLAG_INTERPOLATION_UPDATE = 1 << 14,
FLAG_APPLY_GRAVITY = 1 << 15,
FLAG_NO_BLOOD_SPLASH = 1 << 16,
FLAG_NO_REMOVE_ON_TEX_RENDER = 1 << 17,
FLAG_NO_DEATH_TRIGGER = 1 << 18,
FLAG_NO_SPIKE_DAMAGE = 1 << 19,
FLAG_LASER_POP = 1 << 19,
FLAG_ITEM_SHOULD_DUPLICATE = 1 << 19,
FLAG_BOSSDEATH_TRIGGERED = 1 << 20,
FLAG_DONT_OVERWRITE = 1 << 21,
FLAG_SPAWN_STICKY_SPIDERS = 1 << 22,
FLAG_SPAWN_BLACK_HP = 1 << 23,
FLAG_SHRINK = 1 << 24,
FLAG_NO_FLASH_ON_DAMAGE = 1 << 25,
FLAG_NO_KNOCKBACK = 1 << 26,
FLAG_SLIPPERY_PHYSICS = 1 << 27,
FLAG_ADD_JAR_FLY = 1 << 28,
FLAG_FRIENDLY = 1 << 29,
FLAG_NO_PHYSICS_KNOCKBACK = 1 << 30,
FLAG_DONT_COUNT_BOSS_HP = 1 << 31,
FLAG_NO_SPRITE_UPDATE = 1 << 32,
FLAG_CONTAGIOUS = 1 << 33,
FLAG_BLEED_OUT = 1 << 34,
FLAG_HIDE_HP_BAR = 1 << 35,
FLAG_NO_DAMAGE_BLINK = 1 << 36,
FLAG_PERSISTENT = 1 << 37,
FLAG_BACKDROP_DETAIL = 1 << 38,
FLAG_AMBUSH = 1 << 39,
FLAG_GLITCH = 1 << 40,
FLAG_SPIN = 1 << 41,
FLAG_NO_REWARD = 1 << 42,
FLAG_REDUCE_GIBS = 1 << 43,
FLAG_TRANSITION_UPDATE = 1 << 44,
FLAG_NO_PLAYER_CONTROL = 1 << 45,
FLAG_NO_QUERY = 1 << 46,
FLAG_KNOCKED_BACK = 1 << 47,
FLAG_APPLY_IMPACT_DAMAGE = 1 << 48,
FLAG_ICE_FROZEN = 1 << 49,
FLAG_ICE = 1 << 50,
FLAG_MAGNETIZED = 1 << 51,
FLAG_BAITED = 1 << 52,
FLAG_KILLSWITCH = 1 << 53,
FLAG_WEAKNESS = 1 << 54,
FLAG_EXTRA_GORE = 1 << 55,
FLAG_BRIMSTONE_MARKED = 1 << 56,
FLAG_HELD = 1 << 57,
FLAG_THROWN = 1 << 58,
FLAG_FRIENDLY_BALL = 1 << 59,
}
/** For EntityType.ENTITY_TEAR (2) */
declare enum TearFlags {
TEAR_NORMAL = 0,
TEAR_SPECTRAL = 1,
TEAR_PIERCING = 1 << 1,
TEAR_HOMING = 1 << 2,
TEAR_SLOW = 1 << 3,
TEAR_POISON = 1 << 4,
TEAR_FREEZE = 1 << 5,
TEAR_SPLIT = 1 << 6,
TEAR_GROW = 1 << 7,
TEAR_BOOMERANG = 1 << 8,
TEAR_PERSISTENT = 1 << 9,
TEAR_WIGGLE = 1 << 10,
TEAR_MULLIGAN = 1 << 11,
TEAR_EXPLOSIVE = 1 << 12,
TEAR_CHARM = 1 << 13,
TEAR_CONFUSION = 1 << 14,
TEAR_HP_DROP = 1 << 15,
TEAR_ORBIT = 1 << 16,
TEAR_WAIT = 1 << 17,
TEAR_QUADSPLIT = 1 << 18,
TEAR_BOUNCE = 1 << 19,
TEAR_FEAR = 1 << 20,
TEAR_SHRINK = 1 << 21,
TEAR_BURN = 1 << 22,
TEAR_ATTRACTOR = 1 << 23,
TEAR_KNOCKBACK = 1 << 24,
TEAR_PULSE = 1 << 25,
TEAR_SPIRAL = 1 << 26,
TEAR_FLAT = 1 << 27,
TEAR_SAD_BOMB = 1 << 28,
TEAR_BUTT_BOMB = 1 << 29,
TEAR_SQUARE = 1 << 30,
TEAR_GLOW = 1 << 31,
TEAR_GISH = 1 << 32,
TEAR_MYSTERIOUS_LIQUID_CREEP = 1 << 33,
TEAR_SHIELDED = 1 << 34,
TEAR_GLITTER_BOMB = 1 << 35,
TEAR_SCATTER_BOMB = 1 << 36,
TEAR_STICKY = 1 << 37,
TEAR_CONTINUUM = 1 << 38,
TEAR_LIGHT_FROM_HEAVEN = 1 << 39,
TEAR_COIN_DROP = 1 << 40,
TEAR_BLACK_HP_DROP = 1 << 41,
TEAR_TRACTOR_BEAM = 1 << 42,
TEAR_GODS_FLESH = 1 << 43,
TEAR_GREED_COIN = 1 << 44,
TEAR_CROSS_BOMB = 1 << 45,
TEAR_BIG_SPIRAL = 1 << 46,
TEAR_PERMANENT_CONFUSION = 1 << 47,
TEAR_BOOGER = 1 << 48,
TEAR_EGG = 1 << 49,
TEAR_ACID = 1 << 50,
TEAR_BONE = 1 << 51,
TEAR_BELIAL = 1 << 52,
TEAR_MIDAS = 1 << 53,
TEAR_NEEDLE = 1 << 54,
TEAR_JACOBS = 1 << 55,
TEAR_HORN = 1 << 56,
TEAR_LASER = 1 << 57,
TEAR_POP = 1 << 58,
TEAR_ABSORB = 1 << 59,
TEAR_LASERSHOT = 1 << 60,
TEAR_HYDROBOUNCE = 1 << 61,
TEAR_BURSTSPLIT = 1 << 62,
TEAR_CREEP_TRAIL = 1 << 63,
TEAR_PUNCH = 1 << 64,
TEAR_ICE = 1 << 65,
TEAR_MAGNETIZE = 1 << 66,
TEAR_BAIT = 1 << 67,
TEAR_OCCULT = 1 << 68,
TEAR_ORBIT_ADVANCED = 1 << 69,
TEAR_ROCK = 1 << 70,
TEAR_TURN_HORIZONTAL = 1 << 71,
TEAR_BLOOD_BOMB = 1 << 72,
TEAR_ECOLI = 1 << 73,
TEAR_COIN_DROP_DEATH = 1 << 74,
TEAR_BRIMSTONE_BOMB = 1 << 75,
TEAR_RIFT = 1 << 76,
TEAR_SPORE = 1 << 77,
TEAR_GHOST_BOMB = 1 << 78,
TEAR_CARD_DROP_DEATH = 1 << 79,
TEAR_RUNE_DROP_DEATH = 1 << 80,
TEAR_TELEPORT = 1 << 81,
TEAR_EFFECT_COUNT = 82,
TEAR_REROLL_ROCK_WISP = 1 << 115,
TEAR_MOM_STOMP_WISP = 1 << 116,
TEAR_ENEMY_TO_WISP = 1 << 117,
TEAR_REROLL_ENEMY = 1 << 118,
TEAR_GIGA_BOMB = 1 << 119,
TEAR_EXTRA_GORE = 1 << 120,
TEAR_RAINBOW = 1 << 121,
TEAR_DETONATE = 1 << 122,
TEAR_CHAIN = 1 << 123,
TEAR_DARK_MATTER = 1 << 124,
TEAR_GOLDEN_BOMB = 1 << 125,
TEAR_FAST_BOMB = 1 << 126,
TEAR_LUDOVICO = 1 << 127,
}
/** For EntityType.ENTITY_PROJECTILE (9) */
declare enum ProjectileFlags {
SMART = 1,
EXPLODE = 1 << 1,
ACID_GREEN = 1 << 2,
GOO = 1 << 3,
GHOST = 1 << 4,
WIGGLE = 1 << 5,
BOOMERANG = 1 << 6,
HIT_ENEMIES = 1 << 7,
ACID_RED = 1 << 8,
GREED = 1 << 9,
RED_CREEP = 1 << 10,
ORBIT_CW = 1 << 11,
ORBIT_CCW = 1 << 12,
NO_WALL_COLLIDE = 1 << 13,
CREEP_BROWN = 1 << 14,
FIRE = 1 << 15,
BURST = 1 << 16,
ANY_HEIGHT_ENTITY_HIT = 1 << 17,
CURVE_LEFT = 1 << 18,
CURVE_RIGHT = 1 << 19,
TURN_HORIZONTAL = 1 << 20,
SINE_VELOCITY = 1 << 21,
MEGA_WIGGLE = 1 << 22,
SAWTOOTH_WIGGLE = 1 << 23,
SLOWED = 1 << 24,
TRIANGLE = 1 << 25,
MOVE_TO_PARENT = 1 << 26,
ACCELERATE = 1 << 27,
DECELERATE = 1 << 28,
BURST3 = 1 << 29,
CONTINUUM = 1 << 30,
CANT_HIT_PLAYER = 1 << 31,
CHANGE_FLAGS_AFTER_TIMEOUT = 1 << 32,
CHANGE_VELOCITY_AFTER_TIMEOUT = 1 << 33,
STASIS = 1 << 34,
FIRE_WAVE = 1 << 35,
FIRE_WAVE_X = 1 << 36,
ACCELERATE_EX = 1 << 37,
BURST8 = 1 << 38,
FIRE_SPAWN = 1 << 39,
ANTI_GRAVITY = 1 << 40,
TRACTOR_BEAM = 1 << 41,
BOUNCE = 1 << 42,
BOUNCE_FLOOR = 1 << 43,
SHIELDED = 1 << 44,
BLUE_FIRE_SPAWN = 1 << 45,
LASER_SHOT = 1 << 46,
GODHEAD = 1 << 47,
SMART_PERFECT = 1 << 48,
BURSTSPLIT = 1 << 49,
WIGGLE_ROTGUT = 1 << 50,
FREEZE = 1 << 51,
ACCELERATE_TO_POSITION = 1 << 52,
BROCCOLI = 1 << 53,
BACKSPLIT = 1 << 54,
SIDEWAVE = 1 << 55,
ORBIT_PARENT = 1 << 56,
FADEOUT = 1 << 57,
}
declare enum CacheFlag {
CACHE_DAMAGE = 0x1,
CACHE_FIREDELAY = 0x2,
CACHE_SHOTSPEED = 0x4,
CACHE_RANGE = 0x8,
CACHE_SPEED = 0x10,
CACHE_TEARFLAG = 0x20,
CACHE_TEARCOLOR = 0x40,
CACHE_FLYING = 0x80,
CACHE_WEAPON = 0x100,
CACHE_FAMILIARS = 0x200,
CACHE_LUCK = 0x400,
CACHE_SIZE = 0x800,
CACHE_COLOR = 0x1000,
CACHE_PICKUP_VISION = 0x2000,
CACHE_ALL = 0xffff,
CACHE_TWIN_SYNC = 0x80000000,
}
declare enum DamageFlag {
DAMAGE_NOKILL = 1,
DAMAGE_FIRE = 1 << 1,
DAMAGE_EXPLOSION = 1 << 2,
DAMAGE_LASER = 1 << 3,
DAMAGE_ACID = 1 << 4,
DAMAGE_RED_HEARTS = 1 << 5,
DAMAGE_COUNTDOWN = 1 << 6,
DAMAGE_SPIKES = 1 << 7,
DAMAGE_CLONES = 1 << 8,
DAMAGE_POOP = 1 << 9,
DAMAGE_DEVIL = 1 << 10,
DAMAGE_ISSAC_HEART = 1 << 11,
DAMAGE_TNT = 1 << 12,
DAMAGE_INVINCIBLE = 1 << 13,
DAMAGE_SPAWN_FLY = 1 << 14,
DAMAGE_POISON_BURN = 1 << 15,
DAMAGE_CURSED_DOOR = 1 << 16,
DAMAGE_TIMER = 1 << 17,
DAMAGE_IV_BAG = 1 << 18,
DAMAGE_PITFALL = 1 << 19,
DAMAGE_CHEST = 1 << 20,
DAMAGE_FAKE = 1 << 21,
DAMAGE_BOOGER = 1 << 22,
DAMAGE_SPAWN_BLACK_HEART = 1 << 23,
DAMAGE_CRUSH = 1 << 24,
DAMAGE_NO_MODIFIERS = 1 << 25,
DAMAGE_SPAWN_RED_HEART = 1 << 26,
DAMAGE_SPAWN_COIN = 1 << 27,
DAMAGE_NO_PENALTIES = 1 << 28,
DAMAGE_SPAWN_TEMP_HEART = 1 << 29,
DAMAGE_IGNORE_ARMOR = 1 << 30,
DAMAGE_SPAWN_CARD = 1 << 31,
DAMAGE_SPAWN_RUNE = 1 << 32,
}
declare enum GameStateFlag {
STATE_FAMINE_SPAWNED = 0,
STATE_PESTILENCE_SPAWNED = 1,
STATE_WAR_SPAWNED = 2,
STATE_DEATH_SPAWNED = 3,
STATE_BOSSPOOL_SWITCHED = 4,
STATE_DEVILROOM_SPAWNED = 5,
STATE_DEVILROOM_VISITED = 6,
STATE_BOOK_REVELATIONS_USED = 7,
STATE_BOOK_PICKED_UP = 8,
STATE_WRATH_SPAWNED = 9,
STATE_GLUTTONY_SPAWNED = 10,
STATE_LUST_SPAWNED = 11,
STATE_SLOTH_SPAWNED = 12,
STATE_ENVY_SPAWNED = 13,
STATE_PRIDE_SPAWNED = 14,
STATE_GREED_SPAWNED = 15,
STATE_SUPERGREED_SPAWNED = 16,
STATE_DONATION_SLOT_BROKEN = 17,
STATE_DONATION_SLOT_JAMMED = 18,
STATE_HEAVEN_PATH = 19,
STATE_REBIRTH_BOSS_SWITCHED = 20,
STATE_HAUNT_SELECTED = 21,
STATE_ADVERSARY_SELECTED = 22,
STATE_MR_FRED_SELECTED = 23,
STATE_MAMA_GURDY_SELECTED = 24,
STATE_URIEL_SPAWNED = 25,
STATE_GABRIEL_SPAWNED = 26,
STATE_FALLEN_SPAWNED = 27,
STATE_HEADLESS_HORSEMAN_SPAWNED = 28,
STATE_KRAMPUS_SPAWNED = 29,
STATE_DONATION_SLOT_BLOWN = 30,
STATE_SHOPKEEPER_KILLED = 31,
STATE_ULTRAPRIDE_SPAWNED = 32,
STATE_BOSSRUSH_DONE = 33,
STATE_GREED_SLOT_JAMMED = 34,
STATE_AFTERBIRTH_BOSS_SWITCHED = 35,
STATE_BROWNIE_SELECTED = 36,
STATE_SUPERBUM_APPEARED = 37,
STATE_BOSSRUSH_DOOR_SPAWNED = 38,
STATE_BLUEWOMB_DOOR_SPAWNED = 39,
STATE_BLUEWOMB_DONE = 40,
STATE_HEART_BOMB_COIN_PICKED = 41,
STATE_ABPLUS_BOSS_SWITCHED = 42,
STATE_SISTERS_VIS_SELECTED = 43,
STATE_MAX_COINS_OBTAINED = 43,
STATE_SECRET_PATH = 44,
STATE_PERFECTION_SPAWNED = 45,
STATE_MAUSOLEUM_HEART_KILLED = 46,
STATE_BACKWARDS_PATH_INIT = 47,
STATE_BACKWARDS_PATH = 48,
NUM_STATE_FLAGS = 49,
}
declare enum LevelStateFlag {
STATE_BUM_KILLED = 0,
STATE_EVIL_BUM_KILLED = 1,
STATE_REDHEART_DAMAGED = 2,
STATE_BUM_LEFT = 3,
STATE_EVIL_BUM_LEFT = 4,
STATE_DAMAGED = 5,
STATE_SHOPKEEPER_KILLED_LVL = 6,
STATE_COMPASS_EFFECT = 7,
STATE_MAP_EFFECT = 8,
STATE_BLUE_MAP_EFFECT = 9,
STATE_FULL_MAP_EFFECT = 10,
STATE_GREED_LOST_PENALTY = 11,
STATE_GREED_MONSTRO_SPAWNED = 12,
STATE_ITEM_DUNGEON_FOUND = 13,
STATE_MAMA_MEGA_USED = 14,
STATE_WOODEN_CROSS_REMOVED = 15,
STATE_SHOVEL_QUEST_TRIGGERED = 16,
STATE_SATANIC_BIBLE_USED = 17,
STATE_SOL_EFFECT = 18,
STATE_LEVEL_START_TRIGGERED = 19,
STATE_LUNA_EFFECT = 20,
STATE_VOID_DOOR_DISABLED = 21,
STATE_MINESHAFT_ESCAPE = 22,
STATE_MIRROR_BROKEN = 23,
NUM_STATE_FLAGS = 24,
}
declare enum UseFlag {
/** Don't play use animations. */
USE_NOANIM = 1,
/** Don't add costume. */
USE_NOCOSTUME = 1 << 1,
/** Effect was triggered by an active item owned by the player. */
USE_OWNED = 1 << 2,
/** Allow the effect to trigger on non-main players (i.e. coop babies). */
USE_ALLOWNONMAIN = 1 << 3,
/** D4 only: Reroll the player's active item. */
USE_REMOVEACTIVE = 1 << 4,
/** Effect was triggered a second time by Car Battery (or Tarot Cloth for cards). */
USE_CARBATTERY = 1 << 5,
/** Effect was triggered by Void. */
USE_VOID = 1 << 6,
/** Effect was mimicked by an active item (Blank Card, Placebo). */
USE_MIMIC = 1 << 7,
/** Never play announcer voice. */
USE_NOANNOUNCER = 1 << 8,
/**
* This allows an item to spawn wisps when called from another item usage as the wisps generator
* checks for NOANIM, so usually you want to use this with NOANIM call.
*/
USE_ALLOWWISPSPAWN = 1 << 9,
/**
* If set, forces UseActiveItem to use the CustomVarData argument instead of the active item's
* stored VarData.
*/
USE_CUSTOMVARDATA = 1 << 10,
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,520 @@
// Enums from the "resources/scripts/enums.lua" file
// (entity variants only)
/** For EntityType.TEAR (2) */
declare enum TearVariant {
BLUE = 0,
BLOOD = 1,
TOOTH = 2,
METALLIC = 3,
BOBS_HEAD = 4,
FIRE_MIND = 5,
DARK_MATTER = 6,
MYSTERIOUS = 7,
SCHYTHE = 8,
CHAOS_CARD = 9,
LOST_CONTACT = 10,
CUPID_BLUE = 11,
CUPID_BLOOD = 12,
NAIL = 13,
PUPULA = 14,
PUPULA_BLOOD = 15,
GODS_FLESH = 16,
GODS_FLESH_BLOOD = 17,
DIAMOND = 18,
EXPLOSIVO = 19,
COIN = 20,
MULTIDIMENSIONAL = 21,
STONE = 22,
NAIL_BLOOD = 23,
GLAUCOMA = 24,
GLAUCOMA_BLOOD = 25,
BOOGER = 26,
EGG = 27,
RAZOR = 28,
BONE = 29,
BLACK_TOOTH = 30,
NEEDLE = 31,
BELIAL = 32,
EYE = 33,
EYE_BLOOD = 34,
BALLOON = 35,
HUNGRY = 36,
BALLOON_BRIMSTONE = 37,
BALLOON_BOMB = 38,
FIST = 39,
GRIDENT = 40,
ICE = 41,
ROCK = 42,
KEY = 43,
KEY_BLOOD = 44,
ERASER = 45,
FIRE = 46,
SWORD_BEAM = 47,
SPORE = 48,
TECH_SWORD_BEAM = 49,
}
/** For EntityType.ENTITY_FAMILIAR (3) */
declare enum FamiliarVariant {
FAMILIAR_NULL = 0,
BROTHER_BOBBY = 1,
DEMON_BABY = 2,
LITTLE_CHUBBY = 3,
LITTLE_GISH = 4,
LITTLE_STEVEN = 5,
ROBO_BABY = 6,
SISTER_MAGGY = 7,
ABEL = 8,
GHOST_BABY = 9,
HARLEQUIN_BABY = 10,
RAINBOW_BABY = 11,
ISAACS_HEAD = 12,
BLUE_BABY_SOUL = 13,
DEAD_BIRD = 14,
EVES_BIRD_FOOT = 15,
DADDY_LONGLEGS = 16,
PEEPER = 17,
BOMB_BAG = 20,
SACK_OF_PENNIES = 21,
LITTLE_CHAD = 22,
RELIC = 23,
BUM_FRIEND = 24,
HOLY_WATER = 25,
KEY_PIECE_1 = 26,
KEY_PIECE_2 = 27,
KEY_FULL = 28,
FOREVER_ALONE = 30,
DISTANT_ADMIRATION = 31,
GUARDIAN_ANGEL = 32,
FLY_ORBITAL = 33,
SACRIFICIAL_DAGGER = 35,
DEAD_CAT = 40,
ONE_UP = 41,
GUPPYS_HAIRBALL = 42,
BLUE_FLY = 43,
CUBE_OF_MEAT_1 = 44,
CUBE_OF_MEAT_2 = 45,
CUBE_OF_MEAT_3 = 46,
CUBE_OF_MEAT_4 = 47,
ISAACS_BODY = 48,
SMART_FLY = 50,
DRY_BABY = 51,
JUICY_SACK = 52,
ROBO_BABY_2 = 53,
ROTTEN_BABY = 54,
HEADLESS_BABY = 55,
LEECH = 56,
MYSTERY_SACK = 57,
BBF = 58,
BOBS_BRAIN = 59,
BEST_BUD = 60,
LIL_BRIMSTONE = 61,
ISAACS_HEART = 62,
LIL_HAUNT = 63,
DARK_BUM = 64,
BIG_FAN = 65,
SISSY_LONGLEGS = 66,
PUNCHING_BAG = 67,
GUILLOTINE = 68,
BALL_OF_BANDAGES_1 = 69,
BALL_OF_BANDAGES_2 = 70,
BALL_OF_BANDAGES_3 = 71,
BALL_OF_BANDAGES_4 = 72,
BLUE_SPIDER = 73,
MONGO_BABY = 74,
SAMSONS_CHAINS = 75,
CAINS_OTHER_EYE = 76,
BLUEBABYS_ONLY_FRIEND = 77,
SCISSORS = 78,
GEMINI = 79,
INCUBUS = 80,
FATES_REWARD = 81,
LIL_CHEST = 82,
SWORN_PROTECTOR = 83,
FRIEND_ZONE = 84,
LOST_FLY = 85,
CHARGED_BABY = 86,
LIL_GURDY = 87,
BUMBO = 88,
CENSER = 89,
KEY_BUM = 90,
RUNE_BAG = 91,
SERAPHIM = 92,
GB_BUG = 93,
SPIDER_MOD = 94,
FARTING_BABY = 95,
SUCCUBUS = 96,
LIL_LOKI = 97,
OBSESSED_FAN = 98,
PAPA_FLY = 99,
MILK = 100,
MULTIDIMENSIONAL_BABY = 101,
SUPER_BUM = 102,
TONSIL = 103,
BIG_CHUBBY = 104,
DEPRESSION = 105,
SHADE = 106,
HUSHY = 107,
LIL_MONSTRO = 108,
KING_BABY = 109,
FINGER = 110,
YO_LISTEN = 111,
ACID_BABY = 112,
SPIDER_BABY = 113,
SACK_OF_SACKS = 114,
BROWN_NUGGET_POOTER = 115,
BLOODSHOT_EYE = 116,
MOMS_RAZOR = 117,
ANGRY_FLY = 118,
BUDDY_IN_A_BOX = 119,
SPRINKLER = 120,
LEPROSY = 121,
LIL_HARBINGERS = 122,
ANGELIC_PRISM = 123,
MYSTERY_EGG = 124,
LIL_SPEWER = 125,
SLIPPED_RIB = 126,
POINTY_RIB = 127,
BONE_ORBITAL = 128,
HALLOWED_GROUND = 129,
JAW_BONE = 130,
INTRUDER = 200,
DIP = 201,
DAMOCLES = 202,
BLOOD_OATH = 203,
PSY_FLY = 204,
MENORAH = 205,
WISP = 206,
PEEPER_2 = 207,
BOILED_BABY = 208,
FREEZER_BABY = 209,
BIRD_CAGE = 210,
LOST_SOUL = 211,
LIL_DUMPY = 212,
KNIFE_PIECE_1 = 213,
KNIFE_PIECE_2 = 214,
TINYTOMA = 216,
TINYTOMA_2 = 217,
BOT_FLY = 218,
SIREN_MINION = 220,
PASCHAL_CANDLE = 221,
STITCHES = 222,
KNIFE_FULL = 223,
BABY_PLUM = 224,
FRUITY_PLUM = 225,
SPIN_TO_WIN = 226,
MINISAAC = 228,
SWARM_FLY_ORBITAL = 229,
LIL_ABADDON = 230,
ABYSS_LOCUST = 231,
LIL_PORTAL = 232,
WORM_FRIEND = 233,
BONE_SPUR = 234,
TWISTED_BABY = 235,
STAR_OF_BETHLEHEM = 236,
ITEM_WISP = 237,
BLOOD_BABY = 238,
CUBE_BABY = 239,
UMBILICAL_BABY = 240,
BLOOD_PUPPY = 241,
VANISHING_TWIN = 242,
DECAP_ATTACK = 243,
FORGOTTEN_BODY = 900,
}
/** For EntityType.ENTITY_BOMBDROP (4) */
declare enum BombVariant {
BOMB_NORMAL = 0,
BOMB_BIG = 1,
BOMB_DECOY = 2,
BOMB_TROLL = 3,
BOMB_SUPERTROLL = 4,
BOMB_POISON = 5,
BOMB_POISON_BIG = 6,
BOMB_SAD = 7,
BOMB_HOT = 8,
BOMB_BUTT = 9,
BOMB_MR_MEGA = 10,
BOMB_BOBBY = 11,
BOMB_GLITTER = 12,
BOMB_THROWABLE = 13,
BOMB_SMALL = 14,
BOMB_BRIMSTONE = 15,
BOMB_SAD_BLOOD = 16,
BOMB_GIGA = 17,
BOMB_GOLDENTROLL = 18,
BOMB_ROCKET = 19,
BOMB_ROCKET_GIGA = 20,
}
/** For EntityType.ENTITY_PICKUP (5) */
declare enum PickupVariant {
PICKUP_NULL = 0,
PICKUP_HEART = 10,
PICKUP_COIN = 20,
PICKUP_KEY = 30,
PICKUP_BOMB = 40,
PICKUP_THROWABLEBOMB = 41,
PICKUP_POOP = 42,
PICKUP_CHEST = 50,
PICKUP_BOMBCHEST = 51,
PICKUP_SPIKEDCHEST = 52,
PICKUP_ETERNALCHEST = 53,
PICKUP_MIMICCHEST = 54,
PICKUP_OLDCHEST = 55,
PICKUP_WOODENCHEST = 56,
PICKUP_MEGACHEST = 57,
PICKUP_HAUNTEDCHEST = 58,
PICKUP_LOCKEDCHEST = 60,
PICKUP_GRAB_BAG = 69,
PICKUP_PILL = 70,
PICKUP_LIL_BATTERY = 90,
PICKUP_COLLECTIBLE = 100,
PICKUP_SHOPITEM = 150,
PICKUP_TAROTCARD = 300,
PICKUP_BIGCHEST = 340,
PICKUP_TRINKET = 350,
PICKUP_REDCHEST = 360,
PICKUP_TROPHY = 370,
PICKUP_BED = 380,
PICKUP_MOMSCHEST = 390,
}
/** For EntityType.ENTITY_PROJECTILE (9) */
declare enum ProjectileVariant {
PROJECTILE_NORMAL = 0,
PROJECTILE_BONE = 1,
PROJECTILE_FIRE = 2,
PROJECTILE_PUKE = 3,
PROJECTILE_TEAR = 4,
PROJECTILE_CORN = 5,
PROJECTILE_HUSH = 6,
PROJECTILE_COIN = 7,
PROJECTILE_GRID = 8,
PROJECTILE_ROCK = 9,
PROJECTILE_RING = 10,
PROJECTILE_MEAT = 11,
PROJECTILE_FCUK = 12,
PROJECTILE_WING = 13,
PROJECTILE_LAVA = 14,
PROJECTILE_HEAD = 15,
PROJECTILE_PEEP = 16,
}
/** For EntityType.ENTITY_EFFECT (1000) */
declare enum EffectVariant {
EFFECT_NULL = 0,
BOMB_EXPLOSION = 1,
BLOOD_EXPLOSION = 2,
FLY_EXPLOSION = 3,
ROCK_PARTICLE = 4,
BLOOD_PARTICLE = 5,
DEVIL = 6,
BLOOD_SPLAT = 7,
LADDER = 8,
ANGEL = 9,
BLUE_FLAME = 10,
BULLET_POOF = 11,
TEAR_POOF_A = 12,
TEAR_POOF_B = 13,
RIPPLE_POOF = 14,
CROSS_POOF = 14,
POOF01 = 15,
POOF02 = 16,
POOF04 = 17,
BOMB_CRATER = 18,
CRACK_THE_SKY = 19,
SCYTHE_BREAK = 20,
TINY_BUG = 21,
CREEP_RED = 22,
CREEP_GREEN = 23,
CREEP_YELLOW = 24,
CREEP_WHITE = 25,
CREEP_BLACK = 26,
WOOD_PARTICLE = 27,
MONSTROS_TOOTH = 28,
MOM_FOOT_STOMP = 29,
TARGET = 30,
ROCKET = 31,
PLAYER_CREEP_LEMON_MISHAP = 32,
TINY_FLY = 33,
FART = 34,
TOOTH_PARTICLE = 35,
XRAY_WALL = 36,
PLAYER_CREEP_HOLYWATER = 37,
SPIDER_EXPLOSION = 38,
HEAVEN_LIGHT_DOOR = 39,
STARFLASH = 40,
WATER_DROPLET = 41,
BLOOD_GUSH = 42,
POOP_EXPLOSION = 43,
PLAYER_CREEP_WHITE = 44,
PLAYER_CREEP_BLACK = 45,
PLAYER_CREEP_RED = 46,
TRINITY_SHIELD = 47,
BATTERY = 48,
HEART = 49,
LASER_IMPACT = 50,
HOT_BOMB_FIRE = 51,
RED_CANDLE_FLAME = 52,
PLAYER_CREEP_GREEN = 53,
PLAYER_CREEP_HOLYWATER_TRAIL = 54,
SPIKE = 55,
CREEP_BROWN = 56,
PULLING_EFFECT = 57,
POOP_PARTICLE = 58,
DUST_CLOUD = 59,
BOOMERANG = 60,
SHOCKWAVE = 61,
ROCK_EXPLOSION = 62,
WORM = 63,
BEETLE = 64,
WISP = 65,
EMBER_PARTICLE = 66,
SHOCKWAVE_DIRECTIONAL = 67,
WALL_BUG = 68,
BUTTERFLY = 69,
BLOOD_DROP = 70,
BRIMSTONE_SWIRL = 71,
CRACKWAVE = 72,
SHOCKWAVE_RANDOM = 73,
ISAACS_CARPET = 74,
BAR_PARTICLE = 75,
DICE_FLOOR = 76,
LARGE_BLOOD_EXPLOSION = 77,
PLAYER_CREEP_LEMON_PARTY = 78,
TEAR_POOF_SMALL = 79,
TEAR_POOF_VERYSMALL = 80,
FRIEND_BALL = 81,
WOMB_TELEPORT = 82,
SPEAR_OF_DESTINY = 83,
EVIL_EYE = 84,
DIAMOND_PARTICLE = 85,
NAIL_PARTICLE = 86,
FALLING_EMBER = 87,
DARK_BALL_SMOKE_PARTICLE = 88,
ULTRA_GREED_FOOTPRINT = 89,
PLAYER_CREEP_PUDDLE_MILK = 90,
MOMS_HAND = 91,
PLAYER_CREEP_BLACKPOWDER = 92,
PENTAGRAM_BLACKPOWDER = 93,
CREEP_SLIPPERY_BROWN = 94,
GOLD_PARTICLE = 95,
HUSH_LASER = 96,
IMPACT = 97,
COIN_PARTICLE = 98,
WATER_SPLASH = 99,
HUSH_ASHES = 100,
HUSH_LASER_UP = 101,
BULLET_POOF_HUSH = 102,
ULTRA_GREED_BLING = 103,
FIREWORKS = 104,
BROWN_CLOUD = 105,
FART_RING = 106,
BLACK_HOLE = 107,
MR_ME = 108,
DEATH_SKULL = 109,
ENEMY_BRIMSTONE_SWIRL = 110,
HAEMO_TRAIL = 111,
HALLOWED_GROUND = 112,
BRIMSTONE_BALL = 113,
FORGOTTEN_CHAIN = 114,
BROKEN_SHOVEL_SHADOW = 115,
DIRT_PATCH = 116,
FORGOTTEN_SOUL = 117,
SMALL_ROCKET = 118,
TIMER = 119,
SPAWNER = 120,
LIGHT = 121,
BIG_HORN_HOLE_HELPER = 122,
HALO = 123,
TAR_BUBBLE = 124,
BIG_HORN_HAND = 125,
TECH_DOT = 126,
MAMA_MEGA_EXPLOSION = 127,
OPTION_LINE = 128,
LEECH_EXPLOSION = 130,
MAGGOT_EXPLOSION = 131,
BIG_SPLASH = 132,
WATER_RIPPLE = 133,
PEDESTAL_RIPPLE = 134,
RAIN_DROP = 135,
GRID_ENTITY_PROJECTILE_HELPER = 136,
WORMWOOD_HOLE = 137,
MIST = 138,
TRAPDOOR_COVER = 139,
BACKDROP_DECORATION = 140,
SMOKE_CLOUD = 141,
WHIRLPOOL = 142,
FARTWAVE = 143,
ENEMY_GHOST = 144,
ROCK_POOF = 145,
DIRT_PILE = 146,
FIRE_JET = 147,
FIRE_WAVE = 148,
BIG_ROCK_EXPLOSION = 149,
BIG_CRACKWAVE = 150,
BIG_ATTRACT = 151,
HORNFEL_ROOM_CONTROLLER = 152,
OCCULT_TARGET = 153,
DOOR_OUTLINE = 154,
CREEP_SLIPPERY_BROWN_GROWING = 155,
TALL_LADDER = 156,
WILLO_SPAWNER = 157,
TADPOLE = 158,
LIL_GHOST = 159,
BISHOP_SHIELD = 160,
PORTAL_TELEPORT = 161,
HERETIC_PENTAGRAM = 162,
CHAIN_GIB = 163,
SIREN_RING = 164,
CHARM_EFFECT = 165,
SPRITE_TRAIL = 166,
CHAIN_LIGHTNING = 167,
COLOSTOMIA_PUDDLE = 168,
CREEP_STATIC = 169,
DOGMA_DEBRIS = 170,
DOGMA_BLACKHOLE = 171,
DOGMA_ORB = 172,
CRACKED_ORB_POOF = 173,
SHOP_SPIKES = 174,
KINETI_BEAM = 175,
CLEAVER_SLASH = 176,
REVERSE_EXPLOSION = 177,
URN_OF_SOULS = 178,
ENEMY_SOUL = 179,
RIFT = 180,
LAVA_SPAWNER = 181,
BIG_KNIFE = 182,
MOTHER_SHOCKWAVE = 183,
WORM_FRIEND_SNARE = 184,
REDEMPTION = 185,
HUNGRY_SOUL = 186,
EXPLOSION_WAVE = 187,
DIVINE_INTERVENTION = 188,
PURGATORY = 189,
MOTHER_TRACER = 190,
PICKUP_GHOST = 191,
FISSURE_SPAWNER = 192,
ANIMA_CHAIN = 193,
DARK_SNARE = 194,
CREEP_LIQUID_POOP = 195,
GROUND_GLOW = 196,
DEAD_BIRD = 197,
GENERIC_TRACER = 198,
ULTRA_DEATH_SCYTHE = 199,
}
/** For GridEntityType.GRID_DOOR (16) */
declare enum DoorVariant {
DOOR_UNSPECIFIED = 0,
DOOR_LOCKED = 1,
DOOR_LOCKED_DOUBLE = 2,
DOOR_LOCKED_CRACKED = 3,
DOOR_LOCKED_BARRED = 4,
DOOR_LOCKED_KEYFAMILIAR = 5,
DOOR_LOCKED_GREED = 6,
DOOR_HIDDEN = 7,
DOOR_UNLOCKED = 8,
}

View File

@ -0,0 +1,21 @@
declare type PtrHash = number & { __ptrHashBrand: unknown };
declare function Game(this: void): Game;
/**
* Comparing two API objects directly in mod code will not work, even if the Lua metadata points to
* the same pointer in memory. As a workaround, use this function to get a numerical hash of the
* object.
*
* A `PtrHash` object is simply a branded number for better type safety and code clarity.
*/
declare function GetPtrHash(
this: void,
pointer: Entity | RoomDescriptor | RoomDescriptorReadOnly,
): PtrHash;
/** Returns a random integer between 0 and 2^32. */
declare function Random(this: void): int;
/**
* Returns a random vector between (-1, -1) and (1, 1).
* Multiply this vector by a number for larger random vectors.
*/
declare function RandomVector(this: void): Vector;

View File

@ -0,0 +1,98 @@
/// <reference types="lua-types/5.3" />
/// <reference path="enums.d.ts" />
/// <reference path="enumsFlags.d.ts" />
/// <reference path="enumsSubTypes.d.ts" />
/// <reference path="enumsVariants.d.ts" />
/// <reference path="functions.d.ts" />
/// <reference path="json.d.ts" />
/// <reference path="main.d.ts" />
/// <reference path="primitives.d.ts" />
/// <reference path="socket.d.ts" />
/// <reference path="ActiveItemDesc.d.ts" />
/// <reference path="BitSet128.d.ts" />
/// <reference path="CardConfigList.d.ts" />
/// <reference path="Color.d.ts" />
/// <reference path="CostumeConfigList.d.ts" />
/// <reference path="EffectList.d.ts" />
/// <reference path="Entity.d.ts" />
/// <reference path="EntityBomb.d.ts" />
/// <reference path="EntityEffect.d.ts" />
/// <reference path="EntityFamiliar.d.ts" />
/// <reference path="EntityKnife.d.ts" />
/// <reference path="EntityLaser.d.ts" />
/// <reference path="EntityList.d.ts" />
/// <reference path="EntityNPC.d.ts" />
/// <reference path="EntityPickup.d.ts" />
/// <reference path="EntityPlayer.d.ts" />
/// <reference path="EntityProjectile.d.ts" />
/// <reference path="EntityPtr.d.ts" />
/// <reference path="EntityRef.d.ts" />
/// <reference path="EntityTear.d.ts" />
/// <reference path="Font.d.ts" />
/// <reference path="Game.d.ts" />
/// <reference path="GridEntity.d.ts" />
/// <reference path="GridEntityDesc.d.ts" />
/// <reference path="GridEntityDoor.d.ts" />
/// <reference path="GridEntityPit.d.ts" />
/// <reference path="GridEntityPoop.d.ts" />
/// <reference path="GridEntityPressurePlate.d.ts" />
/// <reference path="GridEntityRock.d.ts" />
/// <reference path="GridEntitySpikes.d.ts" />
/// <reference path="GridEntityTNT.d.ts" />
/// <reference path="HUD.d.ts" />
/// <reference path="Input.d.ts" />
/// <reference path="Isaac.d.ts" />
/// <reference path="ItemConfig.d.ts" />
/// <reference path="ItemConfigCard.d.ts" />
/// <reference path="ItemConfigCostume.d.ts" />
/// <reference path="ItemConfigItem.d.ts" />
/// <reference path="ItemConfigList.d.ts" />
/// <reference path="ItemConfigPillEffect.d.ts" />
/// <reference path="ItemPool.d.ts" />
/// <reference path="KColor.d.ts" />
/// <reference path="Level.d.ts" />
/// <reference path="Mod.d.ts" />
/// <reference path="MusicManager.d.ts" />
/// <reference path="PathFinder.d.ts" />
/// <reference path="PillConfigList.d.ts" />
/// <reference path="PosVel.d.ts" />
/// <reference path="ProjectileParams.d.ts" />
/// <reference path="QueueItemData.d.ts" />
/// <reference path="MultiShotParams.d.ts" />
/// <reference path="RNG.d.ts" />
/// <reference path="Room.d.ts" />
/// <reference path="RoomConfig.d.ts" />
/// <reference path="RoomConfigEntry.d.ts" />
/// <reference path="RoomConfigSpawn.d.ts" />
/// <reference path="RoomDescriptor.d.ts" />
/// <reference path="RoomDescriptorReadOnly.d.ts" />
/// <reference path="RoomList.d.ts" />
/// <reference path="Seeds.d.ts" />
/// <reference path="SFXManager.d.ts" />
/// <reference path="ShockwaveParams.d.ts" />
/// <reference path="SpawnList.d.ts" />
/// <reference path="Sprite.d.ts" />
/// <reference path="TearParams.d.ts" />
/// <reference path="TemporaryEffect.d.ts" />
/// <reference path="TemporaryEffects.d.ts" />
/// <reference path="Vector.d.ts" />
/// <reference path="VectorList.d.ts" />
/// <reference path="unofficial/enums.d.ts" />
/// <reference path="unofficial/enumsGridEntity.d.ts" />
/// <reference path="unofficial/enumsGridEntityVariants.d.ts" />
/// <reference path="unofficial/enumsState.d.ts" />
/// <reference path="unofficial/enumsSubTypes.d.ts" />
/// <reference path="unofficial/enumsVariants.d.ts" />
/// <reference path="unofficial/enumsXML.d.ts" />
/// <reference path="mods/EID.d.ts" />
/// <reference path="mods/Encyclopedia.d.ts" />
/// <reference path="mods/MinimapAPI.d.ts" />
/// <reference path="mods/ModConfigMenu.d.ts" />
/// <reference path="mods/MusicModCallback.d.ts" />
/// <reference path="mods/StageAPI.d.ts" />
/// <reference path="mods/StageAPIInterfaces.d.ts" />
/// <reference path="mods/StageAPIUnofficial.d.ts" />

View File

@ -0,0 +1,12 @@
// The "json.lua" module exists at:
// C:\Program Files (x86)\Steam\steamapps\common\The Binding of Isaac Rebirth\resources\scripts\json.lua
// It is intended to be consumed by mods via:
// local json = require("json")
// We need to specify the "@noResolution" tstl compiler annotation,
// since the "json.lua" file is not supposed to exist inside of end-user mods
/** @noResolution */
declare module "json" {
function encode(this: void, data: unknown): string;
function decode(this: void, data: string): unknown;
}

View File

@ -0,0 +1,11 @@
// Functions and constants from the "resources/scripts/main.lua" file
export {};
/** @noSelf */
declare global {
function RegisterMod(modName: string, APIVersion: int): Mod;
function StartDebug(): void;
const REPENTANCE: boolean | undefined;
}

View File

@ -0,0 +1,487 @@
declare const EID: EIDInterface | undefined;
declare interface EIDDescriptionObject {
Description: string;
ID: int;
ItemType: int;
ItemVariant: int;
Name: string;
RealID: int;
Transformation: string;
fullItemString: string;
}
/**
* @param LeftOffset Defaults to -1.
* @param TopOffset Defaults to 0.
* @param SpriteObject Defaults to `EID.InlineIconSprite`.
*/
declare type EIDInlineIcon = [
AnimationName: string,
Frame: int,
Width: int,
Height: int,
LeftOffset?: int,
TopOffset?: int,
SpriteObject?: Sprite,
];
declare type EIDTransformationTargetType =
| "collectible"
| "trinket"
| "card"
| "pill"
| "entity";
declare interface EIDInterface {
/** Gets the size of the screen. */
GetScreenSize(): Vector;
/** Adds a character specific description for the item "Birthright". */
addBirthright(
characterId: int,
description: string,
playerName?: string,
language?: string,
): void;
/** Adds a description for a card/rune. */
addCard(
id: int,
description: string,
itemName?: string,
language?: string,
): void;
/** Adds a description for a collectible. */
addCollectible(
id: int,
description: string,
itemName?: string,
language?: string,
): void;
/**
* Adds a new color object with the shortcut defined in the "shortcut" variable
* (e.g. "{{shortcut}}" = your color).
*
* Shortcuts are case-sensitive! Shortcuts can be overridden with this function to allow for full
* control over everything.
*
* Define a callback to let it be called when interpreting the color-markup. Define a `KColor`
* otherwise for a simple color change.
*/
addColor(
shortcut: string,
kColor: KColor,
callback?: (color: KColor) => KColor,
): void;
/**
* Adds Description object modifiers.
* Used for altering descriptions. Examples: Spindown dice, Tarot Cloth, etc.
*
* @param condition A function that returns `true` if `callback` should be called on the given
* description string.
* @param callback A function that returns a modified version of the given description string.
*/
addDescriptionModifier(
modifierName: string,
condition: (testDescription: string) => boolean,
callback: (oldDescription: string) => string,
): void;
/**
* Adds a description for an entity.
*
* When subtype is -1 or undefined, it will affect all subtypes of that entity.
*/
addEntity(
id: int,
variant: int,
subtype: int | undefined,
entityName: string,
description: string,
language?: string,
): void;
/**
* Adds a new icon object with the shortcut defined in the "shortcut" variable
* (e.g. "{{shortcut}}" = your icon).
*
* Shortcuts are case-sensitive! Shortcuts can be overridden with this function to allow for full
* control over everything.
*
* Setting "animationFrame" to -1 will play the animation. The spriteObject needs to be of class
* Sprite() and have an .anm2 loaded to do this.
*
* @param leftOffset Defaults to -1.
* @param topOffset Defaults to 0.
*/
addIcon(
shortcut: string,
animationName: string,
animationFrame: int,
width: int,
height: int,
leftOffset: float | undefined,
topOffset: float | undefined,
spriteObject: Sprite,
): void;
/** Adds a description for a pilleffect id. */
addPill(
id: int,
description: string,
itemName?: string,
language?: string,
): void;
/**
* Adds a text position modifier `Vector`, which will be applied to the text position variable.
*
* Useful to add small offsets. For example: for schoolbag HUD.
*/
addTextPosModifier(identifier: string, modifierVector: Vector): void;
/** Adds a description for a trinket. */
addTrinket(
id: int,
description: string,
itemName?: string,
language?: string,
): void;
/**
* Changes the initial position of all EID descriptions.
*
* Useful to totally alter and override the current initial overlay position.
*/
alterTextPos(newPosVector: Vector): void;
/** Appends a given string to the description of a given `EIDDescriptionObj`. */
appendToDescription(
descObj: EIDDescriptionObject,
appendString: string,
): void;
/** Compares two KColors. Returns true if they are equal. */
areColorsEqual(c1: KColor, c2: KColor): boolean;
/**
* Assigns transformations to an entity (Adds to existing transformations).
*
* When type = entity, targetIdentifier must be in the format "ID.Variant.subtype".
* For any other type, it can just be the id.
*
* EXAMPLE: `EID.assignTransformation("collectible", 1, "My Transformation")`.
*/
assignTransformation(
targetType: EIDTransformationTargetType,
targetIdentifier: string | int,
transformationString: string,
): void;
/** Creates a copy of a `KColor` object. This prevents overwriting existing `KColor` objects. */
copyKColor(colorObj: KColor): KColor;
/**
* Tries to read special markup used to generate icons for all collectibles/trinkets and the
* default cards/pills.
*
* @returns An `EIDInlineIcon` Object or `undefined` if no parsing was possible.
*/
createItemIconObject(str: string): EIDInlineIcon | undefined;
/** Creates a new transformation. */
createTransformation(
uniqueName: string,
displayName: string,
language?: string,
): void;
/**
* Overrides all potentially displayed texts and permanently displays the given texts. Can be
* turned off again using
* {@link EID.hidePermanentText EID:hidePermanentText()}.
*/
displayPermanentText(descriptionObject: EIDDescriptionObject): void;
/**
* Filters a given string and looks for `KColor` markup.
* Splits the text into subsections limited by them.
*
* @returns An array of tables containing subsections of the text, their respective `KColor`,
* and the width of the subsection.
*/
filterColorMarkup(
text: string,
baseKColor: KColor,
): Array<[string, KColor, int]>;
/**
* Searches through the given string and replaces Icon placeholders with icons.
* Returns 2 values:
*
* - The string without the placeholders but with an accurate space between lines.
* - An array of tables containing each Inline Sprite and the preceding text width.
*/
filterIconMarkup(
text: string,
textPosX?: int,
textPosY?: int,
): LuaMultiReturn<[string, Array<[EIDInlineIcon, int]>]>;
/**
* Fits a given string to a specific width.
*
* @returns The string as a table of lines.
*/
fitTextToWidth(str: string, textboxWidth: number): string[];
/**
* Generates a string with the defined pixel-length using a custom 1px wide character.
*
* This will only work for EID's specific custom font.
*/
generatePlaceholderString(length: int): string;
/** Returns an adjusted SubType id for special cases like Horse Pills and Golden Trinkets. */
getAdjustedSubtype(Type: int, Variant: int, SubType: int): int;
/**
* Gets a `KColor` from a Markup-string (example Input: `"{{ColorText}}"`).
*
* @returns The `KColor` object and a `boolean` value indicating if the given string was a color
* markup or not.
*/
getColor(str: string, baseKColor: KColor): LuaMultiReturn<[KColor, boolean]>;
/**
* Returns the description data table in the current language related to a given id, variant and
* subtype.
*
* Falls back to English if it doesn't exist.
*/
getDescriptionData(
Type: int,
Variant: int,
SubType: int,
): EIDDescriptionObject;
/**
* Returns the specified object table in the current language.
*
* Falls back to English if it doesn't exist.
*/
getDescriptionEntry(objTable: string, objID?: string): EIDDescriptionObject;
/**
* Returns the description object of the specified entity.
*
* Falls back to English if the objID isn't available.
*/
getDescriptionObj(
Type: int,
Variant: int,
SubType: int,
): EIDDescriptionObject;
/** Get `KColor` object of "Error" texts. */
getErrorColor(): KColor;
/** Turns entity type names into actual in-game ID.Variant pairs. */
getIDVariantString(typeName: string): string;
/**
* Returns the `EIDInlineIcon` object of a given icon string.
*
* Can be used to validate an icon string.
*/
getIcon(str: string): EIDInlineIcon;
/**
* Returns the entity that is currently described. Returns last described entity if currently not
* displaying text.
*/
getLastDescribedEntity(): Entity;
/**
* Fetches description table from the legacy mod descriptions if they exist.
*
* @returns ["", "", description], ["", name, description],
* or `undefined` (if there is no legacy description).
*/
getLegacyModDescription(
Type: int,
Variant: int,
SubType: int,
): ["", "", string] | ["", string, string] | undefined;
/** Get `KColor` object of "Entity Name" texts. */
getNameColor(): KColor;
/** Tries to get the in-game name of an item based on its ID. */
getObjectName(Type: int, Variant: int, SubType: int): string;
/** Converts a given CollectibleID into the respective Spindown dice result. */
getSpindownResult(collectibleID: int): int;
/** Returns the width of a given string in pixels */
getStrWidth(str: string): int;
/** Turns entity type and variants into their EID table-name. */
getTableName(Type: int, Variant: int, SubType: int): string;
/** Get `KColor` object of "Description" texts. */
getTextColor(): KColor;
/** Returns the current text position. */
getTextPosition(): Vector;
/**
* Gets the transformation uniqueName / ID of a given entity.
*
* Example: `EID:getTransformation(5,100,34)` will return `"12"` which is the id for Bookworm.
*/
getTransformation(Type: int, Variant: int, SubType: int): string;
/** Get `KColor` object of "Transformation" texts. */
getTransformationColor(): KColor;
/** Returns the icon for a given transformation name or ID. */
getTransformationIcon(str: string): EIDInlineIcon;
/**
* Gets the name of the given transformation by its uniqueName / ID.
*
* (Note: this function might be broken)
*/
getTransformationName(id: string): string;
/**
* Tries to get the in-game description of an object, based on their description in the XML files.
*
* @returns `"(No Description available)"` if it cannot find the given object's description.
*/
getXMLDescription(
Type: int,
Variant: int,
SubType: int,
): string | "(no description available)";
/**
* Returns the icon used for the bullet-point. It will look at the first word in the given string.
*/
handleBulletpointIcon(text: string): EIDInlineIcon;
/** Returns `true`, if curse of blind is active. */
hasCurseBlind(): boolean;
/** Check if an entity is part of the describable entities. */
hasDescription(entity: Entity): boolean;
/** Hides permanently displayed text objects if they exist. */
hidePermanentText(): void;
/** Interpolates between 2 KColors with a given fraction. */
interpolateColors(kColor1: KColor, kColor2: KColor, fraction: number): KColor;
/** Returns if EID is displaying text right now. */
isDisplayingText(): boolean;
/** Loads a given font from a given file path and use it to render text. */
loadFont(fontFileName: string): boolean;
/**
* Removes a Description object modifier.
* Used for altering descriptions. Examples: Spindown dice, Tarot Cloth, etc.
*/
removeDescriptionModifier(modifierName: string): void;
/**
* Removes a given value from the string inside a table.
* Example: `"1,2,3"`, removing `2` will return `"1,3"`.
*/
removeEntryFromString(
sourceTable: LuaTable<string | number, string> | string[],
entryKey: string | number,
entryValue: string,
): void;
/**
* Removes a text position modifier `Vector`.
*
* Useful to remove small offsets. For example: for schoolbag HUD.
*/
removeTextPosModifier(identifier: string): void;
/**
* Removes a transformation from an entity.
*
* When type = entity, targetIdentifier must be in the format "ID.Variant.subtype".
* For any other type, it can just be the id.
*
* EXAMPLE: `EID.removeTransformation("collectible", 1, "My Transformation")`.
*/
removeTransformation(
targetType: EIDTransformationTargetType,
targetIdentifier: string | int,
transformationString: string,
): void;
/** Helper function to render Icons in specific EID settings. */
renderIcon(spriteObj: Sprite, posX: int, posY: int): void;
/**
* Renders a list of given inline sprite objects returned by the
* {@link EID.filterIconMarkup EID:filterIconMarkup()} function.
*
* Table entry format: {`EIDInlineIcon` Object, Width of text preceding the icon}.
*/
renderInlineIcons(
spriteTable: Array<[EIDInlineIcon, int]>,
posX: int,
posY: int,
): void;
/**
* Renders a given string using the EID custom font.
* This will also apply any markup and render icons.
*
* Needs to be called in a render callback.
*
* @returns The last used `KColor`.
*/
renderString(
str: string,
position: Vector,
scale: Vector,
kColor: KColor,
): KColor;
/** Replaces shorthand-representations of a character with the internal reference. */
replaceShortMarkupStrings(text: string): string;
/**
* Converts a given table into a string containing the crafting icons of the table.
*
* Example input: `{1,2,3,4,5,6,7,8}`.
*
* Result: `"{{Crafting8}}{{Crafting7}}{{Crafting6}}{{Crafting5}}{{Crafting4}}{{Crafting3}}{{Crafting2}}{{Crafting1}}"`.
*
* Prefer {@link EID.tableToCraftingIconsMerged tableToCraftingIconsMerged()},
* due to improved render performance.
*/
tableToCraftingIconsFull(craftTable: int[]): string;
/**
* Converts a given table into a string containing the crafting icons of the table,
* which are also grouped to reduce render lag.
*
* Example input: `{1,1,1,2,2,3,3,3}`.
*
* Result: `"3{{Crafting3}}2{{Crafting2}}3{{Crafting1}}"`.
*/
tableToCraftingIconsMerged(craftTable: int[]): string;
}

Some files were not shown because too many files have changed in this diff Show More