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
<?php | |
// Minimum viable cheatdb replacement. | |
// Needs a directory of clientmods at ./packages | |
// Run with php -S 127.0.0.1:8080 simple_cheatdb.php | |
// Set dragonfire contentdb_url setting to http://127.0.0.1:8080 | |
// Needs php-zip (e.g. apt install php8.2-zip in debian) | |
$packs = scandir("./packages"); | |
error_log($_SERVER['REQUEST_URI']); | |
$rq = explode("/", $_SERVER['REQUEST_URI']); |
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
--turns ores adjacent to air to the stone/deepslate/netherrack/blackstone counterparts | |
--in one in `chance` of the cases | |
--does not appear to *always* work i.e. with chance = 1 you'll still rarely see some exposed ores | |
local chance = 5 | |
local c_stone = minetest.get_content_id("mcl_core:stone") | |
local c_deepslate = minetest.get_content_id("mcl_deepslate:deepslate") | |
local c_netherrack = minetest.get_content_id("mcl_nether:netherrack") | |
local c_blackstone = minetest.get_content_id("mcl_blackstone:blackstone") | |
local c_air = minetest.get_content_id("air") |
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
mcla_itemframes = {} | |
local S = minetest.get_translator(minetest.get_current_modname()) | |
local fbox = {type = "fixed", fixed = {-6/16, -1/2, -6/16, 7/16, -7/16, 6/16}} | |
local function find_entity(pos) | |
for _,o in pairs(minetest.get_objects_inside_radius(pos, 0.4)) do | |
local l = o:get_luaentity() | |
if l and l.name == "mcla_itemframes:item" then | |
return l |
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 search_radius = 20 | |
local limit = 15 | |
local interval = 60 | |
local function crowded(e) | |
local n = 0 | |
local pos = e.object:get_pos() | |
if not pos then return end | |
for _,f in pairs(minetest.luaentities) do | |
if f.is_mob and f.name == e.name and not f.tamed and not f.nametag then |
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
mcl_events = {} | |
local siegenight = false | |
local siege_active = false | |
local function is_in_village(pl) | |
local pos = pl:get_pos() | |
local bell = minetest.find_node_near(pos,64,{"mcl_bells:bell"}) | |
if bell then return true end | |
--local m = minetest.get_meta(bell) |
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
-- test to check the time savings of localizing global functions | |
-- use /tgvars and /tlvars to run the tests for global and local | |
local vec = vector | |
local function do_testl(p) | |
local t0 = os.clock() | |
for i=1,65000 do for j=1,65000 do --for k=1,65000 do | |
local k = 5 | |
local nv = vec.new(i,j,k) | |
local v = vec.add(p,nv) |
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 adjacents = { | |
{ x =-1, y = 0, z = 0 }, | |
{ x = 1, y = 0, z = 0 }, | |
{ x = 0, y = 0, z =-1 }, | |
{ x = 0, y = 0, z = 1 }, | |
} | |
local infinitree_node="mcl_core:acaciatree" | |
local leaves_node="mcl_core:acacialeaves" | |
minetest.register_abm({ | |
label = "infinitrees", |
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
math.randomseed(os.time()) | |
minetest.register_chatcommand("mobtest",{ | |
description="Spawns all available mobs", | |
privs={server=true}, | |
func=function(n,param) | |
local p=minetest.get_player_by_name(n) | |
local pos=p:get_pos() | |
for k,v in pairs(minetest.registered_entities) do | |
if v.horny ~= nil then | |
local spos=vector.add(pos,vector.new(math.random(100)+10,0,math.random(100)+10)) |
This file has been truncated, but you can view the full file.
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 list= { | |
vector.new(1,1,1), | |
vector.new(1,1,2), | |
vector.new(1,1,3), | |
vector.new(1,1,4), | |
vector.new(1,1,5), | |
vector.new(1,1,6), | |
vector.new(1,1,7), | |
vector.new(1,1,8), | |
vector.new(1,1,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_lbm({ | |
label = "Replace locked chests with normal ones", | |
name = "replace_locked_chests:lbm", | |
nodenames = {"default:chest_locked"}, | |
run_at_every_load = true, | |
action = function(pos, node) | |
local m=minetest.get_meta(pos):to_table() | |
local p1=node.param1 | |
local p2=node.param2 | |
m.fields={} |