Skip to content

Instantly share code, notes, and snippets.

mg.register_ore({
name = "air",
seeddiff = 1234,
maxhdistance = 70,
maxvdistance = 70,
maxheight = -3,
seglenghtn = 10,
seglenghtdev = 4,
segincln = 0.2,
segincldev = 0.6,
minetest.register_privilege("forceload",
{description = "Can use world forceloaders",
give_to_singleplayer = true})
minetest.register_node("worldloader:worldloader", {
description = "Test",
drawtype = "normal",
tiles = {"worldloader_worldloader.png"},
groups = {oddly_breakable_by_hand = 2},
on_place = function(itemstack, user, pointed_thing)
pipes = [[None] * 10 for i in range(10)]
new_pipes = [[None] * 10 for i in range(10)]
new_pipes2 = [[None] * 10 for i in range(10)]
for i in range(5):
pipes[1][i+1] = 0
def update():
for i in range(1, 9):
for j in range(1, 9):
--run Files
local modpath = minetest.get_modpath("waypoints")
waypoints = {}
waypoints.players = {}
local time = 0
minetest.register_on_leaveplayer(function(player)--Called if on a server, if single player than it isn't called
--specialties.writeXP(player:get_player_name())
end)
@Ekdohibs
Ekdohibs / gist:7510145
Last active December 28, 2015 13:49
Force load API draft
minetest.get_force_load_handler()
^ returns a force load handler
handler.force_load_block(pos)
^ force loads the block containing pos
^ returns the number of times the block is currently force loaded by the handler
^ can be 0 if the block was not force loaded
^ force loading a block multiple times does not count towards the max force loaded
^ block limit of the handler
minetest.register_node("test:test", {
description = "Test",
tiles = {"test.png"},
paramtype2 = "facedir",
paramtype = "light",
groups = {choppy=2,oddly_breakable_by_hand=1,flammable=2},
on_construct = function(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("space crash", 1)
@@ -1015,11 +1015,12 @@ checkbox[<X>,<Y>;<name>;<label>;<selected>]
^ name fieldname data is transfered to lua
^ label to be shown left of checkbox
^ selected (optional) true/false
Note: do NOT use a element name starting with "key_" those names are reserved to
-pass key press events to formspec!
+pass key press events to formspec! Do NOT use "quit" either, since it is
+reserved for formspec close events.
local function copytable(t)
t2 = {}
for k,i in pairs(t) do
t2[k] = i
end
return t2
end
function realtest.register_ore(name, OreDef)
local ore = {
minetest.register_on_generated(function(minp, maxp, seed)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local a = VoxelArea:new{
MinEdge={x=emin.x, y=emin.y, z=emin.z},
MaxEdge={x=emax.x, y=emax.y, z=emax.z},
}
local va = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
for _, ore_sheet in ipairs(mg.registered_ore_sheets) do
local sidelen = maxp.x - minp.x + 1
minetest.register_on_craft(function(itemstack, player, old_craft_list, craft_inv)
for i = 1,9 do
if i~=5 and old_craft_list[i]:get_count() > 0 then
return
end
end
local s = old_craft_list[5]
if s:get_name() == "default:steel_ingot" and s:get_count() >= 9 then
local st = s:to_table()
st.count = st.count - 9