Skip to content

Instantly share code, notes, and snippets.

@Jordach
Jordach / init.lua.txt
Created June 12, 2012 15:48 — forked from anonymous/init.lua.txt
init.lua
-- Simple logging mod
local path = minetest.get_modpath("log").."/data/"
-- returns block coordinates containing [pos] node
local function convert_position(pos)
return {x = math.floor(pos.x / 16), y = math.floor(pos.y / 16), z = math.floor(pos.z / 16)}
end
local function filename(pos, short)
if short == true then
@Jordach
Jordach / init.lua
Created September 16, 2012 09:42
Stuff
local grass_gen = function( minp, maxp )
if maxp.y < 40 then
for lx = minp.x, maxp.x do
for ly = minp.y, maxp.y do
for lz = minp.z, maxp.z do
local p = { x = lx, y = ly, z = lz }
local n = minetest.env:get_node( p )
if n.name == "air" then
minetest.env:place_node( p, { name = "default:dirt_with_grass" } )
end
local grass_gen = function( minp, maxp )
if maxp.y < 40 then
for lx = minp.x, maxp.x do
for ly = minp.y, maxp.y do
for lz = minp.z, maxp.z do
local p = { x = lx, y = ly, z = lz }
local n = minetest.env:get_node( p )
minetest.env:add_node( p, { name = "default:dirt_with_grass" } )
end
end
@Jordach
Jordach / init.lua
Created September 29, 2012 17:53
init
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
if maxp.y < height_min or minp.y > height_max then
return
end
local y_min = math.max(minp.y, height_min)
local y_max = math.min(maxp.y, height_max)
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
local pr = PseudoRandom(seed)
local num_chunks = math.floor(chunks_per_volume * volume)
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
#include <iostream>
using namespace std;
int goals_of_first_team;
int goals_of_second_team;
int points_of_ManC;
@Jordach
Jordach / LuaTerminal.lua
Last active April 27, 2022 07:48
LuaTerminal
terminal_version = "0.1.4"
system_drive = "nil" --possibly irrelevant for UNIX systems. todo: these need to be loaded at startup
working_dir = "nil"
folder_dir = "nil"
os_name = "nil"
user_is_windows = "unsure" --until proven guilty....fact: Lua Terminal was made on windows.
@Jordach
Jordach / gist:6935009
Last active December 25, 2015 06:49
If the number fits in an 8 bit byte, then prepend 0s to make full 8 bit bytes, numbers above 255 get new digits added (like normal binary)
function DecToBase(IN,BASE)
local B,K,OUT,D=BASE or 10,"0123456789ABCDEFGHIJKLMNOPQRSTUVW",""
while IN>0 do
IN,D=math.floor(IN/B),math.mod(IN,B)+1
OUT=string.sub(K,D,D)..OUT
end
if string.len(OUT) == 1 then
OUT = "0000000" .. OUT
elseif string.len(OUT) == 2 then
OUT = "000000" .. OUT
--Global variables
Assumed_Hour = 7.50
Tax_Level = 0.2
-- Options
print ('Please select your options:')
print ('1: Get payroll record.')
print ('2: Calculate net pay.')
print ('3: Print paycheck.')
@Jordach
Jordach / areas.cpp
Last active December 27, 2015 11:19
#include <iostream>
using namespace std;
int main()
{
int length, width, perimeter, area;
cout << "Length = ";
cin >> length;
@Jordach
Jordach / Jordach
Created November 29, 2013 19:13
Example empty player file:
breath = 65535
hp = 20
name = Jordach
pitch = 16.6
position = (90,15,20)
version = 1
yaw = -14.79
PlayerArgsEnd
List main 32
Width 0