This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local achievements_file=minetest.get_worldpath() .. "/achievements" | |
function read_file(filename) | |
local f = io.open(filename, "r") | |
if f==nil then return {} end | |
local t = f:read("*all") | |
f:close() | |
if t=="" or t==nil then return {} end | |
return minetest.deserialize(t) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local achievements_file=minetest.get_worldpath() .. "/achievements" | |
function read_file(filename) | |
local f = io.open(filename, "r") | |
if f==nil then return {} end | |
local t = f:read("*all") | |
f:close() | |
if t=="" or t==nil then return {} end | |
return minetest.deserialize(t) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local CRAFT_TABLE_SIZE = 4 | |
local update_craft_table_inv = function(inv) | |
inv:set_stack("craftpreview", 1, minetest.get_craft_result({method = "normal", items = inv:get_list("craft"), width = CRAFT_TABLE_SIZE}).item) | |
end | |
local update_craft_table = function(pos) | |
local meta = minetest.get_meta(pos) | |
local inv = meta:get_inventory() | |
update_craft_table_inv(inv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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) |
OlderNewer