mirror of
https://github.com/minetest/minetest.git
synced 2024-12-24 15:12:23 +01:00
Liquid adjusting: continue to drop
This commit is contained in:
parent
efc75db764
commit
6b2c46c431
@ -191,17 +191,58 @@ public:
|
||||
virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n)
|
||||
{
|
||||
ServerMap *map = &env->getServerMap();
|
||||
if (map->transforming_liquid_size() < 500)
|
||||
if (map->transforming_liquid_size() > 500)
|
||||
return;
|
||||
map->transforming_liquid_add(p);
|
||||
//if ((*map).m_transforming_liquid.size() < 500) (*map).m_transforming_liquid.push_back(p);
|
||||
}
|
||||
};
|
||||
|
||||
class LiquidDropABM : public ActiveBlockModifier
|
||||
{
|
||||
private:
|
||||
std::set<std::string> contents;
|
||||
|
||||
public:
|
||||
LiquidDropABM(ServerEnvironment *env, INodeDefManager *nodemgr)
|
||||
{
|
||||
std::set<content_t> liquids;
|
||||
nodemgr->getIds("group:liquid", liquids);
|
||||
for(std::set<content_t>::const_iterator k = liquids.begin(); k != liquids.end(); k++)
|
||||
contents.insert(nodemgr->get(*k).liquid_alternative_source);
|
||||
}
|
||||
virtual std::set<std::string> getTriggerContents()
|
||||
{ return contents; }
|
||||
virtual std::set<std::string> getRequiredNeighbors()
|
||||
{
|
||||
std::set<std::string> neighbors;
|
||||
neighbors.insert("mapgen_air");
|
||||
return neighbors;
|
||||
}
|
||||
virtual float getTriggerInterval()
|
||||
{ return 20.0; }
|
||||
virtual u32 getTriggerChance()
|
||||
{ return 10; }
|
||||
virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n)
|
||||
{
|
||||
ServerMap *map = &env->getServerMap();
|
||||
if (map->transforming_liquid_size() > 500)
|
||||
return;
|
||||
//todo: look around except top
|
||||
MapNode n_below = map->getNodeNoEx(p - v3s16(0, 1, 0));
|
||||
if (n_below.getContent() != CONTENT_AIR)
|
||||
return;
|
||||
map->transforming_liquid_add(p);
|
||||
}
|
||||
};
|
||||
|
||||
void add_legacy_abms(ServerEnvironment *env, INodeDefManager *nodedef)
|
||||
{
|
||||
env->addActiveBlockModifier(new GrowGrassABM());
|
||||
env->addActiveBlockModifier(new RemoveGrassABM());
|
||||
env->addActiveBlockModifier(new MakeTreesFromSaplingsABM(env, nodedef));
|
||||
if (g_settings->getBool("liquid_finite"))
|
||||
if (g_settings->getBool("liquid_finite")) {
|
||||
env->addActiveBlockModifier(new LiquidFlowABM(env, nodedef));
|
||||
env->addActiveBlockModifier(new LiquidDropABM(env, nodedef));
|
||||
}
|
||||
}
|
||||
|
@ -1755,7 +1755,7 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
|
||||
}
|
||||
|
||||
//relax up
|
||||
if (relax && p0.Y <= water_level && liquid_levels[D_TOP] == 0 &&
|
||||
if (relax && ((p0.Y == water_level) || (fast_flood && p0.Y <= water_level)) && liquid_levels[D_TOP] == 0 &&
|
||||
liquid_levels[D_BOTTOM] == LIQUID_LEVEL_SOURCE &&
|
||||
total_level >= LIQUID_LEVEL_SOURCE * can_liquid_same_level-
|
||||
(can_liquid_same_level - relax) &&
|
||||
|
Loading…
Reference in New Issue
Block a user