aboutsummaryrefslogtreecommitdiff
path: root/src/wieldmesh.h
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2017-02-04 04:04:03 +0000
committerparamat <mat.gregory@virginmedia.com>2017-02-04 07:21:16 +0000
commit2d03cfd24c89c66e5ace4f335dae42f7c2c84f6b (patch)
treed6016829711cb111314be0431bf3ddcf75603827 /src/wieldmesh.h
parent03b34cb3dd0647b3e378f00cdc7203e580c9dcc8 (diff)
downloadminetest-2d03cfd24c89c66e5ace4f335dae42f7c2c84f6b.tar.gz
minetest-2d03cfd24c89c66e5ace4f335dae42f7c2c84f6b.tar.bz2
minetest-2d03cfd24c89c66e5ace4f335dae42f7c2c84f6b.zip
MapgenBasic node resolver: Various fixes
Add a fallback node for stair_desert_stone to avoid ignore placed in Minimal subgame desert dungeons. Don't allow river_water_source to fallback to water_source as river water needs to be non-renewable and have a short flow range. Make stair_sandstonebrick fall back to sandstonebrick instead of sandstone. Re-order some lines. Add a comment.
Diffstat (limited to 'src/wieldmesh.h')
0 files changed, 0 insertions, 0 deletions
class="hl opt">.floor(pos.y/BLOCKSIZE), z = math.floor(pos.z/BLOCKSIZE)} end function core.forceload_block(pos) local blockpos = get_blockpos(pos) local hash = core.hash_node_position(blockpos) if blocks_forceloaded[hash] ~= nil then blocks_forceloaded[hash] = blocks_forceloaded[hash] + 1 return true else if total_forceloaded >= (tonumber(core.setting_get("max_forceloaded_blocks")) or 16) then return false end total_forceloaded = total_forceloaded+1 blocks_forceloaded[hash] = 1 forceload_block(blockpos) return true end end function core.forceload_free_block(pos) local blockpos = get_blockpos(pos) local hash = core.hash_node_position(blockpos) if blocks_forceloaded[hash] == nil then return end if blocks_forceloaded[hash] > 1 then blocks_forceloaded[hash] = blocks_forceloaded[hash] - 1 else total_forceloaded = total_forceloaded-1 blocks_forceloaded[hash] = nil forceload_free_block(blockpos) end end -- Keep the forceloaded areas after restart local wpath = core.get_worldpath() local function read_file(filename) local f = io.open(filename, "r") if f==nil then return {} end local t = f:read("*all") f:close() if t=="" or t==nil then return {} end return core.deserialize(t) or {} end local function write_file(filename, table) local f = io.open(filename, "w") f:write(core.serialize(table)) f:close() end blocks_forceloaded = read_file(wpath.."/force_loaded.txt") for _, __ in pairs(blocks_forceloaded) do total_forceloaded = total_forceloaded + 1 end core.after(5, function() for hash, _ in pairs(blocks_forceloaded) do local blockpos = core.get_position_from_hash(hash) forceload_block(blockpos) end end) core.register_on_shutdown(function() write_file(wpath.."/force_loaded.txt", blocks_forceloaded) end)