Skip to content

Instantly share code, notes, and snippets.

View HybridDog's full-sized avatar
💭

HybridDog

💭
  • We store your personal data in the United States. See our privacy policy for more information.
View GitHub Profile
local current_pos
local actual_node_get = minetest.get_node_or_nil
local function temp_node_get(pos, ...)
current_pos = pos
return actual_node_get(pos, ...)
end
local actual_turnon = mesecon.turnon
function mesecon.turnon(...)
local function inform_near_players(pos, msg)
for _,player in pairs(minetest.get_objects_inside_radius(pos, 10)) do
if player:is_player() then
minetest.chat_send_player(player:get_player_name(), msg)
end
end
end
function apn(pos, placer, itemstack)
local grop = minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "myuno")
@HybridDog
HybridDog / tnt_mapgen.lua
Created September 24, 2015 17:16
tnt mapgen
local c_air = minetest.get_content_id("air")
local c_tnt = minetest.get_content_id("tnt:tnt")
minetest.register_on_generated(function(minp, maxp)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
for i in area:iterp(minp, maxp) do
if data[i] ~= c_air then
@HybridDog
HybridDog / crash_mod_file.lua
Last active August 29, 2015 14:26
error in error handling
local near_player = {x=0, y=0, z=0}
local please_crash = "foo"
minetest.register_node(":default:tmp", {
on_dig = function()
please_crash()
end
})
minetest.after(3, function()
@HybridDog
HybridDog / make_links.sh
Created July 30, 2015 18:48
a minecraft > minetest texture pack linker, linking is better than copying because its faster and the script only needs to be executed once
diff --git a/skins/init.lua b/skins/init.lua
index 8ae6759..b6e59b2 100644
--- a/skins/init.lua
+++ b/skins/init.lua
@@ -27,7 +27,7 @@ dofile(skins.modpath.."/meta.lua")
dofile(skins.modpath.."/players.lua")
skins.update_player_skin = function(player)
- name = player:get_player_name()
+ local name = player:get_player_name()
minetest.register_node("workbench:3x3", {
description = "WorkBench",
tile_images = {"workbench_3x3_top.png","workbench_3x3_bottom.png","workbench_3x3_side.png"},
paramtype2 = "facedir",
groups = {choppy=2,oddly_breakable_by_hand=1},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",