Skip to content

Instantly share code, notes, and snippets.

View init.lua.txt
-- 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
View init.lua
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
View gist:3731863
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
View init.lua
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)
View gist:3912475
#include <iostream>
using namespace std;
int goals_of_first_team;
int goals_of_second_team;
int points_of_ManC;
View LuaTerminal.lua
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 Dec 25, 2015
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)
View gist:6935009
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
View Payroll crap.lua
--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.')
View areas.cpp
#include <iostream>
using namespace std;
int main()
{
int length, width, perimeter, area;
cout << "Length = ";
cin >> length;
@Jordach
Jordach / Jordach
Created Nov 29, 2013
Example empty player file:
View Jordach
breath = 65535
hp = 20
name = Jordach
pitch = 16.6
position = (90,15,20)
version = 1
yaw = -14.79
PlayerArgsEnd
List main 32
Width 0