many worldgen mods and gonna try technic now
@@ -3,6 +3,9 @@
|
|||||||
"3d_armor":{
|
"3d_armor":{
|
||||||
"author":"stu"
|
"author":"stu"
|
||||||
},
|
},
|
||||||
|
"ambience":{
|
||||||
|
"author":"TenPlus1"
|
||||||
|
},
|
||||||
"ancient_bones":{
|
"ancient_bones":{
|
||||||
"author":"karlexceed"
|
"author":"karlexceed"
|
||||||
},
|
},
|
||||||
@@ -19,6 +22,9 @@
|
|||||||
"author":"mt-mods",
|
"author":"mt-mods",
|
||||||
"required":["xcompat"]
|
"required":["xcompat"]
|
||||||
},
|
},
|
||||||
|
"biome_lib":{
|
||||||
|
"author":"mt-mods"
|
||||||
|
},
|
||||||
"bucket_wooden":{
|
"bucket_wooden":{
|
||||||
"author":"Hume2"
|
"author":"Hume2"
|
||||||
},
|
},
|
||||||
@@ -34,9 +40,27 @@
|
|||||||
"coloredstrings":{
|
"coloredstrings":{
|
||||||
"author":"Alib234"
|
"author":"Alib234"
|
||||||
},
|
},
|
||||||
|
"denseores":{
|
||||||
|
"author":"benedict424"
|
||||||
|
},
|
||||||
|
"desertores":{
|
||||||
|
"author":"DumbDave961"
|
||||||
|
},
|
||||||
|
"dfcaverns":{
|
||||||
|
"author":"FaceDeer"
|
||||||
|
},
|
||||||
"discovery_maps":{
|
"discovery_maps":{
|
||||||
"author":"TomCon"
|
"author":"TomCon"
|
||||||
},
|
},
|
||||||
|
"dmobs":{
|
||||||
|
"author":"TenPlus1",
|
||||||
|
"notes":"Dragons are too frequent, nyan cats are annoying.",
|
||||||
|
"required":["mobs"],
|
||||||
|
"status":"abandoned"
|
||||||
|
},
|
||||||
|
"ebiomes":{
|
||||||
|
"author":"CowboyLv"
|
||||||
|
},
|
||||||
"ethereal":{
|
"ethereal":{
|
||||||
"author":"TenPlus1",
|
"author":"TenPlus1",
|
||||||
"colloquial_name":"Ethereal NG",
|
"colloquial_name":"Ethereal NG",
|
||||||
@@ -69,6 +93,31 @@
|
|||||||
"handholds_redo":{
|
"handholds_redo":{
|
||||||
"author":"TestificateMods"
|
"author":"TestificateMods"
|
||||||
},
|
},
|
||||||
|
"livingcaves":{
|
||||||
|
"author":"Liil"
|
||||||
|
},
|
||||||
|
"livingcavesmobs":{
|
||||||
|
"author":"mt-mods",
|
||||||
|
"required":["livingcaves"]
|
||||||
|
},
|
||||||
|
"livingdesert":{
|
||||||
|
"author":"Liil"
|
||||||
|
},
|
||||||
|
"livingjungle":{
|
||||||
|
"author":"mt-mods"
|
||||||
|
},
|
||||||
|
"lumpblocks":{
|
||||||
|
"author":"SilverSandstone"
|
||||||
|
},
|
||||||
|
"marinara":{
|
||||||
|
"author":"mt-mods",
|
||||||
|
"notes":"Needs TNT.",
|
||||||
|
"required":["mobs"]
|
||||||
|
},
|
||||||
|
"marinaramobs":{
|
||||||
|
"author":"Liil",
|
||||||
|
"required":["marinara","mobs"]
|
||||||
|
},
|
||||||
"mesecons":{
|
"mesecons":{
|
||||||
"author":"Jeija",
|
"author":"Jeija",
|
||||||
"notes":"Add its provides.."
|
"notes":"Add its provides.."
|
||||||
@@ -104,19 +153,46 @@
|
|||||||
"author":"ClothierEdward",
|
"author":"ClothierEdward",
|
||||||
"required":["awards"]
|
"required":["awards"]
|
||||||
},
|
},
|
||||||
|
"moreblocks":{
|
||||||
|
"author":"Calinou"
|
||||||
|
},
|
||||||
|
"morebricks":{
|
||||||
|
"author":"CalebJ"
|
||||||
|
},
|
||||||
"moreores":{
|
"moreores":{
|
||||||
"author":"Calinou"
|
"author":"Calinou"
|
||||||
},
|
},
|
||||||
|
"moretrees":{
|
||||||
|
"author":"mt-mods"
|
||||||
|
},
|
||||||
"multitools":{
|
"multitools":{
|
||||||
"author":"ChimneySwift"
|
"author":"ChimneySwift"
|
||||||
},
|
},
|
||||||
|
"nativevillages":{
|
||||||
|
"author":"Liil",
|
||||||
|
"required":["people"]
|
||||||
|
},
|
||||||
|
"naturalbiomes":{
|
||||||
|
"author":"Liil"
|
||||||
|
},
|
||||||
"nutritional":{
|
"nutritional":{
|
||||||
"author":"ghurir"
|
"author":"ghurir"
|
||||||
},
|
},
|
||||||
|
"people":{
|
||||||
|
"author":"Liil",
|
||||||
|
"required":["mobs"]
|
||||||
|
},
|
||||||
|
"plantlife_modpack":{
|
||||||
|
"author":"mt-mods",
|
||||||
|
"required":["biome_lib"]
|
||||||
|
},
|
||||||
"priviledges_manager":{
|
"priviledges_manager":{
|
||||||
"author":"Impulse",
|
"author":"Impulse",
|
||||||
"status":"untested"
|
"status":"untested"
|
||||||
},
|
},
|
||||||
|
"renewable_desert_stone":{
|
||||||
|
"author":"Emandac"
|
||||||
|
},
|
||||||
"ropes":{
|
"ropes":{
|
||||||
"author":"FaceDeer"
|
"author":"FaceDeer"
|
||||||
},
|
},
|
||||||
@@ -129,6 +205,10 @@
|
|||||||
"provides":["autobahn","basic_materials","compost","datastorage","doc","hyperloop","lcdlib","minecart","nanobasic","networks","safer_lua","signs_bot","stamina","ta4_addons","ta4_jetpack","ta4_paraglider","techage","techpack_stairway","towercrane","tubelib2","unified_inventory"],
|
"provides":["autobahn","basic_materials","compost","datastorage","doc","hyperloop","lcdlib","minecart","nanobasic","networks","safer_lua","signs_bot","stamina","ta4_addons","ta4_jetpack","ta4_paraglider","techage","techpack_stairway","towercrane","tubelib2","unified_inventory"],
|
||||||
"required":["3d_armor","xcompat"]
|
"required":["3d_armor","xcompat"]
|
||||||
},
|
},
|
||||||
|
"technic_plus":{
|
||||||
|
"author":"mt-mods",
|
||||||
|
"notes":"This is a rewrite of technic for performance improves and new machines."
|
||||||
|
},
|
||||||
"too_many_tnt":{
|
"too_many_tnt":{
|
||||||
"author":"SkyBuilder1717",
|
"author":"SkyBuilder1717",
|
||||||
"notes":"Remember to enable TNT.",
|
"notes":"Remember to enable TNT.",
|
||||||
@@ -169,9 +249,21 @@
|
|||||||
"uraniumstuff":{
|
"uraniumstuff":{
|
||||||
"author":"Epoxum"
|
"author":"Epoxum"
|
||||||
},
|
},
|
||||||
|
"vizlib":{
|
||||||
|
"author":"OgelGames",
|
||||||
|
"notes":"I forgot to note which mods make use of this."
|
||||||
|
},
|
||||||
"wetmud":{
|
"wetmud":{
|
||||||
"author":"Nicu"
|
"author":"Nicu"
|
||||||
},
|
},
|
||||||
|
"wilhelminessounds":{
|
||||||
|
"author":"Liil",
|
||||||
|
"required":["ambience"]
|
||||||
|
},
|
||||||
|
"winuserleafdecay":{
|
||||||
|
"author":"Liil",
|
||||||
|
"notes":"Compatibility for Windows hosts."
|
||||||
|
},
|
||||||
"worldedit":{
|
"worldedit":{
|
||||||
"author":"sfan5"
|
"author":"sfan5"
|
||||||
},
|
},
|
||||||
@@ -249,17 +341,23 @@
|
|||||||
"Unnamed Luanti Technic Pack":{
|
"Unnamed Luanti Technic Pack":{
|
||||||
"mods":{
|
"mods":{
|
||||||
"3d_armor":true,
|
"3d_armor":true,
|
||||||
|
"ambience":true,
|
||||||
"ancient_bones":true,
|
"ancient_bones":true,
|
||||||
"anvil":true,
|
"anvil":true,
|
||||||
"automobiles_pck":true,
|
"automobiles_pck":true,
|
||||||
"awards":true,
|
"awards":true,
|
||||||
"basic_materials":true,
|
"basic_materials":true,
|
||||||
|
"biome_lib":true,
|
||||||
"bucket_wooden":true,
|
"bucket_wooden":true,
|
||||||
"ccompass":true,
|
"ccompass":true,
|
||||||
"charcoal":true,
|
"charcoal":true,
|
||||||
"colored_chests":true,
|
"colored_chests":true,
|
||||||
"coloredstrings":true,
|
"coloredstrings":true,
|
||||||
|
"denseores":true,
|
||||||
|
"desertores":true,
|
||||||
|
"dfcaverns":true,
|
||||||
"discovery_maps":true,
|
"discovery_maps":true,
|
||||||
|
"ebiomes":true,
|
||||||
"everness":true,
|
"everness":true,
|
||||||
"eye_spy":true,
|
"eye_spy":true,
|
||||||
"fakelib":true,
|
"fakelib":true,
|
||||||
@@ -268,6 +366,13 @@
|
|||||||
"grass_string":true,
|
"grass_string":true,
|
||||||
"hammersredo":true,
|
"hammersredo":true,
|
||||||
"handholds_redo":true,
|
"handholds_redo":true,
|
||||||
|
"livingcaves":true,
|
||||||
|
"livingcavesmobs":true,
|
||||||
|
"livingdesert":true,
|
||||||
|
"livingjungle":true,
|
||||||
|
"lumpblocks":true,
|
||||||
|
"marinara":true,
|
||||||
|
"marinaramobs":true,
|
||||||
"mesecons":true,
|
"mesecons":true,
|
||||||
"mob_horse":true,
|
"mob_horse":true,
|
||||||
"mob_mese_monster_classic":true,
|
"mob_mese_monster_classic":true,
|
||||||
@@ -277,13 +382,25 @@
|
|||||||
"mobs_water":true,
|
"mobs_water":true,
|
||||||
"more_ladders":true,
|
"more_ladders":true,
|
||||||
"moreawards":true,
|
"moreawards":true,
|
||||||
|
"moreblocks":true,
|
||||||
|
"morebricks":true,
|
||||||
"moreores":true,
|
"moreores":true,
|
||||||
|
"moretrees":true,
|
||||||
"multitools":true,
|
"multitools":true,
|
||||||
|
"nativevillages":true,
|
||||||
|
"naturalbiomes":true,
|
||||||
"nutritional":true,
|
"nutritional":true,
|
||||||
|
"people":true,
|
||||||
|
"plantlife_modpack":true,
|
||||||
|
"priviledges_manager":true,
|
||||||
|
"renewable_desert_stone":true,
|
||||||
"ropes":true,
|
"ropes":true,
|
||||||
|
"stamina":true,
|
||||||
|
"technic_plus":true,
|
||||||
"too_many_tnt":true,
|
"too_many_tnt":true,
|
||||||
"toolranks":true,
|
"toolranks":true,
|
||||||
"toolranks_extras":true,
|
"toolranks_extras":true,
|
||||||
|
"towercrane":true,
|
||||||
"travelnet":true,
|
"travelnet":true,
|
||||||
"treecapitator":true,
|
"treecapitator":true,
|
||||||
"unified_inventory":true,
|
"unified_inventory":true,
|
||||||
@@ -291,7 +408,10 @@
|
|||||||
"unifiedbricks":true,
|
"unifiedbricks":true,
|
||||||
"unifieddyes":true,
|
"unifieddyes":true,
|
||||||
"uraniumstuff":true,
|
"uraniumstuff":true,
|
||||||
|
"vizlib":true,
|
||||||
"wetmud":true,
|
"wetmud":true,
|
||||||
|
"wilhelminessounds":true,
|
||||||
|
"winuserleafdecay":true,
|
||||||
"worldedit":true,
|
"worldedit":true,
|
||||||
"x_farming":true,
|
"x_farming":true,
|
||||||
"xcompat":true,
|
"xcompat":true,
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
Ambience Redo mod for Minetest
|
||||||
|
by TenPlus1
|
||||||
|
|
||||||
|
Based on Immersive Sounds .36 mod by Neuromancer and optimized to run on servers with a brand new API to quickly and easily add sound sets to your world, it also has new fire sounds for use with Fire Redo mod...
|
||||||
|
|
||||||
|
|
||||||
|
Four new functions are available to add and change sound sets, and two commands to adjust player volume for music and sounds (api.txt file shows detailed usage):
|
||||||
|
|
||||||
|
ambience.add_set(set_name, def)
|
||||||
|
|
||||||
|
ambience.add_to_set(set_name, sound_table)
|
||||||
|
|
||||||
|
ambience.get_set(set_name)
|
||||||
|
|
||||||
|
ambience.del_set(set_name)
|
||||||
|
|
||||||
|
/mvol (volume)
|
||||||
|
/svol (volume)
|
||||||
|
|
||||||
|
|
||||||
|
Changelog:
|
||||||
|
- 0.1 - Initial release
|
||||||
|
- 0.2 - Code change and new water sounds added
|
||||||
|
- 0.3 - Works with Fire Redo mod to provide fire sounds
|
||||||
|
- 0.4 - Code optimized
|
||||||
|
- 0.5 - Changed to kilbiths smaller sound files and removed canadianloon1, adjusted timings
|
||||||
|
- 0.6 - Using new find_nodes_in_area features to count nodes and speed up execution (thanks everamzah)
|
||||||
|
- 0.7 - Code tweaks and added Jungle sounds for day and night time
|
||||||
|
- 0.8 - Override default water sounds for 0.4.14 dev and above, add separate gain for each sound
|
||||||
|
- 0.9 - Plays music files on server or local client when found at midnight, files to be named "ambience_music.1.ogg" changing number each up to 9.
|
||||||
|
- 1.0 - Added icecrack sound when walking on snow/ice flows, also tidied code
|
||||||
|
- 1.1 - Using newer functions, Minetest 0.4.16 and above needed to run
|
||||||
|
- 1.2 - Added PlayerPlus compatibility, removed fire sounds, added volume changes
|
||||||
|
- 1.3 - Added API for use with other mods, code rewrite
|
||||||
|
- 1.4 - Re-ordered water sets to come before fire and lava, day/night sounds play when leaves around and above ground
|
||||||
|
- 1.5 - Added 'flame_sound' and fire redo check, code tidy and tweak, added ephemeral flag for background sounds.
|
||||||
|
- 1.6 - Finding env_sounds disables water and lava sets, added 'ambience_water_move' flag to override water walking sounds, use eye level for head node.
|
||||||
|
- 1.7 - Music will play every 20-30 minutes if found, use '/mvol 0' to stop playing music or disable in-game.
|
||||||
|
- 1.8 - Players can set induvidual volume for sound and music which is saved.
|
||||||
|
- 1.9 - Tidy code, refactor music playing, add biome name to sound_check.
|
||||||
|
- 2.0 - Add Mineclone support, add ethereal leaf check, remove minetest.after for custom timer, add Polish translation, tweak & tidy code.
|
||||||
|
- 2.1 - Add ambience.group_total() function for easy counting of group: nodes inside a set.
|
||||||
|
- 2.2 - Adds background sounds to sets that play looped in the background while normal sounds play on top (when conditions met), and sound chance.
|
||||||
|
- 2.3 - Add 'ambience_music_interval' setting [default is 1200, 0 to disable]. Optimize code.
|
||||||
|
|
||||||
|
|
||||||
|
Code license: MIT
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
|
||||||
|
Ambience Lite API
|
||||||
|
=================
|
||||||
|
|
||||||
|
This short guide will show you how to add sound sets into ambience mod for the
|
||||||
|
api to use and play sounds accordingly. Please note that the order they are
|
||||||
|
added will affect sound checks, so high priority sets first.
|
||||||
|
|
||||||
|
|
||||||
|
Function Usage
|
||||||
|
==============
|
||||||
|
|
||||||
|
|
||||||
|
Adding Sound Set
|
||||||
|
----------------
|
||||||
|
|
||||||
|
ambience.add_set(set_name, def)
|
||||||
|
'set_name' contains the name of the sound set to add
|
||||||
|
'def' contains the following:
|
||||||
|
'frequency' how often the sound set is played (1 to 1000) higher is more
|
||||||
|
'nodes' contains a table of nodes needed for checks
|
||||||
|
'background' contains a table of sounds that play in the background when
|
||||||
|
sound_check conditions are met.
|
||||||
|
'sounds' contains a table of sounds that play on top of any background
|
||||||
|
sounds that can stop when conditions are not met, or can be
|
||||||
|
ephemeral for shorter sounds.
|
||||||
|
'sound_check(def)' function to check if sounds can be played, def contains:
|
||||||
|
'player' player userdata
|
||||||
|
'pos' position of player
|
||||||
|
'tod' time of day
|
||||||
|
'totals' totals for each node e.g. def.totals["default:sand"]
|
||||||
|
'positions' position data for every node found
|
||||||
|
'head_node' name of node at player head level
|
||||||
|
'feet_node' nameof node at player foot level
|
||||||
|
'biome' name of biome at current position
|
||||||
|
|
||||||
|
This will let you add a set or sounds with the frequency it's used and check
|
||||||
|
function for it to play. If ephemeral is true then no handler will be used and sound will be played in background alongside other sounds.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
ambience.add_set("village", {
|
||||||
|
frequency = 500,
|
||||||
|
nodes = {"mymod:village_sound_block"}, -- activates sounds when in range
|
||||||
|
background = {
|
||||||
|
{"name = "village_background", gain = 0.5, fade = 1.0},
|
||||||
|
},
|
||||||
|
sounds = {
|
||||||
|
{name = "dogbark", gain = 0.4, ephemeral = true, chance = 7}, -- quick sound effect
|
||||||
|
{name = "talking_villagers", gain = 0.3, chance = 3}, -- stops when out of range
|
||||||
|
{name = "chicken", gain = 0.6, ephemeral = true, chance = 5},
|
||||||
|
{name = "chicken", gain = 0.6, pitch = 1.2, ephemeral = true, chance = 5},
|
||||||
|
},
|
||||||
|
sound_check = function(def)
|
||||||
|
local number = def.totals["mymod:village_sound_block"] or 0
|
||||||
|
if number > 0 then
|
||||||
|
return "village"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
ambience.add_set("windy", {
|
||||||
|
frequency = 80,
|
||||||
|
nodes = {"default:sand"},
|
||||||
|
sounds = {
|
||||||
|
{name = "wind", length = 9, gain = 0.3, fade = 1.0}, -- fade in sound
|
||||||
|
{name = "desertwind", length = 8, gain = 0.3},
|
||||||
|
{name = "crow", length = 3, ephemeral = true},
|
||||||
|
},
|
||||||
|
sound_check = function(def)
|
||||||
|
local number = def.totals["default:sand"] or 0 -- yep, can also be nil
|
||||||
|
if def.pos.y > 0 and number > 30 then -- above ground near plenty sand
|
||||||
|
return "windy", 0.2 -- return set to play and optional gain volume
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Counting group: nodes
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Instead of counting each node total for things like leaves within the sound_check function, you could use the following helper function to return their total instead e.g.
|
||||||
|
|
||||||
|
local number = ambience.group_totals(def.totals, "leaves") -- count all group:leaves
|
||||||
|
|
||||||
|
|
||||||
|
Adding sound to existing Set
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
ambience.add_to_set(set_name, sound_table)
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
ambience.add_to_set("cave", {name = "monster_whispers", pitch = 1.2, length = 8})
|
||||||
|
|
||||||
|
|
||||||
|
Getting Sound Set
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
ambience.get_set(set_name)
|
||||||
|
|
||||||
|
This returns a table containing all of the set information like example above.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
local myset = ambience.get_set("windy") -- returns everything inside {} above.
|
||||||
|
|
||||||
|
|
||||||
|
Deleting Sound Set
|
||||||
|
------------------
|
||||||
|
|
||||||
|
ambience.del_set(set_name)
|
||||||
|
|
||||||
|
This will remove a sound set from the list.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
ambience.del_set("windy")
|
||||||
|
|
||||||
|
|
||||||
|
Additional Commands
|
||||||
|
===================
|
||||||
|
|
||||||
|
Two volume commands have been added to set sound and music volume:
|
||||||
|
|
||||||
|
/svol (0.1 to 1.0)
|
||||||
|
/mvol (0.1 to 1.0) -- 0 can be used to stop music curently playing
|
||||||
|
|
||||||
|
|
||||||
|
Music
|
||||||
|
=====
|
||||||
|
|
||||||
|
Music can be stored in the sounds folder either on server or locally and so long
|
||||||
|
as it is named 'ambience_music.1', 'ambience_music.2' etc. then it will select
|
||||||
|
a song randomly to play every 20 minutes.
|
||||||
|
|
||||||
@@ -0,0 +1,403 @@
|
|||||||
|
|
||||||
|
ambience = {}
|
||||||
|
|
||||||
|
-- settings
|
||||||
|
|
||||||
|
local SOUNDVOLUME = 1.0
|
||||||
|
local MUSICVOLUME = 0.6
|
||||||
|
local MUSICINTERVAL = tonumber(core.settings:get("ambience_music_interval")) or (60 * 20)
|
||||||
|
local radius = 6
|
||||||
|
local playing = {} -- user settings, timers and current set playing
|
||||||
|
local sound_sets = {} -- all the sounds and their settings
|
||||||
|
local sound_set_order = {} -- needed because pairs loops randomly through tables
|
||||||
|
local set_nodes = {} -- all the nodes needed for sets
|
||||||
|
|
||||||
|
-- translation and local
|
||||||
|
|
||||||
|
local S = core.get_translator("ambience")
|
||||||
|
local get_id = core.get_node_raw
|
||||||
|
local get_id_name = core.get_name_from_content_id
|
||||||
|
local get_node = core.get_node
|
||||||
|
|
||||||
|
if get_id then get_node = function(pos)
|
||||||
|
|
||||||
|
local id, p1, p2, pos_ok = get_id(pos.x, pos.y, pos.z)
|
||||||
|
|
||||||
|
return {name = get_id_name(id), param1 = p1, param2 = p2, loaded = pos_ok}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add set to list
|
||||||
|
|
||||||
|
function ambience.add_set(set_name, def)
|
||||||
|
|
||||||
|
if not set_name or not def then return end
|
||||||
|
|
||||||
|
sound_sets[set_name] = {
|
||||||
|
frequency = def.frequency or 50,
|
||||||
|
background = def.background or {},
|
||||||
|
sounds = def.sounds or {},
|
||||||
|
sound_check = def.sound_check,
|
||||||
|
nodes = def.nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
-- add set name to the sound_set_order table
|
||||||
|
local can_add = true
|
||||||
|
|
||||||
|
for i = 1, #sound_set_order do
|
||||||
|
|
||||||
|
if sound_set_order[i] == set_name then can_add = false end
|
||||||
|
end
|
||||||
|
|
||||||
|
if can_add then table.insert(sound_set_order, set_name) end
|
||||||
|
|
||||||
|
-- add any missing nodes to the set_nodes table
|
||||||
|
if def.nodes then
|
||||||
|
|
||||||
|
for i = 1, #def.nodes do
|
||||||
|
|
||||||
|
can_add = def.nodes[i]
|
||||||
|
|
||||||
|
for j = 1, #set_nodes do
|
||||||
|
|
||||||
|
if def.nodes[i] == set_nodes[j] then can_add = false end
|
||||||
|
end
|
||||||
|
|
||||||
|
if can_add then table.insert(set_nodes, can_add) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add sound to existing set
|
||||||
|
|
||||||
|
function ambience.add_to_set(set_name, def)
|
||||||
|
|
||||||
|
if not set_name or not def or not sound_sets[set_name] then return end
|
||||||
|
|
||||||
|
table.insert(sound_sets[set_name].sounds, def)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- return set from list using name
|
||||||
|
|
||||||
|
function ambience.get_set(set_name)
|
||||||
|
return sound_sets[set_name]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- remove set from list
|
||||||
|
|
||||||
|
function ambience.del_set(set_name)
|
||||||
|
|
||||||
|
sound_sets[set_name] = nil
|
||||||
|
|
||||||
|
local can_del = false
|
||||||
|
|
||||||
|
for i = 1, #sound_set_order do
|
||||||
|
|
||||||
|
if sound_set_order[i] == set_name then can_del = i end
|
||||||
|
end
|
||||||
|
|
||||||
|
if can_del then table.remove(sound_set_order, can_del) end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- return node total belonging to a specific group:
|
||||||
|
|
||||||
|
function ambience.group_total(ntab, ngrp)
|
||||||
|
|
||||||
|
local tot = 0
|
||||||
|
local def, grp
|
||||||
|
|
||||||
|
for _,n in pairs(ntab) do
|
||||||
|
|
||||||
|
def = core.registered_nodes[_]
|
||||||
|
grp = def and def.groups and def.groups[ngrp]
|
||||||
|
|
||||||
|
if grp and grp > 0 then
|
||||||
|
tot = tot + n
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return tot
|
||||||
|
end
|
||||||
|
|
||||||
|
-- setup table when player joins
|
||||||
|
|
||||||
|
core.register_on_joinplayer(function(player)
|
||||||
|
|
||||||
|
if player then
|
||||||
|
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local meta = player:get_meta()
|
||||||
|
|
||||||
|
playing[name] = {
|
||||||
|
mvol = tonumber(meta:get_string("ambience.mvol")) or MUSICVOLUME,
|
||||||
|
svol = tonumber(meta:get_string("ambience.svol")) or SOUNDVOLUME,
|
||||||
|
timer = 0, music = 0, music_handler = nil, set = "nil"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- remove table when player leaves
|
||||||
|
|
||||||
|
core.register_on_leaveplayer(function(player)
|
||||||
|
if player then playing[player:get_player_name()] = nil end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- plays music and selects sound set
|
||||||
|
|
||||||
|
local function get_ambience(player, tod, name)
|
||||||
|
|
||||||
|
local p = playing[name]
|
||||||
|
|
||||||
|
-- if enabled, play local/server music on interval check
|
||||||
|
if MUSICINTERVAL > 0 and p and p.mvol > 0 then
|
||||||
|
|
||||||
|
-- increase music time interval
|
||||||
|
p.music = p.music + 1
|
||||||
|
|
||||||
|
-- if not already playing, play music on interval check
|
||||||
|
if p.music > MUSICINTERVAL and not p.music_handler then
|
||||||
|
|
||||||
|
p.music_handler = core.sound_play("ambience_music",
|
||||||
|
{to_player = name, gain = p.mvol})
|
||||||
|
|
||||||
|
p.music = 0 -- reset interval
|
||||||
|
|
||||||
|
-- after 5 minutes (a normal song length) reset music timers
|
||||||
|
elseif p.music_handler and p.music > 300 then
|
||||||
|
|
||||||
|
p.music = 0 ; p.music_handler = nil
|
||||||
|
--print("--- resetting music timers")
|
||||||
|
end
|
||||||
|
--print("-- music timer", playing[name].music .. "/" .. MUSICINTERVAL)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get foot and head level nodes at player position
|
||||||
|
local pos = player:get_pos() ; if not pos then return end
|
||||||
|
local eyeh = player:get_properties().eye_height or 1.47 -- eye level with fallback
|
||||||
|
local nod_head = get_node({x = pos.x, y = pos.y + eyeh, z = pos.z}).name
|
||||||
|
local nod_feet = get_node({x = pos.x, y = pos.y + 0.2, z = pos.z}).name
|
||||||
|
|
||||||
|
-- get all set nodes around player
|
||||||
|
local ps, cn = core.find_nodes_in_area(
|
||||||
|
{x = pos.x - radius, y = pos.y - radius, z = pos.z - radius},
|
||||||
|
{x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, set_nodes)
|
||||||
|
|
||||||
|
-- get biome data
|
||||||
|
local bdata = core.get_biome_data(pos)
|
||||||
|
local biome = bdata and core.get_biome_name(bdata.biome) or ""
|
||||||
|
|
||||||
|
-- loop through sets in order and choose first that meets conditions set
|
||||||
|
for n = 1, #sound_set_order do
|
||||||
|
|
||||||
|
local set = sound_sets[ sound_set_order[n] ]
|
||||||
|
|
||||||
|
if set and set.sound_check then
|
||||||
|
|
||||||
|
-- pass settings to set function for condition check
|
||||||
|
local set_name, gain = set.sound_check({
|
||||||
|
player = player,
|
||||||
|
pos = pos,
|
||||||
|
tod = tod,
|
||||||
|
totals = cn,
|
||||||
|
positions = ps,
|
||||||
|
head_node = nod_head,
|
||||||
|
feet_node = nod_feet,
|
||||||
|
biome = biome
|
||||||
|
})
|
||||||
|
|
||||||
|
-- if conditions met return set name and gain value
|
||||||
|
if set_name then return set_name, gain end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil, nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- players routine
|
||||||
|
|
||||||
|
local timer = 0
|
||||||
|
local random = math.random
|
||||||
|
|
||||||
|
core.register_globalstep(function(dtime)
|
||||||
|
|
||||||
|
local players = core.get_connected_players()
|
||||||
|
local pname
|
||||||
|
|
||||||
|
-- reduce sound timer for each player and stop/reset when needed
|
||||||
|
for _, player in pairs(players) do
|
||||||
|
|
||||||
|
pname = player:get_player_name()
|
||||||
|
|
||||||
|
local p = playing[pname]
|
||||||
|
|
||||||
|
if p and p.timer and p.timer > 0 then
|
||||||
|
|
||||||
|
p.timer = p.timer - dtime
|
||||||
|
|
||||||
|
if p.timer <= 0 then
|
||||||
|
|
||||||
|
if p.handler then
|
||||||
|
core.sound_stop(p.handler)
|
||||||
|
end
|
||||||
|
|
||||||
|
p.set = nil ; p.gain = nil ; p.handler = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- one second timer
|
||||||
|
timer = timer + dtime ; if timer < 1 then return end ; timer = 0
|
||||||
|
|
||||||
|
local tod = core.get_timeofday()
|
||||||
|
|
||||||
|
-- loop through players
|
||||||
|
for _, player in pairs(players) do
|
||||||
|
|
||||||
|
pname = player:get_player_name()
|
||||||
|
|
||||||
|
local p = playing[pname]
|
||||||
|
local set_name, MORE_GAIN = get_ambience(player, tod, pname)
|
||||||
|
local set_def = sound_sets[set_name]
|
||||||
|
local ok = p and true -- everything starts off ok if player found
|
||||||
|
|
||||||
|
-- are we playing any available background sounds?
|
||||||
|
if ok and not p.bg and set_def and #set_def.background > 0 then
|
||||||
|
|
||||||
|
-- choose a random sound from the background set
|
||||||
|
local bg_num = random(#set_def.background)
|
||||||
|
local bg_amb = set_def.background[bg_num]
|
||||||
|
|
||||||
|
-- only play sound if set differs from last one played
|
||||||
|
if set_name ~= p.bg_set then
|
||||||
|
|
||||||
|
p.bg = core.sound_play(bg_amb.name, {
|
||||||
|
to_player = pname,
|
||||||
|
gain = (bg_amb.gain or 0.3) * p.svol,
|
||||||
|
pitch = bg_amb.pitch, fade = bg_amb.fade, loop = true
|
||||||
|
})
|
||||||
|
|
||||||
|
--print("-- bg start", p.bg, set_name)
|
||||||
|
|
||||||
|
p.bg_set = set_name
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif ok and p.bg and set_name ~= p.bg_set then
|
||||||
|
|
||||||
|
--print("-- bg stop", p.bg, set_name, p.bg_set)
|
||||||
|
|
||||||
|
core.sound_stop(p.bg)
|
||||||
|
|
||||||
|
p.bg = nil ; p.bg_set = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if ok and p.handler then -- are we playing something already?
|
||||||
|
|
||||||
|
-- stop current sound if another set active or gain changed
|
||||||
|
if p.set ~= set_name or p.gain ~= MORE_GAIN then
|
||||||
|
|
||||||
|
--print ("-- change stop", set_name, p.handler)
|
||||||
|
|
||||||
|
core.sound_stop(p.handler)
|
||||||
|
|
||||||
|
p.set = nil ; p.gain = nil ; p.handler = nil ; p.timer = 0
|
||||||
|
else
|
||||||
|
ok = false -- sound set still playing, skip new sound
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local chance = random(1000)
|
||||||
|
|
||||||
|
-- if chance is lower than set frequency then use set
|
||||||
|
if ok and set_name and chance < set_def.frequency
|
||||||
|
and set_def.sounds and #set_def.sounds > 0 then
|
||||||
|
|
||||||
|
local amb = set_def.sounds[random(#set_def.sounds)] -- choose random set
|
||||||
|
|
||||||
|
-- selected sound chance of playing from a set
|
||||||
|
if random((amb.chance or 1)) == 1 then
|
||||||
|
|
||||||
|
-- play sound
|
||||||
|
p.handler = core.sound_play(amb.name, {
|
||||||
|
to_player = pname,
|
||||||
|
gain = ((amb.gain or 0.3) + (MORE_GAIN or 0)) * p.svol,
|
||||||
|
pitch = amb.pitch or 1.0, fade = amb.fade
|
||||||
|
}, amb.ephemeral)
|
||||||
|
|
||||||
|
--print ("playing... " .. amb.name .. " (" .. chance .. " < "
|
||||||
|
-- .. p.frequency .. ") @ ", MORE_GAIN, p.handler)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- save what player is currently listening to if handler found
|
||||||
|
if p.handler then
|
||||||
|
p.set = set_name ; p.gain = MORE_GAIN ; p.timer = (amb.length or 5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- sound volume command
|
||||||
|
|
||||||
|
core.register_chatcommand("svol", {
|
||||||
|
params = S("<svol>"),
|
||||||
|
description = S("set sound volume (0.1 to 1.0)"),
|
||||||
|
privs = {},
|
||||||
|
|
||||||
|
func = function(name, param)
|
||||||
|
|
||||||
|
local svol = tonumber(param) or playing[name].svol
|
||||||
|
|
||||||
|
if svol < 0.1 then svol = 0.1 end
|
||||||
|
if svol > 1.0 then svol = 1.0 end
|
||||||
|
|
||||||
|
local player = core.get_player_by_name(name)
|
||||||
|
local meta = player:get_meta()
|
||||||
|
|
||||||
|
meta:set_string("ambience.svol", svol)
|
||||||
|
|
||||||
|
playing[name].svol = svol
|
||||||
|
|
||||||
|
return true, S("Sound volume set to @1", svol)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- music volume command (0 stops music)
|
||||||
|
|
||||||
|
core.register_chatcommand("mvol", {
|
||||||
|
params = S("<mvol>"),
|
||||||
|
description = S("set music volume (0.1 to 1.0, 0 to stop music)"),
|
||||||
|
privs = {},
|
||||||
|
|
||||||
|
func = function(name, param)
|
||||||
|
|
||||||
|
local mvol = tonumber(param) or playing[name].mvol
|
||||||
|
|
||||||
|
-- stop music currently playing by setting volume to 0
|
||||||
|
if mvol == 0 and playing[name].music_handler then
|
||||||
|
|
||||||
|
core.sound_stop(playing[name].music_handler)
|
||||||
|
|
||||||
|
playing[name].music_handler = nil
|
||||||
|
|
||||||
|
core.chat_send_player(name, S("Music stopped!"))
|
||||||
|
end
|
||||||
|
|
||||||
|
if mvol < 0 then mvol = 0 end
|
||||||
|
if mvol > 1.0 then mvol = 1.0 end
|
||||||
|
|
||||||
|
local player = core.get_player_by_name(name)
|
||||||
|
local meta = player:get_meta()
|
||||||
|
|
||||||
|
meta:set_string("ambience.mvol", mvol)
|
||||||
|
|
||||||
|
playing[name].mvol = mvol
|
||||||
|
|
||||||
|
return true, S("Music volume set to @1", mvol)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- load default sound sets
|
||||||
|
|
||||||
|
dofile(core.get_modpath("ambience") .. "/soundsets.lua")
|
||||||
|
|
||||||
|
|
||||||
|
print("[MOD] Ambience Lite loaded")
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2022 TenPlus1
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
Sound licenses:
|
||||||
|
|
||||||
|
--Nightime Sound, Recorded by Mike Koenig, License: Attribution 3.0 http://soundbible.com/951-Nightime.html
|
||||||
|
|
||||||
|
--Crickets At Night Sound, License: Attribution 3.0 | Recorded by Mike Koenig |http://soundbible.com/365-Crickets-At-Night.html
|
||||||
|
|
||||||
|
--Medium Pack Of Wolves Howling, License: Public Domain | Recorded by fws.gov, http://soundbible.com/277-Medium-Pack-Of-Wolves-Howling.html
|
||||||
|
|
||||||
|
--Horned Owl Sound, License: Attribution 3.0 | Recorded by Mike Koenig , http://soundbible.com/1851-Horned-Owl.html
|
||||||
|
|
||||||
|
--Bats In Cave Sound, License: CC0 | Recorded by SaloSensei , https://freesound.org/people/SaloSensei/sounds/616219/
|
||||||
|
|
||||||
|
--Spooky Water Drops Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/380-Spooky-Water-Drops.html
|
||||||
|
|
||||||
|
-- Single Water Droplet Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/384-Single-Water-Droplet.html
|
||||||
|
|
||||||
|
--HollowWind, Black Boe, Creative Commons 0 License, http://www.freesound.org/people/Black%20Boe/sounds/22331/
|
||||||
|
|
||||||
|
--drippingwater*.ogg sounds: CC0, Dripping Water Mod, by kddekadenz, http://minetest.net/forum/viewtopic.php?id=1688
|
||||||
|
|
||||||
|
--best cardinal bird: License: Attribution 3.0 | Recorded by PsychoBird, http://soundbible.com/1515-Best-Cardinal-Bird.html
|
||||||
|
|
||||||
|
--birdsongnl: the Attribution License, HerbertBoland, http://www.freesound.org/people/HerbertBoland/sounds/28312/ (end)
|
||||||
|
|
||||||
|
--robin2: Attribution License, reinsamba, http://www.freesound.org/people/reinsamba/sounds/32479/ (end)
|
||||||
|
|
||||||
|
--Craw.WAV, Attribution License, inchadney, http://www.freesound.org/people/inchadney/sounds/52450/
|
||||||
|
|
||||||
|
--bluejay.wav, Creative Commons 0 License, UncleSigmund, http://www.freesound.org/people/UncleSigmund/sounds/42382/
|
||||||
|
|
||||||
|
--scuba1*.ogg- digifishmusic, Attribution License, http://www.freesound.org/people/digifishmusic/sounds/45521/
|
||||||
|
|
||||||
|
--dolphin_screaming - Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/161691/
|
||||||
|
|
||||||
|
ComboWind uses:
|
||||||
|
--wind-in-the-trees -Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/16995/
|
||||||
|
--drygrassInWind- Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/146436/
|
||||||
|
|
||||||
|
--Splash: Attribution 3.0 | Recorded by BlastwaveFx.com, http://soundbible.com/546-Fish-Splashing.html
|
||||||
|
|
||||||
|
--small_waterfall Attribution License, volivieri, http://www.freesound.org/people/volivieri/sounds/38390/
|
||||||
|
|
||||||
|
--Lake_Waves_2*, Attribution License, Benboncan, http://www.freesound.org/people/Benboncan/sounds/67884/
|
||||||
|
|
||||||
|
--earth01a, Creative Commons 0 License., Halion , http://www.freesound.org/people/Halion/sounds/17785
|
||||||
|
|
||||||
|
--fiji_beach, Creative Commons 0 License, c97059890, http://www.freesound.org/people/c97059890/sounds/21754/
|
||||||
|
|
||||||
|
--seagull, Attribution 3.0 License., hazure, http://www.freesound.org/people/hazure/sounds/23707/,
|
||||||
|
|
||||||
|
--seagull_2, DonnyDB -- https://freesound.org/s/765399/ -- License: Attribution NonCommercial 4.0
|
||||||
|
desert:
|
||||||
|
coyote2, Attribution License, rogerforeman, http://www.freesound.org/people/rogerforeman/sounds/68068/
|
||||||
|
http://www.freesound.org/people/Proxima4/sounds/104319/
|
||||||
|
Desert Monolith.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104319/
|
||||||
|
Rattlesnake Rattle, Public Domain, fws.gov, http://soundbible.com/237-Rattlesnake-Rattle.html
|
||||||
|
|
||||||
|
flying:
|
||||||
|
crystal_airlines: Attribution License, suonho, http://www.freesound.org/people/suonho/sounds/56364/
|
||||||
|
|
||||||
|
desert wind:
|
||||||
|
Desert Simple.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104320/
|
||||||
|
|
||||||
|
http://www.freesfx.co.uk/soundeffects/forests-jungles/
|
||||||
|
|
||||||
|
icecrack.ogg by ecfike, Creative Commons 0 license (https://freesound.org/people/ecfike/sounds/177212/)
|
||||||
|
|
||||||
|
big_splash.ogg by gubodup, Creative Commons 0 License (https://freesound.org/people/qubodup/sounds/442773/)
|
||||||
|
|
||||||
|
wooden_frog, wooden frog e.WAV by ERH -- https://freesound.org/s/34512/ -- License: Attribution 4.0
|
||||||
|
|
||||||
|
screenshot.jpg created using https://www.textstudio.com/ image by swvrsy (cc0)
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# textdomain: ambience
|
||||||
|
<svol>=<slaŭtec>
|
||||||
|
set sound volume (0.1 to 1.0)=agordi sonlaŭtecon (0.1 ĝis 1.0)
|
||||||
|
Sound volume set to @1=Sonlaŭteco agordita al @1
|
||||||
|
<mvol>=<mlaŭtec>
|
||||||
|
set music volume (0.1 to 1.0, 0 to stop music)=agordi muziklaŭtecon (0.1 ĝis 1.0; malŝalti muzikon per 0)
|
||||||
|
Music volume set to @1=Muziklaŭteco agordita al @1
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# textdomain: ambience
|
||||||
|
<svol>=<volumen de sonido>
|
||||||
|
set sound volume (0.1 to 1.0)=establecer volumen de sonido (0.1 a 1.0)
|
||||||
|
Sound volume set to @1=Volumen de sonido establecido a @1
|
||||||
|
<mvol>=<volumen de música>
|
||||||
|
set music volume (0.1 to 1.0, 0 to stop music)=establecer volumen de música (0.1 a 1.0, 0 para detener la música)
|
||||||
|
Music volume set to @1=Volumen de música establecido a @1
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# textdomain: ambience
|
||||||
|
<svol>=<sgłośność>
|
||||||
|
set sound volume (0.1 to 1.0)=ustaw głośność dźwięku (0.1 do 1.0)
|
||||||
|
Sound volume set to @1=Głośność dźwięku ustawiona na @1
|
||||||
|
<mvol>=<mgłośność>
|
||||||
|
set music volume (0.1 to 1.0, 0 to stop music)=ustaw głośność muzyki (0.1 do 1.0, 0 aby zatrzymać muzykę)
|
||||||
|
Music volume set to @1=Głośność muzyki ustawiona na @1
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# textdomain: ambience
|
||||||
|
<svol>=
|
||||||
|
set sound volume (0.1 to 1.0)=
|
||||||
|
Sound volume set to @1=
|
||||||
|
<mvol>=
|
||||||
|
set music volume (0.1 to 1.0, 0 to stop music)=
|
||||||
|
Music volume set to @1=
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
name = ambience
|
||||||
|
description = Adds realistic sound effects into your world.
|
||||||
|
optional_depends = default, mcl_core, mclx_core
|
||||||
|
min_minetest_version = 5.0
|
||||||
|
After Width: | Height: | Size: 119 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
ambience_music_interval (Ambience music interval [0 to disable]) int 1200
|
||||||
|
|
||||||
|
ambience_water_move (Ambience water movement) bool true
|
||||||
|
|
||||||
|
ambience_water_splash (Big splash when jumping in water) bool false
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Royalty-Free to Use (https://pixabay.com/sound-effects/film-special-effects-0005-crystal-lamp-with-swing-front-107459/)
|
||||||
|
caverealms_crystal.ogg
|
||||||
|
|
||||||
|
Royalty Free to Use (https://pixabay.com/sound-effects/film-special-effects-deep-whoosh-bass-impact-effect-04-407108/)
|
||||||
|
caverealms_deep_whoosh.ogg
|
||||||
@@ -0,0 +1,510 @@
|
|||||||
|
--[[
|
||||||
|
Default Sound Sets
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Order is very important when adding a sound set so it will play
|
||||||
|
certain sound sets before any another.
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- mod support
|
||||||
|
|
||||||
|
local mod_def = core.get_modpath("default")
|
||||||
|
local mod_mcl = core.get_modpath("mcl_core")
|
||||||
|
|
||||||
|
-- Big Splash jumping in water
|
||||||
|
|
||||||
|
if core.settings:get_bool("ambience_water_splash") == true then
|
||||||
|
|
||||||
|
local players = {}
|
||||||
|
|
||||||
|
core.register_on_joinplayer(function(player)
|
||||||
|
players[player:get_player_name()] = {in_water = nil, old_pos = -31000}
|
||||||
|
end)
|
||||||
|
|
||||||
|
core.register_on_leaveplayer(function(player)
|
||||||
|
players[player:get_player_name()] = nil
|
||||||
|
end)
|
||||||
|
|
||||||
|
ambience.add_set("big_splash", {
|
||||||
|
|
||||||
|
frequency = 1000,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "big_splash", gain = 0.3, length = 4, ephemeral = true},
|
||||||
|
{name = "big_splash", gain = 0.3, length = 4, ephemeral = true, pitch = 0.9},
|
||||||
|
{name = "big_splash", gain = 0.3, length = 4, ephemeral = true, pitch = 1.1}
|
||||||
|
},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local hdef = core.registered_nodes[def.head_node]
|
||||||
|
local fdef = core.registered_nodes[def.feet_node]
|
||||||
|
local name = def.player:get_player_name()
|
||||||
|
|
||||||
|
if hdef and hdef.groups.water and fdef and fdef.groups.water then
|
||||||
|
|
||||||
|
local diff = players[name].old_pos - def.pos.y
|
||||||
|
|
||||||
|
if not players[name].in_water and diff > 1 then
|
||||||
|
|
||||||
|
players[name].in_water = 2
|
||||||
|
|
||||||
|
return "big_splash"
|
||||||
|
end
|
||||||
|
|
||||||
|
players[name].in_water = 2
|
||||||
|
else
|
||||||
|
if fdef and fdef.groups.water then
|
||||||
|
players[name].in_water = 1
|
||||||
|
else
|
||||||
|
players[name].in_water = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
players[name].old_pos = def.pos.y
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Underwater sounds play when player head is submerged
|
||||||
|
|
||||||
|
ambience.add_set("underwater", {
|
||||||
|
|
||||||
|
frequency = 1000,
|
||||||
|
|
||||||
|
-- This is an example of how it could be used as a background sound also
|
||||||
|
-- background = {
|
||||||
|
-- {name = "scuba", length = 8},
|
||||||
|
-- {name = "scuba", pitch = 1.2, length = 8}
|
||||||
|
-- },
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "scuba", length = 8, loop = true}
|
||||||
|
},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local nodef = core.registered_nodes[def.head_node]
|
||||||
|
|
||||||
|
if nodef and nodef.groups.water then
|
||||||
|
return "underwater"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- add new sound to above set
|
||||||
|
|
||||||
|
ambience.add_to_set("underwater", {name = "scuba", pitch = 1.2, length = 8, loop = true})
|
||||||
|
|
||||||
|
-- Splashing sound plays when player walks inside water nodes (if enabled)
|
||||||
|
|
||||||
|
if core.settings:get_bool("ambience_water_move") ~= false then
|
||||||
|
|
||||||
|
-- override default water sounds
|
||||||
|
|
||||||
|
if mod_def then
|
||||||
|
core.override_item("default:water_source", { sounds = {} })
|
||||||
|
core.override_item("default:water_flowing", { sounds = {} })
|
||||||
|
core.override_item("default:river_water_source", { sounds = {} })
|
||||||
|
core.override_item("default:river_water_flowing", { sounds = {} })
|
||||||
|
elseif mod_mcl then
|
||||||
|
core.override_item("mcl_core:water_source", { sounds = {} })
|
||||||
|
core.override_item("mcl_core:water_flowing", { sounds = {} })
|
||||||
|
core.override_item("mclx_core:river_water_source", { sounds = {} })
|
||||||
|
core.override_item("mclx_core:river_water_flowing", { sounds = {} })
|
||||||
|
end
|
||||||
|
|
||||||
|
ambience.add_set("splash", {
|
||||||
|
|
||||||
|
frequency = 1000,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "default_water_footstep", length = 2}
|
||||||
|
},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local nodef = core.registered_nodes[def.feet_node]
|
||||||
|
|
||||||
|
if nodef and nodef.groups.water then
|
||||||
|
|
||||||
|
local control = def.player:get_player_control()
|
||||||
|
|
||||||
|
if control.up or control.down or control.left or control.right then
|
||||||
|
return "splash"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check for env_sounds mod, if not found enable water flowing and lava sounds
|
||||||
|
if not core.get_modpath("env_sounds") then
|
||||||
|
|
||||||
|
-- Water sound plays when near flowing water
|
||||||
|
|
||||||
|
ambience.add_set("flowing_water", {
|
||||||
|
|
||||||
|
frequency = 1000,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "waterfall", length = 6}
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = {"group:water"},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:water_flowing"] or 0)
|
||||||
|
+ (def.totals["mcl_core:water_flowing"] or 0)
|
||||||
|
|
||||||
|
if c > 40 then return "flowing_water", 0.5
|
||||||
|
|
||||||
|
elseif c > 5 then return "flowing_water" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- River sound plays when near flowing river
|
||||||
|
|
||||||
|
ambience.add_set("river", {
|
||||||
|
|
||||||
|
frequency = 1000,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "river", length = 4, gain = 0.1}
|
||||||
|
},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:river_water_flowing"] or 0)
|
||||||
|
+ (def.totals["mclx_core:river_water_flowing"] or 0)
|
||||||
|
|
||||||
|
if c > 20 then return "river", 0.5
|
||||||
|
|
||||||
|
elseif c > 5 then return "river" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Lava sound plays when near lava
|
||||||
|
|
||||||
|
ambience.add_set("lava", {
|
||||||
|
|
||||||
|
frequency = 1000,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "lava", length = 7}
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = {"group:lava"},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:lava_source"] or 0)
|
||||||
|
+ (def.totals["default:lava_flowing"] or 0)
|
||||||
|
+ (def.totals["mcl_core:lava_source"] or 0)
|
||||||
|
+ (def.totals["mcl_core:lava_flowing"] or 0)
|
||||||
|
|
||||||
|
if c > 20 then return "lava", 0.5
|
||||||
|
|
||||||
|
elseif c > 5 then return "lava" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
else
|
||||||
|
print ("[MOD] Ambience - Using env_sounds for water and lava sounds.")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Beach sounds play when pos above 0 and below 6 and 100+ water source found
|
||||||
|
|
||||||
|
ambience.add_set("beach", {
|
||||||
|
|
||||||
|
frequency = 40,
|
||||||
|
|
||||||
|
background = {
|
||||||
|
{name = "beach", length = 13},
|
||||||
|
},
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "seagull", length = 4.5, ephemeral = true, chance = 2},
|
||||||
|
{name = "seagull", length = 4.5, pitch = 1.2, ephemeral = true, chance = 2},
|
||||||
|
--{name = "beach", length = 13},
|
||||||
|
{name = "gull", length = 1, ephemeral = true, chance = 2},
|
||||||
|
{name = "seagull_2", length = 4, ephemeral = true, chance = 2}
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = {"group:water"},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:water_source"] or 0)
|
||||||
|
+ (def.totals["mcl_core:water_source"] or 0)
|
||||||
|
|
||||||
|
if def.pos.y > 0 and def.pos.y < 6 and c > 100 then
|
||||||
|
return "beach"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Ice sounds play when 100 or more ice are nearby
|
||||||
|
|
||||||
|
ambience.add_set("ice", {
|
||||||
|
|
||||||
|
frequency = 80,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "icecrack", length = 5, gain = 1.1},
|
||||||
|
{name = "desertwind", length = 8},
|
||||||
|
{name = "wind", length = 9}
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = (mod_mcl and {"mcl_core:ice", "mcl_core:packed_ice"} or {"default:ice"}),
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:ice"] or 0)
|
||||||
|
+(def.totals["mcl_core:ice"] or 0)
|
||||||
|
+ (def.totals["mcl_core:packed_ice"] or 0)
|
||||||
|
|
||||||
|
if c > 400 then return "ice" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Desert sounds play when near 150+ desert or normal sand
|
||||||
|
|
||||||
|
ambience.add_set("desert", {
|
||||||
|
|
||||||
|
frequency = 20,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "coyote", length = 2.5, ephemeral = true},
|
||||||
|
{name = "wind", length = 9},
|
||||||
|
{name = "desertwind", length = 8}
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
(mod_mcl and "mcl_core:redsand" or "default:desert_sand"),
|
||||||
|
(mod_mcl and "mcl_core:sand" or "default:sand")
|
||||||
|
},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:desert_sand"] or 0)
|
||||||
|
+ (def.totals["default:sand"] or 0)
|
||||||
|
+ (def.totals["mcl_core:sand"] or 0)
|
||||||
|
+ (def.totals["mcl_core:redsand"] or 0)
|
||||||
|
|
||||||
|
if c > 150 and def.pos.y > 10 then return "desert" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Cave sounds play when below player position Y -25 and water nearby
|
||||||
|
|
||||||
|
ambience.add_set("cave", {
|
||||||
|
|
||||||
|
frequency = 60,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "drippingwater1", length = 1.5, ephemeral = true},
|
||||||
|
{name = "drippingwater2", length = 1.5, ephemeral = true},
|
||||||
|
{name = "drippingwater2", length = 1.5, pitch = 1.2, ephemeral = true},
|
||||||
|
{name = "drippingwater2", length = 1.5, pitch = 1.4, ephemeral = true},
|
||||||
|
{name = "bats", length = 5, ephemeral = true}
|
||||||
|
},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:water_source"] or 0)
|
||||||
|
+ (def.totals["mcl_core:water_source"] or 0)
|
||||||
|
|
||||||
|
if c > 0 and def.pos.y < -25 then return "cave" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Jungle sounds play during day and when around 90 jungletree trunks
|
||||||
|
|
||||||
|
ambience.add_set("jungle", {
|
||||||
|
|
||||||
|
frequency = 200,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "jungle_day_1", length = 7},
|
||||||
|
{name = "deer", length = 7, ephemeral = true},
|
||||||
|
{name = "canadianloon2", length = 14},
|
||||||
|
{name = "bird1", length = 11},
|
||||||
|
{name = "peacock", length = 2, ephemeral = true},
|
||||||
|
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true},
|
||||||
|
{name = "wooden_frog", length = 2, gain = 0.2, ephemeral = true}
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = {(mod_mcl and "mcl_trees:tree_jungle" or "default:jungletree")},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:jungletree"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:tree_jungle"] or 0)
|
||||||
|
|
||||||
|
if def.tod > 0.2 and def.tod < 0.8 and c > 79 then return "jungle" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Jungle sounds play during night and when around 90 jungletree trunks
|
||||||
|
|
||||||
|
ambience.add_set("jungle_night", {
|
||||||
|
|
||||||
|
frequency = 200,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "jungle_night_1", length = 4, ephemeral = true},
|
||||||
|
{name = "jungle_night_2", length = 4, ephemeral = true},
|
||||||
|
{name = "deer", length = 7, ephemeral = true},
|
||||||
|
{name = "frog", length = 1, ephemeral = true},
|
||||||
|
{name = "frog", length = 1, pitch = 1.3, ephemeral = true},
|
||||||
|
{name = "wooden_frog", length = 2, gain = 0.2, ephemeral = true}
|
||||||
|
},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
-- jungle tree was added in last set, so doesnt need to be added in this one
|
||||||
|
local c = (def.totals["default:jungletree"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:tree_jungle"] or 0)
|
||||||
|
|
||||||
|
if (def.tod < 0.2 or def.tod > 0.8) and c > 79 then return "jungle_night" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Daytime sounds play during day when around leaves and above ground
|
||||||
|
|
||||||
|
ambience.add_set("day", {
|
||||||
|
|
||||||
|
frequency = 40,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "cardinal", length = 3, ephemeral = true},
|
||||||
|
{name = "craw", length = 3, ephemeral = true},
|
||||||
|
{name = "bluejay", length = 6, ephemeral = true},
|
||||||
|
{name = "robin", length = 4, ephemeral = true},
|
||||||
|
{name = "robin", length = 4, pitch = 1.2, ephemeral = true},
|
||||||
|
{name = "bird1", length = 11},
|
||||||
|
{name = "bird2", length = 6, ephemeral = true},
|
||||||
|
{name = "crestedlark", length = 6, ephemeral = true},
|
||||||
|
{name = "crestedlark", length = 6, pitch = 1.1, ephemeral = true},
|
||||||
|
{name = "peacock", length = 2, ephemeral = true},
|
||||||
|
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true},
|
||||||
|
{name = "wind", length = 9}
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = {"group:leaves"},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
-- use handy function to count all nodes in group:leaves
|
||||||
|
local c = ambience.group_total(def.totals, "leaves")
|
||||||
|
|
||||||
|
if (def.tod > 0.2 and def.tod < 0.8) and def.pos.y > 0 and c > 50 then
|
||||||
|
return "day"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Nighttime sounds play at night when above ground near leaves
|
||||||
|
|
||||||
|
ambience.add_set("night", {
|
||||||
|
|
||||||
|
frequency = 40,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "hornedowl", length = 2, ephemeral = true},
|
||||||
|
{name = "hornedowl", length = 2, pitch = 1.1, ephemeral = true},
|
||||||
|
{name = "wolves", length = 4, gain = 0.4, ephemeral = true},
|
||||||
|
{name = "cricket", length = 6, ephemeral = true},
|
||||||
|
{name = "deer", length = 7, ephemeral = true},
|
||||||
|
{name = "frog", length = 1, ephemeral = true},
|
||||||
|
{name = "frog", length = 1, pitch = 1.2, ephemeral = true},
|
||||||
|
{name = "wind", length = 9}
|
||||||
|
},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
-- use handy function to count all nodes in group:leaves
|
||||||
|
local c = ambience.group_total(def.totals, "leaves")
|
||||||
|
|
||||||
|
if (def.tod < 0.2 or def.tod > 0.8) and def.pos.y > 0 and c > 50 then
|
||||||
|
return "night"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Winds play when player is above 50 y-pos or near 150+ snow blocks
|
||||||
|
|
||||||
|
ambience.add_set("high_up", {
|
||||||
|
|
||||||
|
frequency = 40,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "desertwind", length = 8},
|
||||||
|
{name = "desertwind", length = 8, pitch = 1.3},
|
||||||
|
{name = "wind", length = 9},
|
||||||
|
{name = "wind", length = 9, pitch = 1.4}
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = {(mod_mcl and "mcl_core:snowblock" or "default:snowblock")},
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["default:snowblock"] or 0)
|
||||||
|
+ (def.totals["mcl_core:snowblock"] or 0)
|
||||||
|
|
||||||
|
if def.pos.y > 50 or c > 100 then return "high_up" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- caverealms sounds
|
||||||
|
|
||||||
|
if core.get_modpath("caverealms") then
|
||||||
|
|
||||||
|
-- salt crystal biome
|
||||||
|
|
||||||
|
ambience.add_set("caverealms_crystal", {
|
||||||
|
|
||||||
|
frequency = 50,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "caverealms_crystal", length = 3, ephemeral = true},
|
||||||
|
{name = "caverealms_crystal", length = 3, pitch = 0.9, ephemeral = true},
|
||||||
|
{name = "caverealms_crystal", length = 3, pitch = 1.2, ephemeral = true},
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = ({"caverealms:stone_with_salt"}),
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["caverealms:stone_with_salt"] or 0)
|
||||||
|
|
||||||
|
if c > 250 then return "caverealms_crystal" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- moss, algae, lichen area rumble
|
||||||
|
|
||||||
|
ambience.add_set("caverealms_rumble", {
|
||||||
|
|
||||||
|
frequency = 50,
|
||||||
|
|
||||||
|
sounds = {
|
||||||
|
{name = "caverealms_deep_whoosh", length = 3, ephemeral = true},
|
||||||
|
{name = "caverealms_deep_whoosh", length = 3, pitch = 0.6, ephemeral = true},
|
||||||
|
{name = "caverealms_deep_whoosh", length = 3, pitch = 0.8, ephemeral = true},
|
||||||
|
},
|
||||||
|
|
||||||
|
nodes = ({"caverealms:stone_with_moss", "caverealms:stone_with_algae",
|
||||||
|
"caverealms:stone_with_lichen"}),
|
||||||
|
|
||||||
|
sound_check = function(def)
|
||||||
|
|
||||||
|
local c = (def.totals["caverealms:stone_with_moss"] or 0) +
|
||||||
|
(def.totals["caverealms:stone_with_algae"] or 0) +
|
||||||
|
(def.totals["caverealms:stone_with_lichen"] or 0)
|
||||||
|
|
||||||
|
if def.pos.y < -50 and c > 150 then return "caverealms_rumble" end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
name: luacheck
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
luacheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Luacheck
|
||||||
|
uses: lunarmodules/luacheck@master
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
unused_args = false
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"biome_lib"
|
||||||
|
}
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
-- Stdlib
|
||||||
|
string = {fields = {"split", "trim"}},
|
||||||
|
table = {fields = {"copy"}},
|
||||||
|
|
||||||
|
-- Minetest
|
||||||
|
"minetest", "vector",
|
||||||
|
"dump", "PerlinNoise",
|
||||||
|
|
||||||
|
-- mods
|
||||||
|
"default",
|
||||||
|
}
|
||||||
@@ -0,0 +1,665 @@
|
|||||||
|
This document describes the Plantlife mod API.
|
||||||
|
|
||||||
|
Last revision: 2021-04-20
|
||||||
|
|
||||||
|
|
||||||
|
=========
|
||||||
|
Functions
|
||||||
|
=========
|
||||||
|
|
||||||
|
There are two main functions defined by this mod:
|
||||||
|
|
||||||
|
biome_lib.register_active_spawner()
|
||||||
|
biome_lib.register_on_generate()
|
||||||
|
|
||||||
|
There are also several internal, helper functions that can be called if so
|
||||||
|
desired, but they are not really intended for use by other mods and may change
|
||||||
|
at any time. They are briefly described below these main functions, but see
|
||||||
|
init.lua for details.
|
||||||
|
|
||||||
|
Most functions in biome_lib are either declared locally or kept within its
|
||||||
|
own namespace to avoid collisions/conflicts with other mods.
|
||||||
|
|
||||||
|
=====
|
||||||
|
biome_lib.register_active_spawner(biome)
|
||||||
|
biome_lib.register_active_spawner(sdelay, splant, sradius, schance, ssurface, savoid)
|
||||||
|
|
||||||
|
This first function is an ABM-based spawner function originally created as
|
||||||
|
part of Ironzorg's flowers mod. It has since been largely extended and
|
||||||
|
expanded. There are two ways to call this function: You can either pass it
|
||||||
|
several individual string and number parameters to use the legacy interface,
|
||||||
|
or you can pass a single biome definition as a table, with all of your options
|
||||||
|
spelled out nicely. This is the preferred method.
|
||||||
|
|
||||||
|
When used with the legacy interface, you must specify the parameters exactly
|
||||||
|
in order, with the first five being mandatory (even if some are set to nil),
|
||||||
|
and the last one being optional:
|
||||||
|
|
||||||
|
sdelay: The value passed to the ABM's interval parameter, in seconds.
|
||||||
|
splant: The node name of the item to spawn (e.g.
|
||||||
|
"flowers:flower_rose"). A plant will of course only be
|
||||||
|
spawned if the node about to be replaced is air.
|
||||||
|
sradius: Don't spawn within this many nodes of the avoid items
|
||||||
|
mentioned below. If set to nil, this check is skipped.
|
||||||
|
schance: The value passed to the ABM's chance parameter, normally in
|
||||||
|
the 10-100 range (1-in-X chance of operating on a given node)
|
||||||
|
ssurface: String with the name of the node on which to spawn the plant
|
||||||
|
in question, such as "default:sand" or
|
||||||
|
"default:dirt_with_grass". It is not recommended to put air,
|
||||||
|
stone, or plain dirt here if you can use some other node, as
|
||||||
|
doing so will cause the engine to process potentially large
|
||||||
|
numbers of such nodes when deciding when to execute the ABM
|
||||||
|
and where it should operate.
|
||||||
|
savoid: Table with a list of groups and/or node names to avoid when
|
||||||
|
spawning the plant, such as {"group:flowers", "default:tree"}.
|
||||||
|
|
||||||
|
When passed a table as the argument, and thus using the modern calling method,
|
||||||
|
you must pass a number of arguments in the form of an ordinary keyed-value
|
||||||
|
table. Below is a list of everything supported by this function:
|
||||||
|
|
||||||
|
biome = {
|
||||||
|
spawn_plants = something, -- [*] String or table; see below.
|
||||||
|
spawn_delay = number, -- same as sdelay, above.
|
||||||
|
spawn_chance = number, -- same as schance, above.
|
||||||
|
spawn_surfaces = {table}, -- List of node names on which the plants
|
||||||
|
-- should be spawned. As with the single-node "ssurface"
|
||||||
|
-- option in the legacy API, you should not put stone, air,
|
||||||
|
-- etc. here.
|
||||||
|
|
||||||
|
---- From here down are a number of optional parameters. You will
|
||||||
|
---- most likely want to use at least some of these to limit how and
|
||||||
|
---- where your objects are spawned.
|
||||||
|
|
||||||
|
label = string, -- set this to identify the ABM for Minetest's profiler
|
||||||
|
avoid_nodes = {table}, -- same meaning as savoid, above
|
||||||
|
avoid_radius = num, -- same as sradius
|
||||||
|
seed_diff = num, -- The Perlin seed difference value passed to the
|
||||||
|
-- minetest.get_perlin() function. Used along with
|
||||||
|
-- the global Perlin controls below to create the
|
||||||
|
-- "biome" in which the plants will spawn. Defaults
|
||||||
|
-- to 0 if not provided.
|
||||||
|
light_min = num, -- Minimum amount of light necessary to make a plant
|
||||||
|
-- spawn. Defaults to 0.
|
||||||
|
light_max = num, -- Maximum amount of light needed to spawn. Defaults
|
||||||
|
-- to the engine's MAX_LIGHT value of 14.
|
||||||
|
neighbors = {table}, -- List of neighboring nodes that need to be
|
||||||
|
-- immediately next to the node the plant is about to
|
||||||
|
-- spawn on. Can also be a string with a single node
|
||||||
|
-- name. It is both passed to the ABM as the
|
||||||
|
-- "neighbors" parameter, and is used to manually
|
||||||
|
-- check the adjacent nodes. It only takes one of
|
||||||
|
-- these for the spawn routine to mark the target as
|
||||||
|
-- spawnable. Defaults to nil (ignored).
|
||||||
|
ncount = num, -- There must be at least this many of the above
|
||||||
|
-- neighbors in the eight spaces immediately
|
||||||
|
-- surrounding the node the plant is about to spawn on
|
||||||
|
-- for it to happen. If not provided, this check is
|
||||||
|
-- disabled.
|
||||||
|
facedir = num, -- The value passed to the param2 variable when adding
|
||||||
|
-- the node to the map. Defaults to 0. Be sure that
|
||||||
|
-- the value you use here (and the range thereof) is
|
||||||
|
-- appropriate for the type of node you're spawning.
|
||||||
|
random_facedir = {table}, -- If set, the table should contain two values.
|
||||||
|
-- If they're both provided, the spawned plant will be
|
||||||
|
-- given a random facedir value in the range specified
|
||||||
|
-- by these two numbers. Overrides the facedir
|
||||||
|
-- parameter above, if it exists. Use {0,3} if you
|
||||||
|
-- want the full range for wallmounted nodes, or {2,5}
|
||||||
|
-- for most everything else, or any other pair of
|
||||||
|
-- numbers appropriate for the node you want to spawn.
|
||||||
|
depth_max = num, -- If the object spawns on top of a water source, the
|
||||||
|
-- water must be at most this deep. Defaults to 1.
|
||||||
|
min_elevation = num, -- Surface must be at this altitude or higher to
|
||||||
|
-- spawn at all. Defaults to -16 meters.
|
||||||
|
max_elevation = num, -- Surface must be no higher than this altitude.
|
||||||
|
-- Defaults to +48.
|
||||||
|
near_nodes = {table}, -- List of nodes that must be somewhere in the
|
||||||
|
-- vicinity in order for the plant to spawn. Can also
|
||||||
|
-- be a string with a single node name. If not
|
||||||
|
-- provided, this check is disabled.
|
||||||
|
near_nodes_size = num, -- How large of an area to check for the above
|
||||||
|
-- node. Specifically, this checks a flat, horizontal
|
||||||
|
-- area centered on the node to be spawned on.
|
||||||
|
-- Defaults to 0, but is ignored if the above
|
||||||
|
-- near_nodes value is not set.
|
||||||
|
near_nodes_vertical = num, -- Used with the size value above, this extends
|
||||||
|
-- the vertical range of the near nodes search.
|
||||||
|
-- Basically, this turns the flat region described
|
||||||
|
-- above into a cuboid region. The area to be checked
|
||||||
|
-- will extend this high and this low above/below the
|
||||||
|
-- target node, centered thereon. Defaults to 1 (only
|
||||||
|
-- check the layer above, the layer at, and the layer
|
||||||
|
-- below the target node), but is ignored if
|
||||||
|
-- near_nodes is not set.
|
||||||
|
near_nodes_count = num, -- How many of the above nodes must be within that
|
||||||
|
-- radius. Defaults to 1 but is ignored if near_nodes
|
||||||
|
-- isn't set. Bear in mind that the total area to be
|
||||||
|
-- checked is equal to:
|
||||||
|
-- (near_nodes_size^2)*near_nodes_vertical*2
|
||||||
|
-- For example, if size is 10 and vertical is 4, then
|
||||||
|
-- the area is (10^2)*8 = 800 nodes in size, so you'll
|
||||||
|
-- want to make sure you specify a value appropriate
|
||||||
|
-- for the size of the area being tested.
|
||||||
|
air_size = num, -- How large of an area to check for air above and
|
||||||
|
-- around the target. If omitted, only the space
|
||||||
|
-- above the target is checked. This does not check
|
||||||
|
-- for air at the sides or below the target.
|
||||||
|
air_count = num, -- How many of the surrounding nodes need to be air
|
||||||
|
-- for the above check to return true. If omitted,
|
||||||
|
-- only the space above the target is checked.
|
||||||
|
plantlife_limit = num, -- The value compared against the generic "plants
|
||||||
|
-- can grow here" Perlin noise layer. Smaller numbers
|
||||||
|
-- result in more abundant plants. Range of -1 to +1,
|
||||||
|
-- with values in the range of about 0 to 0.5 being
|
||||||
|
-- most useful. Defaults to 0.1.
|
||||||
|
temp_min = num, -- Minimum temperature needed for the desired object
|
||||||
|
-- to spawn. This is a 2d Perlin value, which has an
|
||||||
|
-- inverted range of +1 to -1. Larger values
|
||||||
|
-- represent *colder* temperatures, so this value is
|
||||||
|
-- actually the upper end of the desired Perlin range.
|
||||||
|
-- See the temperature map section at the bottom of
|
||||||
|
-- this document for details on how these values work.
|
||||||
|
-- Defaults to +1 (unlimited coldness).
|
||||||
|
temp_max = num, -- Maximum temperature/lower end of the Perlin range.
|
||||||
|
-- Defaults to -1 (unlimited heat).
|
||||||
|
humidity_min = num, -- Minimum humidity for the plant to spawn in. Like
|
||||||
|
-- the temperature map, this is a Perlin value where
|
||||||
|
-- lower numbers mean more humidity in the area.
|
||||||
|
-- Defaults to +1 (0% humidity).
|
||||||
|
humidity_max = num, -- Maximum humidity for the plant to spawn at.
|
||||||
|
-- Defaults to -1 (100% humidity).
|
||||||
|
verticals_list = {table}, -- List of nodes that should be considered to be
|
||||||
|
-- natural walls.
|
||||||
|
alt_wallnode = "string", -- If specified, this node will be substituted in
|
||||||
|
-- place of the plant(s) defined by spawn_plants
|
||||||
|
-- above, if the spawn target has one or more adjacent
|
||||||
|
-- walls. In such a case, the two above facedir
|
||||||
|
-- parameters will be ignored.
|
||||||
|
spawn_on_side = bool, -- Set this to true to immediately spawn the node on
|
||||||
|
-- one side of the target node rather than the top.
|
||||||
|
-- The code will search for an airspace to the side of
|
||||||
|
-- the target, then spawn the plant at the first one
|
||||||
|
-- found. The above facedir and random_facedir
|
||||||
|
-- parameters are ignored in this case. If the above
|
||||||
|
-- parameters for selecting generic wall nodes are
|
||||||
|
-- provided, this option is ignored. Important note:
|
||||||
|
-- the facedir values assigned by this option only
|
||||||
|
-- make sense with wallmounted nodes (nodes which
|
||||||
|
-- don't use facedir won't be affected).
|
||||||
|
choose_random_wall = bool, -- if set to true, and searching for walls is
|
||||||
|
-- being done, just pick any random wall if there is
|
||||||
|
-- one, rather than returning the first one.
|
||||||
|
spawn_on_bottom = bool, -- If set to true, spawn the object below the
|
||||||
|
-- target node instead of above it. The above
|
||||||
|
-- spawn_on_side variable takes precedence over this
|
||||||
|
-- one if both happen to be true. When using this
|
||||||
|
-- option with the random facedir function above, the
|
||||||
|
-- values given to the facedir parameter are for
|
||||||
|
-- regular nodes, not wallmounted.
|
||||||
|
spawn_replace_node = bool, -- If set to true, the target node itself is
|
||||||
|
-- replaced by the spawned object. Overrides the
|
||||||
|
-- spawn_on_bottom and spawn_on_side settings.
|
||||||
|
}
|
||||||
|
|
||||||
|
[*] spawn_plants must be either a table or a string. If it's a table, the
|
||||||
|
values therein are treated as a list of nodenames to pick from randomly on
|
||||||
|
each application of the ABM code. The more nodes you can pack into this
|
||||||
|
parameter to avoid making too many calls to this function, the lower the CPU
|
||||||
|
load will likely be.
|
||||||
|
|
||||||
|
You can also specify a string containing the name of a function to execute.
|
||||||
|
In this case, the function will be passed a single position parameter
|
||||||
|
indicating where the function should place the desired object, and the checks
|
||||||
|
for spawning on top vs. sides vs. bottom vs. replacing the target node will be
|
||||||
|
skipped.
|
||||||
|
|
||||||
|
By default, if a biome node, size, and count are not defined, the biome
|
||||||
|
checking is disabled. Same holds true for the nneighbors bit above that.
|
||||||
|
|
||||||
|
|
||||||
|
=====
|
||||||
|
biome_lib.register_on_generate(biome, nodes_or_function_or_treedef)
|
||||||
|
|
||||||
|
To register an object to be spawned at mapgen time rather than via an ABM,
|
||||||
|
call this function with two parameters: a table with your object's biome
|
||||||
|
information, and a string, function, or table describing what to do if the
|
||||||
|
engine finds a suitable surface node (see below).
|
||||||
|
|
||||||
|
The biome table contains quite a number of options, though there are fewer
|
||||||
|
here than are available in the ABM-based spawner, as some stuff doesn't make
|
||||||
|
sense at map-generation time.
|
||||||
|
|
||||||
|
biome = {
|
||||||
|
surface = something, -- What node(s). May be a string such as
|
||||||
|
-- "default:dirt_with_grass" or a table with
|
||||||
|
-- multiple such entries.
|
||||||
|
|
||||||
|
---- Everything else is optional, but you'll definitely want to use
|
||||||
|
---- some of these other fields to limit where and under what
|
||||||
|
---- conditions the objects are spawned.
|
||||||
|
|
||||||
|
below_nodes = {table}, -- List of nodes that must be below the target
|
||||||
|
-- node. Useful in snow biomes to keep objects from
|
||||||
|
-- spawning in snow that's on the wrong surface for
|
||||||
|
-- that object.
|
||||||
|
avoid_nodes = {table}, -- List of nodes to avoid when spawning. Groups are
|
||||||
|
-- not supported here.
|
||||||
|
avoid_radius = num, -- How much distance to leave between the object to be
|
||||||
|
-- added and the objects to be avoided. If this or
|
||||||
|
-- the avoid_nodes value is nil/omitted, this check is
|
||||||
|
-- skipped. Avoid using excessively large radii.
|
||||||
|
rarity = num, -- How rare should this object be in its biome? Larger
|
||||||
|
-- values make objects more rare, via:
|
||||||
|
-- math.random() * 100 > this
|
||||||
|
rarity_fertility -- The amount that the rarity is reduced by fertility.
|
||||||
|
= num, -- This makes the rarity field the upper bound for
|
||||||
|
-- rarity, and (rarity - rarity_fertility) the lower
|
||||||
|
-- bound. Defaults to 0.
|
||||||
|
max_count = num, -- The absolute maximum number of your object that
|
||||||
|
-- should be allowed to spawn in a 5x5x5 mapblock area
|
||||||
|
-- (80x80x80 nodes). Defaults to 5, but be sure you
|
||||||
|
-- set this to some reasonable value depending on your
|
||||||
|
-- object and its size if 5 is insufficient.
|
||||||
|
tries = num, -- the number of attempts that will be made to spawn
|
||||||
|
-- an object, defaults to 2. This means if the first
|
||||||
|
-- attempt fails due to something blocking the object
|
||||||
|
-- for example, another attempt will be made in
|
||||||
|
-- another random location.
|
||||||
|
seed_diff = num, -- Perlin seed-diff value. Defaults to 0, which
|
||||||
|
-- causes the function to inherit the global value of
|
||||||
|
-- 329.
|
||||||
|
neighbors = {table}, -- What ground nodes must be right next to and at the
|
||||||
|
-- same elevation as the node to be spawned on.
|
||||||
|
ncount = num, -- At least this many of the above nodes must be next
|
||||||
|
-- to the node to spawn on. Any value greater than 8
|
||||||
|
-- will probably cause the code to never spawn
|
||||||
|
-- anything. Defaults to 0.
|
||||||
|
depth = num, -- How deep/thick of a layer the spawned-on node must
|
||||||
|
-- be. Typically used for water.
|
||||||
|
min_elevation = num, -- Minimum elevation in meters/nodes. Defaults to
|
||||||
|
-- -16 meters.
|
||||||
|
max_elevation = num, -- Max elevation. Defaults to +48m.
|
||||||
|
near_nodes = {table}, -- what nodes must be in the general vicinity of the
|
||||||
|
-- object being spawned.
|
||||||
|
near_nodes_size = num, -- how wide of a search area to look for the nodes
|
||||||
|
-- in that list.
|
||||||
|
near_nodes_vertical = num, -- How high/low of an area to search from the
|
||||||
|
-- target node.
|
||||||
|
near_nodes_count = num, -- at least this many of those nodes must be in
|
||||||
|
-- the area.
|
||||||
|
plantlife_limit = num, -- The value compared against the generic "plants
|
||||||
|
-- can grow here" Perlin noise layer. Smaller numbers
|
||||||
|
-- result in more abundant plants. Range of -1 to +1,
|
||||||
|
-- with values in the range of about 0 to 0.5 being
|
||||||
|
-- most useful. Defaults to 0.1.
|
||||||
|
temp_min = num, -- Coldest allowable temperature for a plant to spawn
|
||||||
|
-- (that is, the largest Perlin value).
|
||||||
|
temp_max = num, -- warmest allowable temperature to spawn a plant
|
||||||
|
-- (lowest Perlin value).
|
||||||
|
verticals_list = {table}, -- Same as with the spawn_on_surfaces function.
|
||||||
|
check_air = bool, -- Flag to tell the mapgen code to check for air above
|
||||||
|
-- the spawn target. Defaults to true if not
|
||||||
|
-- explicitly set to false. Set this to false VERY
|
||||||
|
-- SPARINGLY, as it will slow the map generator down.
|
||||||
|
delete_above = bool, -- Flag to tell the mapgen code to delete the two
|
||||||
|
-- nodes directly above the spawn target just before
|
||||||
|
-- adding the plant or tree. Useful when generating
|
||||||
|
-- in snow biomes. Defaults to false.
|
||||||
|
delete_above_surround = bool, -- Flag to tell the mapgen code to also
|
||||||
|
-- delete the five nodes surrounding the above space,
|
||||||
|
-- and the five nodes above those, resulting in a two-
|
||||||
|
-- node-deep cross-shaped empty region above/around
|
||||||
|
-- the spawn target. Useful when adding trees to snow
|
||||||
|
-- biomes. Defaults to false.
|
||||||
|
spawn_replace_node = bool, -- same as with the ABM spawner.
|
||||||
|
random_facedir = {table}, -- same as with the ABM spawner.
|
||||||
|
}
|
||||||
|
|
||||||
|
Regarding nodes_or_function_or_treedef, this must either be a string naming
|
||||||
|
a node to spawn, a table with a list of nodes to choose from, a table with an
|
||||||
|
L-Systems tree definition, or a function.
|
||||||
|
|
||||||
|
If you specified a string, the code will attempt to determine whether that
|
||||||
|
string specifies a valid node name. If it does, that node will be placed on
|
||||||
|
top of the target position directly (unless one of the other mapgen options
|
||||||
|
directs the code to do otherwise).
|
||||||
|
|
||||||
|
If you specified a table and there is no "axiom" field, the code assumes that
|
||||||
|
it is a list of nodes. Simply name one node per entry in the list, e.g.
|
||||||
|
{"default:junglegrass", "default:dry_shrub"} and so on, for as many nodes as
|
||||||
|
you want to list. A random node from the list will be chosen each time the
|
||||||
|
code goes to place a node.
|
||||||
|
|
||||||
|
If you specified a table, and there *is* an "axiom" field, the code assumes
|
||||||
|
that this table contains an L-Systems tree definition, which will be passed
|
||||||
|
directly to the engine's spawn_tree() function along with the position on
|
||||||
|
which to spawn the tree.
|
||||||
|
|
||||||
|
You can also supply a function to be directly executed, which is given the
|
||||||
|
current node position (the usual "pos" table format) as its sole argument. It
|
||||||
|
will be called in the form:
|
||||||
|
|
||||||
|
somefunction(pos)
|
||||||
|
|
||||||
|
=====
|
||||||
|
biome_lib.update_plant(options)
|
||||||
|
|
||||||
|
This third function is used to turn the spawned nodes above into something
|
||||||
|
else over time. This function has no return value, and accepts a biome
|
||||||
|
definition table as the only parameter. These are defined like so:
|
||||||
|
|
||||||
|
options = {
|
||||||
|
label = string, -- set this to identify the ABM for Minetest's
|
||||||
|
-- profiler. If not set, biome_lib will set it to
|
||||||
|
-- "biome_lib.update_plant(): " appended with the node
|
||||||
|
-- in grow_plant (or the first item if it's a table)
|
||||||
|
grow_plant = "string" or {table}, -- Name(s) of the node(s) to be grown
|
||||||
|
-- into something else. This value is passed to the
|
||||||
|
-- ABM as the "nodenames" parameter, so the plants
|
||||||
|
-- themselves are the ABM trigger, rather than
|
||||||
|
-- the ground they spawned on. A plant will only grow
|
||||||
|
-- if the node above it is air. If you use a table,
|
||||||
|
-- note that all nodes referenced therein will be
|
||||||
|
-- grown into the same final object.
|
||||||
|
grow_delay = num, -- Passed as the ABM "interval" parameter, as with
|
||||||
|
-- spawning.
|
||||||
|
grow_chance = num, -- Passed as the ABM "chance" parameter.
|
||||||
|
grow_result = "string", -- Name of the node into which the grow_plant
|
||||||
|
-- node(s) should transform when the ABM executes.
|
||||||
|
|
||||||
|
---- Everything from here down is optional.
|
||||||
|
|
||||||
|
dry_early_node = "string", -- This value is ignored except for jungle
|
||||||
|
-- grass (a corner case needed by that mod), where it
|
||||||
|
-- indicates which node the grass must be on in order
|
||||||
|
-- for it to turn from the short size to
|
||||||
|
-- "default:dry_shrub" instead of the medium size.
|
||||||
|
grow_nodes = {table}, -- One of these nodes must be under the plant in
|
||||||
|
-- order for it to grow at all. Normally this should
|
||||||
|
-- be the same as the list of surfaces passed to the
|
||||||
|
-- spawning ABM as the "nodenames" parameter. This is
|
||||||
|
-- so that the plant can be manually placed on
|
||||||
|
-- something like a flower pot or something without it
|
||||||
|
-- necessarily growing and perhaps dieing. Defaults
|
||||||
|
-- to "default:dirt_with_grass".
|
||||||
|
facedir = num, -- Same as with spawning a plant.
|
||||||
|
need_wall = bool, -- Set this to true if you the plant needs to grow
|
||||||
|
-- against a wall. Defaults to false.
|
||||||
|
verticals_list = {table}, -- same as with spawning a plant.
|
||||||
|
choose_random_wall = bool, -- same as with spawning a plant.
|
||||||
|
grow_vertically = bool, -- Set this to true if the plant needs to grow
|
||||||
|
-- vertically, as in climbing poison ivy. Defaults to
|
||||||
|
-- false.
|
||||||
|
height_limit = num, -- Set this to limit how tall the desired node can
|
||||||
|
-- grow. The mod will search straight down from the
|
||||||
|
-- position being spawned at to find a ground node,
|
||||||
|
-- set via the field below. Defaults to 5 nodes.
|
||||||
|
ground_nodes = {table}, -- What nodes should be treated as "the ground"
|
||||||
|
-- below a vertically-growing plant. Usually this
|
||||||
|
-- should be the same as the grow_nodes table, but
|
||||||
|
-- might also include, for example, water or some
|
||||||
|
-- other surrounding material. Defaults to
|
||||||
|
-- "default:dirt_with_grass".
|
||||||
|
grow_function = something, -- [*] see below.
|
||||||
|
seed_diff = num, -- [*] see below.
|
||||||
|
}
|
||||||
|
|
||||||
|
[*] grow_function can take one of three possible settings: it can be nil (or
|
||||||
|
not provided), a string, or a table.
|
||||||
|
|
||||||
|
If it is not provided or it's set to nil, all of the regular growing code is
|
||||||
|
executed normally, the value of seed_diff, if any, is ignored, and the node to
|
||||||
|
be placed is assumed to be specified in the grow_result variable.
|
||||||
|
|
||||||
|
If this value is set to a simple string, this is treated as the name of the
|
||||||
|
function to use to grow the plant. In this case, all of the usual growing
|
||||||
|
code is executeed, but then instead of a plant being simply added to the
|
||||||
|
world, grow_result is ignored and the named function is executed and passed a
|
||||||
|
few parmeters in the following general form:
|
||||||
|
|
||||||
|
somefunction(pos, perlin1, perlin2)
|
||||||
|
|
||||||
|
These values represent the current position (the usual table), the Perlin
|
||||||
|
noise value for that spot in the generic "plants can grow here" map for the
|
||||||
|
seed_diff value above, the Perlin value for that same spot from the
|
||||||
|
temperature map, and the detected neighboring wall face, if there was one (or
|
||||||
|
nil if not). If seed_diff is not provided, it defaults to 0.
|
||||||
|
|
||||||
|
If this variable is instead set to a table, it is treated an an L-Systems tree
|
||||||
|
definition. All of the growing code is executed in the usual manner, then the
|
||||||
|
tree described by that definition is spawned at the current position instead,
|
||||||
|
and grow_result is ignored.
|
||||||
|
|
||||||
|
|
||||||
|
=====
|
||||||
|
biome_lib.find_adjacent_wall(pos, verticals, randomflag)
|
||||||
|
|
||||||
|
Of the few helper functions, this one expects a position parameter and a table
|
||||||
|
with the list of nodes that should be considered as walls. The code will
|
||||||
|
search around the given position for a neighboring wall, returning the first
|
||||||
|
one it finds as a facedir value, or nil if there are no adjacent walls.
|
||||||
|
|
||||||
|
If randomflag is set to true, the function will just return the facedir of any
|
||||||
|
random wall it finds adjacent to the target position. Defaults to false if
|
||||||
|
not specified.
|
||||||
|
|
||||||
|
=====
|
||||||
|
biome_lib.is_node_loaded(pos)
|
||||||
|
|
||||||
|
This acts as a wrapper for the minetest.get_node_or_nil(node_pos)
|
||||||
|
function and accepts a single position parameter. Returns true if the node in
|
||||||
|
question is already loaded, or false if not.
|
||||||
|
|
||||||
|
|
||||||
|
=====
|
||||||
|
biome_lib.dbg(string, level)
|
||||||
|
|
||||||
|
This is a simple debug output function which takes one string parameter. It
|
||||||
|
just checks if DEBUG is true and outputs the phrase "[Plantlife] " followed by
|
||||||
|
the supplied string, via the print() function, if so.
|
||||||
|
|
||||||
|
'level' is a number that, if supplied, dictates the lowest 'biome_lib_debug'
|
||||||
|
can be set to in minetest.conf for this message to be displayed. Both the
|
||||||
|
default log level and the default message level are 0, thus always showing the
|
||||||
|
supplied message.
|
||||||
|
|
||||||
|
Although it's not set in stone, a good practice is to use a level of 0 (or
|
||||||
|
just omit the value) for anything that generally important enough that it
|
||||||
|
ought always be shown, 1 for errors, 2 for warnings, 3 for info, 4 for verbose
|
||||||
|
spammy stuff.
|
||||||
|
|
||||||
|
=====
|
||||||
|
biome_lib.generate_ltree(pos, treemodel)
|
||||||
|
biome_lib.grow_ltree(pos, treemodel)
|
||||||
|
|
||||||
|
In the case of the growing code and the mapgen-based tree generator code,
|
||||||
|
generating a tree is done via the above two calls, which in turn immediately
|
||||||
|
call the usual spawn_tree() functions. This rerouting exists as a way for
|
||||||
|
other mods to hook into biome_lib's tree-growing functions in general,
|
||||||
|
perhaps to execute something extra whenever a tree is spawned.
|
||||||
|
|
||||||
|
biome_lib.generate_ltree(pos, treemodel) is called any time a tree is spawned
|
||||||
|
at map generation time. 'pos' is the position of the block on which the tree
|
||||||
|
is to be placed. 'treemodel' is the standard L-Systems tree definition table
|
||||||
|
expected by the spawn_tree() function. Refer to the 'trunk' field in that
|
||||||
|
table to derive the name of the tree being spawned.
|
||||||
|
|
||||||
|
biome_lib.grow_ltree(pos, treemodel) does the same sort of thing whenever a
|
||||||
|
tree is spawned within the abm-based growing code, for example when growing a
|
||||||
|
sapling into a tree.
|
||||||
|
|
||||||
|
|
||||||
|
=====
|
||||||
|
There are other, internal helper functions that are not meant for use by other
|
||||||
|
mods. Don't rely on them, as they are subject to change without notice.
|
||||||
|
|
||||||
|
======================
|
||||||
|
Fertile Ground Mapping
|
||||||
|
======================
|
||||||
|
|
||||||
|
The mod uses Perlin noise to create "biomes" of the various plants, via the
|
||||||
|
minetest.get_perlin() function. At present, there are three layers of
|
||||||
|
Perlin noise used.
|
||||||
|
|
||||||
|
The first one is for a "fertile ground" layer, which I tend to refer to as the
|
||||||
|
generic "stuff can potentially grow here" layer. Its values are hard-coded:
|
||||||
|
|
||||||
|
perlin_octaves = 3
|
||||||
|
perlin_persistence = 0.6
|
||||||
|
perlin_scale = 100
|
||||||
|
|
||||||
|
For more information on how Perlin noise is generated, you will need to search
|
||||||
|
the web, as these default values were from that which is used by minetest_game
|
||||||
|
to spawn jungle grass at mapgen time, and I'm still learning how Perlin noise
|
||||||
|
works. ;-)
|
||||||
|
|
||||||
|
|
||||||
|
===================
|
||||||
|
Temperature Mapping
|
||||||
|
===================
|
||||||
|
|
||||||
|
The second Perlin layer is a temperature map, with values taken from
|
||||||
|
SPlizard's Snow Biomes mod so that the two will be compatible, since that mod
|
||||||
|
appears to be the standard now. Those values are:
|
||||||
|
|
||||||
|
temperature_seeddiff = 112
|
||||||
|
temperature_octaves = 3
|
||||||
|
temperature_persistence = 0.5
|
||||||
|
temperature_scale = 150
|
||||||
|
|
||||||
|
The way Perlin values are used by this mod, in keeping with the snow mod's
|
||||||
|
apparent methods, larger values returned by the Perlin function represent
|
||||||
|
*colder* temperatures. In this mod, the following table gives a rough
|
||||||
|
approximation of how temperature maps to these values, normalized to
|
||||||
|
0.53 = 0 °C and +1.0 = -25 °C.
|
||||||
|
|
||||||
|
Perlin Approx. Temperature
|
||||||
|
-1.0 81 °C ( 178 °F)
|
||||||
|
-0.75 68 °C ( 155 °F)
|
||||||
|
-0.56 58 °C ( 136 °F)
|
||||||
|
-0.5 55 °C ( 131 °F)
|
||||||
|
-0.25 41 °C ( 107 °F)
|
||||||
|
-0.18 38 °C ( 100 °F)
|
||||||
|
0 28 °C ( 83 °F)
|
||||||
|
0.13 21 °C ( 70 °F)
|
||||||
|
0.25 15 °C ( 59 °F)
|
||||||
|
0.5 2 °C ( 35 °F)
|
||||||
|
0.53 0 °C ( 32 °F)
|
||||||
|
0.75 -12 °C ( 11 °F)
|
||||||
|
0.86 -18 °C ( 0 °F)
|
||||||
|
1.0 -25 °C (- 13 °F)
|
||||||
|
|
||||||
|
Included in this table are even 0.25 steps in Perlin values along with some
|
||||||
|
common temperatures on both the Centigrade and Fahrenheit scales. Note that
|
||||||
|
unless you're trying to model the Moon or perhaps Mercury in your mods/maps,
|
||||||
|
you probably won't need to bother with Perlin values of less than -0.56 or so.
|
||||||
|
|
||||||
|
|
||||||
|
================
|
||||||
|
Humidity Mapping
|
||||||
|
================
|
||||||
|
|
||||||
|
Last but not least is a moisture/humidity map. Like the temperature map
|
||||||
|
above, Perlin values can be tested to determine the approximate humidity of
|
||||||
|
the *air* in the area. This humidity map is basically the perlin layer used
|
||||||
|
for deserts.
|
||||||
|
|
||||||
|
A value of +1.0 is very moist (basically a thick fog, if it could be seen), a
|
||||||
|
value of roughly +0.25 represents the edge of a desert as usually seen in the
|
||||||
|
game, and a value of -1.0 is as dry as a bone.
|
||||||
|
|
||||||
|
This does not check for nearby water, just general air humidity, and that
|
||||||
|
being the case, nearby ground does not affect the reported humidity of a
|
||||||
|
region (because this isn't yet possible to calculate yet). Use the near_nodes
|
||||||
|
and avoid_nodes parameters and their related options to check for water and
|
||||||
|
such.
|
||||||
|
|
||||||
|
The Perlin values use for this layer are:
|
||||||
|
|
||||||
|
humidity_seeddiff = 9130
|
||||||
|
humidity_octaves = 3
|
||||||
|
humidity_persistence = 0.5
|
||||||
|
humidity_scale = 250
|
||||||
|
|
||||||
|
And this particular one is mapped slightly differently from the others:
|
||||||
|
|
||||||
|
noise3 = perlin3:get2d({x=p_top.x+150, y=p_top.z+50})
|
||||||
|
|
||||||
|
(Note the +150 and +50 offsets)
|
||||||
|
|
||||||
|
|
||||||
|
==================
|
||||||
|
Default game nodes
|
||||||
|
==================
|
||||||
|
|
||||||
|
Although this project was intended to be used with minetest_game, it can be
|
||||||
|
configured to work with something else instead. All you need to do is provide
|
||||||
|
the names of the nodes in your game you want biome_lib's internals to use.
|
||||||
|
|
||||||
|
See settingtypes.txt for a list. Any item listed there can be changed either
|
||||||
|
by adding it to your minetest.conf, or by using the "all settings" menu in
|
||||||
|
Minetest, whatever's appropriate for your particular setup.
|
||||||
|
|
||||||
|
==================
|
||||||
|
Engine Decorations
|
||||||
|
==================
|
||||||
|
|
||||||
|
If a call to biome_lib.register_on_generate() contains items and biome
|
||||||
|
definition settings that are suitable, biome_lib will pass that call on to the
|
||||||
|
engine instead, to use its built-in decorations feature, since it'll be much
|
||||||
|
faster than Lua.
|
||||||
|
|
||||||
|
For this to work, first the item to be added must either be a node, or a
|
||||||
|
table with a list of nodes that biome_lib would normally pick from randomly.
|
||||||
|
That is to say, you cannot specify an L-tree or a function here, as the engine
|
||||||
|
does not support that sort of thing (biome_lib will just switch to its normal
|
||||||
|
handling if you do).
|
||||||
|
|
||||||
|
Second, these biome definition items must not be present:
|
||||||
|
|
||||||
|
* below_nodes
|
||||||
|
* avoid_nodes
|
||||||
|
* avoid_radius
|
||||||
|
* neighbors
|
||||||
|
* ncount
|
||||||
|
* depth
|
||||||
|
* near_nodes_size
|
||||||
|
* near_nodes_vertical
|
||||||
|
* temp_min
|
||||||
|
* temp_max
|
||||||
|
* verticals_list
|
||||||
|
* delete_above
|
||||||
|
* delete_above_surround
|
||||||
|
|
||||||
|
The plantlife_limit definition item is ignored when checking if a particular
|
||||||
|
call can be routed to the engine.
|
||||||
|
|
||||||
|
The call given to the engine will use the remaining biome definition items in
|
||||||
|
the following manner:
|
||||||
|
|
||||||
|
deco_type = "simple",
|
||||||
|
flags = "all_floors"
|
||||||
|
decoration = node or table with node list
|
||||||
|
place_on = surface
|
||||||
|
y_min = min_elevation
|
||||||
|
y_max = max_elevation
|
||||||
|
spawn_by = near_nodes
|
||||||
|
num_spawn_by = near_nodes_count
|
||||||
|
param2 = \_ set to the range specified by the biome definition's
|
||||||
|
param2_max = / random_facedir table, if present, otherwise omitted
|
||||||
|
noise_params = {
|
||||||
|
octaves = biome_lib.fertile_perlin_octaves,
|
||||||
|
persist = biome_lib.fertile_perlin_persistence * (250/biome_lib.fertile_perlin_scale),
|
||||||
|
scale = ((100-biome.rarity)/100) * (math.min(biome.max_count, 6400)/6400),
|
||||||
|
seed = biome.seed_diff,
|
||||||
|
offset = 0,
|
||||||
|
spread = {x = 100, y = 100, z = 100},
|
||||||
|
lacunarity = 2,
|
||||||
|
flags = "absvalue"
|
||||||
|
}
|
||||||
|
|
||||||
|
If the biome definition's check_air setting is false, "force_placement" is
|
||||||
|
added to the decoration's flags setting.
|
||||||
|
|
||||||
|
If the biome def's spawn_replace_node is set to true, the decoration's
|
||||||
|
place_offset_y is set to -1 (otherwise it is omitted).
|
||||||
@@ -0,0 +1,600 @@
|
|||||||
|
License for code: LGPL 3.0
|
||||||
|
License for media and all other assets: CC-by-SA 4.0
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Attribution-ShareAlike 4.0 International
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
||||||
|
does not provide legal services or legal advice. Distribution of
|
||||||
|
Creative Commons public licenses does not create a lawyer-client or
|
||||||
|
other relationship. Creative Commons makes its licenses and related
|
||||||
|
information available on an "as-is" basis. Creative Commons gives no
|
||||||
|
warranties regarding its licenses, any material licensed under their
|
||||||
|
terms and conditions, or any related information. Creative Commons
|
||||||
|
disclaims all liability for damages resulting from their use to the
|
||||||
|
fullest extent possible.
|
||||||
|
|
||||||
|
Using Creative Commons Public Licenses
|
||||||
|
|
||||||
|
Creative Commons public licenses provide a standard set of terms and
|
||||||
|
conditions that creators and other rights holders may use to share
|
||||||
|
original works of authorship and other material subject to copyright
|
||||||
|
and certain other rights specified in the public license below. The
|
||||||
|
following considerations are for informational purposes only, are not
|
||||||
|
exhaustive, and do not form part of our licenses.
|
||||||
|
|
||||||
|
Considerations for licensors: Our public licenses are
|
||||||
|
intended for use by those authorized to give the public
|
||||||
|
permission to use material in ways otherwise restricted by
|
||||||
|
copyright and certain other rights. Our licenses are
|
||||||
|
irrevocable. Licensors should read and understand the terms
|
||||||
|
and conditions of the license they choose before applying it.
|
||||||
|
Licensors should also secure all rights necessary before
|
||||||
|
applying our licenses so that the public can reuse the
|
||||||
|
material as expected. Licensors should clearly mark any
|
||||||
|
material not subject to the license. This includes other CC-
|
||||||
|
licensed material, or material used under an exception or
|
||||||
|
limitation to copyright. More considerations for licensors:
|
||||||
|
wiki.creativecommons.org/Considerations_for_licensors
|
||||||
|
|
||||||
|
Considerations for the public: By using one of our public
|
||||||
|
licenses, a licensor grants the public permission to use the
|
||||||
|
licensed material under specified terms and conditions. If
|
||||||
|
the licensor's permission is not necessary for any reason--for
|
||||||
|
example, because of any applicable exception or limitation to
|
||||||
|
copyright--then that use is not regulated by the license. Our
|
||||||
|
licenses grant only permissions under copyright and certain
|
||||||
|
other rights that a licensor has authority to grant. Use of
|
||||||
|
the licensed material may still be restricted for other
|
||||||
|
reasons, including because others have copyright or other
|
||||||
|
rights in the material. A licensor may make special requests,
|
||||||
|
such as asking that all changes be marked or described.
|
||||||
|
Although not required by our licenses, you are encouraged to
|
||||||
|
respect those requests where reasonable. More considerations
|
||||||
|
for the public:
|
||||||
|
wiki.creativecommons.org/Considerations_for_licensees
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
Creative Commons Attribution-ShareAlike 4.0 International Public
|
||||||
|
License
|
||||||
|
|
||||||
|
By exercising the Licensed Rights (defined below), You accept and agree
|
||||||
|
to be bound by the terms and conditions of this Creative Commons
|
||||||
|
Attribution-ShareAlike 4.0 International Public License ("Public
|
||||||
|
License"). To the extent this Public License may be interpreted as a
|
||||||
|
contract, You are granted the Licensed Rights in consideration of Your
|
||||||
|
acceptance of these terms and conditions, and the Licensor grants You
|
||||||
|
such rights in consideration of benefits the Licensor receives from
|
||||||
|
making the Licensed Material available under these terms and
|
||||||
|
conditions.
|
||||||
|
|
||||||
|
|
||||||
|
Section 1 -- Definitions.
|
||||||
|
|
||||||
|
a. Adapted Material means material subject to Copyright and Similar
|
||||||
|
Rights that is derived from or based upon the Licensed Material
|
||||||
|
and in which the Licensed Material is translated, altered,
|
||||||
|
arranged, transformed, or otherwise modified in a manner requiring
|
||||||
|
permission under the Copyright and Similar Rights held by the
|
||||||
|
Licensor. For purposes of this Public License, where the Licensed
|
||||||
|
Material is a musical work, performance, or sound recording,
|
||||||
|
Adapted Material is always produced where the Licensed Material is
|
||||||
|
synched in timed relation with a moving image.
|
||||||
|
|
||||||
|
b. Adapter's License means the license You apply to Your Copyright
|
||||||
|
and Similar Rights in Your contributions to Adapted Material in
|
||||||
|
accordance with the terms and conditions of this Public License.
|
||||||
|
|
||||||
|
c. BY-SA Compatible License means a license listed at
|
||||||
|
creativecommons.org/compatiblelicenses, approved by Creative
|
||||||
|
Commons as essentially the equivalent of this Public License.
|
||||||
|
|
||||||
|
d. Copyright and Similar Rights means copyright and/or similar rights
|
||||||
|
closely related to copyright including, without limitation,
|
||||||
|
performance, broadcast, sound recording, and Sui Generis Database
|
||||||
|
Rights, without regard to how the rights are labeled or
|
||||||
|
categorized. For purposes of this Public License, the rights
|
||||||
|
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||||
|
Rights.
|
||||||
|
|
||||||
|
e. Effective Technological Measures means those measures that, in the
|
||||||
|
absence of proper authority, may not be circumvented under laws
|
||||||
|
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||||
|
Treaty adopted on December 20, 1996, and/or similar international
|
||||||
|
agreements.
|
||||||
|
|
||||||
|
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||||
|
any other exception or limitation to Copyright and Similar Rights
|
||||||
|
that applies to Your use of the Licensed Material.
|
||||||
|
|
||||||
|
g. License Elements means the license attributes listed in the name
|
||||||
|
of a Creative Commons Public License. The License Elements of this
|
||||||
|
Public License are Attribution and ShareAlike.
|
||||||
|
|
||||||
|
h. Licensed Material means the artistic or literary work, database,
|
||||||
|
or other material to which the Licensor applied this Public
|
||||||
|
License.
|
||||||
|
|
||||||
|
i. Licensed Rights means the rights granted to You subject to the
|
||||||
|
terms and conditions of this Public License, which are limited to
|
||||||
|
all Copyright and Similar Rights that apply to Your use of the
|
||||||
|
Licensed Material and that the Licensor has authority to license.
|
||||||
|
|
||||||
|
j. Licensor means the individual(s) or entity(ies) granting rights
|
||||||
|
under this Public License.
|
||||||
|
|
||||||
|
k. Share means to provide material to the public by any means or
|
||||||
|
process that requires permission under the Licensed Rights, such
|
||||||
|
as reproduction, public display, public performance, distribution,
|
||||||
|
dissemination, communication, or importation, and to make material
|
||||||
|
available to the public including in ways that members of the
|
||||||
|
public may access the material from a place and at a time
|
||||||
|
individually chosen by them.
|
||||||
|
|
||||||
|
l. Sui Generis Database Rights means rights other than copyright
|
||||||
|
resulting from Directive 96/9/EC of the European Parliament and of
|
||||||
|
the Council of 11 March 1996 on the legal protection of databases,
|
||||||
|
as amended and/or succeeded, as well as other essentially
|
||||||
|
equivalent rights anywhere in the world.
|
||||||
|
|
||||||
|
m. You means the individual or entity exercising the Licensed Rights
|
||||||
|
under this Public License. Your has a corresponding meaning.
|
||||||
|
|
||||||
|
|
||||||
|
Section 2 -- Scope.
|
||||||
|
|
||||||
|
a. License grant.
|
||||||
|
|
||||||
|
1. Subject to the terms and conditions of this Public License,
|
||||||
|
the Licensor hereby grants You a worldwide, royalty-free,
|
||||||
|
non-sublicensable, non-exclusive, irrevocable license to
|
||||||
|
exercise the Licensed Rights in the Licensed Material to:
|
||||||
|
|
||||||
|
a. reproduce and Share the Licensed Material, in whole or
|
||||||
|
in part; and
|
||||||
|
|
||||||
|
b. produce, reproduce, and Share Adapted Material.
|
||||||
|
|
||||||
|
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||||
|
Exceptions and Limitations apply to Your use, this Public
|
||||||
|
License does not apply, and You do not need to comply with
|
||||||
|
its terms and conditions.
|
||||||
|
|
||||||
|
3. Term. The term of this Public License is specified in Section
|
||||||
|
6(a).
|
||||||
|
|
||||||
|
4. Media and formats; technical modifications allowed. The
|
||||||
|
Licensor authorizes You to exercise the Licensed Rights in
|
||||||
|
all media and formats whether now known or hereafter created,
|
||||||
|
and to make technical modifications necessary to do so. The
|
||||||
|
Licensor waives and/or agrees not to assert any right or
|
||||||
|
authority to forbid You from making technical modifications
|
||||||
|
necessary to exercise the Licensed Rights, including
|
||||||
|
technical modifications necessary to circumvent Effective
|
||||||
|
Technological Measures. For purposes of this Public License,
|
||||||
|
simply making modifications authorized by this Section 2(a)
|
||||||
|
(4) never produces Adapted Material.
|
||||||
|
|
||||||
|
5. Downstream recipients.
|
||||||
|
|
||||||
|
a. Offer from the Licensor -- Licensed Material. Every
|
||||||
|
recipient of the Licensed Material automatically
|
||||||
|
receives an offer from the Licensor to exercise the
|
||||||
|
Licensed Rights under the terms and conditions of this
|
||||||
|
Public License.
|
||||||
|
|
||||||
|
b. Additional offer from the Licensor -- Adapted Material.
|
||||||
|
Every recipient of Adapted Material from You
|
||||||
|
automatically receives an offer from the Licensor to
|
||||||
|
exercise the Licensed Rights in the Adapted Material
|
||||||
|
under the conditions of the Adapter's License You apply.
|
||||||
|
|
||||||
|
c. No downstream restrictions. You may not offer or impose
|
||||||
|
any additional or different terms or conditions on, or
|
||||||
|
apply any Effective Technological Measures to, the
|
||||||
|
Licensed Material if doing so restricts exercise of the
|
||||||
|
Licensed Rights by any recipient of the Licensed
|
||||||
|
Material.
|
||||||
|
|
||||||
|
6. No endorsement. Nothing in this Public License constitutes or
|
||||||
|
may be construed as permission to assert or imply that You
|
||||||
|
are, or that Your use of the Licensed Material is, connected
|
||||||
|
with, or sponsored, endorsed, or granted official status by,
|
||||||
|
the Licensor or others designated to receive attribution as
|
||||||
|
provided in Section 3(a)(1)(A)(i).
|
||||||
|
|
||||||
|
b. Other rights.
|
||||||
|
|
||||||
|
1. Moral rights, such as the right of integrity, are not
|
||||||
|
licensed under this Public License, nor are publicity,
|
||||||
|
privacy, and/or other similar personality rights; however, to
|
||||||
|
the extent possible, the Licensor waives and/or agrees not to
|
||||||
|
assert any such rights held by the Licensor to the limited
|
||||||
|
extent necessary to allow You to exercise the Licensed
|
||||||
|
Rights, but not otherwise.
|
||||||
|
|
||||||
|
2. Patent and trademark rights are not licensed under this
|
||||||
|
Public License.
|
||||||
|
|
||||||
|
3. To the extent possible, the Licensor waives any right to
|
||||||
|
collect royalties from You for the exercise of the Licensed
|
||||||
|
Rights, whether directly or through a collecting society
|
||||||
|
under any voluntary or waivable statutory or compulsory
|
||||||
|
licensing scheme. In all other cases the Licensor expressly
|
||||||
|
reserves any right to collect such royalties.
|
||||||
|
|
||||||
|
|
||||||
|
Section 3 -- License Conditions.
|
||||||
|
|
||||||
|
Your exercise of the Licensed Rights is expressly made subject to the
|
||||||
|
following conditions.
|
||||||
|
|
||||||
|
a. Attribution.
|
||||||
|
|
||||||
|
1. If You Share the Licensed Material (including in modified
|
||||||
|
form), You must:
|
||||||
|
|
||||||
|
a. retain the following if it is supplied by the Licensor
|
||||||
|
with the Licensed Material:
|
||||||
|
|
||||||
|
i. identification of the creator(s) of the Licensed
|
||||||
|
Material and any others designated to receive
|
||||||
|
attribution, in any reasonable manner requested by
|
||||||
|
the Licensor (including by pseudonym if
|
||||||
|
designated);
|
||||||
|
|
||||||
|
ii. a copyright notice;
|
||||||
|
|
||||||
|
iii. a notice that refers to this Public License;
|
||||||
|
|
||||||
|
iv. a notice that refers to the disclaimer of
|
||||||
|
warranties;
|
||||||
|
|
||||||
|
v. a URI or hyperlink to the Licensed Material to the
|
||||||
|
extent reasonably practicable;
|
||||||
|
|
||||||
|
b. indicate if You modified the Licensed Material and
|
||||||
|
retain an indication of any previous modifications; and
|
||||||
|
|
||||||
|
c. indicate the Licensed Material is licensed under this
|
||||||
|
Public License, and include the text of, or the URI or
|
||||||
|
hyperlink to, this Public License.
|
||||||
|
|
||||||
|
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||||
|
reasonable manner based on the medium, means, and context in
|
||||||
|
which You Share the Licensed Material. For example, it may be
|
||||||
|
reasonable to satisfy the conditions by providing a URI or
|
||||||
|
hyperlink to a resource that includes the required
|
||||||
|
information.
|
||||||
|
|
||||||
|
3. If requested by the Licensor, You must remove any of the
|
||||||
|
information required by Section 3(a)(1)(A) to the extent
|
||||||
|
reasonably practicable.
|
||||||
|
|
||||||
|
b. ShareAlike.
|
||||||
|
|
||||||
|
In addition to the conditions in Section 3(a), if You Share
|
||||||
|
Adapted Material You produce, the following conditions also apply.
|
||||||
|
|
||||||
|
1. The Adapter's License You apply must be a Creative Commons
|
||||||
|
license with the same License Elements, this version or
|
||||||
|
later, or a BY-SA Compatible License.
|
||||||
|
|
||||||
|
2. You must include the text of, or the URI or hyperlink to, the
|
||||||
|
Adapter's License You apply. You may satisfy this condition
|
||||||
|
in any reasonable manner based on the medium, means, and
|
||||||
|
context in which You Share Adapted Material.
|
||||||
|
|
||||||
|
3. You may not offer or impose any additional or different terms
|
||||||
|
or conditions on, or apply any Effective Technological
|
||||||
|
Measures to, Adapted Material that restrict exercise of the
|
||||||
|
rights granted under the Adapter's License You apply.
|
||||||
|
|
||||||
|
|
||||||
|
Section 4 -- Sui Generis Database Rights.
|
||||||
|
|
||||||
|
Where the Licensed Rights include Sui Generis Database Rights that
|
||||||
|
apply to Your use of the Licensed Material:
|
||||||
|
|
||||||
|
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||||
|
to extract, reuse, reproduce, and Share all or a substantial
|
||||||
|
portion of the contents of the database;
|
||||||
|
|
||||||
|
b. if You include all or a substantial portion of the database
|
||||||
|
contents in a database in which You have Sui Generis Database
|
||||||
|
Rights, then the database in which You have Sui Generis Database
|
||||||
|
Rights (but not its individual contents) is Adapted Material,
|
||||||
|
|
||||||
|
including for purposes of Section 3(b); and
|
||||||
|
c. You must comply with the conditions in Section 3(a) if You Share
|
||||||
|
all or a substantial portion of the contents of the database.
|
||||||
|
|
||||||
|
For the avoidance of doubt, this Section 4 supplements and does not
|
||||||
|
replace Your obligations under this Public License where the Licensed
|
||||||
|
Rights include other Copyright and Similar Rights.
|
||||||
|
|
||||||
|
|
||||||
|
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||||
|
|
||||||
|
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||||
|
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||||
|
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||||
|
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||||
|
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||||
|
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||||
|
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||||
|
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||||
|
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||||
|
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||||
|
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||||
|
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||||
|
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||||
|
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||||
|
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||||
|
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||||
|
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
c. The disclaimer of warranties and limitation of liability provided
|
||||||
|
above shall be interpreted in a manner that, to the extent
|
||||||
|
possible, most closely approximates an absolute disclaimer and
|
||||||
|
waiver of all liability.
|
||||||
|
|
||||||
|
|
||||||
|
Section 6 -- Term and Termination.
|
||||||
|
|
||||||
|
a. This Public License applies for the term of the Copyright and
|
||||||
|
Similar Rights licensed here. However, if You fail to comply with
|
||||||
|
this Public License, then Your rights under this Public License
|
||||||
|
terminate automatically.
|
||||||
|
|
||||||
|
b. Where Your right to use the Licensed Material has terminated under
|
||||||
|
Section 6(a), it reinstates:
|
||||||
|
|
||||||
|
1. automatically as of the date the violation is cured, provided
|
||||||
|
it is cured within 30 days of Your discovery of the
|
||||||
|
violation; or
|
||||||
|
|
||||||
|
2. upon express reinstatement by the Licensor.
|
||||||
|
|
||||||
|
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||||
|
right the Licensor may have to seek remedies for Your violations
|
||||||
|
of this Public License.
|
||||||
|
|
||||||
|
c. For the avoidance of doubt, the Licensor may also offer the
|
||||||
|
Licensed Material under separate terms or conditions or stop
|
||||||
|
distributing the Licensed Material at any time; however, doing so
|
||||||
|
will not terminate this Public License.
|
||||||
|
|
||||||
|
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||||
|
License.
|
||||||
|
|
||||||
|
|
||||||
|
Section 7 -- Other Terms and Conditions.
|
||||||
|
|
||||||
|
a. The Licensor shall not be bound by any additional or different
|
||||||
|
terms or conditions communicated by You unless expressly agreed.
|
||||||
|
|
||||||
|
b. Any arrangements, understandings, or agreements regarding the
|
||||||
|
Licensed Material not stated herein are separate from and
|
||||||
|
independent of the terms and conditions of this Public License.
|
||||||
|
|
||||||
|
|
||||||
|
Section 8 -- Interpretation.
|
||||||
|
|
||||||
|
a. For the avoidance of doubt, this Public License does not, and
|
||||||
|
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||||
|
conditions on any use of the Licensed Material that could lawfully
|
||||||
|
be made without permission under this Public License.
|
||||||
|
|
||||||
|
b. To the extent possible, if any provision of this Public License is
|
||||||
|
deemed unenforceable, it shall be automatically reformed to the
|
||||||
|
minimum extent necessary to make it enforceable. If the provision
|
||||||
|
cannot be reformed, it shall be severed from this Public License
|
||||||
|
without affecting the enforceability of the remaining terms and
|
||||||
|
conditions.
|
||||||
|
|
||||||
|
c. No term or condition of this Public License will be waived and no
|
||||||
|
failure to comply consented to unless expressly agreed to by the
|
||||||
|
Licensor.
|
||||||
|
|
||||||
|
d. Nothing in this Public License constitutes or may be interpreted
|
||||||
|
as a limitation upon, or waiver of, any privileges and immunities
|
||||||
|
that apply to the Licensor or You, including from the legal
|
||||||
|
processes of any jurisdiction or authority.
|
||||||
|
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
Creative Commons is not a party to its public
|
||||||
|
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||||
|
its public licenses to material it publishes and in those instances
|
||||||
|
will be considered the “Licensor.” The text of the Creative Commons
|
||||||
|
public licenses is dedicated to the public domain under the CC0 Public
|
||||||
|
Domain Dedication. Except for the limited purpose of indicating that
|
||||||
|
material is shared under a Creative Commons public license or as
|
||||||
|
otherwise permitted by the Creative Commons policies published at
|
||||||
|
creativecommons.org/policies, Creative Commons does not authorize the
|
||||||
|
use of the trademark "Creative Commons" or any other trademark or logo
|
||||||
|
of Creative Commons without its prior written consent including,
|
||||||
|
without limitation, in connection with any unauthorized modifications
|
||||||
|
to any of its public licenses or any other arrangements,
|
||||||
|
understandings, or agreements concerning use of licensed material. For
|
||||||
|
the avoidance of doubt, this paragraph does not form part of the
|
||||||
|
public licenses.
|
||||||
|
|
||||||
|
Creative Commons may be contacted at creativecommons.org.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Biome Lib
|
||||||
|
|
||||||
|
This library's purpose is to allow other mods to add growing things to the map in a straightforward, simple manner. It contains all the core functions needed by mods and modpacks such as More Trees, Tiny Trees, Plantlife, and others.
|
||||||
|
|
||||||
|
Spawning of plants is optionally sensitive to the amount of available light, elevation, nearness to other nodes, plant-to-plant density, water depth, and a whole host of controls.
|
||||||
|
|
||||||
|
All objects spawned or generated using this mod use Perlin noise to stay within simple biomes, rather than just letting everything just spread around the map randomly.
|
||||||
|
|
||||||
|
This library also features a basic temperature map, which should blend in nicely with SPlizard's Snow Biomes mod (the same Perlin settings are used, with the assumption that the edge of a snow biome is 0° Centigrade).
|
||||||
|
|
||||||
|
Both mapgen-based spawning and ABM-based spawning is supported. Growing code is strictly ABM-based. L-system trees can be spawned at mapgen time via the engine's spawn_tree() function and are quite fast.
|
||||||
|
|
||||||
|
It is primarily intended for mapgen v6, but it should work fine when used with mapgen v7.
|
||||||
|
|
||||||
|
**Dependencies:** nothing, but if you don't use `minetest_game`, you'll need to supply some settings (see API.txt).
|
||||||
|
|
||||||
|
**Recommends**: [Plantlife Modpack](https://github.com/mt-mods/plantlife_modpack),
|
||||||
|
[More Trees](https://github.com/mt-mods/moretrees)
|
||||||
|
|
||||||
|
**API**: This mod supplies a small number of very powerful functions. They are, briefly:
|
||||||
|
|
||||||
|
* biome_lib:register_generate_plant()
|
||||||
|
* biome_lib:spawn_on_surfaces()
|
||||||
|
* biome_lib:grow_plants()
|
||||||
|
* biome_lib:find_valid_wall()
|
||||||
|
* biome_lib:is_node_loaded()
|
||||||
|
|
||||||
|
For a complete description of these functions as well as several of the internal variables within the mod, see `API.txt`.
|
||||||
|
|
||||||
|
**Configuration:** This mod has several variables you can set in your `minetest.conf` to change things a bit, from the default nodes it uses, to the debug log level and the block queue behavior. For a list with complete descriptions, see `settingtypes.txt`.
|
||||||
@@ -0,0 +1,695 @@
|
|||||||
|
biome_lib.block_log = {}
|
||||||
|
biome_lib.block_recheck_list = {}
|
||||||
|
biome_lib.run_block_recheck_list = false
|
||||||
|
|
||||||
|
biome_lib.actionslist_aircheck = {}
|
||||||
|
biome_lib.actionslist_no_aircheck = {}
|
||||||
|
|
||||||
|
biome_lib.surfaceslist_aircheck = {}
|
||||||
|
biome_lib.surfaceslist_no_aircheck = {}
|
||||||
|
|
||||||
|
biome_lib.registered_decorations = {}
|
||||||
|
|
||||||
|
biome_lib.fertile_perlin_octaves = 3
|
||||||
|
biome_lib.fertile_perlin_persistence = 0.6
|
||||||
|
biome_lib.fertile_perlin_scale = 100
|
||||||
|
|
||||||
|
local time_speed = tonumber(minetest.settings:get("time_speed"))
|
||||||
|
biome_lib.time_scale = 1
|
||||||
|
|
||||||
|
if time_speed and time_speed > 0 then
|
||||||
|
biome_lib.time_scale = 72 / time_speed
|
||||||
|
end
|
||||||
|
|
||||||
|
biome_lib.air = {name = "air"}
|
||||||
|
|
||||||
|
-- the mapgen rarely creates useful surfaces outside this range, but mods can
|
||||||
|
-- still specify a wider range if needed.
|
||||||
|
biome_lib.mapgen_elevation_limit = { ["min"] = -16, ["max"] = 48 }
|
||||||
|
|
||||||
|
|
||||||
|
-- Local functions
|
||||||
|
|
||||||
|
function biome_lib.dbg(msg, level)
|
||||||
|
local l = tonumber(level) or 0
|
||||||
|
if biome_lib.debug_log_level >= l then
|
||||||
|
print(os.date("%Y-%m-%d %H:%M:%S").." [Biome Lib]: "..msg)
|
||||||
|
minetest.log("verbose", "[Biome Lib]: "..msg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_biome_data(pos, perlin_fertile)
|
||||||
|
local fertility = perlin_fertile:get_2d({x=pos.x, y=pos.z})
|
||||||
|
|
||||||
|
local data = minetest.get_biome_data(pos)
|
||||||
|
-- Original values this method returned were +1 (lowest) to -1 (highest)
|
||||||
|
-- so we need to convert the 0-100 range from get_biome_data() to that.
|
||||||
|
return fertility, 1 - (data.heat / 100 * 2), 1 - (data.humidity / 100 * 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.is_node_loaded(node_pos)
|
||||||
|
local n = minetest.get_node_or_nil(node_pos)
|
||||||
|
if (not n) or (n.name == "ignore") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.set_defaults(biome)
|
||||||
|
|
||||||
|
biome.seed_diff = biome.seed_diff or 0
|
||||||
|
biome.min_elevation = biome.min_elevation or biome_lib.mapgen_elevation_limit.min
|
||||||
|
biome.max_elevation = biome.max_elevation or biome_lib.mapgen_elevation_limit.max
|
||||||
|
biome.temp_min = biome.temp_min or 1
|
||||||
|
biome.temp_max = biome.temp_max or -1
|
||||||
|
biome.humidity_min = biome.humidity_min or 1
|
||||||
|
biome.humidity_max = biome.humidity_max or -1
|
||||||
|
biome.plantlife_limit = biome.plantlife_limit or 0.1
|
||||||
|
biome.near_nodes_vertical = biome.near_nodes_vertical or 1
|
||||||
|
|
||||||
|
-- specific to on-generate
|
||||||
|
|
||||||
|
biome.neighbors = biome.neighbors or biome.surface
|
||||||
|
biome.near_nodes_size = biome.near_nodes_size or 0
|
||||||
|
biome.near_nodes_count = biome.near_nodes_count or 1
|
||||||
|
biome.rarity = biome.rarity or 50
|
||||||
|
biome.rarity_fertility = biome.rarity_fertility or 0
|
||||||
|
biome.max_count = biome.max_count or 125
|
||||||
|
biome.tries = biome.tries or 2
|
||||||
|
if biome.check_air ~= false then biome.check_air = true end
|
||||||
|
|
||||||
|
-- specific to abm spawner
|
||||||
|
biome.seed_diff = biome.seed_diff or 0
|
||||||
|
biome.light_min = biome.light_min or 0
|
||||||
|
biome.light_max = biome.light_max or 15
|
||||||
|
biome.depth_max = biome.depth_max or 1
|
||||||
|
biome.facedir = biome.facedir or 0
|
||||||
|
return biome
|
||||||
|
end
|
||||||
|
|
||||||
|
local function search_table(t, s)
|
||||||
|
for i = 1, #t do
|
||||||
|
if t[i] == s then return true end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- register the list of surfaces to spawn stuff on, filtering out all duplicates.
|
||||||
|
-- separate the items by air-checking or non-air-checking map eval methods
|
||||||
|
|
||||||
|
function biome_lib.register_on_generate(biomedef, nodes_or_function_or_model)
|
||||||
|
|
||||||
|
-- if calling code passes an undefined node for a surface or
|
||||||
|
-- as a node to be spawned, don't register an action for it.
|
||||||
|
|
||||||
|
if type(nodes_or_function_or_model) == "string"
|
||||||
|
and string.find(nodes_or_function_or_model, ":")
|
||||||
|
and not minetest.registered_nodes[nodes_or_function_or_model] then
|
||||||
|
biome_lib.dbg("Warning: Ignored registration for undefined spawn node: "..
|
||||||
|
dump(nodes_or_function_or_model), 2)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if type(nodes_or_function_or_model) == "string"
|
||||||
|
and not string.find(nodes_or_function_or_model, ":") then
|
||||||
|
biome_lib.dbg("Warning: Registered function call using deprecated string method: "..
|
||||||
|
dump(nodes_or_function_or_model), 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
biome_lib.mapgen_elevation_limit.min = math.min(biomedef.min_elevation or 0, biome_lib.mapgen_elevation_limit.min)
|
||||||
|
biome_lib.mapgen_elevation_limit.max = math.max(biomedef.max_elevation or 0, biome_lib.mapgen_elevation_limit.max)
|
||||||
|
|
||||||
|
local decor_def = biome_lib.can_use_decorations(biomedef, nodes_or_function_or_model)
|
||||||
|
|
||||||
|
if decor_def then
|
||||||
|
biome_lib.dbg("Using engine decorations instead of biome_lib functions for node(s): "..
|
||||||
|
dump(nodes_or_function_or_model), 3)
|
||||||
|
biome_lib.registered_decorations[#biome_lib.registered_decorations + 1] = nodes_or_function_or_model
|
||||||
|
minetest.register_decoration(decor_def)
|
||||||
|
return
|
||||||
|
elseif biomedef.check_air == false then
|
||||||
|
biome_lib.dbg("Register no-air-check mapgen hook: "..dump(nodes_or_function_or_model), 3)
|
||||||
|
biome_lib.actionslist_no_aircheck[#biome_lib.actionslist_no_aircheck + 1] = {biomedef, nodes_or_function_or_model}
|
||||||
|
local s = biomedef.surface
|
||||||
|
if type(s) == "string" then
|
||||||
|
if s and (string.find(s, "^group:") or minetest.registered_nodes[s]) then
|
||||||
|
if not search_table(biome_lib.surfaceslist_no_aircheck, s) then
|
||||||
|
biome_lib.surfaceslist_no_aircheck[#biome_lib.surfaceslist_no_aircheck + 1] = s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
biome_lib.dbg("Warning: Ignored no-air-check registration for undefined surface node: "..dump(s), 2)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = 1, #biomedef.surface do
|
||||||
|
s = biomedef.surface[i]
|
||||||
|
if s and (string.find(s, "^group:") or minetest.registered_nodes[s]) then
|
||||||
|
if not search_table(biome_lib.surfaceslist_no_aircheck, s) then
|
||||||
|
biome_lib.surfaceslist_no_aircheck[#biome_lib.surfaceslist_no_aircheck + 1] = s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
biome_lib.dbg("Warning: Ignored no-air-check registration for undefined surface node: "..dump(s), 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
biome_lib.dbg("Register with-air-checking mapgen hook: "..dump(nodes_or_function_or_model), 3)
|
||||||
|
biome_lib.actionslist_aircheck[#biome_lib.actionslist_aircheck + 1] = { biomedef, nodes_or_function_or_model }
|
||||||
|
local s = biomedef.surface
|
||||||
|
if type(s) == "string" then
|
||||||
|
if s and (string.find(s, "^group:") or minetest.registered_nodes[s]) then
|
||||||
|
if not search_table(biome_lib.surfaceslist_aircheck, s) then
|
||||||
|
biome_lib.surfaceslist_aircheck[#biome_lib.surfaceslist_aircheck + 1] = s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
biome_lib.dbg("Warning: Ignored with-air-checking registration for undefined surface node: "..dump(s), 2)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = 1, #biomedef.surface do
|
||||||
|
s = biomedef.surface[i]
|
||||||
|
if s and (string.find(s, "^group:") or minetest.registered_nodes[s]) then
|
||||||
|
if not search_table(biome_lib.surfaceslist_aircheck, s) then
|
||||||
|
biome_lib.surfaceslist_aircheck[#biome_lib.surfaceslist_aircheck + 1] = s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
biome_lib.dbg("Warning: Ignored with-air-checking registration for undefined surface node: "..dump(s), 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Function to check whether a position matches the given biome definition
|
||||||
|
-- Returns true when the surface can be populated
|
||||||
|
|
||||||
|
local function populate_single_surface(biome, pos, perlin_fertile_area, checkair)
|
||||||
|
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||||
|
|
||||||
|
if biome.rarity - biome.rarity_fertility == 100 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local fertility, temperature, humidity = get_biome_data(pos, perlin_fertile_area)
|
||||||
|
|
||||||
|
if math.random() * 100 <= (biome.rarity - ((fertility + 1) / 2 * biome.rarity_fertility)) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos_biome_ok = pos.y >= biome.min_elevation and pos.y <= biome.max_elevation
|
||||||
|
and fertility >= biome.plantlife_limit
|
||||||
|
and temperature <= biome.temp_min and temperature >= biome.temp_max
|
||||||
|
and humidity <= biome.humidity_min and humidity >= biome.humidity_max
|
||||||
|
|
||||||
|
if not pos_biome_ok then
|
||||||
|
return -- Y position mismatch, outside of biome
|
||||||
|
end
|
||||||
|
|
||||||
|
local biome_surfaces_string = dump(biome.surface)
|
||||||
|
local surface_ok = false
|
||||||
|
|
||||||
|
if not biome.depth then
|
||||||
|
local dest_node = minetest.get_node(pos)
|
||||||
|
if string.find(biome_surfaces_string, dest_node.name) then
|
||||||
|
surface_ok = true
|
||||||
|
else
|
||||||
|
if string.find(biome_surfaces_string, "group:") then
|
||||||
|
for j = 1, #biome.surface do
|
||||||
|
if string.find(biome.surface[j], "^group:")
|
||||||
|
and minetest.get_item_group(dest_node.name, biome.surface[j]) then
|
||||||
|
surface_ok = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif not string.find(biome_surfaces_string,
|
||||||
|
minetest.get_node({ x = pos.x, y = pos.y-biome.depth-1, z = pos.z }).name) then
|
||||||
|
surface_ok = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if not surface_ok then
|
||||||
|
return -- Surface does not match the given node group/name
|
||||||
|
end
|
||||||
|
|
||||||
|
if checkair and minetest.get_node(p_top).name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if biome.below_nodes and
|
||||||
|
not string.find(dump(biome.below_nodes),
|
||||||
|
minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||||
|
) then
|
||||||
|
return -- Node below does not match
|
||||||
|
end
|
||||||
|
|
||||||
|
if biome.ncount and
|
||||||
|
#minetest.find_nodes_in_area(
|
||||||
|
{x=pos.x-1, y=pos.y, z=pos.z-1},
|
||||||
|
{x=pos.x+1, y=pos.y, z=pos.z+1},
|
||||||
|
biome.neighbors
|
||||||
|
) <= biome.ncount then
|
||||||
|
return -- Not enough similar biome nodes around
|
||||||
|
end
|
||||||
|
|
||||||
|
if biome.near_nodes and
|
||||||
|
#minetest.find_nodes_in_area(
|
||||||
|
{x=pos.x-biome.near_nodes_size, y=pos.y-biome.near_nodes_vertical, z=pos.z-biome.near_nodes_size},
|
||||||
|
{x=pos.x+biome.near_nodes_size, y=pos.y+biome.near_nodes_vertical, z=pos.z+biome.near_nodes_size},
|
||||||
|
biome.near_nodes
|
||||||
|
) < biome.near_nodes_count then
|
||||||
|
return -- Long distance neighbours do not match
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Position fits into given biome
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.populate_surfaces(b, nodes_or_function_or_model, snodes, checkair)
|
||||||
|
local items_added = 0
|
||||||
|
|
||||||
|
local biome = biome_lib.set_defaults(b)
|
||||||
|
|
||||||
|
-- filter stage 1 - find nodes from the supplied surfaces that are within the current biome.
|
||||||
|
|
||||||
|
local in_biome_nodes = {}
|
||||||
|
local perlin_fertile_area = minetest.get_perlin(biome.seed_diff, biome_lib.fertile_perlin_octaves,
|
||||||
|
biome_lib.fertile_perlin_persistence, biome_lib.fertile_perlin_scale)
|
||||||
|
|
||||||
|
for i = 1, #snodes do
|
||||||
|
local pos = vector.new(snodes[i])
|
||||||
|
if populate_single_surface(biome, pos, perlin_fertile_area, checkair) then
|
||||||
|
in_biome_nodes[#in_biome_nodes + 1] = pos
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- filter stage 2 - find places within that biome area to place the plants.
|
||||||
|
|
||||||
|
local num_in_biome_nodes = #in_biome_nodes
|
||||||
|
|
||||||
|
if num_in_biome_nodes == 0 then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, math.min(math.ceil(biome.max_count/25), num_in_biome_nodes) do
|
||||||
|
local tries = 0
|
||||||
|
local spawned = false
|
||||||
|
while tries < biome.tries and not spawned do
|
||||||
|
local pos = in_biome_nodes[math.random(1, num_in_biome_nodes)]
|
||||||
|
|
||||||
|
local will_place = true
|
||||||
|
local fdir = nil
|
||||||
|
if biome.random_facedir then
|
||||||
|
fdir = math.random(biome.random_facedir[1], biome.random_facedir[2])
|
||||||
|
end
|
||||||
|
|
||||||
|
if biome.spawn_on_side then
|
||||||
|
local onside = biome_lib.find_open_side(pos)
|
||||||
|
if onside then
|
||||||
|
pos = onside.newpos
|
||||||
|
fdir = onside.facedir
|
||||||
|
else
|
||||||
|
will_place = false
|
||||||
|
end
|
||||||
|
elseif biome.spawn_on_bottom then
|
||||||
|
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
else
|
||||||
|
will_place = false
|
||||||
|
end
|
||||||
|
elseif biome.spawn_replace_node then
|
||||||
|
pos.y = pos.y-1
|
||||||
|
end
|
||||||
|
|
||||||
|
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||||
|
|
||||||
|
if will_place and not (biome.avoid_nodes and biome.avoid_radius
|
||||||
|
and minetest.find_node_near(p_top, biome.avoid_radius
|
||||||
|
+ math.random(-1.5,2), biome.avoid_nodes)) then
|
||||||
|
if biome.delete_above then
|
||||||
|
minetest.swap_node(p_top, biome_lib.air)
|
||||||
|
minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z}, biome_lib.air)
|
||||||
|
end
|
||||||
|
|
||||||
|
if biome.delete_above_surround then
|
||||||
|
minetest.swap_node({x=p_top.x-1, y=p_top.y, z=p_top.z}, biome_lib.air)
|
||||||
|
minetest.swap_node({x=p_top.x+1, y=p_top.y, z=p_top.z}, biome_lib.air)
|
||||||
|
minetest.swap_node({x=p_top.x, y=p_top.y, z=p_top.z-1}, biome_lib.air)
|
||||||
|
minetest.swap_node({x=p_top.x, y=p_top.y, z=p_top.z+1}, biome_lib.air)
|
||||||
|
|
||||||
|
minetest.swap_node({x=p_top.x-1, y=p_top.y+1, z=p_top.z}, biome_lib.air)
|
||||||
|
minetest.swap_node({x=p_top.x+1, y=p_top.y+1, z=p_top.z}, biome_lib.air)
|
||||||
|
minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z-1}, biome_lib.air)
|
||||||
|
minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z+1}, biome_lib.air)
|
||||||
|
end
|
||||||
|
|
||||||
|
if biome.spawn_replace_node then
|
||||||
|
minetest.swap_node(pos, biome_lib.air)
|
||||||
|
end
|
||||||
|
|
||||||
|
local objtype = type(nodes_or_function_or_model)
|
||||||
|
|
||||||
|
if objtype == "table" then
|
||||||
|
if nodes_or_function_or_model.axiom then
|
||||||
|
biome_lib.generate_ltree(p_top, nodes_or_function_or_model)
|
||||||
|
biome_lib.dbg("An L-tree was spawned at "..minetest.pos_to_string(p_top), 4)
|
||||||
|
spawned = true
|
||||||
|
else
|
||||||
|
local n=nodes_or_function_or_model[math.random(#nodes_or_function_or_model)]
|
||||||
|
minetest.swap_node(p_top, { name = n, param2 = fdir })
|
||||||
|
biome_lib.dbg("Node \""..n.."\" was randomly picked from a list and placed at "..
|
||||||
|
minetest.pos_to_string(p_top), 4)
|
||||||
|
spawned = true
|
||||||
|
end
|
||||||
|
elseif objtype == "string" and
|
||||||
|
minetest.registered_nodes[nodes_or_function_or_model] then
|
||||||
|
minetest.swap_node(p_top, { name = nodes_or_function_or_model, param2 = fdir })
|
||||||
|
biome_lib.dbg("Node \""..nodes_or_function_or_model.."\" was placed at "..
|
||||||
|
minetest.pos_to_string(p_top), 4)
|
||||||
|
spawned = true
|
||||||
|
elseif objtype == "function" then
|
||||||
|
nodes_or_function_or_model(pos, fdir)
|
||||||
|
biome_lib.dbg("A function was run on surface node at "..minetest.pos_to_string(pos), 4)
|
||||||
|
spawned = true
|
||||||
|
elseif objtype == "string" and pcall(loadstring(("return %s(...)"):
|
||||||
|
format(nodes_or_function_or_model)),pos) then
|
||||||
|
spawned = true
|
||||||
|
biome_lib.dbg("An obsolete string-specified function was run on surface node at "..
|
||||||
|
minetest.pos_to_string(p_top), 4)
|
||||||
|
else
|
||||||
|
biome_lib.dbg("Warning: Ignored invalid definition for object "..
|
||||||
|
dump(nodes_or_function_or_model).." that was pointed at {"..dump(pos).."}", 2)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
tries = tries + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if spawned then items_added = items_added + 1 end
|
||||||
|
end
|
||||||
|
return items_added
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Primary log read-out/mapgen spawner
|
||||||
|
|
||||||
|
local function confirm_block_surroundings(p)
|
||||||
|
local n=minetest.get_node_or_nil(p)
|
||||||
|
if not n or n.name == "ignore" then return false end
|
||||||
|
|
||||||
|
for x = -32,32,64 do -- step of 64 causes it to only check the 8 corner blocks
|
||||||
|
for y = -32,32,64 do
|
||||||
|
for z = -32,32,64 do
|
||||||
|
n = minetest.get_node_or_nil({x=p.x + x, y=p.y + y, z=p.z + z})
|
||||||
|
if not n or n.name == "ignore" then return false end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.generate_block(shutting_down)
|
||||||
|
|
||||||
|
if shutting_down then
|
||||||
|
if #biome_lib.block_recheck_list > 0 then
|
||||||
|
for i = 1, #biome_lib.block_recheck_list do
|
||||||
|
biome_lib.block_log[#biome_lib.block_log + 1] = biome_lib.block_recheck_list[i]
|
||||||
|
end
|
||||||
|
biome_lib.block_recheck_list = {}
|
||||||
|
end
|
||||||
|
biome_lib.run_block_recheck_list = false
|
||||||
|
else
|
||||||
|
if biome_lib.run_block_recheck_list
|
||||||
|
and not biome_lib.block_recheck_list[1] then
|
||||||
|
biome_lib.run_block_recheck_list = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local blocklog = biome_lib.run_block_recheck_list
|
||||||
|
and biome_lib.block_recheck_list
|
||||||
|
or biome_lib.block_log
|
||||||
|
|
||||||
|
if not blocklog[1] then return end
|
||||||
|
|
||||||
|
local minp = blocklog[1][1]
|
||||||
|
local maxp = blocklog[1][2]
|
||||||
|
local airflag = blocklog[1][3]
|
||||||
|
|
||||||
|
if not biome_lib.pos_hash then -- we need to read the maplock and get the surfaces list
|
||||||
|
local now = minetest.get_us_time()
|
||||||
|
biome_lib.pos_hash = {}
|
||||||
|
minetest.load_area(minp)
|
||||||
|
if not confirm_block_surroundings(minp)
|
||||||
|
and not shutting_down
|
||||||
|
-- if any neighbors appear not to be loaded and the block hasn't expired yet, defer it
|
||||||
|
and (blocklog[1][4] + biome_lib.block_timeout) > now then
|
||||||
|
|
||||||
|
if biome_lib.run_block_recheck_list then
|
||||||
|
biome_lib.block_log[#biome_lib.block_log + 1] = table.copy(biome_lib.block_recheck_list[1])
|
||||||
|
table.remove(biome_lib.block_recheck_list, 1)
|
||||||
|
else
|
||||||
|
biome_lib.block_recheck_list[#biome_lib.block_recheck_list + 1] = table.copy(biome_lib.block_log[1])
|
||||||
|
table.remove(biome_lib.block_log, 1)
|
||||||
|
end
|
||||||
|
biome_lib.pos_hash = nil
|
||||||
|
biome_lib.dbg("Mapblock at "..minetest.pos_to_string(minp)..
|
||||||
|
" had a neighbor not fully emerged, skipped it for now.", 4)
|
||||||
|
return
|
||||||
|
else
|
||||||
|
biome_lib.pos_hash.surface_node_list = airflag
|
||||||
|
and minetest.find_nodes_in_area_under_air(minp, maxp, biome_lib.surfaceslist_aircheck)
|
||||||
|
or minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_no_aircheck)
|
||||||
|
if #biome_lib.pos_hash.surface_node_list == 0 then
|
||||||
|
biome_lib.dbg("Mapblock at "..minetest.pos_to_string(minp).." dequeued: no detected surfaces.", 4)
|
||||||
|
table.remove(blocklog, 1)
|
||||||
|
biome_lib.pos_hash = nil
|
||||||
|
return
|
||||||
|
else
|
||||||
|
biome_lib.pos_hash.action_index = 1
|
||||||
|
biome_lib.dbg("Mapblock at "..minetest.pos_to_string(minp)..
|
||||||
|
" has "..#biome_lib.pos_hash.surface_node_list..
|
||||||
|
" surface nodes to work on (airflag="..dump(airflag)..")", 4)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif not (airflag and biome_lib.actionslist_aircheck[biome_lib.pos_hash.action_index])
|
||||||
|
and not (not airflag and biome_lib.actionslist_no_aircheck[biome_lib.pos_hash.action_index]) then
|
||||||
|
-- the block is finished, remove it
|
||||||
|
if #biome_lib.pos_hash.surface_node_list > 0 then
|
||||||
|
biome_lib.dbg("Deleted mapblock "..minetest.pos_to_string(minp).." from the block log", 4)
|
||||||
|
end
|
||||||
|
table.remove(blocklog, 1)
|
||||||
|
biome_lib.pos_hash = nil
|
||||||
|
else
|
||||||
|
-- below, [1] is biome, [2] is the thing to be added
|
||||||
|
local added = 0
|
||||||
|
if airflag then
|
||||||
|
if biome_lib.actionslist_aircheck[biome_lib.pos_hash.action_index] then
|
||||||
|
added = biome_lib.populate_surfaces(
|
||||||
|
biome_lib.actionslist_aircheck[biome_lib.pos_hash.action_index][1],
|
||||||
|
biome_lib.actionslist_aircheck[biome_lib.pos_hash.action_index][2],
|
||||||
|
biome_lib.pos_hash.surface_node_list, true)
|
||||||
|
biome_lib.pos_hash.action_index = biome_lib.pos_hash.action_index + 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if biome_lib.actionslist_no_aircheck[biome_lib.pos_hash.action_index] then
|
||||||
|
added = biome_lib.populate_surfaces(
|
||||||
|
biome_lib.actionslist_no_aircheck[biome_lib.pos_hash.action_index][1],
|
||||||
|
biome_lib.actionslist_no_aircheck[biome_lib.pos_hash.action_index][2],
|
||||||
|
biome_lib.pos_hash.surface_node_list, false)
|
||||||
|
biome_lib.pos_hash.action_index = biome_lib.pos_hash.action_index + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if added > 0 then
|
||||||
|
biome_lib.dbg("biome_lib.populate_surfaces ran on mapblock at "..
|
||||||
|
minetest.pos_to_string(minp)..". Entry #"..
|
||||||
|
(biome_lib.pos_hash.action_index-1).." added "..added.." items.", 4)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The spawning ABM
|
||||||
|
|
||||||
|
function biome_lib.register_active_spawner(sd,sp,sr,sc,ss,sa)
|
||||||
|
|
||||||
|
local b = {}
|
||||||
|
|
||||||
|
if type(sd) ~= "table" then
|
||||||
|
b.spawn_delay = sd -- old api expects ABM interval param here.
|
||||||
|
b.spawn_plants = {sp}
|
||||||
|
b.avoid_radius = sr
|
||||||
|
b.spawn_chance = sc
|
||||||
|
b.spawn_surfaces = {ss}
|
||||||
|
b.avoid_nodes = sa
|
||||||
|
else
|
||||||
|
b = sd
|
||||||
|
end
|
||||||
|
|
||||||
|
if b.spawn_delay*biome_lib.time_scale >= 1 then
|
||||||
|
b.interval = b.spawn_delay*biome_lib.time_scale
|
||||||
|
else
|
||||||
|
b.interval = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local biome = biome_lib.set_defaults(b)
|
||||||
|
|
||||||
|
biome.spawn_plants_count = #(biome.spawn_plants)
|
||||||
|
|
||||||
|
local n
|
||||||
|
if type(biome.spawn_plants) == "table" then
|
||||||
|
n = "random: "..biome.spawn_plants[1]..", ..."
|
||||||
|
else
|
||||||
|
n = biome.spawn_plants
|
||||||
|
end
|
||||||
|
biome.label = biome.label or "biome_lib spawn_on_surfaces(): "..n
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = biome.spawn_surfaces,
|
||||||
|
interval = biome.interval,
|
||||||
|
chance = biome.spawn_chance,
|
||||||
|
neighbors = biome.neighbors,
|
||||||
|
label = biome.label,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||||
|
local n_top = minetest.get_node(p_top)
|
||||||
|
local perlin_fertile_area = minetest.get_perlin(biome.seed_diff, biome_lib.fertile_perlin_octaves,
|
||||||
|
biome_lib.fertile_perlin_persistence, biome_lib.fertile_perlin_scale)
|
||||||
|
|
||||||
|
local fertility, temperature, humidity = get_biome_data(pos, perlin_fertile_area)
|
||||||
|
|
||||||
|
local pos_biome_ok = pos.y >= biome.min_elevation and pos.y <= biome.max_elevation
|
||||||
|
and fertility > biome.plantlife_limit
|
||||||
|
and temperature <= biome.temp_min and temperature >= biome.temp_max
|
||||||
|
and humidity <= biome.humidity_min and humidity >= biome.humidity_max
|
||||||
|
and biome_lib.is_node_loaded(p_top)
|
||||||
|
|
||||||
|
if not pos_biome_ok then
|
||||||
|
return -- Outside of biome
|
||||||
|
end
|
||||||
|
|
||||||
|
local n_light = minetest.get_node_light(p_top, nil)
|
||||||
|
if n_light < biome.light_min or n_light > biome.light_max then
|
||||||
|
return -- Too dark or too bright
|
||||||
|
end
|
||||||
|
|
||||||
|
if biome.avoid_nodes and biome.avoid_radius and minetest.find_node_near(
|
||||||
|
p_top, biome.avoid_radius + math.random(-1.5,2), biome.avoid_nodes) then
|
||||||
|
return -- Nodes to avoid are nearby
|
||||||
|
end
|
||||||
|
|
||||||
|
if biome.neighbors and biome.ncount and
|
||||||
|
#minetest.find_nodes_in_area(
|
||||||
|
{x=pos.x-1, y=pos.y, z=pos.z-1},
|
||||||
|
{x=pos.x+1, y=pos.y, z=pos.z+1},
|
||||||
|
biome.neighbors
|
||||||
|
) <= biome.ncount then
|
||||||
|
return -- Near neighbour nodes are not present
|
||||||
|
end
|
||||||
|
|
||||||
|
local NEAR_DST = biome.near_nodes_size
|
||||||
|
if biome.near_nodes and biome.near_nodes_count and biome.near_nodes_size and
|
||||||
|
#minetest.find_nodes_in_area(
|
||||||
|
{x=pos.x-NEAR_DST, y=pos.y-biome.near_nodes_vertical, z=pos.z-NEAR_DST},
|
||||||
|
{x=pos.x+NEAR_DST, y=pos.y+biome.near_nodes_vertical, z=pos.z+NEAR_DST},
|
||||||
|
biome.near_nodes
|
||||||
|
) < biome.near_nodes_count then
|
||||||
|
return -- Far neighbour nodes are not present
|
||||||
|
end
|
||||||
|
|
||||||
|
if (biome.air_count and biome.air_size) and
|
||||||
|
#minetest.find_nodes_in_area(
|
||||||
|
{x=p_top.x-biome.air_size, y=p_top.y, z=p_top.z-biome.air_size},
|
||||||
|
{x=p_top.x+biome.air_size, y=p_top.y, z=p_top.z+biome.air_size},
|
||||||
|
"air"
|
||||||
|
) < biome.air_count then
|
||||||
|
return -- Not enough air
|
||||||
|
end
|
||||||
|
|
||||||
|
local walldir = biome_lib.find_adjacent_wall(p_top, biome.verticals_list, biome.choose_random_wall)
|
||||||
|
if biome.alt_wallnode and walldir then
|
||||||
|
if n_top.name == "air" then
|
||||||
|
minetest.swap_node(p_top, { name = biome.alt_wallnode, param2 = walldir })
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local currentsurface = minetest.get_node(pos).name
|
||||||
|
|
||||||
|
if biome_lib.default_water_nodes[currentsurface] and
|
||||||
|
#minetest.find_nodes_in_area(
|
||||||
|
{x=pos.x, y=pos.y-biome.depth_max-1, z=pos.z},
|
||||||
|
vector.new(pos),
|
||||||
|
biome_lib.default_wet_surfaces
|
||||||
|
) == 0 then
|
||||||
|
return -- On water but no ground nearby
|
||||||
|
end
|
||||||
|
|
||||||
|
local rnd = math.random(1, biome.spawn_plants_count)
|
||||||
|
local plant_to_spawn = biome.spawn_plants[rnd]
|
||||||
|
local fdir = biome.facedir
|
||||||
|
if biome.random_facedir then
|
||||||
|
fdir = math.random(biome.random_facedir[1],biome.random_facedir[2])
|
||||||
|
end
|
||||||
|
if type(biome.spawn_plants) == "string" then
|
||||||
|
assert(loadstring(biome.spawn_plants.."(...)"))(pos)
|
||||||
|
elseif not biome.spawn_on_side and not biome.spawn_on_bottom and not biome.spawn_replace_node then
|
||||||
|
if n_top.name == "air" then
|
||||||
|
minetest.swap_node(p_top, { name = plant_to_spawn, param2 = fdir })
|
||||||
|
end
|
||||||
|
elseif biome.spawn_replace_node then
|
||||||
|
minetest.swap_node(pos, { name = plant_to_spawn, param2 = fdir })
|
||||||
|
|
||||||
|
elseif biome.spawn_on_side then
|
||||||
|
local onside = biome_lib.find_open_side(pos)
|
||||||
|
if onside then
|
||||||
|
minetest.swap_node(onside.newpos, { name = plant_to_spawn, param2 = onside.facedir })
|
||||||
|
end
|
||||||
|
elseif biome.spawn_on_bottom then
|
||||||
|
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then
|
||||||
|
minetest.swap_node({x=pos.x, y=pos.y-1, z=pos.z}, { name = plant_to_spawn, param2 = fdir} )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Function to decide how to replace a plant - either grow it, replace it with
|
||||||
|
-- a tree, run a function, or die with an error.
|
||||||
|
|
||||||
|
function biome_lib.replace_plant(pos, replacement, grow_function, walldir, seeddiff)
|
||||||
|
local growtype = type(grow_function)
|
||||||
|
if growtype == "table" then
|
||||||
|
minetest.swap_node(pos, biome_lib.air)
|
||||||
|
biome_lib.grow_ltree(pos, grow_function)
|
||||||
|
return
|
||||||
|
elseif growtype == "function" then
|
||||||
|
local perlin_fertile_area = minetest.get_perlin(seeddiff, biome_lib.fertile_perlin_octaves,
|
||||||
|
biome_lib.fertile_perlin_persistence, biome_lib.fertile_perlin_scale)
|
||||||
|
local fertility, temperature, _ = get_biome_data(pos, perlin_fertile_area)
|
||||||
|
grow_function(pos, fertility, temperature, walldir)
|
||||||
|
return
|
||||||
|
elseif growtype == "string" then
|
||||||
|
local perlin_fertile_area = minetest.get_perlin(seeddiff, biome_lib.fertile_perlin_octaves,
|
||||||
|
biome_lib.fertile_perlin_persistence, biome_lib.fertile_perlin_scale)
|
||||||
|
local fertility, temperature, _ = get_biome_data(pos, perlin_fertile_area)
|
||||||
|
assert(loadstring(grow_function.."(...)"))(pos, fertility, temperature, walldir)
|
||||||
|
return
|
||||||
|
elseif growtype == "nil" then
|
||||||
|
minetest.swap_node(pos, { name = replacement, param2 = walldir})
|
||||||
|
return
|
||||||
|
elseif growtype ~= "nil" and growtype ~= "string" and growtype ~= "table" then
|
||||||
|
error("Invalid grow function "..dump(grow_function).." used on object at ("..dump(pos)..")")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for infinite stacks
|
||||||
|
|
||||||
|
if minetest.get_modpath("unified_inventory") or not minetest.settings:get_bool("creative_mode") then
|
||||||
|
biome_lib.expect_infinite_stacks = false
|
||||||
|
else
|
||||||
|
biome_lib.expect_infinite_stacks = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- read a field from a node's definition
|
||||||
|
|
||||||
|
function biome_lib.get_nodedef_field(nodename, fieldname)
|
||||||
|
if not minetest.registered_nodes[nodename] then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return minetest.registered_nodes[nodename][fieldname]
|
||||||
|
end
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
-- Iterate through the mapblock log,
|
||||||
|
-- populating blocks with new stuff in the process.
|
||||||
|
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
if not biome_lib.block_log[1] then return end -- the block log is empty
|
||||||
|
|
||||||
|
if math.random(100) > biome_lib.queue_ratio then return end
|
||||||
|
for s = 1, biome_lib.entries_per_step do
|
||||||
|
biome_lib.generate_block()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Periodically wake-up the queue to give old blocks a chance to time-out
|
||||||
|
-- if the player isn't currently exploring (i.e. they're just playing in one area)
|
||||||
|
|
||||||
|
function biome_lib.wake_up_queue()
|
||||||
|
if #biome_lib.block_recheck_list > 1
|
||||||
|
and #biome_lib.block_log == 0 then
|
||||||
|
biome_lib.block_log[#biome_lib.block_log + 1] =
|
||||||
|
table.copy(biome_lib.block_recheck_list[#biome_lib.block_recheck_list])
|
||||||
|
biome_lib.block_recheck_list[#biome_lib.block_recheck_list] = nil
|
||||||
|
biome_lib.run_block_recheck_list = true
|
||||||
|
biome_lib.dbg("Woke-up the map queue to give old blocks a chance to time-out.", 3)
|
||||||
|
end
|
||||||
|
minetest.after(biome_lib.block_queue_wakeup_time, biome_lib.wake_up_queue)
|
||||||
|
end
|
||||||
|
|
||||||
|
biome_lib.wake_up_queue()
|
||||||
|
|
||||||
|
-- Play out the entire log all at once on shutdown
|
||||||
|
-- to prevent unpopulated map areas
|
||||||
|
|
||||||
|
local function format_time(t)
|
||||||
|
if t > 59999999 then
|
||||||
|
return os.date("!%M minutes and %S seconds", math.ceil(t/1000000))
|
||||||
|
else
|
||||||
|
return os.date("!%S seconds", math.ceil(t/1000000))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.check_remaining_time()
|
||||||
|
if minetest.get_us_time() > (biome_lib.shutdown_last_timestamp + 10000000) then -- report progress every 10s
|
||||||
|
biome_lib.shutdown_last_timestamp = minetest.get_us_time()
|
||||||
|
|
||||||
|
local entries_remaining = #biome_lib.block_log + #biome_lib.block_recheck_list
|
||||||
|
|
||||||
|
local total_purged = biome_lib.starting_count - entries_remaining
|
||||||
|
local elapsed_time = biome_lib.shutdown_last_timestamp - biome_lib.shutdown_start_time
|
||||||
|
biome_lib.dbg(string.format("%i entries, approximately %s remaining.",
|
||||||
|
entries_remaining, format_time(elapsed_time/total_purged * entries_remaining)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--Purge the block log at shutdown
|
||||||
|
|
||||||
|
minetest.register_on_shutdown(function()
|
||||||
|
|
||||||
|
biome_lib.shutdown_start_time = minetest.get_us_time()
|
||||||
|
biome_lib.shutdown_last_timestamp = minetest.get_us_time()+1
|
||||||
|
|
||||||
|
biome_lib.starting_count = #biome_lib.block_log + #biome_lib.block_recheck_list
|
||||||
|
|
||||||
|
if biome_lib.starting_count == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
biome_lib.dbg("Stand by, purging the mapblock log "..
|
||||||
|
"(there are "..biome_lib.starting_count.." entries) ...", 0)
|
||||||
|
|
||||||
|
while #biome_lib.block_log > 0 do
|
||||||
|
biome_lib.generate_block(true)
|
||||||
|
biome_lib.check_remaining_time()
|
||||||
|
end
|
||||||
|
|
||||||
|
if #biome_lib.block_recheck_list > 0 then
|
||||||
|
biome_lib.block_log = table.copy(biome_lib.block_recheck_list)
|
||||||
|
biome_lib.block_recheck_list = {}
|
||||||
|
while #biome_lib.block_log > 0 do
|
||||||
|
biome_lib.generate_block(true)
|
||||||
|
biome_lib.check_remaining_time()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
biome_lib.dbg("Log purge completed after "..
|
||||||
|
format_time(minetest.get_us_time() - biome_lib.shutdown_start_time)..".", 0)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- "Record" the map chunks being generated by the core mapgen,
|
||||||
|
-- split into individual mapblocks to reduce lag
|
||||||
|
|
||||||
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
|
local timestamp = minetest.get_us_time()
|
||||||
|
for y = 0, 4 do
|
||||||
|
local miny = minp.y + y*16
|
||||||
|
|
||||||
|
if miny >= biome_lib.mapgen_elevation_limit.min
|
||||||
|
and (miny + 15) <= biome_lib.mapgen_elevation_limit.max then
|
||||||
|
|
||||||
|
for x = 0, 4 do
|
||||||
|
local minx = minp.x + x*16
|
||||||
|
|
||||||
|
for z = 0, 4 do
|
||||||
|
local minz = minp.z + z*16
|
||||||
|
|
||||||
|
local bmin = {x=minx, y=miny, z=minz}
|
||||||
|
local bmax = {x=minx + 15, y=miny + 15, z=minz + 15}
|
||||||
|
biome_lib.block_log[#biome_lib.block_log + 1] = { bmin, bmax, true, timestamp }
|
||||||
|
biome_lib.block_log[#biome_lib.block_log + 1] = { bmin, bmax, false, timestamp }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
biome_lib.dbg("Did not enqueue mapblocks at elevation "..miny..
|
||||||
|
"m, they're out of range of any generate_plant() calls.", 4)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
biome_lib.run_block_recheck_list = true
|
||||||
|
end)
|
||||||
|
|
||||||
|
if biome_lib.debug_log_level >= 3 then
|
||||||
|
biome_lib.last_count = 0
|
||||||
|
|
||||||
|
function biome_lib.show_pending_block_count()
|
||||||
|
if biome_lib.last_count ~= #biome_lib.block_log then
|
||||||
|
biome_lib.dbg(string.format("Pending block counts - ready to process: %-8icurrently deferred: %i",
|
||||||
|
#biome_lib.block_log, #biome_lib.block_recheck_list), 3)
|
||||||
|
biome_lib.last_count = #biome_lib.block_log
|
||||||
|
biome_lib.queue_idle_flag = false
|
||||||
|
elseif not biome_lib.queue_idle_flag then
|
||||||
|
if #biome_lib.block_recheck_list > 0 then
|
||||||
|
biome_lib.dbg("Mapblock queue only contains blocks that can't yet be processed.", 3)
|
||||||
|
biome_lib.dbg("Idling the queue until new blocks arrive or the next wake-up call occurs.", 3)
|
||||||
|
else
|
||||||
|
biome_lib.dbg("Mapblock queue has run dry.", 3)
|
||||||
|
biome_lib.dbg("Idling the queue until new blocks arrive.", 3)
|
||||||
|
end
|
||||||
|
biome_lib.queue_idle_flag = true
|
||||||
|
end
|
||||||
|
minetest.after(1, biome_lib.show_pending_block_count)
|
||||||
|
end
|
||||||
|
|
||||||
|
biome_lib.show_pending_block_count()
|
||||||
|
end
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
-- compatibility shims for old mods
|
||||||
|
|
||||||
|
function biome_lib:register_generate_plant(b, n)
|
||||||
|
biome_lib.dbg("Warning: biome_lib:register_generate_plant() is deprecated!", 2)
|
||||||
|
biome_lib.dbg("Use biome_lib.register_on_generate() instead", 2)
|
||||||
|
biome_lib.dbg("Item: "..dump(n), 2)
|
||||||
|
biome_lib.register_on_generate(b, n)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib:spawn_on_surfaces(sd, sp, sr, sc, ss, sa)
|
||||||
|
biome_lib.dbg("Warning: biome_lib:spawn_on_surfaces() is deprecated!", 2)
|
||||||
|
biome_lib.dbg("Use biome_lib.register_active_spawner() instead.", 2)
|
||||||
|
biome_lib.dbg("Item: "..dump(sd.spawn_plants or sp[1] or sp), 2)
|
||||||
|
biome_lib.register_active_spawner(sd, sp, sr, sc, ss, sa)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib:replace_object(p, r, f, w, d)
|
||||||
|
biome_lib.dbg("Warning: biome_lib:replace_object() is deprecated!", 2)
|
||||||
|
biome_lib.dbg("Use biome_lib.replace_plant() instead.", 2)
|
||||||
|
biome_lib.dbg("Item: "..dump(r), 2)
|
||||||
|
biome_lib.replace_plant(p, r, f, w, d)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib:grow_plants(o)
|
||||||
|
biome_lib.dbg("Warning: biome_lib:grow_plants() is deprecated!", 2)
|
||||||
|
biome_lib.dbg("Use biome_lib.update_plant() instead.", 2)
|
||||||
|
biome_lib.dbg("Item: "..dump(o.grow_nodes), 2)
|
||||||
|
biome_lib.update_plant(o)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.generate_ltree(p, n)
|
||||||
|
minetest.spawn_tree(p, n)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.grow_ltree(p, n)
|
||||||
|
minetest.spawn_tree(p, n)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib:generate_tree(p, n)
|
||||||
|
biome_lib.dbg("Warning: biome_lib:generate_tree() is deprecated!", 2)
|
||||||
|
biome_lib.dbg("Use biome_lib.generate_ltree() instead.", 2)
|
||||||
|
biome_lib.dbg("Item: "..dump(n), 2)
|
||||||
|
biome_lib.generate_ltree(p, n)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib:grow_tree(p, n)
|
||||||
|
biome_lib.dbg("Warning: biome_lib:grow_tree() is deprecated!", 2)
|
||||||
|
biome_lib.dbg("Use biome_lib.grow_ltree() instead.", 2)
|
||||||
|
biome_lib.dbg("Item: "..dump(n), 2)
|
||||||
|
biome_lib.grow_ltree(p, n)
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.can_use_decorations(b, nodes_or_function_or_treedef)
|
||||||
|
if not b or not nodes_or_function_or_treedef
|
||||||
|
or b.below_nodes
|
||||||
|
or b.avoid_nodes
|
||||||
|
or b.avoid_radius
|
||||||
|
or b.neighbors
|
||||||
|
or b.ncount
|
||||||
|
or b.depth
|
||||||
|
or b.near_nodes_size
|
||||||
|
or b.near_nodes_vertical
|
||||||
|
or b.temp_min
|
||||||
|
or b.temp_max
|
||||||
|
or b.verticals_list
|
||||||
|
or b.delete_above
|
||||||
|
or b.delete_above_surround
|
||||||
|
or ( type(nodes_or_function_or_treedef) == "string" and not minetest.registered_nodes[nodes_or_function_or_treedef] )
|
||||||
|
or ( type(nodes_or_function_or_treedef) == "table" and nodes_or_function_or_treedef.axiom )
|
||||||
|
or type(nodes_or_function_or_treedef) == "function"
|
||||||
|
then return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local biome = biome_lib.set_defaults(b)
|
||||||
|
|
||||||
|
local decor_def = {
|
||||||
|
["deco_type"] = "simple",
|
||||||
|
["flags"] = "all_floors",
|
||||||
|
["decoration"] = nodes_or_function_or_treedef,
|
||||||
|
["place_on"] = biome.surface,
|
||||||
|
["y_min"] = biome.min_elevation,
|
||||||
|
["y_max"] = biome.max_elevation,
|
||||||
|
["spawn_by"] = biome.near_nodes,
|
||||||
|
["num_spawn_by"] = biome.near_nodes and biome.near_nodes_count,
|
||||||
|
}
|
||||||
|
|
||||||
|
local r = (100-biome.rarity)/100
|
||||||
|
local mc = math.min(biome.max_count, 6400)/6400
|
||||||
|
|
||||||
|
decor_def.noise_params = {
|
||||||
|
octaves = biome_lib.fertile_perlin_octaves,
|
||||||
|
persist = biome_lib.fertile_perlin_persistence * (100/biome_lib.fertile_perlin_scale),
|
||||||
|
scale = math.min(r, mc),
|
||||||
|
seed = biome.seed_diff,
|
||||||
|
offset = 0,
|
||||||
|
spread = {x = 100, y = 100, z = 100},
|
||||||
|
lacunarity = 2,
|
||||||
|
flags = "absvalue"
|
||||||
|
}
|
||||||
|
|
||||||
|
if not b.check_air then
|
||||||
|
decor_def.flags = decor_def.flags..",force_placement"
|
||||||
|
end
|
||||||
|
|
||||||
|
if b.spawn_replace_node then
|
||||||
|
decor_def.place_offset_y = -1
|
||||||
|
end
|
||||||
|
|
||||||
|
if b.random_facedir then
|
||||||
|
decor_def.param2 = math.min(b.random_facedir[1], b.random_facedir[2])
|
||||||
|
decor_def.param2_max = math.max(b.random_facedir[1], b.random_facedir[2])
|
||||||
|
end
|
||||||
|
|
||||||
|
return decor_def
|
||||||
|
end
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
-- The growing ABM
|
||||||
|
|
||||||
|
function biome_lib.check_surface(name, nodes)
|
||||||
|
if not nodes then return true end
|
||||||
|
if type(nodes) == "string" then return nodes == name end
|
||||||
|
if nodes.set and nodes[name] then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
for _, n in ipairs(nodes) do
|
||||||
|
if name == n then return true end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.update_plant(opts)
|
||||||
|
|
||||||
|
local options = opts
|
||||||
|
|
||||||
|
options.height_limit = options.height_limit or 5
|
||||||
|
options.ground_nodes = options.ground_nodes or biome_lib.default_ground_nodes
|
||||||
|
options.grow_nodes = options.grow_nodes or biome_lib.default_grow_nodes
|
||||||
|
options.seed_diff = options.seed_diff or 0
|
||||||
|
|
||||||
|
local n
|
||||||
|
|
||||||
|
if type(options.grow_plant) == "table" then
|
||||||
|
n = "multi: "..options.grow_plant[1]..", ..."
|
||||||
|
else
|
||||||
|
n = options.grow_plant
|
||||||
|
end
|
||||||
|
|
||||||
|
options.label = options.label or "biome_lib.update_plant(): "..n
|
||||||
|
|
||||||
|
if options.grow_delay*biome_lib.time_scale >= 1 then
|
||||||
|
options.interval = options.grow_delay*biome_lib.time_scale
|
||||||
|
else
|
||||||
|
options.interval = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = { options.grow_plant },
|
||||||
|
interval = options.interval,
|
||||||
|
chance = options.grow_chance,
|
||||||
|
label = options.label,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local p_top = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||||
|
local p_bot = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
|
local n_top = minetest.get_node(p_top)
|
||||||
|
local n_bot = minetest.get_node(p_bot)
|
||||||
|
local walldir = nil
|
||||||
|
if options.need_wall and options.verticals_list then
|
||||||
|
walldir = biome_lib.find_adjacent_wall(p_top, options.verticals_list, options.choose_random_wall)
|
||||||
|
end
|
||||||
|
if biome_lib.default_grow_through_nodes[n_top.name]
|
||||||
|
and (not options.need_wall or (options.need_wall and walldir)) then
|
||||||
|
if options.grow_vertically and walldir then
|
||||||
|
if biome_lib.search_downward(pos, options.height_limit, options.ground_nodes) then
|
||||||
|
minetest.swap_node(p_top, { name = options.grow_plant, param2 = walldir})
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif biome_lib.check_surface(n_bot.name, options.grow_nodes) then
|
||||||
|
if not options.grow_result and not options.grow_function then
|
||||||
|
minetest.swap_node(pos, biome_lib.air)
|
||||||
|
|
||||||
|
else
|
||||||
|
biome_lib.replace_plant(pos, options.grow_result, options.grow_function, options.facedir, options.seed_diff)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
-- Biome library mod by VanessaE
|
||||||
|
--
|
||||||
|
-- I got the temperature map idea from "hmmmm", values used for it came from
|
||||||
|
-- Splizard's snow mod.
|
||||||
|
--
|
||||||
|
|
||||||
|
biome_lib = {}
|
||||||
|
biome_lib.modpath = minetest.get_modpath("biome_lib")
|
||||||
|
|
||||||
|
local function tableize(s)
|
||||||
|
return string.split(string.trim(string.gsub(s, " ", "")))
|
||||||
|
end
|
||||||
|
|
||||||
|
local c1 = minetest.settings:get("biome_lib_default_grow_through_nodes")
|
||||||
|
biome_lib.default_grow_through_nodes = {["air"] = true}
|
||||||
|
if c1 then
|
||||||
|
for _, i in ipairs(tableize(c1)) do
|
||||||
|
biome_lib.default_grow_through_nodes[i] = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
biome_lib.default_grow_through_nodes["default:snow"] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local c2 = minetest.settings:get("biome_lib_default_water_nodes")
|
||||||
|
biome_lib.default_water_nodes = {}
|
||||||
|
if c2 then
|
||||||
|
for _, i in ipairs(tableize(c2)) do
|
||||||
|
biome_lib.default_water_nodes[i] = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
biome_lib.default_water_nodes["default:water_source"] = true
|
||||||
|
biome_lib.default_water_nodes["default:water_flowing"] = true
|
||||||
|
biome_lib.default_water_nodes["default:river_water_source"] = true
|
||||||
|
biome_lib.default_water_nodes["default:river_water_flowing"] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local c3 = minetest.settings:get("biome_lib_default_wet_surfaces")
|
||||||
|
local c4 = minetest.settings:get("biome_lib_default_ground_nodes")
|
||||||
|
local c5 = minetest.settings:get("biome_lib_default_grow_nodes")
|
||||||
|
|
||||||
|
biome_lib.default_wet_surfaces = c3 and tableize(c3) or {"default:dirt", "default:dirt_with_grass", "default:sand"}
|
||||||
|
biome_lib.default_ground_nodes = c4 and tableize(c4) or {"default:dirt_with_grass"}
|
||||||
|
biome_lib.default_grow_nodes = c5 and tableize(c5) or {"default:dirt_with_grass"}
|
||||||
|
|
||||||
|
biome_lib.debug_log_level = tonumber(minetest.settings:get("biome_lib_debug_log_level")) or 0
|
||||||
|
|
||||||
|
local rr = tonumber(minetest.settings:get("biome_lib_queue_ratio")) or -200
|
||||||
|
biome_lib.queue_ratio = 100 - rr
|
||||||
|
biome_lib.entries_per_step = math.max(-rr, 1)
|
||||||
|
|
||||||
|
-- the timer that manages the block timeout is in microseconds, but the timer
|
||||||
|
-- that manages the queue wakeup call has to be in seconds, and works best if
|
||||||
|
-- it takes a fraction of the block timeout interval.
|
||||||
|
|
||||||
|
local t = tonumber(minetest.settings:get("biome_lib_block_timeout")) or 300
|
||||||
|
|
||||||
|
biome_lib.block_timeout = t * 1000000
|
||||||
|
|
||||||
|
-- we don't want the wakeup function to trigger TOO often,
|
||||||
|
-- in case the user's block timeout setting is really low
|
||||||
|
|
||||||
|
biome_lib.block_queue_wakeup_time = math.min(t/2, math.max(20, t/10))
|
||||||
|
|
||||||
|
-- the actual important stuff starts here ;-)
|
||||||
|
|
||||||
|
dofile(biome_lib.modpath .. "/api.lua")
|
||||||
|
dofile(biome_lib.modpath .. "/search_functions.lua")
|
||||||
|
dofile(biome_lib.modpath .. "/growth.lua")
|
||||||
|
dofile(biome_lib.modpath .. "/compat.lua")
|
||||||
|
|
||||||
|
minetest.after(0.01, function()
|
||||||
|
-- report the final registration results and enable the active block queue stuff
|
||||||
|
|
||||||
|
local n = #biome_lib.actionslist_aircheck + #biome_lib.actionslist_no_aircheck
|
||||||
|
|
||||||
|
biome_lib.dbg("All mapgen registrations completed.", 0)
|
||||||
|
|
||||||
|
if n > 0 then
|
||||||
|
biome_lib.dbg("Total items/actions to handle manually: "..n..
|
||||||
|
" ("..#biome_lib.actionslist_no_aircheck.." without air checks)", 0)
|
||||||
|
biome_lib.dbg("Total surface types to handle manually: "
|
||||||
|
..#biome_lib.surfaceslist_aircheck + #biome_lib.surfaceslist_no_aircheck, 0)
|
||||||
|
else
|
||||||
|
biome_lib.dbg("There are no \"handle manually\" items/actions registered,", 0)
|
||||||
|
biome_lib.dbg("so the mapblock queue will not be used this session.", 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
biome_lib.dbg("Items sent to the engine's decorations handler: "..#biome_lib.registered_decorations, 0)
|
||||||
|
biome_lib.dbg("Elevation range: "..biome_lib.mapgen_elevation_limit.min.." to "..
|
||||||
|
string.format("%+d", biome_lib.mapgen_elevation_limit.max).." meters.", 0)
|
||||||
|
|
||||||
|
if n > 0 then
|
||||||
|
dofile(biome_lib.modpath .. "/block_queue_checks.lua")
|
||||||
|
end
|
||||||
|
end)
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
name = biome_lib
|
||||||
|
title = Biome Library
|
||||||
|
description = The biome spawning and management library for Plantlife, Moretrees, Tiny Trees, and other mods that originally depended on plants_lib from the plantlife modpack.
|
||||||
|
optional_depends = default
|
||||||
|
min_minetest_version = 5.2.0
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
|
||||||
|
-- function to decide if a node has a wall that's in verticals_list{}
|
||||||
|
-- returns wall direction of valid node, or nil if invalid.
|
||||||
|
|
||||||
|
function biome_lib.find_adjacent_wall(pos, verticals, randomflag)
|
||||||
|
local verts = dump(verticals)
|
||||||
|
if randomflag then
|
||||||
|
local walltab = {}
|
||||||
|
|
||||||
|
if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name) then walltab[#walltab + 1] = 3 end
|
||||||
|
if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name) then walltab[#walltab + 1] = 2 end
|
||||||
|
if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z-1 }).name) then walltab[#walltab + 1] = 5 end
|
||||||
|
if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z+1 }).name) then walltab[#walltab + 1] = 4 end
|
||||||
|
|
||||||
|
if #walltab > 0 then return walltab[math.random(1, #walltab)] end
|
||||||
|
|
||||||
|
else
|
||||||
|
if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name) then return 3 end
|
||||||
|
if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name) then return 2 end
|
||||||
|
if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z-1 }).name) then return 5 end
|
||||||
|
if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z+1 }).name) then return 4 end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Function to search downward from the given position, looking for the first
|
||||||
|
-- node that matches the ground table. Returns the new position, or nil if
|
||||||
|
-- height limit is exceeded before finding it.
|
||||||
|
|
||||||
|
function biome_lib.search_downward(pos, heightlimit, ground)
|
||||||
|
for i = 0, heightlimit do
|
||||||
|
if string.find(dump(ground), minetest.get_node({x=pos.x, y=pos.y-i, z = pos.z}).name) then
|
||||||
|
return {x=pos.x, y=pos.y-i, z = pos.z}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function biome_lib.find_open_side(pos)
|
||||||
|
if minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name == "air" then
|
||||||
|
return {newpos = { x=pos.x-1, y=pos.y, z=pos.z }, facedir = 2}
|
||||||
|
end
|
||||||
|
if minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name == "air" then
|
||||||
|
return {newpos = { x=pos.x+1, y=pos.y, z=pos.z }, facedir = 3}
|
||||||
|
end
|
||||||
|
if minetest.get_node({ x=pos.x, y=pos.y, z=pos.z-1 }).name == "air" then
|
||||||
|
return {newpos = { x=pos.x, y=pos.y, z=pos.z-1 }, facedir = 4}
|
||||||
|
end
|
||||||
|
if minetest.get_node({ x=pos.x, y=pos.y, z=pos.z+1 }).name == "air" then
|
||||||
|
return {newpos = { x=pos.x, y=pos.y, z=pos.z+1 }, facedir = 5}
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Comma-separated list of things that a spawned node is allowed to grow
|
||||||
|
# through. Air is always added to whatever else you specify here.
|
||||||
|
biome_lib_default_grow_through_nodes (List of things a plant can grow through) string default:snow
|
||||||
|
|
||||||
|
# Comma-separated list of nodes that should be treated as water or water-like
|
||||||
|
# for the sake of looking for neighboring wet ground.
|
||||||
|
biome_lib_default_water_nodes (List of "water-like" sources) string default:water_source,default:water_flowing,default:river_water_source,default:river_water_flowing
|
||||||
|
|
||||||
|
# Comma-separated list of nodes that should be considered "wet" if one of
|
||||||
|
# the configured "water-like" sources is nearby.
|
||||||
|
biome_lib_default_wet_surfaces (List of "wet" nodes) string default:dirt,default:dirt_with_grass,default:sand
|
||||||
|
|
||||||
|
# Comma-separated list of nodes that something must be sitting on to be
|
||||||
|
# able to actively change from one thing to another (such as a sapling
|
||||||
|
# growing into a tree), to be used if the mod that added that growable
|
||||||
|
# thing didn't provide its own list of suitable surfaces.
|
||||||
|
biome_lib_default_grow_nodes (List of default surfaces a plant can thrive on) string default:dirt_with_grass
|
||||||
|
|
||||||
|
# Comma-separated list of nodes to use as the "root" of something that can
|
||||||
|
# gradually climb up a wall (such as ivy), to be used if the mod that added
|
||||||
|
# the climing thing didn't provide its own list.
|
||||||
|
biome_lib_default_ground_nodes (List of default root nodes) string default:dirt_with_grass
|
||||||
|
|
||||||
|
# biome_lib divides its workload into "actions", as dictated by the sum
|
||||||
|
# total of all mods that use it, and this sets how much of that work is done
|
||||||
|
# per globalstep tick. If positive, a single action is executed on that
|
||||||
|
# percentage of ticks, on average. If negative, it becomes positive, and
|
||||||
|
# that many actions are executed on every single tick, skipping none.
|
||||||
|
# More negative means more throughput, at the expense of lag. On fast PC's,
|
||||||
|
# a setting of between -500 and -2000 might be good.
|
||||||
|
biome_lib_queue_ratio (Queue run ratio) int -200
|
||||||
|
|
||||||
|
# Minetest's map generator allows neighboring areas to overflow into one
|
||||||
|
# another, to create smooth terrain, but it often hands the map blocks that
|
||||||
|
# comprise those areas to Lua (and hence, to biome_lib) before that overflow
|
||||||
|
# function happens, which causes the mapgen to overwrite whatever Lua does
|
||||||
|
# to them. This setting (in seconds) makes biome_lib wait before adding its
|
||||||
|
# normal output to those map blocks, to give the engine plenty of time to
|
||||||
|
# run that overflow feature first.
|
||||||
|
biome_lib_block_timeout (Deferred block timeout) int 300
|
||||||
|
|
||||||
|
# This does just what it sounds like - it shows all debug output that's sent
|
||||||
|
# with a level equal to or greater than this value. A setting of 0 shows only
|
||||||
|
# the bare necessities, such as the startup and shutdown messages, 1 adds
|
||||||
|
# internal non-fatal errors to what's shown, 2 adds warnings, 3 adds other
|
||||||
|
# basic info, 4 adds all the verbose debugging spew. 3 is perhaps the most
|
||||||
|
# useful setting.
|
||||||
|
biome_lib_debug_log_level (Debug log level) int 0
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# ---> Lua
|
||||||
|
# Compiled Lua sources
|
||||||
|
luac.out
|
||||||
|
|
||||||
|
# luarocks build files
|
||||||
|
*.src.rock
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.os
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
*.def
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
“This License” refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||||
|
|
||||||
|
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||||
|
|
||||||
|
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||||
|
|
||||||
|
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||||
|
|
||||||
|
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||||
|
|
||||||
|
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||||
|
|
||||||
|
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||||
|
|
||||||
|
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||||
|
|
||||||
|
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# denseores
|
||||||
|
|
||||||
|
The Dense Ores mod for Minetest.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
default
|
||||||
|
moreores?
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
--[[
|
||||||
|
Dense Ores mod for Minetest
|
||||||
|
Copyright (C) 2021 benedict424
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Order of everything here:
|
||||||
|
coal, iron, copper, gold, mese, diamond
|
||||||
|
Large, small
|
||||||
|
--]]
|
||||||
|
|
||||||
|
denseores_modpath = minetest.get_modpath("denseores")
|
||||||
|
|
||||||
|
|
||||||
|
--[ Large Ore Nodes --]
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_coal_ore", { --coal
|
||||||
|
description = "Large Coal Ore",
|
||||||
|
tiles ={"default_stone.png^large_coal_ore.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
drop = 'default:coal_lump 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_iron_ore", { --iron
|
||||||
|
description = "Large Iron Ore",
|
||||||
|
tiles ={"default_stone.png^large_iron_ore.png"},
|
||||||
|
groups = {cracky=2},
|
||||||
|
drop = 'default:iron_lump 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_copper_ore", { --copper
|
||||||
|
description = "Large Copper Ore",
|
||||||
|
tiles ={"default_stone.png^large_copper_ore.png"},
|
||||||
|
groups = {cracky=2},
|
||||||
|
drop = 'default:copper_lump 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_tin_ore", { --tin
|
||||||
|
description = "Large Tin Ore",
|
||||||
|
tiles ={"default_stone.png^large_tin_ore.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
drop = 'default:tin_lump 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_gold_ore", { --gold
|
||||||
|
description = "Large Gold Ore",
|
||||||
|
tiles ={"default_stone.png^large_gold_ore.png"},
|
||||||
|
groups = {cracky=2},
|
||||||
|
drop = 'default:gold_lump 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_mese_ore", { --mese
|
||||||
|
description = "Large Mese Ore",
|
||||||
|
tiles ={"default_stone.png^large_mese_ore.png"},
|
||||||
|
groups = {cracky=1},
|
||||||
|
drop = 'default:mese_crystal 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_diamond_ore", { --diamond
|
||||||
|
description = "Large Diamond Ore",
|
||||||
|
tiles ={"default_stone.png^large_diamond_ore.png"},
|
||||||
|
groups = {cracky=1},
|
||||||
|
drop = 'default:diamond 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--[ Large Ore Defenitions --]
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_coal_ore",
|
||||||
|
wherein = "default:stone_with_coal",
|
||||||
|
clust_scarcity = 14,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = 64,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_iron_ore",
|
||||||
|
wherein = "default:stone_with_iron",
|
||||||
|
clust_scarcity = 14,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_copper_ore",
|
||||||
|
wherein = "default:stone_with_copper",
|
||||||
|
clust_scarcity = 14,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_tin_ore",
|
||||||
|
wherein = "default:stone_with_tin",
|
||||||
|
clust_scarcity = 12,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = 64,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_gold_ore",
|
||||||
|
wherein = "default:stone_with_gold",
|
||||||
|
clust_scarcity = 14,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_mese_ore",
|
||||||
|
wherein = "default:stone_with_mese",
|
||||||
|
clust_scarcity = 14,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = -64,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_diamond_ore",
|
||||||
|
wherein = "default:stone_with_diamond",
|
||||||
|
clust_scarcity = 14,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = -128,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--[ Crafting Recipies --]
|
||||||
|
--[ From Large to Normal --]
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "default:coal_lump 2", --coal
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_coal_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "default:iron_lump 2", --iron
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_iron_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "default:copper_lump 2", --copper
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_copper_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "moreores:tin_lump 2", --tin
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_tin_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "default:gold_lump 2", --gold
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_gold_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "default:mese_crystal 2", --mese
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_mese_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "default:diamond 2", --diamond
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_diamond_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Special things happen from this line down.
|
||||||
|
|
||||||
|
|
||||||
|
-- Does moreores exist? Let's find out!
|
||||||
|
if minetest.get_modpath("moreores") then --Thank you Kazea of the Minetest Fourums.
|
||||||
|
dofile(denseores_modpath .. "/mo.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
--[[
|
||||||
|
Dense Ores mod for Minetest
|
||||||
|
Copyright (C) 2021 benedict424
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
-- Mithril, Tin, Silver. That's my pattern.
|
||||||
|
|
||||||
|
--[ Large Ore Nodes --]
|
||||||
|
--[ Finished! --]
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_mithril_ore", {
|
||||||
|
description = "Heavy Mithril Ore",
|
||||||
|
tiles ={"default_stone.png^large_mithril_ore.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
drop = 'moreores:mithril_lump 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("denseores:large_silver_ore", {
|
||||||
|
description = "Heavy Silver Ore",
|
||||||
|
tiles ={"default_stone.png^large_silver_ore.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
drop = 'moreores:silver_lump 2',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--[ Large Ore Defenitions --]
|
||||||
|
--[ Finished! --]
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_mithril_ore",
|
||||||
|
wherein = "moreores:mineral_mithril",
|
||||||
|
clust_scarcity = 12,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = 64,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "denseores:large_silver_ore",
|
||||||
|
wherein = "moreores:mineral_silver",
|
||||||
|
clust_scarcity = 12,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = 64,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--[ Crafting Recipies --]
|
||||||
|
--[ From Large to Normal --]
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "moreores:mithril_lump 2", --mithril
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_mithril_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "moreores:silver_lump 2", --silver
|
||||||
|
recipe = {
|
||||||
|
"denseores:large_silver_ore",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 DustyDave961
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# desertores
|
||||||
|
Generates ores in deserts and other biomes. Also spawns raw ore blocks if enabled. Biome specific ore node variants coming soon.
|
||||||
|
|
||||||
|
Biome specific ore variants may include:
|
||||||
|
* Sandstone
|
||||||
|
* Desert Stone
|
||||||
|
* Permafrost
|
||||||
|
* Desert Sandstone
|
||||||
|
* Silver Sandstone
|
||||||
|
* Cave Ice
|
||||||
@@ -0,0 +1,325 @@
|
|||||||
|
desertores = {}
|
||||||
|
desertores.registered_ores = {
|
||||||
|
-- Coal
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_coal",
|
||||||
|
clust_scarcity = 8 ^ 3,
|
||||||
|
clust_num_ores = 9,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_coal",
|
||||||
|
clust_scarcity = 8 ^ 3,
|
||||||
|
clust_num_ores = 8,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = 64,
|
||||||
|
y_min = -127,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_coal",
|
||||||
|
clust_scarcity = 12 ^ 3,
|
||||||
|
clust_num_ores = 30,
|
||||||
|
clust_size = 5,
|
||||||
|
y_max = -128,
|
||||||
|
y_min = -31000,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Tin
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_tin",
|
||||||
|
clust_scarcity = 10 ^ 3,
|
||||||
|
clust_num_ores = 5,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_tin",
|
||||||
|
clust_scarcity = 13 ^ 3,
|
||||||
|
clust_num_ores = 4,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = -64,
|
||||||
|
y_min = -127,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_tin",
|
||||||
|
clust_scarcity = 10 ^ 3,
|
||||||
|
clust_num_ores = 5,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = -128,
|
||||||
|
y_min = -31000,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Copper
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_copper",
|
||||||
|
clust_scarcity = 9 ^ 3,
|
||||||
|
clust_num_ores = 5,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_copper",
|
||||||
|
clust_scarcity = 12 ^ 3,
|
||||||
|
clust_num_ores = 4,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = -64,
|
||||||
|
y_min = -127,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_copper",
|
||||||
|
clust_scarcity = 9 ^ 3,
|
||||||
|
clust_num_ores = 5,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = -128,
|
||||||
|
y_min = -31000,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Iron
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_iron",
|
||||||
|
clust_scarcity = 9 ^ 3,
|
||||||
|
clust_num_ores = 12,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_iron",
|
||||||
|
clust_scarcity = 7 ^ 3,
|
||||||
|
clust_num_ores = 5,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = -128,
|
||||||
|
y_min = -255,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Gold
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_gold",
|
||||||
|
clust_scarcity = 13 ^ 3,
|
||||||
|
clust_num_ores = 5,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Mese crystal
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_mese",
|
||||||
|
clust_scarcity = 14 ^ 3,
|
||||||
|
clust_num_ores = 5,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Diamond
|
||||||
|
{
|
||||||
|
ore = "default:stone_with_diamond",
|
||||||
|
clust_scarcity = 15 ^ 3,
|
||||||
|
clust_num_ores = 4,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Mese block
|
||||||
|
{
|
||||||
|
ore = "default:mese",
|
||||||
|
clust_scarcity = 36 ^ 3,
|
||||||
|
clust_num_ores = 3,
|
||||||
|
clust_size = 2,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Diamond block
|
||||||
|
{
|
||||||
|
ore = "default:diamondblock",
|
||||||
|
wherein = "default:stone",
|
||||||
|
clust_scarcity = 29 ^ 3,
|
||||||
|
clust_num_ores = 3,
|
||||||
|
clust_size = 2,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1025,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:diamondblock",
|
||||||
|
wherein = {"default:stone", "default:desert_stone"},
|
||||||
|
clust_scarcity = 38 ^ 3,
|
||||||
|
clust_num_ores = 3,
|
||||||
|
clust_size = 2,
|
||||||
|
y_max = -1024,
|
||||||
|
y_min = -2047,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ore = "default:diamondblock",
|
||||||
|
wherein = {"default:stone", "default:desert_stone"},
|
||||||
|
clust_scarcity = 29 ^ 3,
|
||||||
|
clust_num_ores = 4,
|
||||||
|
clust_size = 3,
|
||||||
|
y_max = -2048,
|
||||||
|
y_min = -31000,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
--Dense ores and more ores
|
||||||
|
local moreores_path = core.get_modpath("moreores")
|
||||||
|
local denseores_path = core.get_modpath("denseores")
|
||||||
|
local lumpblocks_path = core.get_modpath("lumpblocks")
|
||||||
|
|
||||||
|
if moreores_path then
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "moreores:mineral_silver",
|
||||||
|
clust_scarcity = moreores.silver_chunk_size_high ^ 3,
|
||||||
|
clust_num_ores = moreores.silver_ore_per_chunk_high,
|
||||||
|
clust_size = moreores.silver_clust_size_high,
|
||||||
|
y_min = moreores.silver_min_depth_high,
|
||||||
|
y_max = moreores.silver_max_depth_high,
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "moreores:mineral_silver",
|
||||||
|
clust_scarcity = moreores.silver_chunk_size ^ 3,
|
||||||
|
clust_num_ores = moreores.silver_ore_per_chunk,
|
||||||
|
clust_size = moreores.silver_clust_size,
|
||||||
|
y_min = moreores.silver_min_depth,
|
||||||
|
y_max = moreores.silver_max_depth,
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "moreores:mineral_silver",
|
||||||
|
clust_scarcity = moreores.silver_chunk_size_deep ^ 3,
|
||||||
|
clust_num_ores = moreores.silver_ore_per_chunk_deep,
|
||||||
|
clust_size = moreores.silver_clust_size_deep,
|
||||||
|
y_min = moreores.silver_min_depth_deep,
|
||||||
|
y_max = moreores.silver_max_depth_deep
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "moreores:mineral_mithril",
|
||||||
|
clust_scarcity = moreores.mithril_chunk_size_high ^ 3,
|
||||||
|
clust_num_ores = moreores.mithril_ore_per_chunk_high,
|
||||||
|
clust_size = moreores.mithril_clust_size_high,
|
||||||
|
y_min = moreores.mithril_min_depth_high,
|
||||||
|
y_max = moreores.mithril_max_depth_high,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if denseores_path then
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "denseores:large_mese_ore",
|
||||||
|
wherein = "default:stone_with_mese",
|
||||||
|
clust_scarcity = 14,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
y_min = -31000,
|
||||||
|
y_max = -64,
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "denseores:large_diamond_ore",
|
||||||
|
wherein = "default:stone_with_diamond",
|
||||||
|
clust_scarcity = 14,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
y_min = -31000,
|
||||||
|
y_max = -128,
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "default:mese",
|
||||||
|
wherein = "denseores:large_mese_ore",
|
||||||
|
clust_scarcity = 36,
|
||||||
|
clust_num_ores = 1,
|
||||||
|
clust_size = 1,
|
||||||
|
y_min = -31000,
|
||||||
|
y_max = -64,
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "default:diamondblock",
|
||||||
|
wherein = "denseores:large_diamond_ore",
|
||||||
|
clust_scarcity = 38,
|
||||||
|
clust_num_ores = 1,
|
||||||
|
clust_size = 1,
|
||||||
|
y_min = -31000,
|
||||||
|
y_max = -128,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if moreores_path and denseores_path then
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "denseores:large_mithril_ore",
|
||||||
|
wherein = "moreores:mineral_mithril",
|
||||||
|
clust_scarcity = 12,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
y_min = -31000,
|
||||||
|
y_max = 64,
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "denseores:large_silver_ore",
|
||||||
|
wherein = "moreores:mineral_silver",
|
||||||
|
clust_scarcity = 12,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 2,
|
||||||
|
y_min = -31000,
|
||||||
|
y_max = 64,
|
||||||
|
})
|
||||||
|
|
||||||
|
if lumpblocks_path then
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "lumpblocks:mithril_block",
|
||||||
|
wherein = "denseores:large_mithril_ore",
|
||||||
|
clust_scarcity = 39,
|
||||||
|
clust_num_ores = 1,
|
||||||
|
clust_size = 1,
|
||||||
|
y_min = -31000,
|
||||||
|
y_max = 64,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if moreores_path and lumpblocks_path then
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "lumpblocks:mithril_block",
|
||||||
|
wherein = {"default:stone", "default:desert_stone"},
|
||||||
|
clust_scarcity = 39 ^ 3,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 1,
|
||||||
|
y_min = moreores.mithril_min_depth_high,
|
||||||
|
y_max = moreores.mithril_max_depth_high,
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "lumpblocks:mithril_block",
|
||||||
|
wherein = {"default:stone", "default:desert_stone"},
|
||||||
|
clust_scarcity = 39 ^ 3,
|
||||||
|
clust_num_ores = 2,
|
||||||
|
clust_size = 1,
|
||||||
|
y_min = moreores.mithril_min_depth,
|
||||||
|
y_max = moreores.mithril_max_depth,
|
||||||
|
})
|
||||||
|
table.insert(desertores.registered_ores, {
|
||||||
|
ore = "lumpblocks:mithril_block",
|
||||||
|
wherein = {"default:stone", "default:desert_stone"},
|
||||||
|
clust_scarcity = 30 ^ 3,
|
||||||
|
clust_num_ores = 3,
|
||||||
|
clust_size = 2,
|
||||||
|
y_min = moreores.mithril_min_depth_deep,
|
||||||
|
y_max = moreores.mithril_max_depth_deep,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, def in ipairs(desertores.registered_ores) do
|
||||||
|
def.ore_type = def.ore_type or "scatter"
|
||||||
|
def.wherein = def.wherein or {
|
||||||
|
"default:desert_stone",
|
||||||
|
"default:sandstone",
|
||||||
|
"default:desert_sandstone",
|
||||||
|
"default:silver_sandstone",
|
||||||
|
"default:permafrost",
|
||||||
|
"default:permafrost_with_moss",
|
||||||
|
"default:permafrost_with_stones",
|
||||||
|
"default:cave_ice",
|
||||||
|
"default:gravel"
|
||||||
|
}
|
||||||
|
core.register_ore(def)
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
name = desertores
|
||||||
|
title = Desert Ores
|
||||||
|
depends = default
|
||||||
|
optional_depends = moreores, denseores, lumpblocks, technic, elepower_dynamics
|
||||||
|
author = DustyDave961
|
||||||
|
supported_games = minetest_game
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Custom for Visual Studio
|
||||||
|
*.cs diff=csharp
|
||||||
|
|
||||||
|
# Standard to msysgit
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[submodule "mapgen_helper"]
|
||||||
|
path = mapgen_helper
|
||||||
|
url = https://github.com/minetest-mods/mapgen_helper
|
||||||
|
branch = master
|
||||||
|
[submodule "subterrane"]
|
||||||
|
path = subterrane
|
||||||
|
url = https://github.com/minetest-mods/subterrane
|
||||||
|
branch = master
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# Chat commands
|
||||||
|
|
||||||
|
There are not many chat commands provided by this modpack since it's primarily a mapgen mod. Only one is available to non-server-admins:
|
||||||
|
|
||||||
|
`mute_df_ambience`: Mutes or unmutes ambient sounds in deep caverns. This muted state is saved per-player, so players that are bothered by ambient sounds can disable them for themselves.
|
||||||
|
|
||||||
|
The following are only available for server admins:
|
||||||
|
|
||||||
|
`find_pit`: Finds the nearest glowing pit in the Underworld layer.
|
||||||
|
|
||||||
|
`mapgen_helper_loc` and `mapgen_helper_tour`: only available if the `mapgen_helper_log_locations` setting has been set to true. mapgen_helper will then record the locations of various types of mapgen feature as they are generated, and these commands will teleport the server admin to them.
|
||||||
|
|
||||||
|
`find_pit_caves`: Lists the locations of nearby vertical shaft caverns, including the top and bottom elevations.
|
||||||
|
|
||||||
|
# APIs
|
||||||
|
|
||||||
|
Not all APIs are listed here, this list focuses on APIs that modders may wish to use in sub-mods that modify DF Caverns' functionality in the existing context of this modpack.
|
||||||
|
|
||||||
|
## bones_loot
|
||||||
|
|
||||||
|
This mod populates the bones in the underworld with loot.
|
||||||
|
|
||||||
|
`bones_loot.register_loot`
|
||||||
|
|
||||||
|
Uses same table format as dungeon_loot from the default minetest_game. eg, {{name = "bucket:bucket_water", chance = 0.45, types = {"sandstone", "desert"}},
|
||||||
|
|
||||||
|
if dungeon_loot is installed it uses dungeon_loot's registration function directly.
|
||||||
|
|
||||||
|
## chasms
|
||||||
|
|
||||||
|
`chasms.register_ignore(node_name)`: Use this to set node types to be left alone by chasm-carving
|
||||||
|
|
||||||
|
`chasms.is_in_chasm(pos)`: returns true if pos is inside a chasm.
|
||||||
|
|
||||||
|
## df_ambience
|
||||||
|
|
||||||
|
`df_ambience.add_set(def)`: adds a sound set to the ambience mod. See soundsets.lua for a bunch of examples of what can go in the `def` table.
|
||||||
|
|
||||||
|
This mod has a lot of similarities to the [https://notabug.org/TenPlus1/ambience](ambience) mod, but after struggling to get that mod to "play nice" with df_caverns' needs it turned out to be easier to just re-implement the specific parts of the mod that were needed here.
|
||||||
|
|
||||||
|
## df_caverns
|
||||||
|
|
||||||
|
`df_caverns.get_biome(pos)`: returns the string name of the df_cavern biome that pos is located in, or nil if it's outside of any of df_caverns' cavern layers. df_caverns uses a homebrew biome system rather than the built-in biome registration system.
|
||||||
|
|
||||||
|
`df_caverns.is_ground_content(node_id)`: used by subterrane's mapgen to avoid removing nodes placed by df_caverns' mapgen. If you're adding new map features inside dfcavern's hollow spaces and they're being chopped in half at mapblock boundaries then you may be able to solve this by overriding this method with one that recognizes the nodes you're adding.
|
||||||
|
|
||||||
|
This was never really expected to be something that someone would need to do, though, so this is a little clunky. If you're having trouble with this please file an issue.
|
||||||
|
|
||||||
|
`df_caverns.populate_puzzle_chest(pos)`: When a "puzzle chest" is generated in the Underworld ruins this method gets called to populate its contents. If you wish to override the contents of the puzzle chest then you can override this method. Place items in the "main" inventory at the pos parameter's location.
|
||||||
|
|
||||||
|
## looped_node_sound
|
||||||
|
|
||||||
|
`looped_node_sound.register(def)`: A simple mod for making nodes emit a looped sound when the player is nearby.
|
||||||
|
|
||||||
|
def = {
|
||||||
|
node_list = {"df_trees:torchspine_1_lit"},
|
||||||
|
sound = "dfcaverns_torchspine_loop",
|
||||||
|
max_gain = 0.5,
|
||||||
|
gain_per_node = 0.05,
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
Dwarf Fortress is copyright 2018 by Tarn Adams. This mod uses no assets or other copyrighted materials from Dwarf Fortress.
|
||||||
|
|
||||||
|
Sounds and textures are under various licenses, see the license.txt file in the /sounds and /textures directories for details.
|
||||||
|
|
||||||
|
License for Code
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Copyright (C) 2021 FaceDeer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
Inspired by the world of Dwarf Fortress, this mod adds a series of vast cavern layers to the depths of Minetest with a variety of biomes that are populated with the flora of Dwarf Fortress.
|
||||||
|
|
||||||
|
## Cavern Layers
|
||||||
|
|
||||||
|
The underground is divided into a number of cavern "layers" with a variety of biomes and other features distributed throughout. As one goes deeper one will find increasingly bizzare flora and exotic environments that provide new challenges and opportunities for players.
|
||||||
|
|
||||||
|
The uppermost layer is home to relatively conventional tree-like fungal growths of Fungiwood and Tower-Cap mushrooms. These provide a source of underground wood. Also found in this region are plump helmets (an edible farmable mushroom), and cave wheat (a pale grass-like growth whose seeds can be ground for flour).
|
||||||
|
|
||||||
|
The next layer down has more exotic growths. Here you can find Goblin Cap mushrooms, the squatter cousins of the Tower Caps. Spore Trees sprout in the warmer and wetter corners of the caverns, raising a climbable three-dimensional mesh or hyphyae above the ground that emits a gentle rain of spore powder. Tunnel Tubes grow in the hottest regions - tall, curved stalks with fruiting bodies at the tips that burst violently when ripe. Smaller growths found here include plump helmets, cave wheat, pig tails (a fibrous fungus that can be grown and harvested for thread) and sweet pods (whose fruiting bodies can be milled for sugar or processed into syrup).
|
||||||
|
|
||||||
|
In the third cavern layer yet stranger forms of life flourish in the hostile conditions. The coal-black caverns of the Black Cap forests, rich with carbonaceous deposits that have accumulated over millions of years and lit by smouldering Torchspines, are found here. The frigid Nethercaps, blue-tinted mushrooms leaching heat out of their environment in ways that shouldn't be thermodynamically possible, fill their caverns with ice and snow. In the hotter areas the vicious Bloodthorn grows, with wicked spines that suck moisture from anything they can pierce. In caves too dry to support biological life enormous glowing crystals grow instead. Smaller plants that can be found here include quarry bushes (farmable for their spicy leaves) and dimple cups (whose eponymous parts can be ground to produce a brilliant blue dye).
|
||||||
|
|
||||||
|
After the third layer are the shores of the Sunless Sea, the ultimate destination of all water that flows downward through the twisty caves of Minetest. Familiar growths crowd its fertile shores, with Tower Cap, Goblin Cap, Fungiwood and Spore Trees able to take root in this relatively hospitable zone. The caverns of the Sunless Sea are vast in extent but are mostly flooded with water, and below the surface grows treacherous Snareweed and underwater citadels of softly-glowing Cave Coral. Twisting rivers connect the various caverns of the Sunless Sea.
|
||||||
|
|
||||||
|
Below the Sunless Sea are seas of a more dangerous sort: lakes of oil and the magma ocean. These caverns are filled with dangerous substances, though there are riches to be had as well; mineral growths fed by the heat and pressure and bountiful fuel sources.
|
||||||
|
|
||||||
|
At the very foundation of the world lies an ancient impenetrable realm. There are signs that life once existed here but it is now long gone. Its dead hollows rest on a layer of Slade, a dense material impervious to conventional mining efforts.
|
||||||
|
|
||||||
|
Unconventional methods of penetrating the Slade do exist, however. And should it be breached, the exotic Primordial cavern layer can be found beneath.
|
||||||
|
|
||||||
|
## Other Features
|
||||||
|
|
||||||
|
The giant caverns generated by this mod differ slightly from the default giant caverns found in some mapgens, they use an additional source of noise to generate more ledges and horizontal floors. They also contain stalactites and stalagmites of various sizes - from single-node spikes decorating the default twisty tunnels to mountainous behemoths in the main caverns that can reach tens of meters in diameter and hundreds of meters in height.
|
||||||
|
|
||||||
|
The trees and plants mentioned above are all farmable, but in contrast to the usual farmable plants and trees they only grow in the *absence* of bright light. Attempting to plant them in sunlight will kill them. A set of recipes is added for cooking the edible ones into a variety of biscuits, stews, and roasts, and sweet pods can be refined into syrup.
|
||||||
|
|
||||||
|
Some of the other cave decorations provide dim bioluminescent lighting in some caverns. Cave moss and hanging glow-worms are most common. There is also non-glowing floor fungus found coating the stone in less hospitable biomes, capable of spreading to adjacent cobblestone structures like a slow-creeping infection.
|
||||||
|
|
||||||
|
[A more comprehensive guide can be found here.](guide.md)
|
||||||
|
|
||||||
|
[APIs and player commands can be found here.](API.md)
|
||||||
|
|
||||||
|
## Synergies with other mods
|
||||||
|
|
||||||
|
"[dynamic liquid](https://github.com/minetest-mods/dynamic_liquid)" is recommended to provide Dwarf Fortress-like fluid dynamics and to deal with water that might spill into caverns.
|
||||||
|
|
||||||
|
"[magma conduits](https://github.com/FaceDeer/magma_conduits/)" is recommended for a Dwarf Fortress like magmatic landscape. If not magma conduits, it is at least recommended that mapgen magma be disabled on whatever mapgen you're adding this mod to; mapgen magma is difficult for lua mapgens like this to tidy up and it will often spill into caverns setting large swaths of fungal forests on fire. Depending on the mapgen you're using this mod with you could do this by setting ``mgv5_lava_depth, mgv7_lava_depth``, ``mgcarpathian_lava_depth``, ``mgflat_lava_depth``, ``mgfractal_lava_depth``, or ``mgvalleys_lava_depth`` to -2800 (near the default depth of the magma sea).
|
||||||
|
|
||||||
|
The "[doc](https://forum.minetest.net/viewtopic.php?f=9&t=15912&p=240152)" mod is supported to provide in-game documentation for all of the new items and nodes this mod adds.
|
||||||
|
|
||||||
|
"[ropes](https://github.com/minetest-mods/ropes)" are very useful for navigating some of the large open spaces this mod provides. Some are large enough that a [glider](https://github.com/CBugDCoder/glider) may be well suited.
|
||||||
|
|
||||||
|
"[radiant damage](https://github.com/FaceDeer/radiant_damage)" greatly increases the danger of the Magma Sea if heat radiance is enabled, as well as several of the rare crystals in the deeper layers that emit Mese radiation if that damage type is enabled.
|
||||||
|
|
||||||
|
Adding "[named_waypoints](https://github.com/FaceDeer/named_waypoints)" and "[namegen](https://github.com/FaceDeer/namegen)" will provide some landmarks in the Underworld that a player can use to navigate by.
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
Sounds and textures are under various licenses, see the license.txt file in the /sounds and /textures directories for details.
|
||||||
|
|
||||||
|
License for Code
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Copyright (C) 2021 FaceDeer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
local S = minetest.get_translator(modname)
|
||||||
|
|
||||||
|
local sound
|
||||||
|
if df_dependencies.sound_leaves then
|
||||||
|
sound = df_dependencies.sound_leaves()
|
||||||
|
end
|
||||||
|
|
||||||
|
local get_node_box = function(connector_thickness)
|
||||||
|
return {
|
||||||
|
type = "connected",
|
||||||
|
--fixed = {-hub_thickness,-hub_thickness,-hub_thickness,hub_thickness,hub_thickness,hub_thickness},
|
||||||
|
connect_top = {-connector_thickness, 0, -connector_thickness, connector_thickness, 0.5, connector_thickness},
|
||||||
|
connect_bottom = {-connector_thickness, -0.5, -connector_thickness, connector_thickness, 0, connector_thickness},
|
||||||
|
connect_back = {-connector_thickness, -connector_thickness, 0, connector_thickness, connector_thickness, 0.5},
|
||||||
|
connect_right = {0, -connector_thickness, -connector_thickness, 0.5, connector_thickness, connector_thickness},
|
||||||
|
connect_front = {-connector_thickness, -connector_thickness, -0.5, connector_thickness, connector_thickness, 0},
|
||||||
|
connect_left = {-0.5, -connector_thickness, -connector_thickness, 0, connector_thickness, connector_thickness},
|
||||||
|
disconnected = {-connector_thickness, -connector_thickness, -connector_thickness, connector_thickness, connector_thickness, connector_thickness},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local anchor_groups = {"group:soil", "group:stone", "group:tree", "group:wood", "group:webbing", "group:solid"}
|
||||||
|
|
||||||
|
local in_anchor_group = function(name)
|
||||||
|
for _, group in pairs(anchor_groups) do
|
||||||
|
if minetest.get_item_group(name, string.sub(group, 7)) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if name == "ignore" then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local cardinal_directions = {
|
||||||
|
{x=1,y=0,z=0},
|
||||||
|
{x=-1,y=0,z=0},
|
||||||
|
{x=0,y=1,z=0},
|
||||||
|
{x=0,y=-1,z=0},
|
||||||
|
{x=0,y=0,z=1},
|
||||||
|
{x=0,y=0,z=-1}
|
||||||
|
}
|
||||||
|
|
||||||
|
local cardinal_planes = {
|
||||||
|
{3,5},
|
||||||
|
{3,5},
|
||||||
|
{1,5},
|
||||||
|
{1,5},
|
||||||
|
{1,3},
|
||||||
|
{1,3},
|
||||||
|
}
|
||||||
|
|
||||||
|
local insert_if_not_in_hashtable = function(pos, insert_into, if_not_in)
|
||||||
|
local hash = minetest.hash_node_position(pos)
|
||||||
|
if if_not_in[hash] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
table.insert(insert_into, pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- flood fill through the web to get all web and anchor locations
|
||||||
|
local get_web_nodes = function(pos, webs, anchors)
|
||||||
|
local to_check = {}
|
||||||
|
table.insert(to_check, pos)
|
||||||
|
while next(to_check) ~= nil do
|
||||||
|
local check_pos = table.remove(to_check)
|
||||||
|
local check_node = minetest.get_node(check_pos)
|
||||||
|
if minetest.get_item_group(check_node.name, "webbing") > 0 then
|
||||||
|
webs[minetest.hash_node_position(check_pos)] = true
|
||||||
|
for _, dir in pairs(cardinal_directions) do
|
||||||
|
insert_if_not_in_hashtable(vector.add(check_pos, dir), to_check, webs)
|
||||||
|
end
|
||||||
|
elseif in_anchor_group(check_node.name) then
|
||||||
|
anchors[minetest.hash_node_position(check_pos)] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local web_line = function(pos, dir, distance)
|
||||||
|
local anchored
|
||||||
|
local web_spine = {}
|
||||||
|
for i = 0, distance do
|
||||||
|
local web_pos = vector.add(pos, vector.multiply(dir,i))
|
||||||
|
local node_name = minetest.get_node(web_pos).name
|
||||||
|
if node_name == "air" or node_name == "big_webs:webbing" then
|
||||||
|
table.insert(web_spine, web_pos)
|
||||||
|
elseif in_anchor_group(node_name) then
|
||||||
|
anchored=true
|
||||||
|
break
|
||||||
|
else
|
||||||
|
anchored=false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if anchored then
|
||||||
|
for _, web_pos in pairs(web_spine) do
|
||||||
|
if math.random() < 0.9 then
|
||||||
|
minetest.set_node(web_pos, {name="big_webs:webbing"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return web_spine
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local generate_web = function(pos)
|
||||||
|
local dir_choice = math.random(1, 6)
|
||||||
|
local dir = cardinal_directions[dir_choice]
|
||||||
|
local web_spine = web_line(pos, dir, 30)
|
||||||
|
if web_spine then
|
||||||
|
local dir2 = cardinal_directions[cardinal_planes[dir_choice][math.random(1, 2)]]
|
||||||
|
local dir2_opposite = vector.multiply(dir2, -1)
|
||||||
|
for _, web_pos in pairs(web_spine) do
|
||||||
|
web_line(web_pos, dir2, 15)
|
||||||
|
web_line(web_pos, dir2_opposite, 15)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("big_webs:webbing", {
|
||||||
|
description = S("Giant Cave Spider Webbing"),
|
||||||
|
_doc_items_longdesc = S("Thick ropes of sticky, springy silk, strung between cavern walls in hopes of catching bats and even larger beasts."),
|
||||||
|
_doc_items_usagehelp = S("Webbing can be collected and re-strung elsewhere to aid in climbing. It absorbs all falling damage when you land on it."),
|
||||||
|
tiles = {
|
||||||
|
{name="big_webs.png"},
|
||||||
|
},
|
||||||
|
use_texture_alpha = "blend",
|
||||||
|
connects_to = anchor_groups,
|
||||||
|
connect_sides = { "top", "bottom", "front", "left", "back", "right" },
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = get_node_box(0.0625),
|
||||||
|
collision_box = get_node_box(0.0625),
|
||||||
|
inventory_image = "big_webs_item.png",
|
||||||
|
wield_image = "big_webs_item.png",
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
climbable = true,
|
||||||
|
groups = {snappy = 2, choppy = 2, webbing = 1, shearsy = 1, swordy=1, flammable=1, destroy_by_lava_flow=1, fall_damage_add_percent=-100, bouncy=20},
|
||||||
|
sounds = sound,
|
||||||
|
on_construct = function(pos)
|
||||||
|
minetest.get_node_timer(pos):start(30)
|
||||||
|
end,
|
||||||
|
on_destruct = function(pos)
|
||||||
|
for _, dir in pairs(cardinal_directions) do
|
||||||
|
local neighbor_pos = vector.add(pos, dir)
|
||||||
|
if minetest.get_item_group(minetest.get_node(neighbor_pos).name, "webbing") > 0 then
|
||||||
|
minetest.get_node_timer(neighbor_pos):start(30)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.get_node_timer(pos):stop()
|
||||||
|
end,
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
local webs = {}
|
||||||
|
local anchors = {}
|
||||||
|
get_web_nodes(pos, webs, anchors)
|
||||||
|
local first_anchor = next(anchors)
|
||||||
|
for hash, _ in pairs(webs) do
|
||||||
|
local web_pos = minetest.get_position_from_hash(hash)
|
||||||
|
if first_anchor == nil then
|
||||||
|
-- unsupported web
|
||||||
|
minetest.set_node(web_pos, {name="air"})
|
||||||
|
minetest.item_drop(ItemStack("big_webs:webbing"), nil, web_pos)
|
||||||
|
end
|
||||||
|
minetest.get_node_timer(web_pos):stop() -- no need to recheck
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
_mcl_blast_resistance = 1.0,
|
||||||
|
_mcl_hardness = 0.5,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("big_webs:web_egg", {
|
||||||
|
description = S("Giant Cave Spider Web Generator"),
|
||||||
|
tiles = {
|
||||||
|
{name="big_webs.png"},
|
||||||
|
},
|
||||||
|
use_texture_alpha = "blend",
|
||||||
|
connects_to = anchor_groups,
|
||||||
|
connect_sides = { "top", "bottom", "front", "left", "back", "right" },
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = get_node_box(0.0625),
|
||||||
|
collision_box = get_node_box(0.0625),
|
||||||
|
inventory_image = "big_webs_item.png",
|
||||||
|
wield_image = "big_webs_item.png",
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
climbable = true,
|
||||||
|
floodable = true,
|
||||||
|
groups = {snappy = 2, choppy = 2, webbing = 1, flammable=1, fall_damage_add_percent=-100, bouncy=20},
|
||||||
|
sounds = sound,
|
||||||
|
on_construct = function(pos)
|
||||||
|
minetest.get_node_timer(pos):start(1)
|
||||||
|
end,
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
generate_web(pos)
|
||||||
|
end,
|
||||||
|
_mcl_blast_resistance = 1.0,
|
||||||
|
_mcl_hardness = 0.5,
|
||||||
|
})
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# textdomain: big_webs
|
||||||
|
|
||||||
|
|
||||||
|
### init.lua ###
|
||||||
|
|
||||||
|
Giant Cave Spider Web Generator=
|
||||||
|
Giant Cave Spider Webbing=
|
||||||
|
|
||||||
|
Thick ropes of sticky, springy silk, strung between cavern walls in hopes of catching bats and even larger beasts.=
|
||||||
|
|
||||||
|
Webbing can be collected and re-strung elsewhere to aid in climbing. It absorbs all falling damage when you land on it.=
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
name=big_webs
|
||||||
|
optional_depends=df_dependencies
|
||||||
|
After Width: | Height: | Size: 309 B |
|
After Width: | Height: | Size: 380 B |
@@ -0,0 +1,22 @@
|
|||||||
|
License for Code
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Copyright (C) 2019 FaceDeer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
|
local dungeon_loot_path = minetest.get_modpath("dungeon_loot")
|
||||||
|
|
||||||
|
bones_loot = {}
|
||||||
|
|
||||||
|
local bones_formspec =
|
||||||
|
"size[8,9]"
|
||||||
|
.."list[current_name;main;0,0.3;8,4;]"
|
||||||
|
.."list[current_player;main;0,4.85;8,1;]"
|
||||||
|
.."list[current_player;main;0,6.08;8,3;8]"
|
||||||
|
.."listring[current_name;main]"
|
||||||
|
.."listring[current_player;main]"
|
||||||
|
..df_dependencies.get_itemslot_bg(0,0.3,8,4)
|
||||||
|
..df_dependencies.get_itemslot_bg(0,4.85,8,1)
|
||||||
|
..df_dependencies.get_itemslot_bg(0,6.08,8,3)
|
||||||
|
if minetest.get_modpath("default") then
|
||||||
|
bones_formspec = bones_formspec .. default.get_hotbar_bg(0,4.85)
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("bones") then
|
||||||
|
df_dependencies.node_name_bones = "bones:bones"
|
||||||
|
else
|
||||||
|
|
||||||
|
local function drop_item_stack(pos, stack)
|
||||||
|
if not stack or stack:is_empty() then return end
|
||||||
|
local drop_offset = vector.new(math.random() - 0.5, 0, math.random() - 0.5)
|
||||||
|
minetest.add_item(vector.add(pos, drop_offset), stack)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("bones_loot:bones", {
|
||||||
|
description = S("Bones"),
|
||||||
|
tiles = {
|
||||||
|
"bones_top.png^[transform2",
|
||||||
|
"bones_bottom.png",
|
||||||
|
"bones_side.png",
|
||||||
|
"bones_side.png",
|
||||||
|
"bones_rear.png",
|
||||||
|
"bones_front.png"
|
||||||
|
},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {oddly_diggable_by_hand=1, handy=1, container=2},
|
||||||
|
sounds = df_dependencies.sound_gravel(),
|
||||||
|
_mcl_hardness = 1.5,
|
||||||
|
_mcl_blast_resistance = 6,
|
||||||
|
can_dig = function(pos, player)
|
||||||
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
return inv:is_empty("main")
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", bones_formspec)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8*4)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_blast = function(pos, intensity)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
for i = 1, inv:get_size("main") do
|
||||||
|
drop_item_stack(pos, inv:get_stack("main", i))
|
||||||
|
end
|
||||||
|
meta:from_table()
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
if math.random(1, math.floor((intensity or 1) * 2)) ~= 1 then return end
|
||||||
|
drop_item_stack(pos, "bones_loot:bones")
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
df_dependencies.node_name_bones = "bones_loot:bones"
|
||||||
|
end
|
||||||
|
|
||||||
|
local bones_node = df_dependencies.node_name_bones
|
||||||
|
|
||||||
|
local local_loot = {}
|
||||||
|
local local_loot_register = function(t)
|
||||||
|
if t.name ~= nil then
|
||||||
|
t = {t} -- single entry
|
||||||
|
end
|
||||||
|
for _, loot in ipairs(t) do
|
||||||
|
table.insert(local_loot, loot)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- we could do this for the dungeon_loot registered loot table as well,
|
||||||
|
-- but best not to meddle in other mods' internals if it can be helped.
|
||||||
|
local clean_up_local_loot = function()
|
||||||
|
if local_loot == nil then return end
|
||||||
|
for i = #local_loot, 1, -1 do
|
||||||
|
if not minetest.registered_items[local_loot[i].name] then
|
||||||
|
table.remove(local_loot, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Uses same table format as dungeon_loot
|
||||||
|
-- eg, {name = "bucket:bucket_water", chance = 0.45, types = {"sandstone", "desert"}},
|
||||||
|
-- if dungeon_loot is installed it uses dungeon_loot's registration function directly.
|
||||||
|
if dungeon_loot_path then
|
||||||
|
bones_loot.register_loot = dungeon_loot.register
|
||||||
|
else
|
||||||
|
bones_loot.register_loot = local_loot_register
|
||||||
|
minetest.after(0, clean_up_local_loot)
|
||||||
|
end
|
||||||
|
|
||||||
|
local get_loot_list = function(pos, loot_type, exclusive_loot_type)
|
||||||
|
local loot_table
|
||||||
|
if dungeon_loot_path then
|
||||||
|
loot_table = dungeon_loot.registered_loot
|
||||||
|
else
|
||||||
|
loot_table = local_loot
|
||||||
|
end
|
||||||
|
|
||||||
|
local item_list = {}
|
||||||
|
local pos_y = pos.y
|
||||||
|
for _, loot in ipairs(loot_table) do
|
||||||
|
if loot.y == nil or (pos_y >= loot.y[1] and pos_y <= loot.y[2]) then
|
||||||
|
if (not exclusive_loot_type and loot.types == nil) or
|
||||||
|
(loot.types and table.indexof(loot.types, loot_type) ~= -1) then
|
||||||
|
table.insert(item_list, loot)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return item_list
|
||||||
|
end
|
||||||
|
|
||||||
|
local shuffle = function(tbl)
|
||||||
|
for i = #tbl, 2, -1 do
|
||||||
|
local rand = math.random(i)
|
||||||
|
tbl[i], tbl[rand] = tbl[rand], tbl[i]
|
||||||
|
end
|
||||||
|
return tbl
|
||||||
|
end
|
||||||
|
|
||||||
|
-- "exclusive" set to true means that loot table entries without a loot_type won't be considered.
|
||||||
|
bones_loot.get_loot = function(pos, loot_type, max_stacks, exclusive_loot_type)
|
||||||
|
local item_list = get_loot_list(pos, loot_type, exclusive_loot_type)
|
||||||
|
shuffle(item_list)
|
||||||
|
|
||||||
|
-- apply chances / randomized amounts and collect resulting items
|
||||||
|
local items = {}
|
||||||
|
for _, loot in ipairs(item_list) do
|
||||||
|
if math.random() <= loot.chance then
|
||||||
|
local itemdef = minetest.registered_items[loot.name]
|
||||||
|
if itemdef then
|
||||||
|
local amount = 1
|
||||||
|
if loot.count ~= nil then
|
||||||
|
amount = math.random(loot.count[1], loot.count[2])
|
||||||
|
end
|
||||||
|
|
||||||
|
if itemdef.tool_capabilities then
|
||||||
|
for n = 1, amount do
|
||||||
|
local wear = math.random(0.20 * 65535, 0.75 * 65535) -- 20% to 75% wear
|
||||||
|
table.insert(items, ItemStack({name = loot.name, wear = wear}))
|
||||||
|
max_stacks = max_stacks - 1
|
||||||
|
if max_stacks <= 0 then break end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local stack_max = itemdef.stack_max
|
||||||
|
while amount > 0 do
|
||||||
|
table.insert(items, ItemStack({name = loot.name, count = math.min(stack_max, amount)}))
|
||||||
|
amount = amount - stack_max
|
||||||
|
max_stacks = max_stacks - 1
|
||||||
|
if max_stacks <= 0 then break end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if max_stacks <= 0 then break end
|
||||||
|
end
|
||||||
|
return items
|
||||||
|
end
|
||||||
|
|
||||||
|
bones_loot.place_bones = function(pos, loot_type, max_stacks, infotext, exclusive_loot_type)
|
||||||
|
minetest.set_node(pos, {name=bones_node, param2 = math.random(1,4)-1})
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if infotext == nil then
|
||||||
|
infotext = S("Someone's old bones")
|
||||||
|
end
|
||||||
|
meta:set_string("infotext", infotext)
|
||||||
|
meta:set_string("formspec", bones_formspec)
|
||||||
|
|
||||||
|
if max_stacks and max_stacks > 0 then
|
||||||
|
local loot = bones_loot.get_loot(pos, loot_type, max_stacks, exclusive_loot_type)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8 * 4)
|
||||||
|
for _, item in ipairs(loot) do
|
||||||
|
inv:add_item("main", item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
label = "Repair underworld bones formspec",
|
||||||
|
name = "bones_loot:repair_underworld_bones_formspec",
|
||||||
|
nodenames = {bones_node},
|
||||||
|
action = function(pos, node)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if not meta:get("formspec") then
|
||||||
|
meta:set_string("formspec", bones_formspec)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# textdomain: bones_loot
|
||||||
|
|
||||||
|
|
||||||
|
### init.lua ###
|
||||||
|
|
||||||
|
# textdomain: bones
|
||||||
|
Bones=Knochen
|
||||||
|
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
|
||||||
|
Someone's old bones=Jemandes alte Knochen
|
||||||
|
|
||||||
|
|
||||||
|
##### not used anymore #####
|
||||||
|
|
||||||
|
@1's old bones=Alte Knochen von @1
|
||||||
|
@1 died at @2.=@1 starb bei @2.
|
||||||
|
@1 died at @2, and dropped their inventory.=@1 starb bei @2 und ließ das Inventar fallen.
|
||||||
|
@1 died at @2, and bones were placed.=@1 starb bei @2 und Knochen wurden platziert.
|
||||||
|
@1's fresh bones=Frische Knochen von @1
|
||||||
|
@1's bones=Knochen von @1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# textdomain: bones_loot
|
||||||
|
|
||||||
|
|
||||||
|
### init.lua ###
|
||||||
|
|
||||||
|
# textdomain: bones
|
||||||
|
Bones=Ostoj
|
||||||
|
Someone's old bones=
|
||||||
|
|
||||||
|
|
||||||
|
##### not used anymore #####
|
||||||
|
|
||||||
|
@1's old bones=La malfreŝaj ostoj de @1
|
||||||
|
@1 died at @2.=@1 mortis ĉe @2
|
||||||
|
@1 died at @2, and dropped their inventory.=@1 mortis ĉe @2, kaj delasis sian stokon.
|
||||||
|
@1 died at @2, and bones were placed.=@1 mortis ĉe @2, kaj ostoj estas demetitaj.
|
||||||
|
@1's fresh bones=La freŝaj ostoj de @1
|
||||||
|
@1's bones=La ostoj de @1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# textdomain: bones_loot
|
||||||
|
|
||||||
|
|
||||||
|
### init.lua ###
|
||||||
|
|
||||||
|
# textdomain: bones
|
||||||
|
Bones=Huesos
|
||||||
|
Someone's old bones=
|
||||||
|
|
||||||
|
|
||||||
|
##### not used anymore #####
|
||||||
|
|
||||||
|
@1's old bones=Huesos antiguos de @1
|
||||||
|
@1 died at @2.=@1 murió en @2.
|
||||||
|
@1 died at @2, and dropped their inventory.=@1 murió en @2, y su inventario se desprendió.
|
||||||
|
@1 died at @2, and bones were placed.=@1 murió en @2, y sus huesos fueron depositados.
|
||||||
|
@1's fresh bones=Huesos recientes de @1
|
||||||
|
@1's bones=Huesos de @1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# textdomain: bones_loot
|
||||||
|
|
||||||
|
|
||||||
|
### init.lua ###
|
||||||
|
|
||||||
|
# textdomain: bones
|
||||||
|
Bones=Os
|
||||||
|
Someone's old bones=
|
||||||
|
|
||||||
|
|
||||||
|
##### not used anymore #####
|
||||||
|
|
||||||
|
@1's old bones=Vieux os de @1
|
||||||
|
@1 died at @2.=@1 est mort à @2.
|
||||||
|
@1 died at @2, and dropped their inventory.=@1 est mort à @2 et a laissé tomber son inventaire.
|
||||||
|
@1 died at @2, and bones were placed.=@1 est mort à @2 et ses os ont été placés.
|
||||||
|
@1's fresh bones=Os frais de @1
|
||||||
|
@1's bones=Os de @1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# textdomain: bones_loot
|
||||||
|
|
||||||
|
|
||||||
|
### init.lua ###
|
||||||
|
|
||||||
|
# textdomain: bones
|
||||||
|
Bones=Tulang
|
||||||
|
Someone's old bones=
|
||||||
|
|
||||||
|
|
||||||
|
##### not used anymore #####
|
||||||
|
|
||||||
|
@1's old bones=Tulang lama @1
|
||||||
|
@1 died at @2.=@1 mati di @2.
|
||||||
|
@1 died at @2, and dropped their inventory.=@1 mati di @2 dan meninggalkan barangnya.
|
||||||
|
@1 died at @2, and bones were placed.=@1 mati di @2 dan tulangnya diletakkan.
|
||||||
|
@1's fresh bones=Tulang segar @1
|
||||||
|
@1's bones=Tulang @1
|
||||||