commit
998ee7a4c9
|
@ -45,6 +45,8 @@ src/cguittfont/cmake_install.cmake
|
|||
src/cguittfont/Makefile
|
||||
src/json/CMakeFiles/
|
||||
src/json/libjsoncpp.a
|
||||
src/sqlite/CMakeFiles/*
|
||||
src/sqlite/libsqlite3.a
|
||||
CMakeCache.txt
|
||||
CPackConfig.cmake
|
||||
CPackSourceConfig.cmake
|
||||
|
|
|
@ -57,6 +57,10 @@ minetest.register_entity("__builtin:falling_node", {
|
|||
-- Note: walkable is in the node definition, not in item groups
|
||||
if minetest.registered_nodes[bcn.name] and
|
||||
minetest.registered_nodes[bcn.name].walkable then
|
||||
if minetest.registered_nodes[bcn.name].buildable_to then
|
||||
minetest.env:remove_node(bcp)
|
||||
return
|
||||
end
|
||||
local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
|
||||
-- Check what's here
|
||||
local n2 = minetest.env:get_node(np)
|
||||
|
@ -80,6 +84,7 @@ minetest.register_entity("__builtin:falling_node", {
|
|||
-- Create node and remove entity
|
||||
minetest.env:add_node(np, {name=self.nodename})
|
||||
self.object:remove()
|
||||
nodeupdate(np)
|
||||
else
|
||||
-- Do nothing
|
||||
end
|
||||
|
@ -144,7 +149,8 @@ function nodeupdate_single(p)
|
|||
n_bottom = minetest.env:get_node(p_bottom)
|
||||
-- Note: walkable is in the node definition, not in item groups
|
||||
if minetest.registered_nodes[n_bottom.name] and
|
||||
not minetest.registered_nodes[n_bottom.name].walkable then
|
||||
(not minetest.registered_nodes[n_bottom.name].walkable or
|
||||
minetest.registered_nodes[n_bottom.name].buildable_to) then
|
||||
minetest.env:remove_node(p)
|
||||
spawn_falling_node(p, n.name)
|
||||
nodeupdate(p)
|
||||
|
|
|
@ -14,14 +14,14 @@ minetest.register_globalstep(function(dtime)
|
|||
for index, timer in ipairs(minetest.timers) do
|
||||
timer.time = timer.time - dtime
|
||||
if timer.time <= 0 then
|
||||
timer.func(unpack(timer.args))
|
||||
timer.func(unpack(timer.args or {}))
|
||||
table.remove(minetest.timers,index)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function minetest.after(time, func, ...)
|
||||
table.insert(minetest.timers_to_add, {time=time, func=func, args=arg})
|
||||
table.insert(minetest.timers_to_add, {time=time, func=func, args={...}})
|
||||
end
|
||||
|
||||
function minetest.check_player_privs(name, privs)
|
||||
|
|
10
src/map.cpp
10
src/map.cpp
|
@ -2497,19 +2497,15 @@ bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
|
|||
bool enable_mapgen_debug_info = m_emerge->mapgen_debug_info;
|
||||
EMERGE_DBG_OUT("initBlockMake(): " PP(blockpos) " - " PP(blockpos));
|
||||
|
||||
//s16 chunksize = 3;
|
||||
//v3s16 chunk_offset(-1,-1,-1);
|
||||
//s16 chunksize = 4;
|
||||
//v3s16 chunk_offset(-1,-1,-1);
|
||||
s16 chunksize = 5;
|
||||
v3s16 chunk_offset(-2,-2,-2);
|
||||
s16 chunksize = m_mgparams->chunksize;
|
||||
s16 coffset = -chunksize / 2;
|
||||
v3s16 chunk_offset(coffset, coffset, coffset);
|
||||
v3s16 blockpos_div = getContainerPos(blockpos - chunk_offset, chunksize);
|
||||
v3s16 blockpos_min = blockpos_div * chunksize;
|
||||
v3s16 blockpos_max = blockpos_div * chunksize + v3s16(1,1,1)*(chunksize-1);
|
||||
blockpos_min += chunk_offset;
|
||||
blockpos_max += chunk_offset;
|
||||
|
||||
//v3s16 extra_borders(1,1,1);
|
||||
v3s16 extra_borders(1,1,1);
|
||||
|
||||
// Do nothing if not inside limits (+-1 because of neighbors)
|
||||
|
|
|
@ -111,7 +111,7 @@ void Mapgen::lightSpread(VoxelArea &a, v3s16 p, u8 light) {
|
|||
}
|
||||
|
||||
|
||||
void Mapgen::updateLighting(v3s16 nmin, v3s16 nmax) {
|
||||
void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) {
|
||||
VoxelArea a(nmin - v3s16(1,0,1) * MAP_BLOCKSIZE,
|
||||
nmax + v3s16(1,0,1) * MAP_BLOCKSIZE);
|
||||
bool block_is_underground = (water_level >= nmax.Y);
|
||||
|
@ -174,7 +174,7 @@ void Mapgen::updateLighting(v3s16 nmin, v3s16 nmax) {
|
|||
}
|
||||
|
||||
|
||||
void Mapgen::updateLightingOld(v3s16 nmin, v3s16 nmax) {
|
||||
void Mapgen::calcLightingOld(v3s16 nmin, v3s16 nmax) {
|
||||
enum LightBank banks[2] = {LIGHTBANK_DAY, LIGHTBANK_NIGHT};
|
||||
|
||||
VoxelArea a(nmin - v3s16(1,0,1) * MAP_BLOCKSIZE,
|
||||
|
|
|
@ -79,8 +79,8 @@ public:
|
|||
void updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nmax);
|
||||
void setLighting(v3s16 nmin, v3s16 nmax, u8 light);
|
||||
void lightSpread(VoxelArea &a, v3s16 p, u8 light);
|
||||
void updateLighting(v3s16 nmin, v3s16 nmax);
|
||||
void updateLightingOld(v3s16 nmin, v3s16 nmax);
|
||||
void calcLighting(v3s16 nmin, v3s16 nmax);
|
||||
void calcLightingOld(v3s16 nmin, v3s16 nmax);
|
||||
|
||||
virtual void makeChunk(BlockMakeData *data) {};
|
||||
virtual int getGroundLevelAtPoint(v2s16 p) = 0;
|
||||
|
|
|
@ -457,12 +457,12 @@ void MapgenV6::makeChunk(BlockMakeData *data) {
|
|||
// Grow grass
|
||||
growGrass();
|
||||
|
||||
// Generate some trees
|
||||
// Generate some trees, and add grass, if a jungle
|
||||
if (flags & MG_TREES)
|
||||
placeTrees();
|
||||
placeTreesAndJungleGrass();
|
||||
|
||||
// Calculate lighting
|
||||
updateLighting(node_min, node_max);
|
||||
calcLighting(node_min, node_max);
|
||||
|
||||
this->generating = false;
|
||||
}
|
||||
|
@ -783,14 +783,26 @@ void MapgenV6::addDirtGravelBlobs() {
|
|||
}
|
||||
|
||||
|
||||
void MapgenV6::placeTrees() {
|
||||
void MapgenV6::placeTreesAndJungleGrass() {
|
||||
//TimeTaker t("placeTrees");
|
||||
if (node_max.Y < water_level)
|
||||
return;
|
||||
|
||||
PseudoRandom grassrandom(blockseed + 53);
|
||||
content_t c_junglegrass = ndef->getId("mapgen_junglegrass");
|
||||
// if we don't have junglegrass, don't place cignore... that's bad
|
||||
if (c_junglegrass == CONTENT_IGNORE)
|
||||
c_junglegrass = CONTENT_AIR;
|
||||
MapNode n_junglegrass(c_junglegrass);
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
|
||||
// Divide area into parts
|
||||
s16 div = 8;
|
||||
s16 sidelen = central_area_size.X / div;
|
||||
double area = sidelen * sidelen;
|
||||
|
||||
// N.B. We must add jungle grass first, since tree leaves will
|
||||
// obstruct the ground, giving us a false ground level
|
||||
for (s16 z0 = 0; z0 < div; z0++)
|
||||
for (s16 x0 = 0; x0 < div; x0++) {
|
||||
// Center position of part of division
|
||||
|
@ -811,9 +823,36 @@ void MapgenV6::placeTrees() {
|
|||
|
||||
// Amount of trees, jungle area
|
||||
u32 tree_count = area * getTreeAmount(p2d_center);
|
||||
bool is_jungle = (flags & MGV6_JUNGLES) && (getHumidity(p2d_center) > 0.75);
|
||||
if (is_jungle)
|
||||
tree_count *= 4;
|
||||
|
||||
float humidity;
|
||||
bool is_jungle = false;
|
||||
if (flags & MGV6_JUNGLES) {
|
||||
humidity = getHumidity(p2d_center);
|
||||
if (humidity > 0.75) {
|
||||
is_jungle = true;
|
||||
tree_count *= 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Add jungle grass
|
||||
if (is_jungle) {
|
||||
u32 grass_count = 5 * humidity * tree_count;
|
||||
for (u32 i = 0; i < grass_count; i++) {
|
||||
s16 x = grassrandom.range(p2d_min.X, p2d_max.X);
|
||||
s16 z = grassrandom.range(p2d_min.Y, p2d_max.Y);
|
||||
|
||||
s16 y = find_ground_level(v2s16(x, z)); ////////////////optimize this!
|
||||
if (y < water_level || y < node_min.Y || y > node_max.Y)
|
||||
continue;
|
||||
|
||||
u32 vi = vm->m_area.index(x, y, z);
|
||||
// place on dirt_with_grass, since we know it is exposed to sunlight
|
||||
if (vm->m_data[vi].getContent() == c_dirt_with_grass) {
|
||||
vm->m_area.add_y(em, vi, 1);
|
||||
vm->m_data[vi] = n_junglegrass;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Put trees in random places on part of division
|
||||
for (u32 i = 0; i < tree_count; i++) {
|
||||
|
@ -846,7 +885,7 @@ void MapgenV6::placeTrees() {
|
|||
}
|
||||
}
|
||||
}
|
||||
//printf("placeTrees: %dms\n", t.stop());
|
||||
//printf("placeTreesAndJungleGrass: %dms\n", t.stop());
|
||||
}
|
||||
|
||||
|
||||
|
@ -878,6 +917,7 @@ void MapgenV6::growGrass() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6::defineCave(Cave &cave, PseudoRandom ps,
|
||||
v3s16 node_min, bool large_cave) {
|
||||
cave.min_tunnel_diameter = 2;
|
||||
|
|
|
@ -163,7 +163,7 @@ public:
|
|||
void flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos);
|
||||
void addDirtGravelBlobs();
|
||||
void growGrass();
|
||||
void placeTrees();
|
||||
void placeTreesAndJungleGrass();
|
||||
virtual void defineCave(Cave &cave, PseudoRandom ps,
|
||||
v3s16 node_min, bool large_cave);
|
||||
void generateCaves(int max_stone_y);
|
||||
|
|
Loading…
Reference in New Issue