Imported from trollstream "ContentDB"
commit
41122e6405
|
@ -0,0 +1,40 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
The semantic of version number is 'Major.minor'. Minor updates are retro-compatible, while major updates may break things.
|
||||
|
||||
[0.4] - 2022-02-20
|
||||
------------------
|
||||
|
||||
### Fixed
|
||||
- Tree leaves slopes not decaying.
|
||||
- Warning about mod.conf name entry.
|
||||
|
||||
|
||||
[0.3] - 2021-08-08
|
||||
------------------
|
||||
|
||||
### Added
|
||||
- Secondary use of digging tools to trigger shape updates.
|
||||
- Obsidian slopes
|
||||
|
||||
### Changed
|
||||
- Slopes are not listed in the creative inventory anymore.
|
||||
|
||||
### Fixed
|
||||
- Texture alignment for rotated slopes.
|
||||
- Warnings about transparent textures.
|
||||
|
||||
|
||||
[0.2] - 2021-02-07
|
||||
------------------
|
||||
|
||||
### Added
|
||||
- Cobble and ice slopes
|
||||
- Update factors for mapgen, place, time, stomp
|
||||
|
||||
|
||||
[0.1] - 2020-12-30
|
||||
------------------
|
||||
|
||||
Initial release.
|
|
@ -0,0 +1,31 @@
|
|||
Natural slopes for Minetest Game
|
||||
================================
|
||||
|
||||
* Version 0.4
|
||||
|
||||
Smoothen the edges by adding natural slopes at generation time and when the landscape changes for Minetest Game. Most of the default ground nodes can have their "stair" shape which is set automatically when they are put on edges.
|
||||
|
||||
Those slopes are not craftable, they just happen by themselves at generation time and when the landscape changes. You can also use your digging tools to soften the edges with their secondary use. This will wear the tool a little on success, and works better with higher-grade tools.
|
||||
|
||||
This mod is an usage of naturalslopeslib for Minetest Game. Please check the library page for the forum topic and details about its settings and optional dependencies.
|
||||
|
||||
## Dependencies
|
||||
|
||||
* Made with Minetest Game 5.4.1
|
||||
* Requires naturalslopeslib 1.3 or above
|
||||
|
||||
## Source code
|
||||
|
||||
* Licenced under LGPLv2 or, at your discretion, any later version.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
https://www.gnu.org/licenses/licenses.html#LGPL
|
|
@ -0,0 +1,50 @@
|
|||
--
|
||||
-- Convert default:dirt to something that fits the environment
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Grass spread",
|
||||
nodenames = {"group:family:default:dirt"},
|
||||
neighbors = {
|
||||
"air",
|
||||
"group:grass",
|
||||
"group:dry_grass",
|
||||
"default:snow",
|
||||
},
|
||||
interval = 6,
|
||||
chance = 50,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
-- Check for darkness: night, shadow or under a light-blocking node
|
||||
-- Returns if ignore above
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
if (minetest.get_node_light(above) or 0) < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- Look for spreading dirt-type neighbours
|
||||
local p2 = minetest.find_node_near(pos, 1, "group:spreading_dirt_type")
|
||||
if p2 then
|
||||
local n3 = minetest.get_node(p2)
|
||||
local shape = minetest.get_item_group(node.name, "natural_slope")
|
||||
local all_shapes = naturalslopeslib.get_all_shapes(n3.name)
|
||||
if #all_shapes > 1 then
|
||||
minetest.set_node(pos, {name = all_shapes[shape + 1], param2 = node.param2})
|
||||
else
|
||||
minetest.set_node(pos, {name = n3.name})
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- Else, any seeding nodes on top?
|
||||
local name = minetest.get_node(above).name
|
||||
-- Snow check is cheapest, so comes first
|
||||
if name == "default:snow" then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_snow"})
|
||||
elseif minetest.get_item_group(name, "grass") ~= 0 then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_grass"})
|
||||
elseif minetest.get_item_group(name, "dry_grass") ~= 0 then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_dry_grass"})
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,18 @@
|
|||
--[[
|
||||
Add natural slopes to Minetest Game
|
||||
--]]
|
||||
naturalslopeslib.propagate_overrides()
|
||||
|
||||
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||
dofile(path .."/functions.lua")
|
||||
|
||||
naturalslopeslib.default_definition.drop_source = true
|
||||
naturalslopeslib.default_definition.tiles = {{align_style = "world"}}
|
||||
naturalslopeslib.default_definition.groups = {not_in_creative_inventory = 1}
|
||||
naturalslopeslib.default_definition.use_texture_alpha = "clip"
|
||||
|
||||
dofile(path .."/nodes.lua")
|
||||
|
||||
naturalslopeslib.reset_defaults()
|
||||
|
||||
dofile(path .."/tools.lua")
|
|
@ -0,0 +1,3 @@
|
|||
name = naturalslopes_minetest_game
|
||||
description = Add ground slopes for Minetest Game
|
||||
depends = naturalslopeslib, default
|
|
@ -0,0 +1,361 @@
|
|||
local S = minetest.get_translator("naturalslopes_minetest_game")
|
||||
|
||||
---
|
||||
--- Stone slopes
|
||||
---
|
||||
|
||||
naturalslopeslib.register_slope("default:stone", {
|
||||
description = S("Stone Slope"),
|
||||
},
|
||||
200,
|
||||
{mapgen = 0.33, place = 0.5}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:cobble", {
|
||||
description = S("Cobblestone Slope"),
|
||||
},
|
||||
10,
|
||||
{time = 3}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:mossycobble", {
|
||||
description = S("Mossy Cobblestone Slope"),
|
||||
},
|
||||
15,
|
||||
{time = 3}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:desert_stone", {
|
||||
description = S("Desert Stone Slope"),
|
||||
},
|
||||
150,
|
||||
{mapgen = 0.33, place = 0.5}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:desert_cobble", {
|
||||
description = S("Desert Cobblestone Slope"),
|
||||
},
|
||||
10,
|
||||
{time = 3}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:sandstone", {
|
||||
description = S("Sandstone Slope"),
|
||||
},
|
||||
120,
|
||||
{mapgen = 0.33, place = 0.5}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:desert_sandstone", {
|
||||
description = S("Desert Sandstone Slope"),
|
||||
},
|
||||
120,
|
||||
{mapgen = 0.33, place = 0.5}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:silver_sandstone", {
|
||||
description = S("Desert Sandstone Slope"),
|
||||
},
|
||||
120,
|
||||
{mapgen = 0.33, place = 0.5}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:obsidian", {
|
||||
description = S("Obsidian"),
|
||||
},
|
||||
500,
|
||||
{mapgen = 0.33, place = 0.5}
|
||||
)
|
||||
|
||||
---
|
||||
--- Soft / Non-Stone slopes
|
||||
---
|
||||
|
||||
naturalslopeslib.register_slope("default:dirt", {
|
||||
description = S("Dirt Slope"),
|
||||
},
|
||||
10,
|
||||
{place = 0.5, time = 0.75}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:dirt_with_grass", {
|
||||
description = S("Dirt with Grass Slope"),
|
||||
tiles = {"default_grass.png", "default_dirt.png",
|
||||
{name = "default_dirt.png^default_grass_side.png"}}
|
||||
},
|
||||
25
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:dirt_with_dry_grass", {
|
||||
description = S("Dirt with Dry Grass Slope"),
|
||||
tiles = {"default_grass.png", "default_dirt.png",
|
||||
{name = "default_dirt.png^default_grass_side.png"}}
|
||||
},
|
||||
20
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:dirt_with_snow", {
|
||||
description = S("Dirt with Snow Slope"),
|
||||
tiles = {"default_snow.png", "default_dirt.png",
|
||||
{name = "default_dirt.png^default_snow_side.png"}}
|
||||
},
|
||||
25
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:dirt_with_rainforest_litter", {
|
||||
description = S("Dirt with Rainforest Litter Slope"),
|
||||
tiles = {
|
||||
"default_rainforest_litter.png",
|
||||
"default_dirt.png",
|
||||
{name = "default_dirt.png^default_rainforest_litter_side.png"}}
|
||||
},
|
||||
15
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:dirt_with_coniferous_litter", {
|
||||
description = S("Dirt with Coniferous Litter Slope"),
|
||||
tiles = {
|
||||
"default_coniferous_litter.png",
|
||||
"default_dirt.png",
|
||||
{name = "default_dirt.png^default_coniferous_litter_side.png"}}
|
||||
},
|
||||
15
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:dry_dirt", {
|
||||
description = S("Savanna Dirt Slope"),
|
||||
},
|
||||
6,
|
||||
{place = 0.5, time = 0.5}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:dry_dirt_with_dry_grass", {
|
||||
description = S("Savanna Dirt with Savanna Grass Slope"),
|
||||
tiles = {"default_dry_grass.png", "default_dry_dirt.png",
|
||||
{name = "default_dry_dirt.png^default_dry_grass_side.png"}}
|
||||
},
|
||||
20
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:permafrost", {
|
||||
description = S("Permafrost Slope"),
|
||||
},
|
||||
30
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:permafrost_with_stones", {
|
||||
description = S("Permafrost with Stones Slope"),
|
||||
},
|
||||
30
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:permafrost_with_moss", {
|
||||
description = S("Permafrost with Moss Slope"),
|
||||
tiles = {"default_moss.png", "default_permafrost.png",
|
||||
{name = "default_permafrost.png^default_moss_side.png"}},
|
||||
},
|
||||
30
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:sand", {
|
||||
description = S("Sand Slope"),
|
||||
},
|
||||
5,
|
||||
{mapgen = 0, place = 0, time = 0}
|
||||
)
|
||||
naturalslopeslib.register_slope("default:desert_sand", {
|
||||
description = S("Desert Sand Slope"),
|
||||
},
|
||||
5,
|
||||
{mapgen = 0, place = 0, time = 0}
|
||||
)
|
||||
naturalslopeslib.register_slope("default:silver_sand", {
|
||||
description = S("Silver Sand Slope"),
|
||||
},
|
||||
5,
|
||||
{mapgen = 0, place = 0, time = 0}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:gravel", {
|
||||
description = S("Gravel Slope"),
|
||||
},
|
||||
7,
|
||||
{stomp = 0.5, time = 2}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:clay", {
|
||||
description = S("Clay Slope"),
|
||||
},
|
||||
15
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:snowblock", {
|
||||
description = S("Snow Block Slope"),
|
||||
},
|
||||
4,
|
||||
{stomp = 0}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:ice", {
|
||||
description = S("Ice Slope"),
|
||||
},
|
||||
60,
|
||||
{mapgen = 0.25}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:cave_ice", {
|
||||
description = S("Cave Ice Slope"),
|
||||
},
|
||||
60,
|
||||
{mapgen = 0.25}
|
||||
)
|
||||
|
||||
---
|
||||
--- Trees
|
||||
---
|
||||
|
||||
naturalslopeslib.register_slope("default:leaves", {
|
||||
description = S("Apple Tree Leaves Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:jungleleaves", {
|
||||
description = S("Jungle Tree Leaves Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:pine_needles", {
|
||||
description = S("Pine Needles Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:acacia_leaves", {
|
||||
description = S("Acacia Tree Leaves Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:aspen_leaves", {
|
||||
description = S("Aspen Tree Leaves Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
|
||||
---
|
||||
--- Plantlife
|
||||
---
|
||||
|
||||
naturalslopeslib.register_slope("default:bush_leaves", {
|
||||
description = S("Bush Leaves Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:blueberry_bush_leaves_with_berries", {
|
||||
description = S("Blueberry Bush Leaves with Berries Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:blueberry_bush_leaves", {
|
||||
description = S("Blueberry Bush Leaves Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:acacia_bush_leaves", {
|
||||
description = S("Acacia Bush Leaves Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
naturalslopeslib.register_slope("default:pine_bush_needles", {
|
||||
description = S("Pine Bush Needles Slope"),
|
||||
},
|
||||
2,
|
||||
{stomp = 6}
|
||||
)
|
||||
|
||||
--
|
||||
-- register trees for leafdecay
|
||||
-- must re-register block shapes because it alterates trunk nodes
|
||||
--
|
||||
|
||||
if minetest.get_mapgen_setting("mg_name") == "v6" then
|
||||
local tree_leaves = naturalslopeslib.get_all_shapes("default:leaves")
|
||||
table.insert(tree_leaves, 1, "default:apple")
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:tree"},
|
||||
leaves = tree_leaves,
|
||||
radius = 2,
|
||||
})
|
||||
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:jungletree"},
|
||||
leaves = naturalslopeslib.get_all_shapes("default:jungleleaves"),
|
||||
radius = 3,
|
||||
})
|
||||
else
|
||||
local tree_leaves = naturalslopeslib.get_all_shapes("default:leaves")
|
||||
table.insert(tree_leaves, 1, "default:apple")
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:tree"},
|
||||
leaves = tree_leaves,
|
||||
radius = 3,
|
||||
})
|
||||
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:jungletree"},
|
||||
leaves = naturalslopeslib.get_all_shapes("default:jungleleaves"),
|
||||
radius = 2,
|
||||
})
|
||||
end
|
||||
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:pine_tree"},
|
||||
leaves = naturalslopeslib.get_all_shapes("default:pine_needles"),
|
||||
radius = 3,
|
||||
})
|
||||
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:acacia_tree"},
|
||||
leaves = naturalslopeslib.get_all_shapes("default:acacia_leaves"),
|
||||
radius = 2,
|
||||
})
|
||||
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:aspen_tree"},
|
||||
leaves = naturalslopeslib.get_all_shapes("default:aspen_leaves"),
|
||||
radius = 3,
|
||||
})
|
||||
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:bush_stem"},
|
||||
leaves = naturalslopeslib.get_all_shapes("default:bush_leaves"),
|
||||
radius = 1,
|
||||
})
|
||||
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:acacia_bush_stem"},
|
||||
leaves = naturalslopeslib.get_all_shapes("default:acacia_bush_leaves"),
|
||||
radius = 1,
|
||||
})
|
||||
|
||||
default.register_leafdecay({
|
||||
trunks = {"default:pine_bush_stem"},
|
||||
leaves = naturalslopeslib.get_all_shapes("default:pine_bush_needles"),
|
||||
radius = 1,
|
||||
})
|
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
|
@ -0,0 +1,43 @@
|
|||
local function use_shape(itemstack, user, pointed_thing)
|
||||
local tool_def = itemstack:get_definition()
|
||||
local node_pos = minetest.get_pointed_thing_position(pointed_thing, false)
|
||||
local node = minetest.get_node(node_pos)
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
local dig_params = minetest.get_dig_params(node_def.groups, tool_def.tool_capabilities)
|
||||
if not dig_params.diggable then
|
||||
return itemstack
|
||||
end
|
||||
local chance = 1.0 / (dig_params.time * 2.0)
|
||||
local success = (chance >= 1.0 or math.random() < chance)
|
||||
if success then
|
||||
local changed = naturalslopeslib.update_shape(node_pos, node)
|
||||
if node_def.sounds.dug then
|
||||
minetest.sound_play(node_def.sounds.dug, {pos = node_pos}, true)
|
||||
end
|
||||
if changed then
|
||||
itemstack:add_wear(math.ceil(dig_params.wear / 4.0))
|
||||
end
|
||||
else
|
||||
if node_def.sounds.dig then
|
||||
minetest.sound_play(node_def.sounds.dig, {to_player = user:get_player_name()}, true)
|
||||
elseif node_def.sounds.dug then
|
||||
minetest.sound_play(node_def.sounds.dug, {to_player = user:get_player_name()}, true)
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local shaper_tools = {"default:pick_wood", "default:pick_stone", "default:pick_bronze",
|
||||
"default:pick_steel", "default:pick_mese", "default:pick_diamond",
|
||||
"default:shovel_wood", "default:shovel_stone", "default:shovel_bronze", "default:shovel_steel",
|
||||
"default:shovel_mese", "default:shovel_diamond",
|
||||
"default:axe_wood", "default:axe_stone", "default:axe_bronze", "default:axe_steel", "default:axe_mese",
|
||||
"default:axe_diamond",
|
||||
"default:sword_wood", "default:sword_stone", "default:sword_bronze", "default:sword_steel",
|
||||
"default:sword_mese", "default:sword_diamond"}
|
||||
|
||||
for _, tool in ipairs(shaper_tools) do
|
||||
minetest.override_item(tool, {
|
||||
on_place = use_shape
|
||||
})
|
||||
end
|
Loading…
Reference in New Issue