Skip to content

Instantly share code, notes, and snippets.

View sofar's full-sized avatar
🤦‍♂️
I'm drowning in the absence of time.

sofar

🤦‍♂️
I'm drowning in the absence of time.
View GitHub Profile
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp
index 01a06b6..f9daca3 100644
--- a/src/content_mapblock.cpp
+++ b/src/content_mapblock.cpp
@@ -1294,7 +1294,6 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
const f32 post_rad=(f32)BS/8;
const f32 bar_rad=(f32)BS/16;
- const f32 bar_len=(f32)(BS/2)-post_rad;
minetest.register_on_newplayer(function(player)
player:setpos({x=-126, y=1, z=-96})
return true
end)
try {
TownyWorld tw = TownyUniverse.getWorld(world.getName());
TownBlock tb = tw.getTownBlock(new Coord(xx, zz));
if (tb.hasTown())
return true;
} catch (NotRegisteredException e) {
e.printStackTrace();
}
@sofar
sofar / init.lua
Created December 30, 2015 16:06
prototype connecting nodeboxes demo
--[[
Wall mod for Minetest
Copyright (C) 2015 Auke Kok <sofar@foo-projects.org>
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
List<String> StringList = getConfig().getStringList("list");
StringList.add("stringvalue");
getConfig().set("list", StringList);
saveConfig();
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index fb83917..9068257 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -476,6 +476,30 @@ int ModApiMapgen::l_get_biome_id(lua_State *L)
}
+// get_biome_at(pos)
+// returns the biome id at pos for mgv7
@sofar
sofar / init.lua.diff
Created January 7, 2016 01:02
Aspen tree schematics
diff --git a/init.lua b/init.lua
index 4696eb5..d6d4f05 100644
--- a/init.lua
+++ b/init.lua
@@ -1,6 +1,160 @@
-- Schematic file format version 4
+local A = {name="air", prob=0}
+local T = {name="default:aspen_tree", prob=255, force_place = true}
+local B = {name="default:aspen_tree", prob=255}
+ lua_getfield(L, index, "connects_to");
+ if(lua_istable(L, -1)
+ int table = lua_gettop(L);
+ lua_pushnil(L);
+ int i = 0;
+ while(lua_next(L, table) != 0){
+ f.tiledef[i] = lua_tostring(L, index);
+ lua_pop(L, 1);
+ i++;
+ }
diff --git a/src/nodedef.h b/src/nodedef.h
index 9e14c73..7322e18 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -277,6 +277,9 @@ struct ContentFeatures
SimpleSoundSpec sound_dig;
SimpleSoundSpec sound_dug;
+ std::vector<std::string> connects_to;
+ std::set<content_t> connects_to_ids;
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index fb90320..70db165 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -389,6 +389,8 @@ void ContentFeatures::reset()
sound_footstep = SimpleSoundSpec();
sound_dig = SimpleSoundSpec("__group");
sound_dug = SimpleSoundSpec();
+ connects_to.clear();
+ connects_to_ids.clear();