1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-12 16:58:39 +00:00

Weather: Clean up getHeat/getHumidity somewhat

This commit is contained in:
kwolekr 2013-09-16 22:52:24 -04:00
parent c9eb17aba3
commit 9bccd75e34
13 changed files with 143 additions and 77 deletions

View file

@ -253,7 +253,7 @@ class LiquidFreeze : public ActiveBlockModifier {
ServerMap *map = &env->getServerMap();
INodeDefManager *ndef = env->getGameDef()->ndef();
float heat = map->getHeat(env, p);
float heat = map->updateBlockHeat(env, p);
//heater = rare
content_t c = map->getNodeNoEx(p - v3s16(0, -1, 0 )).getContent(); // top
//more chance to freeze if air at top
@ -315,7 +315,7 @@ class LiquidMeltWeather : public ActiveBlockModifier {
ServerMap *map = &env->getServerMap();
INodeDefManager *ndef = env->getGameDef()->ndef();
float heat = map->getHeat(env, p);
float heat = map->updateBlockHeat(env, p);
content_t c = map->getNodeNoEx(p - v3s16(0, -1, 0 )).getContent(); // top
if (heat >= 1 && (heat >= 40 || ((myrand_range(heat, 40)) >= (c == CONTENT_AIR ? 10 : 20)))) {
n.freezeMelt(ndef);
@ -378,7 +378,7 @@ void add_legacy_abms(ServerEnvironment *env, INodeDefManager *nodedef) {
env->addActiveBlockModifier(new LiquidDropABM(env, nodedef));
env->addActiveBlockModifier(new LiquidMeltHot(env, nodedef));
//env->addActiveBlockModifier(new LiquidMeltAround(env, nodedef));
if (g_settings->getBool("weather")) {
if (env->m_use_weather) {
env->addActiveBlockModifier(new LiquidFreeze(env, nodedef));
env->addActiveBlockModifier(new LiquidMeltWeather(env, nodedef));
}