Skip to content

Instantly share code, notes, and snippets.

View sapier's full-sized avatar

sapier

View GitHub Profile
--------------------------------------------------------------------------------
-- @function [parent=#adv_spawning] check_light_around_voxel
-- @param pos position to validate
-- @param light_around light around definitions
-- @return true/false
--------------------------------------------------------------------------------
function adv_spawning.check_light_around_voxel(pos,light_around)
if light_around == nil then
return true
end
@sapier
sapier / gist:7863517
Last active March 9, 2022 00:44
Minetest get light from VoxelManip data
local light_lookup = {
{4250+125, 150},
{4500+125, 150},
{4750+125, 250},
{5000+125, 350},
{5250+125, 500},
{5500+125, 675},
{5750+125, 875},
{6000+125, 1000},
{6250+125, 1000}
@sapier
sapier / test_unsafe_functions.lua
Created January 22, 2017 10:26
Testcode for unsafe functions
local os_functiontable = {
-- fct, allowed, p1, p2, p3
{ "clock", true, nil, nil, nil },
{ "date", true, nil, nil, nil },
{ "difftime", true, 10000, 9000, nil },
{ "execute", false, "/bin/true", nil, nil },
{ "getenv", false, "SHELL", nil, nil },
{ "rename", false, "/tmp/somefile", "/tmp/someotherfile", nil },
{ "remove", false, "/tmp/someotherfile", nil, nil },
2017-01-21 18:32:07: ACTION[Main]: Testing for os.clock...
2017-01-21 18:32:07: ACTION[Main]: function present
2017-01-21 18:32:07: ERROR[Main]: function works
2017-01-21 18:32:07: ERROR[Main]: function returned: 1.211562
2017-01-21 18:32:07: ACTION[Main]: Testing for os.date...
2017-01-21 18:32:07: ACTION[Main]: function present
2017-01-21 18:32:07: ERROR[Main]: function works
2017-01-21 18:32:07: ERROR[Main]: function returned: "Sa 21 Jan 2017 18:32:07 CET"
2017-01-21 18:32:07: ACTION[Main]: Testing for os.difftime...
2017-01-21 18:32:07: ACTION[Main]: function present
/home/sapier/minetest.folder/minetest.update/src/content_sao.cpp: In member function ‘virtual void UnitSAO::detachFromParent()’:
/home/sapier/minetest.folder/minetest.update/src/content_sao.cpp:211:52: warning: passing NULL to non-pointer argument 1 of ‘virtual void UnitSAO::setAttachment(int, const string&, v3f, v3f)’ [-Wconversion-null]
setAttachment(NULL, "", v3f(0, 0, 0), v3f(0, 0, 0));
MYMIN(256, dst_c.getRed() - (255 - color.getRed())),
MYMIN(256, dst_c.getGreen() - (255 - color.getGreen())),
MYMIN(256, dst_c.getBlue() - (255 - color.getBlue()))
make
[ 0%] Built target genrev
[ 0%] Built target revision.h
[ 1%] Performing build step for 'TBB_Project'
In file included from ../../src/tbb/concurrent_queue.cpp:29:0:
/usr/include/c++/4.9/cstring:41:28: fatal error: bits/c++config.h: Datei oder Verzeichnis nicht gefunden
#include <bits/c++config.h>
^
compilation terminated.
In file included from /usr/include/c++/4.9/stdexcept:38:0,
diff --git a/src/log.cpp b/src/log.cpp
index 97f25cc..630c142 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -57,13 +57,15 @@ void log_remove_output(ILogOutput *out)
log_outputs[i].erase(it);
}
}
-
+#include <sys/prctl.h>
diff --git a/src/client.cpp b/src/client.cpp
index 1c7ecf3..e50804f 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1016,6 +1016,14 @@ void Client::Receive()
}
//TimeTaker t1("ProcessData", m_device);
ProcessData(*data, datasize, sender_peer_id);
+
+ if(m_server_ser_ver != SER_FMT_VER_INVALID) {
-- minetest.lua
-- Packet dissector for the UDP-based Minetest protocol
-- Copy this to $HOME/.wireshark/plugins/
--
-- Minetest
-- Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
--
-- This program is free software; you can redistribute it and/or modify