aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen
Commit message (Expand)AuthorAge
* Mainmenu game-related changes (#11887)sfan52022-01-09
* Remove a few unused functions reported by callcatcher (#11658)SmallJoker2021-10-12
* Switch MapBlock compression to zstd (#10788)lhofhansl2021-08-31
* Fix access violation in create_schematic() (#11534)Treer2021-08-16
* Fix broken `BiomeGen` abstraction (#11107)sfan52021-03-23
* Schematic: Properly deal with before/after node resolving and document (#11011)SmallJoker2021-03-20
* Fix function override warnings in mg_ore.hsfan52021-03-06
* Remove dead code (#10845)rubenwardy2021-01-22
* MgOre: Fix invalid field polymorphism (#10846)rubenwardy2021-01-21
* Removed some obsolete code (#10562)Zughy2021-01-21
* Fix some minor code issues all over the placesfan52020-12-24
* Allow configuring block disk and net compression. Change default disk level.Lars2020-12-15
* Avoid generating the same chunk more than once with multiple emerge threads.Lars2020-11-26
* Move Mapgen V7 river generation into the main generation loop (#10639)Paramat2020-11-20
* Fix warnings about an unused variables and implicit conversion (#10586)red-0012020-11-12
* Remove unused functions reported by cppcheck (#10463)SmallJoker2020-10-05
* (se)SerializeString: Include max length in the nameSmallJoker2020-10-01
* Add 'ores' global mapgen flag (#10276)Paramat2020-09-03
* Mapgen Flat: Add caverns, disabled by default (#9913)Paramat2020-08-05
* L-System trees: Remove hardcoded use of 'mapgen_dirt' alias (#9931)Paramat2020-05-25
* Allow more than 255 biomes, document new maximum (#9855)Paramat2020-05-20
* Add new Mapgen V7 floatland implementation (#9296)Paramat2020-05-14
* Fix thread safety of PcgRandom use in BiomeGensfan52020-05-05
* Fix remaining issues with mapgen scriptapisfan52020-05-05
* Give the Mapgen on each EmergeThread its own Biome/Ore/Deco/SchemManager copysfan52020-05-05
* Allow ObjDefManager instances to be clonedsfan52020-05-05
* Reduce ServerEnvironment propagation (#9642)Loïc Blot2020-04-11
* Drop content_sao.{cpp,h}Loic Blot2020-04-11
* Move serveractiveobject & unitsaoLoic Blot2020-04-11
* Print error if invalid mapgen alias was detected (#9579)Wuzzy2020-04-10
* Fix 'the the' typos in comments (#9554)LNJ2020-04-04
* Remove unnecessary checks before delete (#9500)Nicolas Abril2020-03-10
* Settings: Add get_flags API for mapgen flags (mg_flags, mgv6_spflags, ...) (#...SmallJoker2020-01-25
* Remove Mapgen V7 floatlands in preparation for new implementation (#9238)Paramat2020-01-04
* Caves: Fix shadowing of 'large_cave_depth' to avoid confusionparamat2019-11-23
* Dungeons: Move duplicated y limit checks to generation functionparamat2019-11-23
* Move duplicated mapgen parameters to class MapgenBasic (#9134)Paramat2019-11-19
* Randomwalk cave liquids: Remove deprecated 'lava depth' parameter (#9105)Paramat2019-11-18
* Randomwalk caves: Extend beyond mapchunk vertically also (#9094)Paramat2019-11-10
* Tunnels: Completely disable generation when 'cave width' >= 10.0 (#9093)Paramat2019-11-09
* Randomwalk caves: Add parameters for number, proportion flooded. Allow small ...Paramat2019-11-08
* Change some usages of "deprecated" to "obsolete" (#9062)random-geek2019-10-29
* Randomwalk caves: Reduce 'insure' value from 10 to 2 (#9035)Paramat2019-10-13
* Fix some reference counters (memleak) (#8981)SmallJoker2019-09-24
* Dungeons: Clean up parameters, improve structure variety (#8918)Paramat2019-09-14
* Dungeons: Remove non-functional 'projecting dungeons' setting (#8897)Paramat2019-09-08
* Mapgen v6: Various mudflow code improvements and bugfixes (#8805)Paramat2019-08-24
* Make Mapgen::spreadLight use a queue (#8838)DS2019-08-23
* Mapgen v6: Fix mudflow iteration and iterate twice (#8795)Paramat2019-08-15
* Better F6 profiler (#8750)SmallJoker2019-08-13
span> if n2.name ~= "air" and (not minetest.registered_nodes[n2.name] or minetest.registered_nodes[n2.name].liquidtype == "none") then local drops = minetest.get_node_drops(n2.name, "") minetest.env:remove_node(np) -- Add dropped items local _, dropped_item for _, dropped_item in ipairs(drops) do minetest.env:add_item(np, dropped_item) end -- Run script hook local _, callback for _, callback in ipairs(minetest.registered_on_dignodes) do callback(np, n2, nil) end end -- Create node and remove entity minetest.env:add_node(np, {name=self.nodename}) self.object:remove() nodeupdate(np) else -- Do nothing end end }) function spawn_falling_node(p, nodename) obj = minetest.env:add_entity(p, "__builtin:falling_node") obj:get_luaentity():set_node(nodename) end function drop_attached_node(p) local nn = minetest.env:get_node(p).name minetest.env:remove_node(p) for _,item in ipairs(minetest.get_node_drops(nn, "")) do local pos = { x = p.x + math.random()/2 - 0.25, y = p.y + math.random()/2 - 0.25, z = p.z + math.random()/2 - 0.25, } minetest.env:add_item(pos, item) end end function check_attached_node(p, n) local def = minetest.registered_nodes[n.name] local d = {x=0, y=0, z=0} if def.paramtype2 == "wallmounted" then if n.param2 == 0 then d.y = 1 elseif n.param2 == 1 then d.y = -1 elseif n.param2 == 2 then d.x = 1 elseif n.param2 == 3 then d.x = -1 elseif n.param2 == 4 then d.z = 1 elseif n.param2 == 5 then d.z = -1 end else d.y = -1 end local p2 = {x=p.x+d.x, y=p.y+d.y, z=p.z+d.z} local nn = minetest.env:get_node(p2).name local def2 = minetest.registered_nodes[nn] if def2 and not def2.walkable then return false end return true end -- -- Some common functions -- function nodeupdate_single(p) n = minetest.env:get_node(p) if minetest.get_node_group(n.name, "falling_node") ~= 0 then p_bottom = {x=p.x, y=p.y-1, z=p.z} 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 or minetest.registered_nodes[n_bottom.name].buildable_to) then minetest.env:remove_node(p) spawn_falling_node(p, n.name) nodeupdate(p) end end if minetest.get_node_group(n.name, "attached_node") ~= 0 then if not check_attached_node(p, n) then drop_attached_node(p) nodeupdate(p) end end end function nodeupdate(p) -- Round p to prevent falling entities to get stuck p.x = math.floor(p.x+0.5) p.y = math.floor(p.y+0.5) p.z = math.floor(p.z+0.5) for x = -1,1 do for y = -1,1 do for z = -1,1 do p2 = {x=p.x+x, y=p.y+y, z=p.z+z} nodeupdate_single(p2) end end end end -- -- Global callbacks -- function on_placenode(p, node) nodeupdate(p) end minetest.register_on_placenode(on_placenode) function on_dignode(p, node) nodeupdate(p) end minetest.register_on_dignode(on_dignode)