Skip to content

Instantly share code, notes, and snippets.

View sapier's full-sized avatar

sapier

View GitHub Profile
17:31:02: ERROR[main]: ServerError: .../../games/dreambuilder_game/mods/pipeworks/luaentity.lua:313: bad argument #1 to 'pairs' (table expected, got nil)
17:31:02: ERROR[main]: stack traceback:
17:31:02: ERROR[main]: [C]: in function 'pairs'
17:31:02: ERROR[main]: .../../games/dreambuilder_game/mods/pipeworks/luaentity.lua:313: in function <.../../games/dreambuilder_game/mods/pipeworks/luaentity.lua:312>
17:31:02: ERROR[main]: ...ersions/minetest-0.4.10/bin/../builtin/game/register.lua:348: in function <...ersions/minetest-0.4.10/bin/../builtin/game/register.lua:336>
Unified Inventory. inventory size: 1580
17:31:07: ERROR[main]: Some exception: ".../../games/dreambuilder_game/mods/pipeworks/luaentity.lua:32: bad argument #1 to 'pairs' (table expected, got nil)
17:31:07: ERROR[main]: stack traceback:
17:31:07: ERROR[main]: [C]: in function 'pairs'
17:31:07: ERROR[main]: .../../games/dreambuilder_game/mods/pipeworks/luaentity.lua:32: in function <.../../games/dreambuilder_game/mods/pipeworks/luaentity.lua:
@sapier
sapier / gist:f3d6e635c4c8c7d298ce
Created August 18, 2014 09:29
Unified inventory positioning fix
diff --git a/mods/unified_inventory/internal.lua b/mods/unified_inventory/internal.lua
index 281653e..31fd35f 100644
--- a/mods/unified_inventory/internal.lua
+++ b/mods/unified_inventory/internal.lua
@@ -28,11 +28,11 @@ function unified_inventory.get_formspec(player, page)
unified_inventory.current_page[player_name] = page
local pagedef = unified_inventory.pages[page]
- local formspec = "size[14,10]"
+ local formspec = "size[13.5,9.5]"
@sapier
sapier / gist:3b6b8327d1fefadd72cc
Last active August 29, 2015 14:05
Suggestion for a reliable yet portable modstore
Add a modlist to minetest e.g.
https://github.com/minetest/modlist/modlist
Content is supposed to be json (... yes ... I know ... I hate it myself too ;-) ):
a simple example:
<<< FILE BEGIN >>>
{
@sapier
sapier / gist:4629aa2acfa1b943df97
Created August 14, 2014 21:00
example trace from mobf
22:42:46: ACTION[ServerThread]: modname | typ | min µs | max µs | avg µs | min % | max % | avg %
22:42:46: ACTION[ServerThread]: -----------------+---------------------------+-----------+-----------+-----------+-----------+-----------+-----------
22:42:46: ACTION[ServerThread]: flowers | | 0 | 7823 | 0 | 0 | 54 | 0
22:42:46: ACTION[ServerThread]: | on_generated | 0 | 7823 | 0 | 0 | 54 | 0
22:42:46: ACTION[ServerThread]: | abm | 0 | 4036 | 0 | 0 | 2 | 0
22:42:46: ACTION[ServerThread]: mob_bear | | 0 | 13057 | 0 | 0 | 76 | 0
22:42:46: ACTION[ServerThread]: | :mob_bear:bear#oa | 0 | 12978 | 0 | 0 |
@sapier
sapier / gist:86ad62c58531b865a4a8
Created August 12, 2014 20:46
dreambuilder 20140812 luajit phenom II X6
modname | typ | min µs | max µs | avg µs | min % | max % | avg %
-----------------+---------------------------+-----------+-----------+-----------+-----------+-----------+-----------
woodsoils | | 0 | 1396470 | 21643 | 0 | 7 | 0
| on_generated | 0 | 1396470 | 21643 | 0 | 7 | 0
titanium | | 0 | 125 | 0 | 0 | 0 | 0
| on_generated | 0 | 125 | 0 | 0 | 0 | 0
mesecons | | 1 | 260 | 11 | 0 | 77 | 3
| globalstep | 1 | 260 | 11 | 0 | 77 | 3
flowers_plus | | 0 | 5533613 | 69534 |
modname | typ | min µs | max µs | avg µs | min % | max % | avg %
-----------------+---------------------------+-----------+-----------+-----------+-----------+-----------+-----------
item_tweaks | | 36 | 2836 | 49 | 0 | 96 | 13
| globalstep | 36 | 2836 | 49 | 0 | 96 | 13
titanium | | 0 | 8 | 0 | 0 | 0 | 0
| on_generated | 0 | 8 | 0 | 0 | 0 | 0
ferns | | 0 | 4873026 | 51109 | 0 | 29 | 0
| on_generated | 0 | 4873026 | 51108 | 0 | 29 | 0
| abm | 0 | 1469860 | 14699 |
modname | typ | min µs | max µs | avg µs | min % | max % | avg %
-----------------+---------------------------+-----------+-----------+-----------+-----------+-----------+-----------
mob_bear | | 0 | 12409 | 0 | 0 | 44 | 0
animal_chicken | | 0 | 24862 | 431 | 0 | 92 | 7
flowers | | 0 | 11772 | 0 | 0 | 19 | 0
animal_sheep | | 0 | 11640 | 7 | 0 | 40 | 0
animal_cow | | 0 | 11561 | 1 | 0 | 77 | 0
adv_spawning | | 0 | 398399 | 7957 | 0 | 99 | 88
animal_deer | | 0 | 10167 | 3 |
modname | typ | min µs | max µs | avg µs | min % | max % | avg %
-----------+------------------+-----------+-----------+-----------+-----------+-----------+-----------
xpanes | | 0 | 10 | 0 | 0 | 1 | 0
| on_dignode | 0 | 10 | 0 | 0 | 1 | 0
total | | 0 | 808360 | 1947 | 100 | 100 | 100
default | | 2 | 26365 | 129 | 0 | 99 | 59
| on_punchnode | 0 | 17929 | 0 | 0 | 12 | 0
| on_dignode | 0 | 17929 | 0 | 0 | 0 | 0
| globalstep | 2 | 17963 | 15 | 0 | 98 | 57
| on_generated | 0 | 469 | 15 | 0 | 93 | 0
video::SColor &vc = p.vertices[j].Color;
if(p.vertices[j].Normal.Y > 0.5) {
- applyContrast (vc, 1.2);
+ applyContrast (vc, 1.095445);
} else if (p.vertices[j].Normal.Y < -0.5) {
- applyContrast (vc, 0.3);
+ applyContrast (vc, 0.547723);
} else if (p.vertices[j].Normal.X > 0.5) {
- applyContrast (vc, 0.5);
+ applyContrast (vc, 0.707107);
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp
index 581fb8f..0800259 100644
--- a/src/mapblock_mesh.cpp
+++ b/src/mapblock_mesh.cpp
@@ -32,7 +32,7 @@
#include "settings.h"
#include "util/directiontables.h"
-void applyContrast(video::SColor& color, float factor)
+static void applyContrast(video::SColor& color, float factor)