Skip to content

Instantly share code, notes, and snippets.

View davisonio's full-sized avatar
🚀
Focusing

Craig Davison davisonio

🚀
Focusing
View GitHub Profile
@davisonio
davisonio / welcomeinfo.lua
Last active March 9, 2022 00:51
WelcomeInfo mod for Minetest, code should have been condensed at the time.
--------------------------------------------
--WelcomeInfo mod by CraigyDavi and crazyR--
--------------------------------------------
--TO DO
--Condense code and make it easier to edit the text using variables.
--Release as a mod.
--Revoke interact when frozen and grant when unfrozen.
--Anything else?
--Please note that at the moment this will not work using a mobile client! *I think*--
@davisonio
davisonio / get_player_ip.lua
Last active March 9, 2022 00:50
Get the IP of a player, Minetest command.
minetest.register_chatcommand("ip", {
params = "<name>",
description = "Show the IP of a player",
privs = {server = true},
func = function(name, param)
-- If no playername is specified you will get a help message
if param == "" then
minetest.chat_send_player(name, "Usage: /ip <playername>")
return
end
@davisonio
davisonio / timer.lua
Last active March 9, 2022 00:44
Timer mod for minetest
local player_hud = {}
local timer = 0
local function floormod (x, y)
return (math.floor(x)%y)
end
local function get_time()
local secs = (60*60*24*minetest.env:get_timeofday())
local mins = floormod(secs/60, 60)
@davisonio
davisonio / random_mapgen.lua
Last active March 9, 2022 00:50
A random mapgen for minetest
local count = 0
local c_air = minetest.get_content_id("air")
local function count_nodes()
for i,_ in pairs(minetest.registered_nodes) do
count = count+1
end
end
minetest.register_on_generated(function(minp, maxp, seed)
@davisonio
davisonio / application-access.md
Last active August 29, 2015 14:03
When was the last time you checked what applications have access to your private data?
local old_nodes = {"mod:block1", "mod:block2", "mod:block3"}
local old_entities = {"mod:item1", "mod:item2", "mod:item3"}
for _,node_name in ipairs(old_nodes) do
minetest.register_node(":"..node_name, {
groups = {old=1},
})
end
minetest.register_abm({
@davisonio
davisonio / stairsplus_example.lua
Last active August 29, 2015 14:04
Stairsplus example for minetest.
stairsplus:register_all("modname", "nodename", "modname:nodename", {
description = "Node Name",
tiles = {"modname_nodename.png"},
groups = {oddly_breakable_by_hand=1},
sounds = default.node_sound_defaults(),
})
@davisonio
davisonio / freenode-spam.txt
Last active August 29, 2015 14:04
Someone did some spam on #freenode @freenode.net
Aug 01 17:20:53 <bsd__> rip
Aug 01 17:20:58 <tt> screwsss: then maybe you should just let things lie for a while
Aug 01 17:21:01 * AKMVACI (~VAA11K@135.Red-83-61-4.staticIP.rima-tde.net) has joined
Aug 01 17:21:01 <AKMVACI> ST7QPD ~~ Something's wrong... but I don't know what... Wondering how, with all the things I've got. Life is good, but the pain don't stop, cos I'm holding on, til I give it up. ~~ LVX1A2
Aug 01 17:21:01 <AKMVACI> ATQJWM ~~ Something's wrong... but I don't know what... Wondering how, with all the things I've got. Life is good, but the pain don't stop, cos I'm holding on, til I give it up. ~~ RQ5FA8
Aug 01 17:21:01 <AKMVACI> M3D1L4 ~~ Something's wrong... but I don't know what... Wondering how, with all the things I've got. Life is good, but the pain don't stop, cos I'm holding on, til I give it up. ~~ 56HTSX
Aug 01 17:21:01 <AKMVACI> RK93GT ~~ Something's wrong... but I don't know what... Wondering how, with all the things I've got. Life is good, but the pain don't stop, cos I'm holding on
@davisonio
davisonio / minetest-error.txt
Last active August 29, 2015 14:06
Dunno, sorry weird pointer problem when I was digging glass quickly.
17:48:31: ACTION[ServerThread]: CraigyDavi digs default:glass at (84,-2,242)
In thread 2ca8:
j:\games\minetest\minetest\src\util/pointer.h:279: SharedBuffer<unsigned char>::drop: Assertion '(*refcount) > 0' failed.
Debug stacks:
17:48:31: ACTION[ServerThread]: CraigyDavi digs default:glass at (83,-1,243)
DEBUG STACK FOR THREAD 11d0:
#0 EmergeThread::Thread
(Leftover data: #1 ServerMap::loadBlock)
(Leftover data: #2 ServerMap::loadBlock)
@davisonio
davisonio / fix-chatlog-bug.lua
Last active August 29, 2015 14:06
Fixes chatlog bug on minetest server.
f:write(os.date("(%m/%d/%y %X) [")..name.."]: "..msg.."\n")