Skip to content

Instantly share code, notes, and snippets.

@corarona
corarona / simpe_cheatdb.php
Created March 3, 2024 03:15
Dead simple cheatdb replacement
<?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']);
@corarona
corarona / init.lua
Last active January 18, 2024 01:21
mcl_obscores
--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")
@corarona
corarona / init.lua
Last active January 14, 2024 04:09
mcla_itemframes POC
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
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
@corarona
corarona / init.lua
Created September 14, 2022 13:14
z-siege
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)
@corarona
corarona / init.lua
Created August 8, 2022 01:13
localized lua vars test
-- 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)
@corarona
corarona / init.lua
Created March 28, 2022 02:07
infinitrees
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",
@corarona
corarona / init.lua
Created February 12, 2022 17:20
mobtest - spawns all mobs in mcl2
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))
@corarona
corarona / init.lua
Last active January 15, 2022 16:26
static tables vs. find_nodes
This file has been truncated, but you can view the full file.
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),
@corarona
corarona / init.lua
Created January 11, 2022 01:30
replace_locked_chests
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={}