Skip to content

Instantly share code, notes, and snippets.

View oatmealine's full-sized avatar
🔨
conk2.ogg

jill oatmealine

🔨
conk2.ogg
View GitHub Profile
@oatmealine
oatmealine / xdrv.lua
Last active October 2, 2024 13:41
Lua type definitions for EX-XDRiVER
---@meta
xdrv = {}
-- 0. https://github.com/tari-cat/XDRV/blob/main/Assets/Scripts/XDRVEditorScripts/ChartMod.cs#L90
-- 1. /ChartModLookup\.Add\("/ -> ''
-- 2. /", ChartModType\..+\)/ -> ''
-- 3. /^//.+/ -> ''
-- 4. /^([\w]+);\n+/ -> ''$1' | '
---@alias xdrv.ModName 'speed' | 'camera_position_x' | 'camera_position_y' | 'camera_position_z' | 'camera_rotation_x' | 'camera_rotation_y' | 'camera_rotation_z' | 'camera_move_x' | 'camera_move_y' | 'camera_move_z' | 'camera_rotate_x' | 'camera_rotate_y' | 'camera_rotate_z' | 'camera_fov' | 'camera_field_of_view' | 'note_move_x' | 'note_move_y' | 'note_move_z' | 'note_rotate_x' | 'note_rotate_y' | 'note_rotate_z' | 'note1_move_x' | 'note1_move_y' | 'note1_move_z' | 'note1_rotate_x' | 'note1_rotate_y' | 'note1_rotate_z' | 'note2_move_x' | 'note2_move_y' | 'note2_move_z' | 'note2_rotate_x' | 'note2_rotate_y' | 'note2_rotate_z' | 'note3_move_x' | 'note3_move_y' | 'note3_move_z' | 'note3_rotate_x' | 'note3_rotate_y' | 'note3_rotate_z' | 'note4_move_x' | 'note4_move_y' |
local sm = {}
local function filterComments(text)
local lines = {}
for line in string.gmatch(text, '([^\n\r]*)[\n\r]?') do
if not string.match(line, '^%s*//.+') and string.len(line) > 0 then
table.insert(lines, line)
end
end
return table.concat(lines, '\n')
@oatmealine
oatmealine / random-values-in-isaac.md
Created May 2, 2022 20:03
I want to get a random value in Isaac!

I want to get a random value in Isaac!

Well I'm glad you asked, because this simple question has many anwsers depending on how much effort you want to put in!

There are 3 types of random you can use in Isaac, going from the one that requires the least amount of effort to the one that requires the most amount of effort. There is no "objectively best" method, as it depends on your usecase, the size of your mod, and how much you truly care.

Why?

For this guide, let's assume your usecase is for adding a random vector to an entity's velocity:

@oatmealine
oatmealine / smelte.lua
Created April 5, 2022 03:11
smelte - a very, very dumb proof-of-concept Lua DSL HTML framework
-- smelte 1.0
-- a very, very dumb proof-of-concept Lua DSL HTML framework
--
-- smelte.declare 'name' (function() return span 'custom element' end)
-- -> void
-- declares a custom element
--
-- smelte.compile (function() return
-- {
-- head = {
@oatmealine
oatmealine / example.lua
Created February 26, 2022 15:37
Simple, fast Lua uwu-ifier
local uwuify = require 'uwu'
assert(uwuify('really') == 'weawwy')
-- constants
SCREEN_WIDTH = 24
SCREEN_HEIGHT = 24
sw, sh = SCREEN_WIDTH, SCREEN_HEIGHT
-- timer
local ticks = 0
local time = 0

A metatable can be defined like

local t = setmetatable({}, {
  __tostring = function() return 'custom tostring behavior!' end
})

Here are the metamethods that you can define, and their behavior

Operators

@oatmealine
oatmealine / formulas.js
Created December 27, 2021 19:11
Formulas.exe but in plain JS
// skills
function calculateSkill(exp, mult = 1) {
return Math.max(Math.floor(mult * (32 * Math.log(exp + 534.5) - 200)), 1);
}
function calculateExp(skill, mult = 1) {
return Math.exp((skill / mult + 200) / 32) - 534.6;
}
@oatmealine
oatmealine / .luacheckrc
Created October 30, 2021 03:51
Luacheck config meant to be used for Isaac modding
-- isaac-related luacheck config
-- please use luacheck while possible!!
-- if you disagree with any of the policies given here
-- id suggest you discuss it with the team before you change it
-- (unless its a global mistake or similar)
return {
-- isaac has lots of globals and doesnt just drop them into one Isaac
-- namespace like the name would imply. fun!
// rhythmbox database collage tool
//
// dependencies: jimp, xml-js
//
// this code is licensed under a [copyleft](https://en.wikipedia.org/wiki/Copyleft) license: this code is completely okay to modify, copy, redistribute and improve upon, as long as you keep this license notice
// ↄ Jill "oatmealine" Monoids 2021
const Jimp = require('jimp');
const fs = require('fs');
const { xml2js } = require('xml-js');