diff --git a/.gitignore b/.gitignore
index 5405a74e9..ac5131698 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,7 +48,6 @@ AppDir
## Non-static Minetest directories or symlinks to these
/bin/
-/games/*
!/games/devtest/
/games/devtest/mods/soundstuff/sounds/gitignored_sounds/*
!/games/devtest/mods/soundstuff/sounds/gitignored_sounds/custom_sounds_here.txt
@@ -126,3 +125,7 @@ lib/irrlichtmt
# Generated mod storage database
client/mod_storage.sqlite
+run
+/games/globo/baloo.log
+/games/globo/history.md
+/games/globo/toc.md
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33f40688d..a40bece27 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -116,7 +116,7 @@ else()
string(CONCAT explanation_msg
"The Minetest team has forked Irrlicht to make their own customizations. "
"It can be found here: https://github.com/minetest/irrlicht\n"
- "For example use: git clone --depth=1 https://github.com/minetest/irrlicht lib/irrlichtmt\n")
+/ "For example use: git clone --depth=1 --branch=$(cat misc/irrlichtmt_tag.txt) https://github.com/minetest/irrlicht lib/irrlichtmt\n")
if(BUILD_CLIENT)
message(FATAL_ERROR "IrrlichtMt is required to build the client, but it was not found.\n${explanation_msg}")
endif()
diff --git a/doc/compiling/linux.md b/doc/compiling/linux.md
index 2d057ea2f..983c35ebb 100644
--- a/doc/compiling/linux.md
+++ b/doc/compiling/linux.md
@@ -71,7 +71,7 @@ Download source (this is the URL to the latest of source repository, which might
Download IrrlichtMt to `lib/irrlichtmt`, it will be used to satisfy the IrrlichtMt dependency that way:
- git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt
+ git clone --depth 1 --branch $(cat misc/irrlichtmt_tag.txt) https://github.com/minetest/irrlicht.git lib/irrlichtmt
Download source, without using Git:
diff --git a/doc/compiling/macos.md b/doc/compiling/macos.md
index 5061223ab..5109e7411 100644
--- a/doc/compiling/macos.md
+++ b/doc/compiling/macos.md
@@ -23,7 +23,7 @@ cd minetest
Download Minetest's fork of Irrlicht:
```
-git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt
+git clone --depth 1 --branch $(cat misc/irrlichtmt_tag.txt) https://github.com/minetest/irrlicht.git lib/irrlichtmt
```
## Build
diff --git a/games/boad/.luacheckrc b/games/boad/.luacheckrc
new file mode 100644
index 000000000..1c7d3994f
--- /dev/null
+++ b/games/boad/.luacheckrc
@@ -0,0 +1,43 @@
+unused_args = false
+allow_defined_top = true
+max_string_line_length = false
+max_line_length = false
+
+ignore = {
+ "131", -- Unused global variable
+ "211", -- Unused local variable
+ "231", -- Local variable never accessed
+ "311", -- Value assigned to a local variable is unused
+ "412", -- Redefining an argument
+ "421", -- Shadowing a local variable
+ "431", -- Shadowing an upvalue
+ "432", -- Shadowing an upvalue argument
+ "611", -- Line contains only whitespace
+}
+
+read_globals = {
+ "ItemStack",
+ "INIT",
+ "DIR_DELIM",
+ "dump", "dump2",
+ "fgettext", "fgettext_ne",
+ "vector",
+ "VoxelArea",
+ "profiler",
+ "Settings",
+ "check",
+ "PseudoRandom",
+
+ string = {fields = {"split", "trim"}},
+ table = {fields = {"copy", "getn", "indexof", "insert_all"}},
+ math = {fields = {"hypot", "round"}},
+}
+
+globals = {
+ "aborted",
+ "minetest",
+ "core",
+ os = { fields = { "tempfolder" } },
+ "_",
+}
+
diff --git a/games/boad/README.md b/games/boad/README.md
new file mode 100644
index 000000000..6a6782e9b
--- /dev/null
+++ b/games/boad/README.md
@@ -0,0 +1,6 @@
+# BOAD
+
+Simple small flat world.
+The agent needs food and water or it will die.
+It can get food from apples and water from the snow blocks.
+
diff --git a/games/boad/game.conf b/games/boad/game.conf
new file mode 100644
index 000000000..fdc4d54d2
--- /dev/null
+++ b/games/boad/game.conf
@@ -0,0 +1,3 @@
+title = BOAD Training Environment
+description = Training environment for simple agents of eboa level capabilities.
+
diff --git a/games/boad/menu/background.png b/games/boad/menu/background.png
new file mode 100644
index 000000000..e69c4d03f
Binary files /dev/null and b/games/boad/menu/background.png differ
diff --git a/games/boad/menu/header.png b/games/boad/menu/header.png
new file mode 100644
index 000000000..ac96a5b98
Binary files /dev/null and b/games/boad/menu/header.png differ
diff --git a/games/boad/menu/icon.png b/games/boad/menu/icon.png
new file mode 100644
index 000000000..971da2c7d
Binary files /dev/null and b/games/boad/menu/icon.png differ
diff --git a/games/boad/mods/basenodes/init.lua b/games/boad/mods/basenodes/init.lua
new file mode 100644
index 000000000..c8b7d09e0
--- /dev/null
+++ b/games/boad/mods/basenodes/init.lua
@@ -0,0 +1,174 @@
+local WATER_ALPHA = "^[opacity:" .. 160
+local WATER_VISC = 1
+local LAVA_VISC = 7
+
+
+
+minetest.register_node("basenodes:dirt_with_grass", {
+ description = "Dirt with Grass",
+ tiles ={"default_grass.png",
+ -- a little dot on the bottom to distinguish it from dirt
+ "default_dirt.png^basenodes_dirt_with_grass_bottom.png",
+ {name = "default_dirt.png^default_grass_side.png",
+ tileable_vertical = false}},
+ groups = {crumbly=3, soil=1},
+})
+
+
+minetest.register_node("basenodes:dirt", {
+ description = "Dirt",
+ tiles ={"default_dirt.png"},
+ groups = {crumbly=3, soil=1},
+})
+
+minetest.register_node("basenodes:stone", {
+ description = "Stone",
+ tiles = {"default_stone.png"},
+ groups = {cracky=3},
+})
+
+minetest.register_node("basenodes:water_source", {
+ description = "Water Source".."\n"..
+ "Swimmable, spreading, renewable liquid".."\n"..
+ "Drowning damage: 1",
+ drawtype = "liquid",
+ waving = 3,
+ tiles = {"default_water.png"..WATER_ALPHA},
+ special_tiles = {
+ {name = "default_water.png"..WATER_ALPHA, backface_culling = false},
+ {name = "default_water.png"..WATER_ALPHA, backface_culling = true},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ liquidtype = "source",
+ liquid_alternative_flowing = "basenodes:water_flowing",
+ liquid_alternative_source = "basenodes:water_source",
+ liquid_viscosity = WATER_VISC,
+ post_effect_color = {a = 64, r = 100, g = 100, b = 200},
+ post_effect_color_shaded = true,
+ groups = {water = 3, liquid = 3},
+})
+
+minetest.register_node("basenodes:water_flowing", {
+ description = "Flowing Water".."\n"..
+ "Swimmable, spreading, renewable liquid".."\n"..
+ "Drowning damage: 1",
+ drawtype = "flowingliquid",
+ waving = 3,
+ tiles = {"default_water_flowing.png"},
+ special_tiles = {
+ {name = "default_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ {name = "default_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ liquidtype = "flowing",
+ liquid_alternative_flowing = "basenodes:water_flowing",
+ liquid_alternative_source = "basenodes:water_source",
+ liquid_viscosity = WATER_VISC,
+ post_effect_color = {a = 64, r = 100, g = 100, b = 200},
+ post_effect_color_shaded = true,
+ groups = {water = 3, liquid = 3},
+})
+
+minetest.register_node("basenodes:river_water_source", {
+ description = "River Water Source".."\n"..
+ "Swimmable, spreading, non-renewable liquid".."\n"..
+ "Drowning damage: 1",
+ drawtype = "liquid",
+ waving = 3,
+ tiles = { "default_river_water.png"..WATER_ALPHA },
+ special_tiles = {
+ {name = "default_river_water.png"..WATER_ALPHA, backface_culling = false},
+ {name = "default_river_water.png"..WATER_ALPHA, backface_culling = true},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ liquidtype = "source",
+ liquid_alternative_flowing = "basenodes:river_water_flowing",
+ liquid_alternative_source = "basenodes:river_water_source",
+ liquid_viscosity = 1,
+ liquid_renewable = false,
+ liquid_range = 2,
+ post_effect_color = {a = 103, r = 30, g = 76, b = 90},
+ post_effect_color_shaded = true,
+ groups = {water = 3, liquid = 3, },
+})
+
+minetest.register_node("basenodes:river_water_flowing", {
+ description = "Flowing River Water".."\n"..
+ "Swimmable, spreading, non-renewable liquid".."\n"..
+ "Drowning damage: 1",
+ drawtype = "flowingliquid",
+ waving = 3,
+ tiles = {"default_river_water_flowing.png"..WATER_ALPHA},
+ special_tiles = {
+ {name = "default_river_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ {name = "default_river_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ liquidtype = "flowing",
+ liquid_alternative_flowing = "basenodes:river_water_flowing",
+ liquid_alternative_source = "basenodes:river_water_source",
+ liquid_viscosity = 1,
+ liquid_renewable = false,
+ liquid_range = 2,
+ post_effect_color = {a = 103, r = 30, g = 76, b = 90},
+ post_effect_color_shaded = true,
+ groups = {water = 3, liquid = 3, },
+})
+
+minetest.register_node("basenodes:apple", {
+ description = "Apple".."\n"..
+ "Punch: Eat (+2)",
+ drawtype = "plantlike",
+ tiles ={"default_apple.png"},
+ inventory_image = "default_apple.png",
+ paramtype = "light",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {dig_immediate=3},
+
+ -- Make eatable because why not?
+ on_use = minetest.item_eat(2),
+})
+
+minetest.register_node("basenodes:snowblock", {
+ description = "Snow Block",
+ tiles ={"default_snow.png"},
+ groups = {crumbly=3},
+})
+
+
diff --git a/games/boad/mods/basenodes/mod.conf b/games/boad/mods/basenodes/mod.conf
new file mode 100644
index 000000000..25024dc63
--- /dev/null
+++ b/games/boad/mods/basenodes/mod.conf
@@ -0,0 +1,2 @@
+name = basenodes
+description = Contains basic nodes for mapgen
diff --git a/games/boad/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png b/games/boad/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png
new file mode 100644
index 000000000..5e8fc41a9
Binary files /dev/null and b/games/boad/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png differ
diff --git a/games/boad/mods/basenodes/textures/basenodes_dirt_with_snow.png b/games/boad/mods/basenodes/textures/basenodes_dirt_with_snow.png
new file mode 100644
index 000000000..7ea2d8d31
Binary files /dev/null and b/games/boad/mods/basenodes/textures/basenodes_dirt_with_snow.png differ
diff --git a/games/boad/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png b/games/boad/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png
new file mode 100644
index 000000000..447c94e98
Binary files /dev/null and b/games/boad/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png differ
diff --git a/games/boad/mods/basenodes/textures/basenodes_snow_sheet.png b/games/boad/mods/basenodes/textures/basenodes_snow_sheet.png
new file mode 100644
index 000000000..455332093
Binary files /dev/null and b/games/boad/mods/basenodes/textures/basenodes_snow_sheet.png differ
diff --git a/games/boad/mods/basenodes/textures/default_apple.png b/games/boad/mods/basenodes/textures/default_apple.png
new file mode 100644
index 000000000..9c115dae4
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_apple.png differ
diff --git a/games/boad/mods/basenodes/textures/default_cobble.png b/games/boad/mods/basenodes/textures/default_cobble.png
new file mode 100644
index 000000000..5b859e9c2
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_cobble.png differ
diff --git a/games/boad/mods/basenodes/textures/default_desert_sand.png b/games/boad/mods/basenodes/textures/default_desert_sand.png
new file mode 100644
index 000000000..19ec87dc0
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_desert_sand.png differ
diff --git a/games/boad/mods/basenodes/textures/default_desert_stone.png b/games/boad/mods/basenodes/textures/default_desert_stone.png
new file mode 100644
index 000000000..5126fb61c
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_desert_stone.png differ
diff --git a/games/boad/mods/basenodes/textures/default_dirt.png b/games/boad/mods/basenodes/textures/default_dirt.png
new file mode 100644
index 000000000..6ca9588a4
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_dirt.png differ
diff --git a/games/boad/mods/basenodes/textures/default_grass.png b/games/boad/mods/basenodes/textures/default_grass.png
new file mode 100644
index 000000000..3d6397186
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_grass.png differ
diff --git a/games/boad/mods/basenodes/textures/default_gravel.png b/games/boad/mods/basenodes/textures/default_gravel.png
new file mode 100644
index 000000000..7e5ff616f
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_gravel.png differ
diff --git a/games/boad/mods/basenodes/textures/default_ice.png b/games/boad/mods/basenodes/textures/default_ice.png
new file mode 100644
index 000000000..c4bddd223
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_ice.png differ
diff --git a/games/boad/mods/basenodes/textures/default_junglegrass.png b/games/boad/mods/basenodes/textures/default_junglegrass.png
new file mode 100644
index 000000000..d64e33abc
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_junglegrass.png differ
diff --git a/games/boad/mods/basenodes/textures/default_jungleleaves.png b/games/boad/mods/basenodes/textures/default_jungleleaves.png
new file mode 100644
index 000000000..1fa67e83a
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_jungleleaves.png differ
diff --git a/games/boad/mods/basenodes/textures/default_jungletree.png b/games/boad/mods/basenodes/textures/default_jungletree.png
new file mode 100644
index 000000000..053850fa7
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_jungletree.png differ
diff --git a/games/boad/mods/basenodes/textures/default_jungletree_top.png b/games/boad/mods/basenodes/textures/default_jungletree_top.png
new file mode 100644
index 000000000..e80de8a69
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_jungletree_top.png differ
diff --git a/games/boad/mods/basenodes/textures/default_lava.png b/games/boad/mods/basenodes/textures/default_lava.png
new file mode 100644
index 000000000..a4cf649f1
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_lava.png differ
diff --git a/games/boad/mods/basenodes/textures/default_lava_flowing.png b/games/boad/mods/basenodes/textures/default_lava_flowing.png
new file mode 100644
index 000000000..07066a6e3
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_lava_flowing.png differ
diff --git a/games/boad/mods/basenodes/textures/default_leaves.png b/games/boad/mods/basenodes/textures/default_leaves.png
new file mode 100644
index 000000000..c0475d4d2
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_leaves.png differ
diff --git a/games/boad/mods/basenodes/textures/default_mossycobble.png b/games/boad/mods/basenodes/textures/default_mossycobble.png
new file mode 100644
index 000000000..69585e37b
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_mossycobble.png differ
diff --git a/games/boad/mods/basenodes/textures/default_pine_needles.png b/games/boad/mods/basenodes/textures/default_pine_needles.png
new file mode 100644
index 000000000..137caa2a3
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_pine_needles.png differ
diff --git a/games/boad/mods/basenodes/textures/default_pine_tree.png b/games/boad/mods/basenodes/textures/default_pine_tree.png
new file mode 100644
index 000000000..5743183c0
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_pine_tree.png differ
diff --git a/games/boad/mods/basenodes/textures/default_pine_tree_top.png b/games/boad/mods/basenodes/textures/default_pine_tree_top.png
new file mode 100644
index 000000000..cc18f3462
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_pine_tree_top.png differ
diff --git a/games/boad/mods/basenodes/textures/default_river_water.png b/games/boad/mods/basenodes/textures/default_river_water.png
new file mode 100644
index 000000000..e1074d2ef
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_river_water.png differ
diff --git a/games/boad/mods/basenodes/textures/default_river_water_flowing.png b/games/boad/mods/basenodes/textures/default_river_water_flowing.png
new file mode 100644
index 000000000..4a756b2bd
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_river_water_flowing.png differ
diff --git a/games/boad/mods/basenodes/textures/default_sand.png b/games/boad/mods/basenodes/textures/default_sand.png
new file mode 100644
index 000000000..0ed0e4ceb
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_sand.png differ
diff --git a/games/boad/mods/basenodes/textures/default_snow.png b/games/boad/mods/basenodes/textures/default_snow.png
new file mode 100644
index 000000000..c42e0eecb
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_snow.png differ
diff --git a/games/boad/mods/basenodes/textures/default_snow_side.png b/games/boad/mods/basenodes/textures/default_snow_side.png
new file mode 100644
index 000000000..f34d10991
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_snow_side.png differ
diff --git a/games/boad/mods/basenodes/textures/default_stone.png b/games/boad/mods/basenodes/textures/default_stone.png
new file mode 100644
index 000000000..763b4396a
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_stone.png differ
diff --git a/games/boad/mods/basenodes/textures/default_tree.png b/games/boad/mods/basenodes/textures/default_tree.png
new file mode 100644
index 000000000..189ec1593
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_tree.png differ
diff --git a/games/boad/mods/basenodes/textures/default_tree_top.png b/games/boad/mods/basenodes/textures/default_tree_top.png
new file mode 100644
index 000000000..d1a4fa704
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_tree_top.png differ
diff --git a/games/boad/mods/basenodes/textures/default_water.png b/games/boad/mods/basenodes/textures/default_water.png
new file mode 100644
index 000000000..3e385ae8b
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_water.png differ
diff --git a/games/boad/mods/basenodes/textures/default_water_flowing.png b/games/boad/mods/basenodes/textures/default_water_flowing.png
new file mode 100644
index 000000000..7cdafd51d
Binary files /dev/null and b/games/boad/mods/basenodes/textures/default_water_flowing.png differ
diff --git a/games/boad/mods/basenodes/textures/dirt_with_grass/default_grass.png b/games/boad/mods/basenodes/textures/dirt_with_grass/default_grass.png
new file mode 100644
index 000000000..47e50e836
Binary files /dev/null and b/games/boad/mods/basenodes/textures/dirt_with_grass/default_grass.png differ
diff --git a/games/boad/mods/basenodes/textures/dirt_with_grass/default_grass_side.png b/games/boad/mods/basenodes/textures/dirt_with_grass/default_grass_side.png
new file mode 100644
index 000000000..04770b6f6
Binary files /dev/null and b/games/boad/mods/basenodes/textures/dirt_with_grass/default_grass_side.png differ
diff --git a/games/boad/mods/basenodes/textures/info.txt b/games/boad/mods/basenodes/textures/info.txt
new file mode 100644
index 000000000..2d4ef7efa
--- /dev/null
+++ b/games/boad/mods/basenodes/textures/info.txt
@@ -0,0 +1,7 @@
+
+The dirt_with_grass folder is for testing loading textures from subfolders.
+If it works correctly, the default_grass_side.png file in the folder is used but
+default_grass.png is not overwritten by the file in the folder.
+
+default_dirt.png should be overwritten by the default_dirt.png in the unittests
+mod which depends on basenodes.
diff --git a/games/boad/mods/flatworld/init.lua b/games/boad/mods/flatworld/init.lua
new file mode 100644
index 000000000..a2e55fcff
--- /dev/null
+++ b/games/boad/mods/flatworld/init.lua
@@ -0,0 +1,133 @@
+-- won't allow you to go below 64. World goes gray
+MAP_SIZE=64
+-- sets this for the NEXT map that is generated. very lame
+minetest.settings:set("mapgen_limit", MAP_SIZE)
+
+minetest.register_on_mapgen_init(function(mgparams)
+
+ minetest.set_mapgen_setting("mg_name", "flat", true)
+ local flags = minetest.get_mapgen_setting("mg_flags")
+
+ if flags then
+ local new_flags = flags:gsub("caves", "nocaves")
+ minetest.set_mapgen_setting("mg_flags", new_flags, true)
+ end
+
+end)
+
+minetest.register_on_generated(function(minp, maxp, blockseed)
+
+ -- food
+ for n=0,10 do
+ local x= math.random(-31, 46)
+ local z=math.random(-31, 46)
+ local pos = {x = x, y = 9, z = z}
+ minetest.set_node(pos, {name = "basenodes:apple"})
+ end
+ -- water
+ for n=0,10 do
+ local x= math.random(-31, 46)
+ local z=math.random(-31, 46)
+ local pos = {x = x, y = 9, z = z}
+ minetest.set_node(pos, {name = "basenodes:snowblock"})
+ end
+ -- walls
+ for n=0,20 do
+ local x= math.random(-31, 46)
+ local z=math.random(-31, 46)
+ local len=math.random(1,4)
+ if math.random(0,1) then
+ for i=0,len do
+ for y = 9, 12 do
+ local pos = {x = x+i, y = y, z = z}
+ minetest.set_node(pos, {name = "basenodes:stone"})
+ end
+ end
+ else
+ for i =0,len do
+ for y = 9, 12 do
+ local pos = {x = x, y = y, z = z+i}
+ minetest.set_node(pos, {name = "basenodes:stone"})
+ end
+ end
+ end
+
+ -- Place barrier nodes at the edges of the world
+ for x = minp.x, maxp.x do
+ for z = minp.z, maxp.z do
+ if x == -32 or x == 47 or -- TODO why these numbers?
+ z == -32 or z == 47 then
+ for y = 8, 15 do
+ local pos = {x = x, y = y, z = z}
+ minetest.set_node(pos, {name = "basenodes:stone"})
+ end
+ end
+ end
+ end
+ end
+end)
+
+
+
+minetest.register_alias("mapgen_water_source", "basenodes:water_source")
+minetest.register_alias("mapgen_river_water_source", "basenodes:river_water_source")
+
+minetest.register_alias("mapgen_dirt", "basenodes:dirt")
+minetest.register_alias("mapgen_stone", "basenodes:dirt")
+minetest.register_alias("mapgen_dirt_with_grass", "basenodes:dirt_with_grass")
+minetest.register_alias("mapgen_apple", "basenodes:apple")
+
+
+minetest.clear_registered_biomes()
+minetest.clear_registered_decorations()
+
+if minetest.settings:get_bool("devtest_register_biomes", true) then
+ minetest.register_biome({
+ name = "mapgen:grassland",
+ node_top = "basenodes:dirt_with_grass",
+ depth_top = 1,
+ node_filler = "basenodes:dirt",
+ depth_filler = 1,
+ node_riverbed = "basenodes:sand",
+ depth_riverbed = 2,
+ node_dungeon = "basenodes:cobble",
+ node_dungeon_alt = "basenodes:mossycobble",
+ node_dungeon_stair = "stairs:stair_cobble",
+ y_max = 31000,
+ y_min = 4,
+ heat_point = 50,
+ humidity_point = 50,
+ })
+
+ minetest.register_biome({
+ name = "mapgen:grassland_ocean",
+ node_top = "basenodes:sand",
+ depth_top = 1,
+ node_filler = "basenodes:sand",
+ depth_filler = 3,
+ node_riverbed = "basenodes:sand",
+ depth_riverbed = 2,
+ node_cave_liquid = "basenodes:water_source",
+ node_dungeon = "basenodes:cobble",
+ node_dungeon_alt = "basenodes:mossycobble",
+ node_dungeon_stair = "stairs:stair_cobble",
+ y_max = 3,
+ y_min = -255,
+ heat_point = 50,
+ humidity_point = 50,
+ })
+
+ minetest.register_biome({
+ name = "mapgen:grassland_under",
+ node_cave_liquid = {"basenodes:water_source", "basenodes:lava_source"},
+ node_dungeon = "basenodes:cobble",
+ node_dungeon_alt = "basenodes:mossycobble",
+ node_dungeon_stair = "stairs:stair_cobble",
+ y_max = -256,
+ y_min = -31000,
+ heat_point = 50,
+ humidity_point = 50,
+ })
+end
+
+
diff --git a/games/boad/mods/flatworld/mod.conf b/games/boad/mods/flatworld/mod.conf
new file mode 100644
index 000000000..a5e093091
--- /dev/null
+++ b/games/boad/mods/flatworld/mod.conf
@@ -0,0 +1,3 @@
+name = flatworld
+description = Minimal map generator
+depends = basenodes
diff --git a/games/boad/mods/hunger/init.lua b/games/boad/mods/hunger/init.lua
new file mode 100644
index 000000000..189ec6321
--- /dev/null
+++ b/games/boad/mods/hunger/init.lua
@@ -0,0 +1,143 @@
+--[[
+Implements the players needing certain nutrients.
+The hunger or thirst will increase till the player eats or drinks
+]]--
+
+gNumApples=NUM_APPLE
+gNumSnow=NUM_SNOW
+
+function damagePlayer(player,amount)
+ local new_health = player:get_hp() - amount
+
+ if new_health < 0 then
+ new_health = 0
+ end
+
+ player:set_hp(new_health)
+end
+
+function addNutrient(player,name,value)
+ local meta = player:get_meta()
+ local nut=tonumber( meta:get_string(name) )
+ print("Nut: " .. nut)
+ nut = nut + value
+ if nut < 0 then
+ nut = 0
+ elseif nut>1000 then
+ nut = 1000
+ end
+ meta:set_string(name, nut)
+end
+
+local function updateHUD(player, hunger_level, thirst_level)
+ -- Remove existing HUD elements if they exist
+ local hud_ids = player:get_meta():get("hud_ids")
+ if hud_ids then
+ hud_ids = minetest.deserialize(hud_ids)
+ if hud_ids.hunger_id then
+ player:hud_remove(hud_ids.hunger_id)
+ end
+ if hud_ids.thirst_id then
+ player:hud_remove(hud_ids.thirst_id)
+ end
+ else
+ hud_ids = {}
+ end
+
+ -- Add new HUD elements for hunger and thirst
+ hud_ids.hunger_id = player:hud_add({
+ hud_elem_type = "text",
+ position = {x = 0.5, y = 0.8},
+ offset = {x = 0, y = 0},
+ text = "Hunger: " .. hunger_level,
+ alignment = {x = 0, y = 0},
+ scale = {x = 100, y = 100},
+ number = 0xFFFFFF,
+ })
+
+ hud_ids.thirst_id = player:hud_add({
+ hud_elem_type = "text",
+ position = {x = 0.5, y = 0.85},
+ offset = {x = 0, y = 0},
+ text = "Thirst: " .. thirst_level,
+ alignment = {x = 0, y = 0},
+ scale = {x = 100, y = 100},
+ number = 0xFFFFFF,
+ })
+
+ -- Save HUD element IDs for later removal
+ player:get_meta():set_string("hud_ids", minetest.serialize(hud_ids))
+end
+
+
+
+minetest.register_globalstep(function(dtime)
+ for _, player in ipairs(minetest.get_connected_players()) do
+ local health = player:get_hp()
+ if health > 0 then
+ local player_meta = player:get_meta()
+ local h=tonumber( player_meta:get_string("hunger") )
+ local t=tonumber(player_meta:get_string("thirst"))
+
+ h = h-dtime*STARVE_1_MUL
+ t= t-dtime*STARVE_2_MUL
+ if h<0 then
+ h=0
+ damagePlayer(player,dtime)
+ end
+ if t<0 then
+ t=0
+ damagePlayer(player,dtime)
+ end
+
+ player_meta:set_string("hunger",h)
+ player_meta:set_string("thirst",t)
+
+ updateHUD(player,h,t)
+ end
+ end
+end)
+
+
+minetest.register_on_joinplayer(function(player)
+ local player_meta = player:get_meta()
+ local h=player_meta:get_string("hunger")
+ local t=player_meta:get_string("thirst")
+ if h == "" then
+ player_meta:set_string("hunger", 1000)
+ end
+ if t == "" then
+ player_meta:set_string("thirst", 1000)
+ end
+end)
+
+minetest.register_on_respawnplayer(function(player)
+ --print("resetting meta values: " .. player:get_player_name())
+ local player_meta = player:get_meta()
+ player_meta:set_string("hunger",1000)
+ player_meta:set_string("thirst",1000)
+
+ local meta2=player:get_meta()
+ --print("After reset:" .. meta2:get_string("hunger"))
+ return false
+end)
+
+
+--[[
+
+local f=function(self, dtime, moveresult)
+ print(dtime)
+end
+
+
+ -- local timer = minetest.get_node_timer(pos)
+-- timer:start(10.5)
+player:set_properties({hp_max = 5,
+--eye_height=4,
+on_step=f,})
+
+-- player.on_step = function(self, dtime, moveresult)
+-- print(dtime)
+-- end
+
+]]--
diff --git a/games/boad/mods/hunger/mod.conf b/games/boad/mods/hunger/mod.conf
new file mode 100644
index 000000000..8a708ffbe
--- /dev/null
+++ b/games/boad/mods/hunger/mod.conf
@@ -0,0 +1,2 @@
+name = hunger
+description = Makes the agent need certain nutrients.
diff --git a/games/boad/mods/main/init.lua b/games/boad/mods/main/init.lua
new file mode 100644
index 000000000..9c517e779
--- /dev/null
+++ b/games/boad/mods/main/init.lua
@@ -0,0 +1,22 @@
+
+
+
+-- Values that need to be moved into a config file
+
+-- won't allow you to go below 64. World goes gray
+MAP_SIZE=64
+
+MIN_COORD=-32 -- TODO why these numbers?
+MAX_COORD=47
+
+STARVE_1_MUL=2
+STARVE_2_MUL=1
+
+APPLE_CHANCE_DIE=25
+SNOW_CHANCE_DIE=25
+
+NUM_SNOW=20
+NUM_APPLE=20
+
+CHANCE_APPLE_SPAWN=10
+CHANCE_SNOW_SPAWN=10
diff --git a/games/boad/mods/main/mod.conf b/games/boad/mods/main/mod.conf
new file mode 100644
index 000000000..c07fe2799
--- /dev/null
+++ b/games/boad/mods/main/mod.conf
@@ -0,0 +1,2 @@
+name = main
+description = Main entry point for the package
\ No newline at end of file
diff --git a/games/boad/mods/notools/init.lua b/games/boad/mods/notools/init.lua
new file mode 100644
index 000000000..16ff439fb
--- /dev/null
+++ b/games/boad/mods/notools/init.lua
@@ -0,0 +1,32 @@
+
+minetest.register_item(":", {
+ type = "none",
+ wield_image = "wieldhand.png",
+ wield_scale = {x = 1, y = 1, z = 2.5},
+ tool_capabilities = {
+ full_punch_interval = 0.9,
+ max_drop_level = 0,
+ },
+
+ on_use = function(itemstack, user, pointed_thing)
+ if pointed_thing.type == "node" then
+ local pos = pointed_thing.under
+ local node = minetest.get_node(pos)
+
+ if node.name == "basenodes:apple" then
+ addNutrient(user,"hunger",100)
+ if math.random(0,99) < 25 then
+ local pos = pointed_thing.under
+ minetest.remove_node(pos)
+ end
+ elseif node.name == "basenodes:snowblock" then
+ addNutrient(user,"thirst",100)
+ if math.random(0,99) < 25 then
+ local pos = pointed_thing.under
+ minetest.remove_node(pos)
+ end
+ end
+ end
+ end,
+
+})
diff --git a/games/boad/mods/notools/mod.conf b/games/boad/mods/notools/mod.conf
new file mode 100644
index 000000000..299959151
--- /dev/null
+++ b/games/boad/mods/notools/mod.conf
@@ -0,0 +1,2 @@
+name = notools
+description = Only a hand that can do nothing.
diff --git a/games/boad/mods/notools/textures/basetools_bloodsword.png b/games/boad/mods/notools/textures/basetools_bloodsword.png
new file mode 100644
index 000000000..a521ba4a2
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_bloodsword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_elementalsword.png b/games/boad/mods/notools/textures/basetools_elementalsword.png
new file mode 100644
index 000000000..d007217ee
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_elementalsword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_firesword.png b/games/boad/mods/notools/textures/basetools_firesword.png
new file mode 100644
index 000000000..eca999ba1
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_firesword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_healdagger.png b/games/boad/mods/notools/textures/basetools_healdagger.png
new file mode 100644
index 000000000..3e6eb9cd0
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_healdagger.png differ
diff --git a/games/boad/mods/notools/textures/basetools_healsword.png b/games/boad/mods/notools/textures/basetools_healsword.png
new file mode 100644
index 000000000..f93fddfb2
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_healsword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_icesword.png b/games/boad/mods/notools/textures/basetools_icesword.png
new file mode 100644
index 000000000..55a8d609d
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_icesword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_mesepick.png b/games/boad/mods/notools/textures/basetools_mesepick.png
new file mode 100644
index 000000000..2993b475b
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_mesepick.png differ
diff --git a/games/boad/mods/notools/textures/basetools_mesesword.png b/games/boad/mods/notools/textures/basetools_mesesword.png
new file mode 100644
index 000000000..bc82769bc
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_mesesword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_steelaxe.png b/games/boad/mods/notools/textures/basetools_steelaxe.png
new file mode 100644
index 000000000..aac594d84
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_steelaxe.png differ
diff --git a/games/boad/mods/notools/textures/basetools_steeldagger.png b/games/boad/mods/notools/textures/basetools_steeldagger.png
new file mode 100644
index 000000000..4c9173094
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_steeldagger.png differ
diff --git a/games/boad/mods/notools/textures/basetools_steelpick.png b/games/boad/mods/notools/textures/basetools_steelpick.png
new file mode 100644
index 000000000..bc02aac3e
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_steelpick.png differ
diff --git a/games/boad/mods/notools/textures/basetools_steelpick_l1.png b/games/boad/mods/notools/textures/basetools_steelpick_l1.png
new file mode 100644
index 000000000..dc03f3f65
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_steelpick_l1.png differ
diff --git a/games/boad/mods/notools/textures/basetools_steelpick_l2.png b/games/boad/mods/notools/textures/basetools_steelpick_l2.png
new file mode 100644
index 000000000..011df4584
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_steelpick_l2.png differ
diff --git a/games/boad/mods/notools/textures/basetools_steelshears.png b/games/boad/mods/notools/textures/basetools_steelshears.png
new file mode 100644
index 000000000..04c86c370
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_steelshears.png differ
diff --git a/games/boad/mods/notools/textures/basetools_steelshovel.png b/games/boad/mods/notools/textures/basetools_steelshovel.png
new file mode 100644
index 000000000..8cab60784
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_steelshovel.png differ
diff --git a/games/boad/mods/notools/textures/basetools_steelsword.png b/games/boad/mods/notools/textures/basetools_steelsword.png
new file mode 100644
index 000000000..9909365c3
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_steelsword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_stoneaxe.png b/games/boad/mods/notools/textures/basetools_stoneaxe.png
new file mode 100644
index 000000000..a374c547d
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_stoneaxe.png differ
diff --git a/games/boad/mods/notools/textures/basetools_stonepick.png b/games/boad/mods/notools/textures/basetools_stonepick.png
new file mode 100644
index 000000000..d9156ee3a
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_stonepick.png differ
diff --git a/games/boad/mods/notools/textures/basetools_stoneshears.png b/games/boad/mods/notools/textures/basetools_stoneshears.png
new file mode 100644
index 000000000..0b4bd3b74
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_stoneshears.png differ
diff --git a/games/boad/mods/notools/textures/basetools_stoneshovel.png b/games/boad/mods/notools/textures/basetools_stoneshovel.png
new file mode 100644
index 000000000..3c1bb48cb
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_stoneshovel.png differ
diff --git a/games/boad/mods/notools/textures/basetools_stonesword.png b/games/boad/mods/notools/textures/basetools_stonesword.png
new file mode 100644
index 000000000..6f3e94cda
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_stonesword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_superhealsword.png b/games/boad/mods/notools/textures/basetools_superhealsword.png
new file mode 100644
index 000000000..4175a0917
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_superhealsword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_titaniumsword.png b/games/boad/mods/notools/textures/basetools_titaniumsword.png
new file mode 100644
index 000000000..55e22c7d5
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_titaniumsword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_usespick.png b/games/boad/mods/notools/textures/basetools_usespick.png
new file mode 100644
index 000000000..27850f961
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_usespick.png differ
diff --git a/games/boad/mods/notools/textures/basetools_usessword.png b/games/boad/mods/notools/textures/basetools_usessword.png
new file mode 100644
index 000000000..0eaf4cf38
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_usessword.png differ
diff --git a/games/boad/mods/notools/textures/basetools_woodaxe.png b/games/boad/mods/notools/textures/basetools_woodaxe.png
new file mode 100644
index 000000000..4015e910f
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_woodaxe.png differ
diff --git a/games/boad/mods/notools/textures/basetools_wooddagger.png b/games/boad/mods/notools/textures/basetools_wooddagger.png
new file mode 100644
index 000000000..6e5ab0fd6
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_wooddagger.png differ
diff --git a/games/boad/mods/notools/textures/basetools_woodpick.png b/games/boad/mods/notools/textures/basetools_woodpick.png
new file mode 100644
index 000000000..15c61f408
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_woodpick.png differ
diff --git a/games/boad/mods/notools/textures/basetools_woodshears.png b/games/boad/mods/notools/textures/basetools_woodshears.png
new file mode 100644
index 000000000..4ff92fd7c
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_woodshears.png differ
diff --git a/games/boad/mods/notools/textures/basetools_woodshovel.png b/games/boad/mods/notools/textures/basetools_woodshovel.png
new file mode 100644
index 000000000..6cc52f8a1
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_woodshovel.png differ
diff --git a/games/boad/mods/notools/textures/basetools_woodsword.png b/games/boad/mods/notools/textures/basetools_woodsword.png
new file mode 100644
index 000000000..364016ed6
Binary files /dev/null and b/games/boad/mods/notools/textures/basetools_woodsword.png differ
diff --git a/games/boad/screenshot.png b/games/boad/screenshot.png
new file mode 100644
index 000000000..08525e71c
Binary files /dev/null and b/games/boad/screenshot.png differ
diff --git a/games/globo/.luacheckrc b/games/globo/.luacheckrc
new file mode 100644
index 000000000..1c7d3994f
--- /dev/null
+++ b/games/globo/.luacheckrc
@@ -0,0 +1,43 @@
+unused_args = false
+allow_defined_top = true
+max_string_line_length = false
+max_line_length = false
+
+ignore = {
+ "131", -- Unused global variable
+ "211", -- Unused local variable
+ "231", -- Local variable never accessed
+ "311", -- Value assigned to a local variable is unused
+ "412", -- Redefining an argument
+ "421", -- Shadowing a local variable
+ "431", -- Shadowing an upvalue
+ "432", -- Shadowing an upvalue argument
+ "611", -- Line contains only whitespace
+}
+
+read_globals = {
+ "ItemStack",
+ "INIT",
+ "DIR_DELIM",
+ "dump", "dump2",
+ "fgettext", "fgettext_ne",
+ "vector",
+ "VoxelArea",
+ "profiler",
+ "Settings",
+ "check",
+ "PseudoRandom",
+
+ string = {fields = {"split", "trim"}},
+ table = {fields = {"copy", "getn", "indexof", "insert_all"}},
+ math = {fields = {"hypot", "round"}},
+}
+
+globals = {
+ "aborted",
+ "minetest",
+ "core",
+ os = { fields = { "tempfolder" } },
+ "_",
+}
+
diff --git a/games/globo/README.md b/games/globo/README.md
new file mode 100644
index 000000000..d7986ddf6
--- /dev/null
+++ b/games/globo/README.md
@@ -0,0 +1 @@
+# Globo
diff --git a/games/globo/game.conf b/games/globo/game.conf
new file mode 100644
index 000000000..39f9519e2
--- /dev/null
+++ b/games/globo/game.conf
@@ -0,0 +1,3 @@
+title = Globo Training Environment
+description = Training environment that requires intelligence.
+
diff --git a/games/globo/menu/background.png b/games/globo/menu/background.png
new file mode 100644
index 000000000..820ad771f
Binary files /dev/null and b/games/globo/menu/background.png differ
diff --git a/games/globo/menu/header.png b/games/globo/menu/header.png
new file mode 100644
index 000000000..974290643
Binary files /dev/null and b/games/globo/menu/header.png differ
diff --git a/games/globo/menu/icon.png b/games/globo/menu/icon.png
new file mode 100644
index 000000000..72dec5d59
Binary files /dev/null and b/games/globo/menu/icon.png differ
diff --git a/games/globo/mods/animals/LICENSE.txt b/games/globo/mods/animals/LICENSE.txt
new file mode 100644
index 000000000..4596486dc
--- /dev/null
+++ b/games/globo/mods/animals/LICENSE.txt
@@ -0,0 +1,655 @@
+License of source code
+----------------------
+Copyright (C) 2019 Dokimi
+
+----------------------
+
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ 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.
+
+
+ Copyright (C)
+
+ 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 .
diff --git a/games/globo/mods/animals/README.txt b/games/globo/mods/animals/README.txt
new file mode 100644
index 000000000..14cdb9283
--- /dev/null
+++ b/games/globo/mods/animals/README.txt
@@ -0,0 +1,33 @@
+Exile mod: animals
+========================
+Adds animals using mobkit api.
+
+Animals spawn only once on mapgen. They then reproduce. If they go extinct they're gone.
+
+
+Authors of source code
+----------------------
+Some water based code adapted from waterlife by Gundul (GNU Lesser General Public License)
+
+
+Authors of media (textures, models, sounds)
+---------------------------
+Gundu: riverfish from waterlife by Gundul, CC-BY-NC-SA 3.0 by Melkor
+
+Kubwakubwa: spider from Mineclone2 GPLv3, CC BY-SA 4.0
+
+Kubwakubwa_warn.ogg: TenPlus1, from `mobs_monster` or `mobs_animal` mod (MIT License)
+
+Sarkamos model: MIT License, Copyright (c) 2019 TheTermos
+
+animals_hatch_egg.ogg, based on http://soundbible.com/1097-Slime-Splash.html, Attribution 3.0, Mike Koenig.
+
+darkasthaan: adapted from spider2 from Mobs Monster by TenPlus1 (MIT License)
+
+impethu: adapted from silkworm from Petz by Runs, CC BY-SA 4.0
+
+pegasun: adapted from chicken, mobs_animal by Krupnov Pavel and TenPlus1 (MIT)
+
+Gundu call sound: based on http://soundbible.com/1660-Underwater-Pool.html, Attribution 3.0, Mike Koenig.
+
+sneachan: from silverfish mobs_mc Mineclone2, GPLv3
diff --git a/games/globo/mods/animals/api.lua b/games/globo/mods/animals/api.lua
new file mode 100644
index 000000000..9267fbe55
--- /dev/null
+++ b/games/globo/mods/animals/api.lua
@@ -0,0 +1,1560 @@
+local random = math.random
+local pi = math.pi
+local time = os.time
+local sqrt = math.sqrt
+
+local abs = math.abs
+local floor = math.floor
+local ceil = math.ceil
+local max = math.max
+local min = math.min
+local tan = math.tan
+local pow = math.pow
+
+local function math_clamp(...) -- num, min, max
+ return minimal.math_clamp(...)
+end
+
+local max_objects = 30
+local mo_check_radius = 40 -- maxobject check radius
+
+animals = animals
+mobkit = mobkit
+
+local use_vh1 = minetest.get_modpath("visual_harm_1ndicators")
+
+--------------------------------------------------------------------------
+--basic
+--------------------------------------------------------------------------
+
+
+-- returns 2D angle from self to target in radians
+local function get_yaw_to_object(pos, opos)
+ local ankat = pos.x - opos.x
+ local gegkat = pos.z - opos.z
+ local yaw = math.atan2(ankat, gegkat)
+ return yaw
+end
+
+
+--flee sound (has to be in water!)
+local function flee_sound(self)
+ if not self.isinliquid then
+ return
+ end
+ mobkit.make_sound(self,'flee')
+end
+
+--------------------------------------------------------------------------
+--Life and death
+--------------------------------------------------------------------------
+
+----------------------------------------------------
+-- drop on death what is defined in the entity table
+function animals.handle_drops(self)
+ if use_vh1 then
+ VH1.clear_bar(self.object)
+ end
+
+ if not self.drops then
+ return
+ end
+
+ for _,item in ipairs(self.drops) do
+
+ local amount = random (item.min, item.max)
+ local chance = random(1,100)
+ local pos = self.object:get_pos()
+ pos.y = pos.y+0.5
+
+ if chance < (100/item.chance) then
+ --leave time for death animation to end
+ minetest.after(5, function()
+ minetest.add_item(pos, item.name.." "..tostring(amount))
+ end)
+ end
+
+ end
+ end
+
+----------------------------------------------------
+--core health
+function animals.core_hp(self)
+ --default drowing and fall damage
+ local hp = self.hp
+ mobkit.vitals(self)
+ --die from damage
+ if use_vh1 and hp ~= self.hp then -- hp has changed, update hp bar
+ VH1.update_bar(self.object, self.hp, self.max_hp)
+ end
+ hp = self.hp
+ if hp <= 0 then
+ mobkit.clear_queue_high(self)
+ animals.handle_drops(self)
+ mobkit.hq_die(self)
+ return false
+ else
+ return true
+ end
+end
+
+
+
+function animals.core_hp_water(self)
+
+ if not self.isinliquid then
+ mobkit.hurt(self,1)
+ if use_vh1 then
+ VH1.update_bar(self.object, self.hp, self.max_hp)
+ end
+ end
+ --die from damage
+ local hp = self.hp
+
+
+local energy = mobkit.recall(self,'energy')
+local age = mobkit.recall(self,'age')
+if not age then age=0 end
+if not energy then energy = 0 end
+ if hp <= 0 then
+ mobkit.clear_queue_high(self)
+ animals.handle_drops(self)
+ mobkit.hq_die(self)
+ return false
+ else
+ return true
+ end
+end
+
+
+local function get_mean_temp(pos) -- this could be put somewhere else like in climate or minimal
+ local temps = {}
+
+ if (type(pos) ~= "table") then -- no pos table is given then
+ return 15
+ elseif (type(pos.x) ~= "number" or type(pos.y) ~= "number" or type(pos.z) ~= "number") then -- incase an invalid pos is given
+ return 15
+ end
+
+ for x = -1, 1, 1 do -- create matrix of possible positions
+ for y = -1, 1, 1 do
+ for z = -1, 1, 1 do
+ local npos = {x = (pos.x - x), y = (pos.y - y), z = (pos.z - z)} -- matrix the pos :D
+
+ temps[#temps + 1] = climate.get_point_temp(npos, true)
+ end
+ end
+ end
+
+ local mtemp = 0 -- start with a number so it can be calculated
+ for _,num in pairs(temps) do
+ mtemp = mtemp + num
+ end
+
+ return mtemp / #temps -- return the "mean" of the matrix'd temps
+end
+
+----------------------------------------------------
+--core health, energy and age
+function animals.core_life(self, lifespan, pos)
+
+ local energy = mobkit.recall(self,'energy')
+ local age = mobkit.recall(self,'age')
+ local hbnate = mobkit.recall(self,'hibernate')
+
+ local energy_loss = self.energy_loss or 0.25
+
+ --stops some crashes in creative?
+ if not energy then
+ energy = 1
+ end
+ if not age then
+ age = 0
+ end
+ if not hbnate then
+ hbnate = false
+ end
+
+ age = age + 1
+ if (hbnate == false) then
+ energy = energy - energy_loss
+ elseif (random() <= 0.005) then -- 0.5% chance to lose energy during hibernation
+ energy = energy - energy_loss
+ end
+
+ --die from exhaustion, old age
+ if energy <=0 or age > lifespan then
+ mobkit.clear_queue_high(self)
+ animals.handle_drops(self)
+ mobkit.hq_die(self)
+ return nil
+ end
+
+ --die from high temp
+ local temp = climate.get_point_temp(pos, true)
+ if (temp == 450) then -- get the mathematical "mean" of the pos and the surroundings nodes (workaround to torches)
+ temp = get_mean_temp(pos)
+ end
+ if temp > 100 then -- if it's still boiling time
+ -- make the animal exhausted and hurt them (instant death)
+ energy = 0
+ mobkit.hurt(self, temp)
+ end
+
+ --temperature stress
+ if temp < self.min_temp or temp > self.max_temp then
+ -- if this temperature is uncomfortable, try to find somewhere else!
+ if (self.class ~= 2) then
+ -- only for land creatures
+ animals.hq_roam_comfort_temp(self,80, self.max_temp / 2)
+ hbnate = false -- moving around, thus not hibernating
+ end
+ if temp > self.max_temp * 4 then
+ mobkit.hurt(self,2)
+ end
+ end
+
+
+ --heal using energy
+ if self.hp < self.max_hp and energy > 10 and random() <= 0.75 then
+ if not (not self.isinliquid and self.class == 2) then
+ -- if not a fish out of water then (fish in water will heal up nicely :D)
+ mobkit.heal(self,1)
+ if use_vh1 then
+ VH1.update_bar(self.object, self.hp, self.max_hp)
+ end
+ energy = energy - 5
+ end
+ end
+
+ if (hbnate == true) then
+ mobkit.clear_queue_low(self)
+ mobkit.animate(self,"dead")
+ end
+
+ return age, energy, hbnate
+end
+
+
+
+----------------------------------------------------
+--put an egg in the world, return energy
+function animals.place_egg(pos, egg_name, energy, energy_egg, medium)
+
+ local p = mobkit.get_node_pos(pos)
+ local e = energy
+ local animal_name = string.gsub(egg_name,"_eggs","")
+ animal_name = string.gsub(animal_name,"_egg","") -- incase it is singular
+ local objcount = #animals.get_entities_inside_radius(animal_name,pos,mo_check_radius)
+
+ if minetest.get_node(p).name == medium and objcount < max_objects then
+
+ local posu = {x = p.x, y = p.y - 1, z = p.z}
+ local n = mobkit.nodeatpos(posu)
+
+ if n and n.walkable and n.name ~= "nodes_nature:tree_mark" then
+ minetest.set_node(p, {name = egg_name})
+ e = energy - energy_egg
+ end
+
+ end
+
+ return e
+end
+
+
+----------------------------------------------------
+--release offspring from an egg (called from timers)
+function animals.hatch_egg(pos, medium_name, replace_name, name, energy_egg, young_per_egg)
+
+ local air = minetest.find_nodes_in_area(
+ {x=pos.x-1, y=pos.y-1, z=pos.z-1},
+ {x=pos.x+1, y=pos.y+1, z=pos.z+1}, {medium_name})
+ --if can't find the stuff this mob moves through then it dies
+ if #air < 1 then
+ minetest.set_node(pos, {name = replace_name})
+ return false
+ end
+
+ local cnt = 0
+ local start_e = math.floor(energy_egg/young_per_egg)
+ local objcount = #animals.get_entities_inside_radius(name, pos, mo_check_radius)
+ while cnt < young_per_egg and objcount < max_objects do
+ local ran_pos = air[random(#air)]
+ local ent = minetest.add_entity(ran_pos, name)
+ minetest.sound_play("animals_hatch_egg", {pos = pos, gain = 0.2, max_hear_distance = 6})
+ ent = ent:get_luaentity()
+ mobkit.remember(ent,'energy', start_e)
+ mobkit.remember(ent,'age',0)
+ objcount = objcount + 1
+ cnt = cnt + 1
+ end
+
+ minetest.set_node(pos, {name = replace_name})
+ return false
+
+end
+
+ --------------------------------------------------------------------------
+ --Movement
+ --------------------------------------------------------------------------
+
+
+
+----------------------------------------------
+--roam to places with equal or lesser darkness
+function animals.hq_roam_dark(self,prty)
+ local timer = time() + 30
+ local func=function(self)
+ if time() > timer then
+ return true
+ end
+
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local neighbor = random(8)
+
+ local height, tpos, liquidflag = mobkit.is_neighbor_node_reachable(self,neighbor)
+
+ if height and not liquidflag then
+ local light = minetest.get_node_light(pos, 0.5) or 0
+ local lightn = minetest.get_node_light(tpos, 0.5) or 0
+ if lightn <= light then
+ mobkit.dumbstep(self,height,tpos,0.3)
+ else
+ return true
+ end
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+
+
+----------------------------------------------
+--roam to places with comfortable temperature
+function animals.hq_roam_comfort_temp(self,prty, opt_temp)
+ local timer = time() + 30
+
+ local func = function(self)
+ if time() > timer then
+ return true
+ end
+
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local neighbor = random(8)
+
+ local height, tpos, liquidflag = mobkit.is_neighbor_node_reachable(self,neighbor)
+
+ if height and not liquidflag then
+ local temp = climate.get_point_temp(pos, true)
+ local tempn = climate.get_point_temp(tpos, true)
+ local dif = abs(opt_temp - temp)
+ local difn = abs(opt_temp - tempn)
+
+ if difn <= dif then
+ mobkit.dumbstep(self,height,tpos,0.3)
+ else
+ return true
+ end
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+
+----------------------------------------------
+--roam to a better surface (by group)
+function animals.hq_roam_surface_group(self, group, prty)
+ local timer = time() + 15
+
+ local func=function(self)
+
+ if time() > timer then
+ return true
+ end
+
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local neighbor = random(8)
+
+ local height, tpos, liquidflag = mobkit.is_neighbor_node_reachable(self, neighbor)
+
+ if height and not liquidflag then
+ --is it the correct group?
+ local s_pos = tpos
+ s_pos.y = s_pos.y - 1
+ local under = minetest.get_node(s_pos)
+
+ if under and minetest.get_item_group(under.name, group) > 0 then
+ mobkit.dumbstep(self, height, tpos, 0.3)
+ else
+ return true
+ end
+ end
+
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+
+----------------------------------------------
+--roam to a walkable (by group) i.e. walk into the node itself c.f. under
+function animals.hq_roam_walkable_group(self, group, prty)
+ local timer = time() + 15
+
+ local func=function(self)
+
+ if time() > timer then
+ return true
+ end
+
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local neighbor = random(8)
+
+ local height, tpos, liquidflag = mobkit.is_neighbor_node_reachable(
+ self, neighbor)
+
+ if height and not liquidflag then
+ --is it the correct?
+ local n_node = minetest.get_node(tpos).name
+
+ if minetest.get_item_group(n_node, group) > 0 then
+ mobkit.dumbstep(self, height, tpos, 0.3)
+ else
+ return true
+ end
+ end
+
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+
+local function aqua_path_safe(start_pos,p)
+ local path=minetest.raycast(start_pos,p,false,true)
+ for pointed_thing in path do
+ local node=mobkit.nodeatpos(pointed_thing.intersection_point)
+ if node and node.drawtype ~= 'liquid' then
+ return false
+ end
+ end
+ return true
+end
+
+
+ ---------------------------------------------------
+--(currently duplicated in mobkit, but only as a local function)
+local function aqua_radar_dumb(pos,yaw,range,reverse)
+ range = range or 4
+ local function okpos(p,start_pos)
+ local node = mobkit.nodeatpos(p)
+ if node then
+ if node.drawtype == 'liquid' then
+ local nodeu = mobkit.nodeatpos(mobkit.pos_shift(p,{y=1}))
+ local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-1}))
+ if ((nodeu and nodeu.drawtype == 'liquid') or (noded and noded.drawtype == 'liquid')) then
+ return true
+ else
+ return false
+ end
+ else
+ local h,_ = mobkit.get_terrain_height(p)
+ if h then
+ local node2 = mobkit.nodeatpos({x=p.x,y=h+1.99,z=p.z})
+ if node2 and node2.drawtype == 'liquid' then
+ return true, h
+ end
+ else
+ return false
+ end
+ end
+ else
+ return false
+ end
+ end
+-- check node in front at range.
+ local fpos = mobkit.pos_translate2d(pos,yaw,range)
+ local ok,h = okpos(fpos,pos)
+
+
+ if not ok then
+--check nodes right and left of possition.
+--Reverse checks from back to front first
+ local ffrom, fto, fstep
+ if reverse then
+ ffrom, fto, fstep = 3,1,-1
+ else
+ ffrom, fto, fstep = 1,3,1
+ end
+ for i=ffrom, fto, fstep do
+ ok,h = okpos(mobkit.pos_translate2d(pos,yaw+i,range),pos)
+ if ok then
+ return yaw+i,h
+ end
+ ok,h = okpos(mobkit.pos_translate2d(pos,yaw-i,range),pos)
+ if ok then
+ return yaw-i,h
+ end
+ end
+ -- No safe path so reverse direction.
+ return yaw+pi,h
+ else
+ return yaw, h
+ end
+end
+
+
+---------------------------------------------------
+-- turn around from opos and swim away until out of sight
+function animals.hq_swimfrompos(self,prty,opos,speed)
+ local timer = time() + 2
+ local func = function(self)
+
+ if time() > timer then
+ return true
+ end
+
+ local pos = mobkit.get_stand_pos(self)
+ local distance = vector.distance(pos,opos)
+ -- rotate 30 degrees to right from current yaw
+ local yaw = self.object:get_yaw() - pi/6
+ if distance > 0.5 then
+ -- or 180 from pos we're running from if no longer close to it
+ yaw = get_yaw_to_object(pos, opos) - pi
+ end
+
+
+ if (distance/1.5) < self.view_range then
+ local swimto, height = aqua_radar_dumb(pos,yaw,1)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+0.2
+ self.object:set_velocity(vel)
+ end
+
+ mobkit.hq_aqua_turn(self,prty,swimto,speed)
+
+ else
+ return true
+ end
+
+ end
+ mobkit.queue_high(self,func,prty)
+ end
+
+
+
+---------------------------------------------------
+-- turn around from tgtob and swim away until out of sight
+function animals.hq_swimfrom(self,prty,tgtobj,speed)
+ local timer = time() + 2
+
+ local func = function(self)
+
+ if time() > timer then
+ return true
+ end
+
+ if not mobkit.is_alive(tgtobj) then
+ return true
+ end
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+
+ local yaw = get_yaw_to_object(pos, opos) - (pi/2)
+ local distance = vector.distance(pos,opos)
+
+ if (distance/1.5) < self.view_range then
+ local swimto, height = aqua_radar_dumb(pos,yaw,speed)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+0.1
+ self.object:set_velocity(vel)
+ end
+
+ mobkit.hq_aqua_turn(self,prty,swimto,speed)
+
+ else
+ return true
+ end
+
+ end
+ mobkit.queue_high(self,func,prty)
+ end
+
+
+
+
+ ---------------------------------------------------
+ -- chase tgtob until somewhat out of sight
+function mobkit.hq_chaseafter(self,prty,tgtobj)
+ local timer = time() + 3
+
+ local func = function(self)
+ if time() > timer then
+ return true
+ end
+
+ if not mobkit.is_alive(tgtobj) then return true end
+
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ if vector.distance(pos,opos) > 3 then
+ mobkit.make_sound(self,'warn')
+ mobkit.goto_next_waypoint(self,opos)
+ else
+ mobkit.lq_idle(self,1)
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+ ---------------------------------------------------
+ -- chase tgtob and swim until somewhat out of sight
+ function animals.hq_swimafter(self,prty,tgtobj,speed)
+ local timer = time() + 3
+
+ local func = function(self)
+ if time() > timer then
+ return true
+ end
+
+ if not mobkit.is_alive(tgtobj) then
+ return true
+ end
+
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+
+ local yaw = get_yaw_to_object(pos, opos) -pi
+ local distance = vector.distance(pos,opos)
+
+ if distance < self.view_range/3 then
+ local swimto, height = aqua_radar_dumb(pos,yaw,3)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+0.1
+ self.object:set_velocity(vel)
+ end
+
+ mobkit.hq_aqua_turn(self,prty,swimto,speed)
+
+ else
+ return true
+ end
+
+ end
+ mobkit.queue_high(self,func,prty)
+ end
+
+
+
+
+
+--------------------------------------------------------------------------
+--Attack and feeding
+--------------------------------------------------------------------------
+
+----------------------------------------------------------------
+--on_punch
+function animals.on_punch(self, tool_capabilities, puncher, prty, chance)
+ if mobkit.is_alive(self) then
+ --do damage
+ mobkit.clear_queue_high(self)
+ local hbnate = mobkit.recall(self,'hibernate')
+ local dmg = tool_capabilities.damage_groups.fleshy or 1
+ mobkit.hurt(self,dmg)
+ mobkit.make_sound(self,'punch')
+ if use_vh1 then
+ VH1.update_bar(self.object, self.hp, self.max_hp)
+ end
+ --fight or flight
+ --flee if hurt (or hibernating!)
+ if self.hp < self.max_hp/10 or self.hp <= (dmg * 2) or hbnate == true then
+ mobkit.animate(self,'fast')
+ mobkit.make_sound(self,'warn')
+ mobkit.hq_runfrom(self, prty, puncher)
+ elseif prty < 20 then
+ animals.fight_or_flight(self, puncher, prty, chance)
+ end
+
+
+ end
+end
+
+
+function animals.on_punch_water(self, tool_capabilities, puncher, prty, chance)
+ if mobkit.is_alive(self) then
+ --do damage
+ mobkit.clear_queue_high(self)
+ mobkit.hurt(self,tool_capabilities.damage_groups.fleshy or 1)
+ mobkit.make_sound(self,'punch')
+ if use_vh1 then
+ VH1.update_bar(self.object, self.hp, self.max_hp)
+ end
+
+ --fight or flight
+ if self.hp < self.max_hp/10 then
+ mobkit.animate(self,'fast')
+ animals.hq_swimfrom(self, prty, puncher, self.max_speed)
+ flee_sound(self)
+ else
+ animals.fight_or_flight_water(self, puncher, prty, chance)
+ end
+
+ end
+end
+
+----------------------------------------------------------------
+--attack or run vs player
+function animals.fight_or_flight_plyr(self, plyr, prty, chance)
+ mobkit.clear_queue_high(self)
+ --fight chance, or run away (don't do it attach bc buggers physics)
+ if random()< chance and plyr:get_attach() == nil then
+ mobkit.hq_warn(self,prty,plyr)
+ else
+ --mobkit.animate(self,'fast')
+ --mobkit.make_sound(self,'scared')
+ mobkit.hq_runfrom(self,prty, plyr)
+ end
+end
+
+--attack or run vs entity
+function animals.fight_or_flight(self, threat, prty, chance)
+ mobkit.clear_queue_high(self)
+ --fight chance, or run away
+ if random()< chance then
+ mobkit.hq_warn(self,prty, threat)
+ else
+ --mobkit.animate(self,'fast')
+ --mobkit.make_sound(self,'scared')
+ mobkit.hq_runfrom(self,prty, threat)
+ end
+end
+
+
+
+
+----attack or run vs player in water
+function animals.fight_or_flight_plyr_water(self, plyr, prty, chance)
+ mobkit.clear_queue_high(self)
+ --ignore chance, or run away
+ if random()< chance and plyr:get_attach() == nil then
+ mobkit.hq_aqua_attack(self, prty, plyr, self.max_speed)
+ else
+ mobkit.animate(self,'fast')
+ animals.hq_swimfrom(self, prty, plyr, self.max_speed)
+ flee_sound(self)
+ end
+end
+
+----attack or run vs player in water
+function animals.fight_or_flight_water(self, threat, prty, chance)
+ mobkit.clear_queue_high(self)
+ --ignore chance, or run away
+ if random()< chance then
+ mobkit.hq_aqua_attack(self, prty, threat, self.max_speed)
+ else
+ mobkit.animate(self,'fast')
+ animals.hq_swimfrom(self, prty, threat, self.max_speed)
+ flee_sound(self)
+ end
+end
+
+----------------------------------------------------------------
+--Find and Flee predators
+function animals.predator_avoid(self, prty, chance)
+
+ for _, pred in ipairs(self.predators) do
+ local thr = mobkit.get_closest_entity(self,pred)
+ if thr then
+ animals.fight_or_flight(self, thr, prty, chance)
+ return thr
+ end
+ end
+end
+
+
+function animals.predator_avoid_water(self, prty, chance)
+
+ for _, pred in ipairs(self.predators) do
+ local thr = mobkit.get_closest_entity(self,pred)
+ if thr then
+ animals.fight_or_flight_water(self, thr, prty, chance)
+ return thr
+ end
+ end
+end
+
+----------------------------------------------------------------
+--Find and hunt prey
+function animals.prey_hunt(self, prty)
+
+ for _, prey in ipairs(self.prey) do
+ local tgtobj = mobkit.get_closest_entity(self,prey)
+ if tgtobj then
+ animals.hq_attack_eat(self,prty,tgtobj)
+ return true
+ end
+ end
+end
+
+
+function animals.prey_hunt_water(self, prty)
+
+ for _, prey in ipairs(self.prey) do
+ local tgtobj = mobkit.get_closest_entity(self,prey)
+ if tgtobj then
+ mobkit.animate(self,'fast')
+ flee_sound(self)
+ animals.hq_aqua_attack_eat(self, prty, tgtobj, self.max_speed)
+ return true
+ end
+ end
+end
+
+
+
+
+----------------------------------------------------
+--for things that eat spreading surface
+function animals.eat_spreading_under(pos, chance)
+ local p = mobkit.get_node_pos(pos)
+ local posu = {x = p.x, y = p.y - 1, z = p.z}
+ local under = minetest.get_node(posu).name
+
+ if minetest.get_item_group(under, "spreading") > 0 then
+ if random()< chance then
+ --set node to it's drop
+ --this is to scratch up surface layers
+ local nodedef = minetest.registered_nodes[under]
+ local drop = nodedef.drop
+ minetest.check_for_falling(posu)
+ minetest.set_node(posu, {name = drop})
+ minetest.sound_play("nodes_nature_dig_crumbly", {gain = 0.2, pos = pos, max_hear_distance = 10})
+ end
+
+ return true
+
+ else
+ return false
+ end
+
+end
+
+----------------------------------------------------
+--for things that eat sediment (i.e. dig in the mud)
+function animals.eat_sediment_under(pos, chance)
+ local p = mobkit.get_node_pos(pos)
+ local posu = {x = p.x, y = p.y - 1, z = p.z}
+ local under = minetest.get_node(posu).name
+
+ if minetest.get_item_group(under, "sediment") > 0 then
+ if random()< chance then
+ --set node to it's drop
+ --this is to scratch up surface layers
+ local nodedef = minetest.registered_nodes[under]
+ local drop = nodedef.drop
+ minetest.check_for_falling(posu)
+ minetest.set_node(posu, {name = drop})
+ minetest.sound_play("nodes_nature_dig_crumbly", {gain = 0.2, pos = pos, max_hear_distance = 10})
+ end
+
+ return true
+
+ else
+ return false
+ end
+
+end
+
+
+----------------------------------------------------
+--eating any flora
+
+function animals.eat_flora(pos, chance)
+ local p = mobkit.get_node_pos(pos)
+ local node = minetest.get_node(p).name
+
+ if minetest.get_item_group(node, "flora") > 0
+ and minetest.get_item_group(node, "cane_plant") == 0
+ then
+ --gain energy
+ if random()< chance then
+ --destroy the plant
+ minetest.set_node(p, {name = 'air'})
+ minetest.sound_play("nodes_nature_dig_snappy", {gain = 0.2, pos = pos, max_hear_distance = 10})
+ end
+
+ return true
+ else
+ return false
+ end
+end
+
+
+----------------------------------------------------------------
+--like mobkit version, but including removal of prey and gaining energy
+--to hit is to catch... for predators, where the chewing does the killing
+function animals.hq_aqua_attack_eat(self,prty,tgtobj,speed)
+ local timer = time() + 12
+
+ local tyaw = 0
+ local prvscanpos = {x=0,y=0,z=0}
+ local init = true
+ local tgtbox = tgtobj:get_properties().collisionbox
+
+ local func = function(self)
+ if time() > timer then
+ return true
+ end
+
+ if not mobkit.is_alive(tgtobj) then
+ return true
+ end
+
+ if init then
+ mobkit.animate(self,'fast')
+ mobkit.make_sound(self,'attack')
+ init = false
+ end
+
+ local pos = mobkit.get_stand_pos(self)
+ local yaw = self.object:get_yaw()
+ local scanpos = mobkit.get_node_pos(mobkit.pos_translate2d(pos,yaw,speed))
+ if not vector.equals(prvscanpos,scanpos) then
+ prvscanpos=scanpos
+ local nyaw,height = aqua_radar_dumb(pos,yaw,speed*0.5)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+1
+ self.object:set_velocity(vel)
+ end
+ if yaw ~= nyaw then
+ tyaw=nyaw
+ mobkit.hq_aqua_turn(self,prty+1,tyaw,speed)
+ return
+ end
+ end
+
+ local tpos = tgtobj:get_pos()
+ tyaw=minetest.dir_to_yaw(vector.direction(pos,tpos))
+ mobkit.turn2yaw(self,tyaw,3)
+ yaw = self.object:get_yaw()
+ if mobkit.timer(self,1) then
+ if not mobkit.is_in_deep(tgtobj) then return true end
+ local vel = self.object:get_velocity()
+ if tpos.y>pos.y+0.5 then self.object:set_velocity({x=vel.x,y=vel.y+0.5,z=vel.z})
+ elseif tpos.y0.15 then
+ local ent = tgtobj:get_luaentity()
+ local ent_e = (mobkit.recall(ent,'energy') or 1)
+ local self_e = (mobkit.recall(self,'energy') or 1)
+ mobkit.remember(self,'energy', (ent_e*0.7) + self_e)
+ ent.object:remove()
+ return true
+ end
+ end
+ mobkit.go_forward_horizontal(self,speed)
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+
+
+
+
+---------------------------------------------------
+--like mobkit version, but including removal of prey and gaining energy
+--to hit is to catch... for predators, where the chewing does the killing
+local function lq_jumpattack_eat(self,height,target)
+ local phase=1
+ local tgtbox = target:get_properties().collisionbox
+
+ local func=function(self)
+ if not mobkit.is_alive(target) then return true end
+
+ if self.isonground then
+ if phase==1 then -- collision bug workaround
+ local vel = self.object:get_velocity()
+ vel.y = -mobkit.gravity*sqrt(height*2/-mobkit.gravity)
+ self.object:set_velocity(vel)
+ mobkit.make_sound(self,'charge')
+ phase=2
+ else
+ mobkit.lq_idle(self,0.3)
+ return true
+ end
+ elseif phase==2 then
+ local dir = minetest.yaw_to_dir(self.object:get_yaw())
+ local vy = self.object:get_velocity().y
+ dir=vector.multiply(dir,6)
+ dir.y=vy
+ self.object:set_velocity(dir)
+ phase=3
+ elseif phase==3 then -- in air
+ local tgtpos = target:get_pos()
+ local pos = self.object:get_pos()
+
+ -- calculate attack spot
+ local yaw = self.object:get_yaw()
+ local dir = minetest.yaw_to_dir(yaw)
+ local apos = mobkit.pos_translate2d(pos,yaw,self.attack.range)
+
+ if mobkit.is_pos_in_box(apos,tgtpos,tgtbox)
+ or (mobkit.isnear2d(pos,tgtpos,1) and random()<0.1) --makes up for issue with some boxes not working together
+ then --bite
+ target:punch(self.object,1,self.attack)
+ -- bounce off
+ local vy = self.object:get_velocity().y
+ self.object:set_velocity({x=dir.x*-3,y=vy,z=dir.z*-3})
+ -- play attack sound if defined
+ mobkit.make_sound(self,'attack')
+ phase=4
+ local ent = target:get_luaentity()
+ local ent_hp = ent.hp or 1
+ local ent_mhp = ent.max_hp or 1
+ local dmg = 1
+ if (type(self.attack) == "table") then
+ if (type(self.attack.damage_groups) == "table") then
+ dmg = self.attack.damage_groups.fleshy or 1
+
+ dmg = math_clamp(dmg,0,ent_mhp) -- clamp damage between 0 and entity max health to prevent excessive energygain
+ end
+ end
+
+ mobkit.hurt(ent,dmg) -- hurt opponent
+
+ -- eat bits of opponent
+ local ent_e = (mobkit.recall(ent,'energy') or 1)
+ local self_e = (mobkit.recall(self,'energy') or 1)
+ local energygain = (ent_e * (dmg / ent_mhp) ) -- omnomnom
+
+ mobkit.remember(self,'energy', (energygain*0.4) + self_e) -- take 40%
+ mobkit.remember(ent,'energy', ent_e - energygain) -- make opponent lose energy
+
+ if (ent.hp <= dmg) then
+ local ent_e = (mobkit.recall(ent,'energy') or 1)
+ local self_e = (mobkit.recall(self,'energy') or 1)
+ mobkit.remember(self,'energy', (energygain*0.25) + self_e) -- add another 25% for nomming fully
+ ent.object:remove()
+ return true
+ end
+
+ end
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+
+
+function animals.hq_attack_eat(self,prty,tgtobj)
+ local timer = time() + 12
+
+ local func = function(self)
+ if time() > timer then
+ return true
+ end
+
+ if not mobkit.is_alive(tgtobj) then return true end
+
+ if mobkit.is_queue_empty_low(self) then
+ local pos = mobkit.get_stand_pos(self)
+ -- local pos = mobkit.get_stand_pos(self)
+ local tpos = mobkit.get_stand_pos(tgtobj)
+ local dist = vector.distance(pos,tpos)
+ if dist > 3 then
+ return true
+ else
+ mobkit.lq_turn2pos(self,tpos)
+ local tgtheight = tgtobj:get_luaentity().height
+ if tgtheight == nil then
+ tgtheight = 0
+ end
+ local height = tgtobj:is_player() and 0.35 or tgtheight*0.6
+ if tpos.y+height>pos.y then
+ lq_jumpattack_eat(self,tpos.y+height-pos.y,tgtobj)
+
+ else
+ mobkit.lq_dumbwalk(self,mobkit.pos_shift(tpos,{x=random()-0.5,z=random()-0.5}))
+ end
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+
+
+
+
+----------------------------------------------------------------
+--Social Behaviour
+
+
+----------------------------------------------------------------
+--territorial behaviour
+--avoid those in better condition
+function animals.territorial(self, energy, eat)
+
+ for _, riv in ipairs(self.rivals) do
+
+ local rival = mobkit.get_closest_entity(self, riv)
+
+ if rival then
+
+ --flee if hurt
+ if self.hp < self.max_hp/4 then
+ mobkit.animate(self,'fast')
+ mobkit.make_sound(self,'warn')
+ mobkit.hq_runfrom(self, 25, rival)
+ return true
+ end
+
+ --contest! The more energetic one wins
+ local r_ent = rival:get_luaentity()
+ local r_ent_e = mobkit.recall(r_ent,'energy') or 0
+
+ if energy > r_ent_e then
+ if eat then
+ animals.hq_attack_eat(self, 25, rival)
+ else
+ mobkit.animate(self,'fast')
+ mobkit.make_sound(self,'warn')
+ mobkit.hq_chaseafter(self,25,rival)
+ end
+ return true
+ else
+ mobkit.animate(self,'fast')
+ mobkit.make_sound(self,'warn')
+ mobkit.hq_runfrom(self,25,rival)
+ return true
+ end
+ end
+
+ end
+
+end
+
+
+--water version
+function animals.territorial_water(self, energy, eat)
+
+ for _, riv in ipairs(self.rivals) do
+
+ local rival = mobkit.get_closest_entity(self, riv)
+
+ if rival then
+
+ --flee if hurt
+ if self.hp < self.max_hp/4 then
+ mobkit.animate(self,'fast')
+ flee_sound(self)
+ animals.hq_swimfrom(self, 25, rival ,self.max_speed)
+ return true
+ end
+
+ --contest! The more energetic one wins
+ local r_ent = rival:get_luaentity()
+ local r_ent_e = mobkit.recall(r_ent,'energy')
+
+ --not clear why some have nil, but it happens
+ if r_ent_e == nil then
+ return
+ end
+
+ if energy > r_ent_e then
+ if eat then
+ animals.hq_aqua_attack_eat(self, 25, rival, self.max_speed)
+ flee_sound(self)
+ else
+ --harass
+ mobkit.animate(self,'fast')
+ animals.hq_swimafter(self, 15, rival, self.max_speed)
+ flee_sound(self)
+ end
+ return true
+ else
+ mobkit.animate(self,'fast')
+ flee_sound(self)
+ animals.hq_swimfrom(self, 25, rival ,self.max_speed)
+ return true
+ end
+ end
+
+ end
+
+end
+
+
+----------------------------------------------------------------
+--flocking behaviour
+--follow friends
+
+function animals.hq_flock(self,prty,tgtobj, min_dist)
+ local timer = time() + 5
+
+ local func = function(self)
+ if time() > timer then
+ return true
+ end
+
+ if not mobkit.is_alive(tgtobj) then return true end
+
+ if mobkit.is_queue_empty_low(self) then
+ local pos = mobkit.get_stand_pos(self)
+ local tpos = mobkit.get_stand_pos(tgtobj)
+ local dist = vector.distance(pos,tpos)
+ if dist <= min_dist then
+ mobkit.lq_idle(self,1)
+ return true
+ else
+ mobkit.goto_next_waypoint(self,tpos)
+ end
+ end
+ end
+
+ mobkit.queue_high(self,func,prty)
+end
+
+
+
+function animals.hq_flock_water(self,prty,tgtobj, min_dist, speed)
+ local timer = time() + 7
+
+ local func = function(self)
+ if time() > timer then
+ return true
+ end
+
+ if not mobkit.is_alive(tgtobj) then
+ return true
+ end
+
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+
+ local yaw = get_yaw_to_object(pos, opos) - (pi/2)
+ local distance = vector.distance(pos,opos)
+
+ if distance > min_dist then
+ local swimto, height = aqua_radar_dumb(pos,yaw,3)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+0.1
+ self.object:set_velocity(vel)
+ end
+
+ mobkit.hq_aqua_turn(self,prty,swimto,speed)
+
+ else
+ --sync with target
+ local tvel = tgtobj:get_velocity()
+ local tyaw = tgtobj:get_yaw()
+
+ mobkit.hq_aqua_turn(self,prty+1,tyaw,tvel)
+ mobkit.make_sound(self,'call')
+ return true
+ end
+
+ end
+ mobkit.queue_high(self,func,prty)
+ end
+
+
+
+
+
+
+
+function animals.flock(self, prty, min_dist, aqua_speed)
+
+ for _, fr in ipairs(self.friends) do
+
+ --local friend = mobkit.get_closest_entity(self, fr)
+ local friend =mobkit.get_nearby_entity(self, fr)
+
+ if friend then
+ --get distance, if too far away go to them
+ if aqua_speed then
+ mobkit.animate(self,'walk')
+ mobkit.make_sound(self,'call')
+ animals.hq_flock_water(self, prty, friend, min_dist, aqua_speed)
+ else
+ mobkit.animate(self,'walk')
+ mobkit.make_sound(self,'call')
+ animals.hq_flock(self, prty, friend, min_dist)
+ end
+ return
+ end
+ end
+
+end
+
+----------------------------------------------------------------
+--mate
+--go after them, if close enough do the deed
+function animals.hq_mate(self,prty,tgtobj)
+ local timer = time() + 10
+
+ local func = function(self)
+ if time() > timer then
+ return true
+ end
+
+ if not mobkit.is_alive(tgtobj) then return true end
+
+ if mobkit.is_queue_empty_low(self) then
+ local pos = mobkit.get_stand_pos(self)
+ local tpos = mobkit.get_stand_pos(tgtobj)
+ local dist = vector.distance(pos,tpos)
+ if dist <= self.attack.range then
+ mobkit.lq_idle(self,1)
+ mobkit.make_sound(self,'mating')
+ if self.sex == "male" then
+ --get the other one pregnant
+ mobkit.remember(tgtobj,'pregnant',true)
+ else
+ --get pregnant
+ mobkit.remember(self,'pregnant',true)
+ end
+ return true
+ else
+ mobkit.make_sound(self,'call')
+ mobkit.goto_next_waypoint(self,tpos)
+ end
+ end
+ end
+
+ mobkit.queue_high(self,func,prty)
+end
+
+--assess potential mate
+function animals.mate_assess(self, name)
+ local mate = mobkit.get_nearby_entity(self, name)
+ if mate then
+ --see if they are in the mood
+ local ent = mate:get_luaentity()
+ local sexy = mobkit.recall(ent,'sexual') or false
+ local preg = mobkit.recall(ent,'pregnant') or false
+ if sexy == true and preg == false then
+ return ent
+ else
+ return false
+ end
+ else
+ return false
+ end
+
+end
+
+function animals.get_entities_inside_radius(creature,pos,radius,match_string)
+ if (type(radius) ~= "number") then
+ radius = 30
+ end
+ -- will use string.match if true
+ if (type(match_string) ~= "boolean") then
+ match_string = true
+ end
+ -- if provided creature is an entity or objectref
+ if (type(creature) == "userdata") then
+ if (type(creature["get_luaentity"]) == "function") then
+ creature = creature:get_luaentity()
+ end
+ if (type(creature) ~= "nil" and type(creature) ~= "boolean" and type(creature) ~= "string") then
+ creature = creature["name"]
+ else
+ creature = ""
+ end
+ end
+
+ if (type(creature) ~= "string") then
+ creature = "*"
+ end
+ if (type(pos) ~= "table") then
+ return
+ end
+ if (type(pos.x) ~= "number" or type(pos.y) ~= "number" or type(pos.z) ~= "number") then
+ minetest.log("warning","animals.get_entities_inside_radius: provided position is invalid")
+ return
+ end
+
+ local objs = minetest.get_objects_inside_radius(pos,radius)
+ local aobjs = {}
+
+ for _,v in pairs(objs) do
+ local name = ""
+ local obj
+ if (type(v) ~= "nil") then
+ obj = v:get_luaentity()
+ end
+ if (type(obj) ~= "nil") then
+ name = obj.name
+ end
+ if (type(name) == "string") then
+ -- if match_string is true, then will use string.match()
+ if (name == creature or creature == "*" or (match_string == true and string.match(creature,name))) then
+ aobjs[#aobjs + 1] = v
+ end
+ end
+ end
+
+ return aobjs
+end
+
+
+
+-- Animals Interactors Interactions
+animals.interactors = {}
+function animals.add_interactors(itype,creature,...) -- interactiontype, creature to be set with properties, all possible creatures to add
+ -- adds the minetest luaentity names of creatures to a certain interaction type provided by a specified creature
+ -- for example, animals.add_interactor("rivals","pegasun","animals:pegasun") would add the entity "animals:pegasun" to the rivals of "pegasun"
+ -- lowercase strings for easier finding and indexing
+ if (type(itype) ~= "string") then
+ return
+ else
+ itype = string.lower(itype)
+ end
+
+ if (type(creature) ~= "string") then
+ return
+ else
+ creature = string.lower(creature)
+ end
+
+ local posscreatures = {...} -- convert specified creatures into an easily accessible table (the ... for multiple args)
+
+ local interactable = animals.interactors[creature] -- finds the creature's table provided within animals.interactors
+ if (type(interactable) ~= "table") then -- creates new one if not found
+ animals.interactors[creature] = {}
+
+ interactable = animals.interactors[creature]
+ end
+
+ local itable = animals.interactors[creature][itype] -- finds the specified interactiontype table within creature's table
+ if (type(itable) ~= "table") then -- create new table with the interactiontype if it isn't specified
+ animals.interactors[creature][itype] = {}
+
+ itable = animals.interactors[creature][itype]
+ end
+
+ for _,interactor in pairs(posscreatures) do
+ if (type(interactor) == "string") then
+ -- add said creature as an "interactor" within the provided interactiontype (if specified creature is an entity name)
+ itable[#itable + 1] = interactor
+ end
+ end
+
+ return true
+end
+
+function animals.get_interactors(creature,itype) -- creature to get stats from, interationtype
+ -- get a table of the creatures that interact with the specified creature in the specified interactiontype way
+ if (type(itype) ~= "string") then
+ return {}
+ else
+ itype = string.lower(itype)
+ end
+
+ if (type(creature) ~= "string") then
+ return {}
+ else
+ creature = string.lower(creature)
+ end
+ -- get the creature's interactors table
+ local interactable = animals.interactors[creature]
+ if (type(interactable) ~= "table") then
+ return {}
+ end
+ -- get who the creature interacts in what specified way
+ local itable = interactable[itype]
+ if (type(itable) ~= "table") then
+ return {}
+ end
+ -- return an empty table or the specified table of interaction type
+ return itable
+end
+
+-------- Mobkit function rewrites
+
+-- makes it so animals do not see or interact with the player (if the animals use this instead of mobkit's) if player is in creative
+
+function animals.get_nearby_player(self,forceplyr)
+ -- "forceplyr" bool parameter to force a player despite creative mode
+ local plyr = mobkit.get_nearby_player(self) -- get player from mobkit
+ if (plyr) then
+ -- if player, then check if player is NOT in creative...
+ if (not minimal.player_in_creative(plyr) or forceplyr == true) then
+ return plyr
+ end
+ end
+end
+
+-- Taken directly from mobkit to properly calculate fall damage
+function animals.vitals(self)
+ -- vitals: fall damage
+ local vel = self.object:get_velocity()
+ local velocity_delta = abs(self.lastvelocity.y - vel.y)
+
+ if (velocity_delta > mobkit.safe_velocity) then
+ -- let's see if there's a node with fall_damage_add_percent first
+ local node = mobkit.nodeatpos(mobkit.pos_shift(self.object:get_pos(),{y = -1}))
+
+ if (type(node) == "table") then
+ local multiplier = node.groups.fall_damage_add_percent -- used for fall damage calculation
+ if (type(multiplier) == "number") then
+ -- convert multiplier into a usable decimal
+ multiplier = multiplier/100
+ if (multiplier <= 0) then
+ -- if it's negative, make positive, and subtract it by 1 to get the result of which velocity should be of itself (-70 = 0.3)
+ multiplier = -multiplier
+ multiplier = 1 - multiplier
+ else
+ multiplier = 1 + multiplier
+ end
+
+ velocity_delta = floor(velocity_delta * multiplier)
+ end
+
+ if (node.drawtype == "airlike") then
+ -- this ouchy code got initiated in air
+ -- sometimes this happens when trampolining and it will hurt the mob by a lot...
+ -- so let's pretend they landed on something soft and multiply the velocity_delta by 0.5 :D (because this'll also activate when mobs land on other mobs or players)
+ velocity_delta = velocity_delta * 0.5
+ end
+ end
+ end
+
+ if velocity_delta > mobkit.safe_velocity then
+ -- alright, time to do some damage if it's still over safe_velocity
+ local damage = floor(self.max_hp * min(1, velocity_delta/mobkit.terminal_velocity))
+
+ self.hp = self.hp - damage
+ end
+
+ -- vitals: oxygen
+ if self.lung_capacity then
+ local colbox = self.object:get_properties().collisionbox
+ local headnode = mobkit.nodeatpos(mobkit.pos_shift(self.object:get_pos(),{y=colbox[5]})) -- node at hitbox top
+ if headnode and headnode.drawtype == 'liquid' then
+ self.oxygen = self.oxygen - self.dtime
+ else
+ self.oxygen = math_clamp(self.oxygen + (self.dtime * 2),0,self.lung_capacity)
+ end
+
+ if self.oxygen <= 0 then mobkit.hurt(self,self.max_hp*0.1) end -- drown by 10% of max_hp
+ end
+end
diff --git a/games/globo/mods/animals/api_capture.lua b/games/globo/mods/animals/api_capture.lua
new file mode 100644
index 000000000..00730413c
--- /dev/null
+++ b/games/globo/mods/animals/api_capture.lua
@@ -0,0 +1,142 @@
+--
+-- Register Egg
+--for capturing and respawing unique animals
+--
+
+local create_mob = function(placer, itemstack, name, pos)
+ local meta = itemstack:get_meta()
+ local meta_table = meta:to_table()
+ local memory
+ if meta_table.fields.memory then
+ memory=minetest.deserialize(meta_table.fields.memory)
+
+ end
+ local sdata = minetest.serialize(meta_table)
+ local mob = minetest.add_entity(pos, name, sdata)
+
+ local ent = mob:get_luaentity()
+ if memory then
+ for key,value in pairs(memory) do
+ mobkit.remember(ent,key,value)
+ end
+ end
+ -- if player isn't in creative
+ if not (minimal.player_in_creative(placer)) then
+ itemstack:take_item() -- since mob is unique we remove egg once spawned
+ end
+ return ent
+end
+
+
+
+local pos_to_spawn = function(name, pos)
+ local x = pos.x
+ local y = pos.y
+ local z = pos.z
+ if minetest.registered_entities[name] and minetest.registered_entities[name].visual_size.x then
+ if minetest.registered_entities[name].visual_size.x >= 32 and
+ minetest.registered_entities[name].visual_size.x <= 48 then
+ y = y + 2
+ elseif minetest.registered_entities[name].visual_size.x > 48 then
+ y = y + 5
+ else
+ y = y + 1
+ end
+ end
+ local spawn_pos = { x = x, y = y, z = z}
+ return spawn_pos
+end
+
+
+--use stunning weapon plus chance to catch
+animals.stun_catch_mob = function(self, clicker,chance, canhand)
+ if self.hp <= 0 then return end
+ local item = clicker:get_wielded_item()
+ local item_name = item:get_name()
+ item = minetest.get_item_group(item_name,"club")
+
+ if (item ~=0 or (canhand == true and item_name == "")) then
+ --hit
+ mobkit.make_sound(self,'punch')
+ --catch chance
+ if math.random() < chance then
+ mobkit.make_sound(self,'punch')
+ animals.capture(self, clicker)
+ end
+ end
+end
+
+
+
+
+
+animals.register_egg = function(name, desc, inv_img, stack, energy)
+ local grp = {spawn_egg = 1}
+ minetest.register_craftitem(name, { -- register new spawn egg containing mob information
+ description = desc,
+ inventory_image = inv_img,
+ --groups = {},
+ stack_max = stack,
+ on_place = function(itemstack, placer, pointed_thing)
+ local spawn_pos = pointed_thing.above
+ -- am I clicking on something with existing on_rightclick function?
+ local under = minetest.get_node(pointed_thing.under)
+ local def = minetest.registered_nodes[under.name]
+ if def and def.on_rightclick then
+ return def.on_rightclick(pointed_thing.under, under, placer, itemstack)
+ end
+ if spawn_pos and not minetest.is_protected(spawn_pos, placer:get_player_name()) then
+ if not minetest.registered_entities[name] then
+ return
+ end
+ spawn_pos = pos_to_spawn(name, spawn_pos)
+ local ent = create_mob(placer, itemstack, name, spawn_pos)
+ --set energy value
+ if not mobkit.recall(ent,'energy') then
+ --# of seconds it will survive without food
+ mobkit.remember(ent,'energy',energy)
+ end
+ end
+ return itemstack
+ end,
+ })
+end
+
+
+
+
+
+animals.capture = function(self, clicker)
+ local new_stack = ItemStack(self.name) -- add special mob egg with all mob information
+ local stack_meta = new_stack:get_meta()
+ --local sett ="---TABLE---: "
+ --local sett = ""
+ --local i = 0
+ for key, value in pairs(self) do
+ local what_type = type(value)
+ if what_type ~= "function"
+ and what_type ~= "nil"
+ and what_type ~= "userdata"
+ then
+ if what_type == "boolean" or what_type == "number" then
+ value = tostring(value)
+ end
+ if key == 'memory' then
+ value = minetest.serialize(value)
+ end
+ stack_meta:set_string(key, value)
+ end
+ end
+
+
+ local inv = clicker:get_inventory()
+ local pname = clicker:get_player_name()
+ if inv:room_for_item("main", new_stack) then
+ inv:add_item("main", new_stack)
+ else
+ minetest.add_item(clicker:get_pos(), new_stack)
+ end
+
+ self.object:remove()
+ return stack_meta
+end
diff --git a/games/globo/mods/animals/crafts.lua b/games/globo/mods/animals/crafts.lua
new file mode 100644
index 000000000..36b581baf
--- /dev/null
+++ b/games/globo/mods/animals/crafts.lua
@@ -0,0 +1,165 @@
+--------------------------------------------------------------------------
+--CRAFTS
+--------------------------------------------------------------------------
+--[[
+Carcasses:
+Invertebrate,
+Fish,
+Bird,
+(Mammal, Lizard)
+
+
+Sizes:
+small, large
+
+--
+leather, Bone, skin, sinews, feathers?
+]]
+
+-- Internationalization
+local S = animals.S
+
+local random = math.random
+local floor = math.floor
+--------------------------------------------------------------------------
+--Carcasses
+-------------------------------------------
+local box_small_invert = {
+ {-0.125, -0.5, -0.1875, 0.125, -0.4375, 0.1875}, -- NodeBox1
+ {-0.0625, -0.4375, -0.1875, 0.0625, -0.375, 0.1875}, -- NodeBox2
+ {-0.0625, -0.5, -0.25, 0.0625, -0.4375, -0.1875}, -- NodeBox3
+ {-0.0625, -0.5, 0.1875, 0.0625, -0.4375, 0.25}, -- NodeBox4
+}
+
+local box_large_invert ={
+ {-0.1875, -0.5, -0.25, 0.1875, -0.375, 0.25}, -- NodeBox1
+ {-0.125, -0.375, -0.25, 0.125, -0.3125, 0.25}, -- NodeBox2
+ {-0.0625, -0.5, -0.375, 0.0625, -0.375, -0.25}, -- NodeBox3
+ {-0.0625, -0.5, 0.25, 0.0625, -0.375, 0.375}, -- NodeBox4
+}
+
+local box_small_bird = {
+ {-0.125, -0.5, -0.1875, 0.125, -0.375, 0.125}, -- NodeBox1
+ {-0.0625, -0.375, -0.1875, 0.0625, -0.3125, 0.0625}, -- NodeBox2
+ {-0.0625, -0.5, -0.3125, 0.0625, -0.375, -0.1875}, -- NodeBox3
+ {-0.0625, -0.5, 0.125, 0.0625, -0.4375, 0.25}, -- NodeBox4
+ {0.125, -0.5, -0.125, 0.3125, -0.4375, 0}, -- NodeBox5
+ {-0.3125, -0.5, -0.125, -0.125, -0.4375, 0}, -- NodeBox6
+ {0.125, -0.5, 0.0625, 0.1875, -0.4375, 0.25}, -- NodeBox7
+ {-0.1875, -0.5, 0.0625, -0.125, -0.4375, 0.25}, -- NodeBox8
+}
+
+local box_small_fish = {
+ {-0.125, -0.5, -0.1875, 0.125, -0.4375, 0.1875}, -- NodeBox1
+ {-0.0625, -0.4375, -0.1875, 0.0625, -0.375, 0.1875}, -- NodeBox2
+ {-0.0625, -0.5, -0.3125, 0.0625, -0.4375, -0.1875}, -- NodeBox3
+ {-0.0625, -0.5, 0.1875, 0.0625, -0.4375, 0.375}, -- NodeBox4
+ {0.125, -0.5, -0.125, 0.1875, -0.4375, 0.125}, -- NodeBox9
+ {-0.1875, -0.5, -0.125, -0.125, -0.4375, 0.125}, -- NodeBox10
+}
+
+local box_large_fish = {
+ {-0.25, -0.5, -0.3125, 0.25, -0.375, 0.3125}, -- NodeBox1
+ {-0.125, -0.375, -0.3125, 0.125, -0.3125, 0.25}, -- NodeBox2
+ {-0.125, -0.5, -0.4375, 0.125, -0.375, -0.3125}, -- NodeBox3
+ {-0.125, -0.5, 0.3125, 0.125, -0.375, 0.4375}, -- NodeBox4
+ {0.25, -0.5, 0, 0.375, -0.4375, 0.25}, -- NodeBox9
+ {-0.375, -0.5, 0, -0.25, -0.4375, 0.25}, -- NodeBox10
+ {-0.0625, -0.3125, -0.1875, 0.0625, -0.25, 0}, -- NodeBox11
+}
+
+local list = {
+ {
+ "invert_small",
+ S("Small Invertebrate"),
+ box_small_invert,
+ minimal.stack_max_medium,
+ 80,
+ },
+ {
+ "invert_large",
+ S("Large Invertebrate"),
+ box_large_invert,
+ minimal.stack_max_medium/4,
+ 70,
+ },
+ {
+ "bird_small",
+ S("Small Bird"),
+ box_small_bird,
+ minimal.stack_max_medium/4,
+ 70,
+ },
+ {
+ "fish_small",
+ S("Small Fish"),
+ box_small_fish,
+ minimal.stack_max_medium/4,
+ 70,
+ },
+ {
+ "fish_large",
+ S("Large Fish"),
+ box_large_fish,
+ minimal.stack_max_bulky,
+ 65,
+ },
+}
+
+
+for i in ipairs(list) do
+ local name = list[i][1]
+ local desc = list[i][2]
+ local box = list[i][3]
+ local stack = list[i][4]
+ local heat = list[i][5]
+
+ --raw
+ minetest.register_node("animals:carcass_"..name, {
+ description = S('@1 Carcass', desc),
+ tiles = {"animals_carcass.png"},
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = box
+ },
+ stack_max = stack/2,
+ groups = {snappy = 3, dig_immediate = 3, falling_node = 1, temp_pass = 1, heatable = heat},
+ sounds = nodes_nature.node_sound_defaults(),
+ })
+
+ --cooked
+ minetest.register_node("animals:carcass_"..name.. "_cooked", {
+ description = S('Cooked @1', desc),
+ tiles = {"nodes_nature_silt.png"},
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = box
+ },
+ stack_max = stack,
+ groups = {snappy = 3, dig_immediate = 3, falling_node = 1, temp_pass = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ })
+
+--burned
+ minetest.register_node("animals:carcass_"..name.. "_burned", {
+ description = S('Burned @1', desc),
+ tiles = {"animals_carcass_burned.png"},
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = box
+ },
+ stack_max = stack,
+ groups = {snappy = 3, dig_immediate = 3, falling_node = 1, temp_pass = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ })
+
+ exile_add_food_hooks("animals:carcass_"..name)
+ exile_add_food_hooks("animals:carcass_"..name.. "_cooked")
+ exile_add_food_hooks("animals:carcass_"..name.. "_burned")
+end
diff --git a/games/globo/mods/animals/darkasthaan.lua b/games/globo/mods/animals/darkasthaan.lua
new file mode 100644
index 000000000..3b1429f89
--- /dev/null
+++ b/games/globo/mods/animals/darkasthaan.lua
@@ -0,0 +1,245 @@
+----------------------------------------------------------------------
+-- Darkasthaan
+
+--[[
+a big spider for deep caves
+much same as kubwakubwa, but more dangerous
+]]
+---------------------------------------------------------------------
+
+-- Internationalization
+local S = animals.S
+
+local random = math.random
+local floor = math.floor
+
+--energy
+local energy_max = 12000--secs it can survive without food
+local energy_egg = energy_max/3 --energy that goes to egg
+local hb_min = 1000 -- hibernate minimum requirement
+local egg_timer = 60*40
+local young_per_egg = 3 --will get this/energy_egg starting energy
+
+local lifespan = energy_max * 7
+
+
+
+-----------------------------------
+local function brain(self)
+
+ --die from damage
+ if not animals.core_hp(self) then
+ return
+ end
+
+ if mobkit.timer(self,1) then
+
+ local pos = mobkit.get_stand_pos(self)
+
+ local age, energy, hbnate = animals.core_life(self, lifespan, pos)
+ --die from exhaustion or age
+ if not age then
+ return
+ end
+
+ ------------------
+ --Emergency actions
+
+ --swim to shore
+ if self.isinliquid then
+ mobkit.hq_liquid_recovery(self,60)
+ end
+
+ local prty = mobkit.get_queue_priority(self)
+ -------------------
+ --High priority actions
+ if prty < 50 then
+
+
+ --Threats
+ local plyr = mobkit.get_nearby_player(self)
+ if plyr then
+ prty = 55
+ animals.fight_or_flight_plyr(self, plyr, prty, 0.75)
+ hbnate = false -- not hibernating anymore
+ end
+
+ --currently has none
+ --animals.predator_avoid(self, 55, 0.75)
+ end
+
+
+ ----------------------
+ --Low priority actions
+
+ if prty < 20 and hbnate ~= true then
+
+ --territorial behaviour
+ local rival = animals.territorial(self, energy, true)
+
+
+ --feeding
+ --hunt prey
+ if energy < energy_max then
+ if not animals.prey_hunt(self, 25) then
+ --random search for darkness
+ animals.hq_roam_dark(self,15)
+
+ if (energy <= hb_min) then
+ hbnate = true
+ end
+ end
+ end
+
+ --reproduction
+ --asexual parthogenesis, eggs
+ --when in prime condition
+ if random() < 0.01
+ and not rival
+ and self.hp >= self.max_hp
+ and energy >= energy_egg*2 then
+ energy = animals.place_egg(pos, "animals:darkasthaan_eggs", energy, energy_egg, 'air')
+ end
+ elseif (hbnate == true) then
+ if animals.prey_hunt(self,40) then -- if found food then get outta hibernation
+ hbnate = false
+ end
+ end
+
+ -------------------
+ --generic behaviour
+ if mobkit.is_queue_empty_high(self) and hbnate ~= true then
+ mobkit.animate(self,'walk')
+ animals.hq_roam_dark(self,10,1)
+ end
+
+ -----------------
+ --housekeeping
+ --save energy, age
+ mobkit.remember(self,'energy',energy)
+ mobkit.remember(self,'age',age)
+ mobkit.remember(self,'hibernate',hbnate) -- to prevent energy loss with no prey around
+
+ end
+end
+
+
+
+
+
+
+---------------
+-- the CREATURE
+---------------
+
+--eggs
+minetest.register_node("animals:darkasthaan_eggs", {
+ description = S('Darkasthaan Eggs'),
+ tiles = {"animals_gundu_eggs.png"},
+ stack_max = minimal.stack_max_medium,
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {-0.125, -0.5, -0.125, 0.125, -0.375, 0.125},
+ },
+ groups = {snappy = 3, falling_node = 1, dig_immediate = 3, flammable = 1, temp_pass = 1, edible = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(egg_timer,egg_timer*2))
+ end,
+ on_timer =function(pos, elapsed)
+ return animals.hatch_egg(pos, 'air', 'air', "animals:darkasthaan", energy_egg, young_per_egg)
+ end,
+})
+
+
+
+
+
+
+----------------------------------------------
+
+--The Animal
+minetest.register_entity("animals:darkasthaan",{
+ --core
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {-0.3, -0.3, -0.3, 0.3, 0, 0.3},
+ visual = "mesh",
+ mesh = "animals_darkasthaan.b3d",
+ textures = {"animals_darkasthaan.png"},
+ visual_size = {x = 0.6, y = 0.6},
+ makes_footstep_sound = true,
+ timeout = 0,
+
+
+ --damage
+ max_hp = 200,
+ lung_capacity = 40,
+ min_temp = 10,
+ max_temp = 50,
+
+ --interaction
+ --predators = {"animals:darkasthaan"},
+ rivals = {"animals:darkasthaan"},
+ prey = {"animals:impethu", "animals:kubwakubwa", "animals:pegasun", "animals:sneachan"},
+
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = brain,
+ -- optional mobkit props
+ -- or used by built in behaviors
+ --physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ walk={range={x=1,y=21},speed=15,loop=true},
+ fast={range={x=1,y=21},speed=35,loop=true},
+ stand={range={x=25,y=45},speed=5,loop=true},
+ },
+ sounds = {
+ warn = {
+ name = "animals_darkasthaan_warn",
+ gain={0.3, 0.7},
+ fade={0.5, 1.5},
+ pitch={0.4, 1.4},
+ },
+ punch = {
+ name = "animals_punch",
+ gain={0.7, 1.3},
+ fade={0.5, 1.5},
+ pitch={0.7, 1.3},
+ },
+ },
+
+ --movement
+ springiness=0,
+ buoyancy = 1.01,
+ max_speed = 1, -- m/s
+ jump_height = 2, -- nodes/meters
+ view_range = 6, -- nodes/meters
+
+ --attack
+ attack={range=0.8, damage_groups={fleshy=12}},
+ armor_groups = {fleshy=100},
+
+ --on actions
+ drops = {
+ {name = "animals:carcass_invert_large", chance = 1, min = 1, max = 1,},
+ },
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ animals.on_punch(self, tool_capabilities, puncher, 55, 0.85)
+ end,
+ on_rightclick = function(self, clicker)
+ if not clicker or not clicker:is_player() then
+ return
+ end
+ animals.stun_catch_mob(self, clicker, 0.02)
+ end,
+})
+
+
+
+
+--spawn egg (i.e. live animal in inventory)
+animals.register_egg("animals:darkasthaan", S("Live Darkasthaan"), "animals_darkasthaan_item.png", minimal.stack_max_medium, energy_egg)
diff --git a/games/globo/mods/animals/gundu.lua b/games/globo/mods/animals/gundu.lua
new file mode 100644
index 000000000..0efc8f7fb
--- /dev/null
+++ b/games/globo/mods/animals/gundu.lua
@@ -0,0 +1,311 @@
+----------------------------------------------------------------------
+-- Gundu
+--a small fish
+--[[
+filter feeds in sunlit waters
+]]
+---------------------------------------------------------------------
+
+-- Internationalization
+local S = animals.S
+
+local random = math.random
+local floor = math.floor
+
+--energy
+local energy_max = 8000--secs it can survive without food
+local energy_egg = energy_max/6 --energy that goes to egg
+local egg_timer = 60*45
+local young_per_egg = 5 --will get this/energy_egg starting energy
+
+local lifespan = energy_max * 6
+
+local function pos_is_liquid(pos)
+ local node=mobkit.nodeatpos(pos)
+ if node and node.drawtype ~= 'liquid' then
+ return false
+ else
+ return true
+ end
+end
+
+-----------------------------------
+local function brain(self)
+ -- Make sure the block in front is liquid.
+ local pos = mobkit.get_stand_pos(self)
+ local yaw = self.object:get_yaw()
+ local vel = self.object:get_velocity()
+
+ local fpos = mobkit.pos_translate2d(pos,yaw,1) --front position
+ local fu_pos = mobkit.pos_shift(fpos,{y=-1}) -- under front position
+ local u_pos = mobkit.pos_shift(pos,{y=-1}) -- under possition
+
+ if not pos_is_liquid(u_pos) or not pos_is_liquid(fu_pos) then
+ -- no water below risie up
+ vel.y = 0.2
+ self.object:set_velocity(vel)
+ end
+
+ if not pos_is_liquid(fpos) then
+ -- rise a little faster and turn
+ vel.y = vel.y+0.2
+ self.object:set_velocity(vel)
+ mobkit.clear_queue_high(self)
+ mobkit.hq_aqua_turn(self,68,yaw+2,2)
+ end
+
+
+ if mobkit.timer(self,1) then
+ -- die from damage - run before animals.core_life()
+ --
+ if not animals.core_hp_water(self) then
+ return
+ end
+ -- Also recharges health from energy
+ local age, energy = animals.core_life(self, lifespan, pos)
+
+ --die from exhaustion or age
+ if not age then
+ return
+ end
+
+
+ local prty = mobkit.get_queue_priority(self)
+ -------------------
+ --High priority actions
+ local pred = nil
+
+ if prty < 50 then
+ --Threats
+ local plyr = mobkit.get_nearby_player(self)
+ if plyr then
+ animals.fight_or_flight_plyr_water(self, plyr, 55, 0)
+ end
+
+ pred = animals.predator_avoid_water(self, 55, 0)
+
+ --Return to water
+ if not self.isinliquid then
+ mobkit.clear_queue_high(self)
+ animals.hq_swimfrompos(self,66,pos,1)
+ end
+ -- Temp out of range
+ local temp = climate.get_point_temp(pos, true)
+ if temp < self.min_temp or temp > self.max_temp then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y-0.2
+ self.object:set_velocity(vel)
+ mobkit.hq_aqua_roam(self,10,0.2)
+ end
+
+ end
+
+
+ ----------------------
+ --Low priority actions
+ if prty < 20 then
+
+ --social behaviour
+ local rival
+ if pred then
+ animals.flock(self, 21, 1, self.max_speed)
+ elseif random() <0.15 then
+ rival = animals.territorial_water(self, energy, false)
+ elseif random() <0.01 then
+ rival = animals.territorial_water(self, energy, true)
+ elseif random() <0.25 then
+ animals.flock(self, 15, 2, self.max_speed/2)
+ end
+
+ --feeding
+ --in bright light, when no threats
+ local light = minetest.get_node_light(pos) or 0
+ local lightm = minetest.get_node_light(pos, 0.5) or 0
+ if not pred and not rival then
+
+ if light >= 9 then
+ --much light much food
+ if energy < energy_max then
+ energy = energy + 5
+ end
+
+ elseif light >= 5 then
+ --some light
+ if energy < energy_max then
+ energy = energy + 2
+ end
+ end
+ end
+
+ --movement
+ local tod = minetest.get_timeofday()
+
+ if tod <0.06 or tod >0.94 then
+ --sink at night to lay eggs
+ local vel = self.object:get_velocity()
+ vel.y = vel.y-0.2
+ self.object:set_velocity(vel)
+ mobkit.hq_aqua_roam(self,10,0.2)
+
+ elseif light <= 9 then
+ --rise during day if not in best light
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+0.2
+ self.object:set_velocity(vel)
+ mobkit.hq_aqua_roam(self,10, random(1, self.max_speed))
+
+ else
+ --no special movement
+ mobkit.hq_aqua_roam(self,5, random(0.5, self.max_speed/2))
+
+ end
+
+
+ --reproduction
+ --asexual parthogenesis, eggs
+ --no threats, darkness, peak condition
+ if (random() < 0.02 or energy >= 9000)
+ and not rival
+ and not pred
+ and lightm <= 11
+ and ( tod <0.5 ) -- only lay at night
+ and self.hp >= self.max_hp
+ and energy >= energy_max - 100 then
+ energy = animals.place_egg(pos, "animals:gundu_eggs", energy, energy_egg, 'nodes_nature:salt_water_source')
+ end
+
+ end
+
+ -------------------
+ --generic behaviour
+ if mobkit.is_queue_empty_high(self) then
+ mobkit.animate(self,'def')
+ mobkit.hq_aqua_roam(self,10,1)
+ end
+
+
+ -----------------
+ --housekeeping
+ --save energy, age
+ mobkit.remember(self,'energy',energy)
+ mobkit.remember(self,'age',age)
+
+ end
+end
+
+
+
+
+
+
+---------------
+-- the CREATURE
+---------------
+
+--eggs
+minetest.register_node("animals:gundu_eggs", {
+ description = S('Gundu Eggs'),
+ tiles = {"animals_gundu_eggs.png"},
+ stack_max = minimal.stack_max_bulky,
+ groups = {snappy = 3, edible = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(egg_timer,egg_timer*2))
+ end,
+ on_timer =function(pos, elapsed)
+ return animals.hatch_egg(pos, 'nodes_nature:salt_water_source', 'nodes_nature:salt_water_flowing', "animals:gundu", energy_egg, young_per_egg)
+ end,
+})
+
+
+
+
+----------------------------------------------
+
+--The Animal
+minetest.register_entity("animals:gundu",{
+ --core
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
+ visual = "mesh",
+ mesh = "animals_gundu.b3d",
+ textures = {"animals_gundu.png"},
+ visual_size = {x = 5, y = 5},
+ makes_footstep_sound = false,
+ timeout = 0,
+
+ --damage
+ max_hp = 40,
+ lung_capacity = 20,
+ min_temp = -2,
+ max_temp = 35,
+
+ --interaction
+ predators = {"animals:sarkamos"},
+ rivals = {"animals:gundu"},
+ friends = {"animals:gundu"},
+ --prey = {"animals:impethu"},
+
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = brain,
+ -- optional mobkit props
+ -- or used by built in behaviors
+ --physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ def={range={x=1,y=35},speed=30,loop=true},
+ fast={range={x=1,y=35},speed=60,loop=true},
+ stand={range={x=36,y=75},speed=20,loop=true},
+ },
+ sounds = {
+ flee = {
+ name = "animals_water_swish",
+ gain={0.5, 1.5},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ call = {
+ name = "animals_gundu_call",
+ gain={0.05, 0.15},
+ fade={0.5, 1.5},
+ pitch={0.6, 1.2},
+ },
+ punch = {
+ name = "animals_punch",
+ gain={0.5, 1},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ },
+
+ --movement
+ springiness=0.5,
+ buoyancy = 1,
+ max_speed = 5, -- m/s
+ jump_height = 1.5, -- nodes/meters
+ view_range = 5, -- nodes/meters
+
+ --attack
+ attack={range=0.3, damage_groups={fleshy=1}},
+ armor_groups = {fleshy=100},
+
+ --on actions
+ drops = {
+ {name = "animals:carcass_fish_small", chance = 1, min = 1, max = 1,},
+ },
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ animals.on_punch_water(self, tool_capabilities, puncher, 56, 0)
+ end,
+ on_rightclick = function(self, clicker)
+ if not clicker or not clicker:is_player() then
+ return
+ end
+ animals.stun_catch_mob(self, clicker, 0.1)
+ end,
+})
+
+
+--spawn egg (i.e. live animal in inventory)
+animals.register_egg("animals:gundu", S("Live Gundu"), "animals_gundu_item.png", minimal.stack_max_medium/2, energy_egg)
diff --git a/games/globo/mods/animals/impethu.lua b/games/globo/mods/animals/impethu.lua
new file mode 100644
index 000000000..4bd13cff2
--- /dev/null
+++ b/games/globo/mods/animals/impethu.lua
@@ -0,0 +1,258 @@
+----------------------------------------------------------------------
+-- Impethu
+--cave worm.
+--[[
+Bottom of shallow cave food chain
+]]
+---------------------------------------------------------------------
+
+-- Internationalization
+local S = animals.S
+
+local random = math.random
+local floor = math.floor
+
+--energy
+local energy_max = 5000--secs it can survive without food
+local energy_egg = energy_max/10 --energy that goes to egg
+local egg_timer = 120*5
+local young_per_egg = 5 --will get this/energy_egg starting energy
+
+local lifespan = energy_max * 4
+
+
+
+-----------------------------------
+local function brain(self)
+
+ --die from damage
+ if not animals.core_hp(self) then
+ return
+ end
+
+ if mobkit.timer(self,1.5) then
+
+ local pos = mobkit.get_stand_pos(self)
+
+ local age, energy = animals.core_life(self, lifespan, pos)
+ --die from exhaustion or age
+ if not age then
+ return
+ end
+
+ ------------------
+ --Emergency actions
+
+ --swim to shore
+ if self.isinliquid then
+ mobkit.hq_liquid_recovery(self,60)
+ end
+
+
+ local prty = mobkit.get_queue_priority(self)
+ -------------------
+ --High priority actions
+ local pred
+
+ if prty < 50 then
+
+
+ --Threats
+ local plyr = mobkit.get_nearby_player(self)
+ if plyr then
+ animals.fight_or_flight_plyr(self, plyr, 55, 0.02)
+ end
+
+ pred = animals.predator_avoid(self, 55, 0.02)
+
+ end
+
+
+ ----------------------
+ --Low priority actions
+
+ if prty < 20 then
+
+ --territorial behaviour
+ local rival
+ if random() < 0.7 then
+ rival = animals.territorial(self, energy, false)
+ else
+ rival = animals.territorial(self, energy, true)
+ end
+
+
+ --feeding
+ --eat stuff in the dark
+ local light = (minetest.get_node_light(pos) or 0)
+
+ if light <= 5 then
+ if not rival and energy < energy_max then
+ energy = energy + 2
+ end
+ mobkit.animate(self,'walk')
+ mobkit.hq_roam(self,10)
+ else
+ --random search for darkness
+ --fatigued by light
+ energy = energy - 1
+ animals.hq_roam_dark(self,15)
+ end
+
+
+ --reproduction
+ --asexual parthogenesis, eggs
+ if random() < 0.005 then
+ if not rival
+ and energy >= energy_max then
+ energy = animals.place_egg(pos, "animals:impethu_eggs", energy, energy_egg, 'air')
+ end
+ end
+
+ end
+
+ -------------------
+ --generic behaviour
+ if mobkit.is_queue_empty_high(self) then
+ mobkit.animate(self,'walk')
+ animals.hq_roam_dark(self,10,1)
+ end
+
+ -----------------
+ --housekeeping
+ --save energy, age
+ mobkit.remember(self,'energy',energy)
+ mobkit.remember(self,'age',age)
+
+ end
+end
+
+
+
+
+
+
+---------------
+-- the CREATURE
+---------------
+
+--eggs
+minetest.register_node("animals:impethu_eggs", {
+ description = S('Impethu Eggs'),
+ tiles = {"animals_gundu_eggs.png"},
+ stack_max = minimal.stack_max_medium,
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {-0.08, -0.5, -0.08, 0.08, -0.4375, 0.08},
+ },
+ groups = {snappy = 3, falling_node = 1, dig_immediate = 3, flammable = 1, temp_pass = 1, edible = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(egg_timer,egg_timer*2))
+ end,
+ on_timer =function(pos, elapsed)
+ local light = (minetest.get_node_light(pos) or 0)
+ if light <= 5 then
+ return animals.hatch_egg(pos, 'air', 'air', "animals:impethu", energy_egg, young_per_egg)
+ else
+ return true
+ end
+ end,
+})
+
+
+
+
+
+
+
+----------------------------------------------
+
+--The Animal
+minetest.register_entity("animals:impethu",{
+ --core
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {-0.09, -0.25, -0.09, 0.09, -0.1, 0.09},
+ visual = "mesh",
+ mesh = "animals_impethu.b3d",
+ textures = {"animals_impethu.png"},
+ visual_size = {x = 5, y = 5},
+ makes_footstep_sound = false,
+ timeout = 0,
+
+ _VH1_barheight = 1,
+ -- animal stats
+ max_hp = 3,
+ lung_capacity = 10,
+ min_temp = -15,
+ max_temp = 50,
+
+ --interaction
+ predators = {"animals:kubwakubwa", "animals:darkasthaan", "animals:pegasun"},
+ rivals = {"animals:impethu", "animals:sneachan"},
+
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = brain,
+ -- optional mobkit props
+ -- or used by built in behaviors
+ --physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ walk={range={x=0, y=12}, speed=10, loop=true},
+ fast={range={x=0, y=12}, speed=10, loop=true},
+ stand={
+ {range={x=12, y=24}, speed=5, loop=true},
+ {range={x=24, y=31}, speed=5, loop=true},
+ },
+ },
+ sounds = {
+ warn = {
+ name = "animals_impethu_warn",
+ gain={0.1, 0.4},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ punch = {
+ name = "animals_punch",
+ gain={0.5, 1.5},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ },
+
+ --movement
+ springiness=0,
+ buoyancy = 1.01,
+ max_speed = 0.5, -- m/s
+ jump_height = 1, -- nodes/meters
+ view_range = 2, -- nodes/meters
+
+ --attack
+ attack={range=0.3, damage_groups={fleshy=1}},
+ armor_groups = {fleshy=100},
+
+ --on actions
+ drops = {
+ {name = "animals:carcass_invert_small", chance = 1, min = 1, max = 1,},
+ },
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ animals.on_punch(self, tool_capabilities, puncher, 55, 0.05)
+ end,
+ on_rightclick = function(self, clicker)
+ if not clicker or not clicker:is_player() then
+ return
+ end
+ animals.stun_catch_mob(self, clicker, 0.75, true)
+ end,
+})
+
+
+
+
+
+--spawn egg (i.e. live animal in inventory)
+animals.register_egg("animals:impethu", S("Live Impethu"), "animals_impethu_item.png", minimal.stack_max_medium, energy_egg)
diff --git a/games/globo/mods/animals/init.lua b/games/globo/mods/animals/init.lua
new file mode 100644
index 000000000..6a31a61f2
--- /dev/null
+++ b/games/globo/mods/animals/init.lua
@@ -0,0 +1,55 @@
+animals = {}
+
+-- Internationalization
+animals.S = minetest.get_translator("animals")
+
+local path = minetest.get_modpath(minetest.get_current_modname())
+
+dofile(path.."/crafts.lua")
+dofile(path.."/api_capture.lua")
+dofile(path.."/api.lua")
+
+
+dofile(path.."/impethu.lua")
+dofile(path.."/kubwakubwa.lua")
+dofile(path.."/darkasthaan.lua")
+
+dofile(path.."/gundu.lua")
+dofile(path.."/sarkamos.lua")
+
+dofile(path.."/pegasun.lua")
+dofile(path.."/sneachan.lua")
+
+---
+--Food Web
+
+--[[
+The aim is for mobs to be permanent populations, rather than spawning "ex nihilo".
+Therefore most are small animals with small ranges. Have actual food webs that keep them alive.
+
+Ocean:
+"plankton (water)" -> gundu -> sarkamos
+
+
+Caves:
+"invisibly small stuff" -> impethu -> kubwakubwa/darkasthaan-> darkasthaan
+
+
+
+Land:
+plants/dirt/sneachan -> pegasun
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]]
diff --git a/games/globo/mods/animals/kubwakubwa.lua b/games/globo/mods/animals/kubwakubwa.lua
new file mode 100644
index 000000000..cdbb26f83
--- /dev/null
+++ b/games/globo/mods/animals/kubwakubwa.lua
@@ -0,0 +1,255 @@
+----------------------------------------------------------------------
+-- Kubwakubwa
+--a spider
+--[[
+Predator in shallow caves
+]]
+
+---------------------------------------------------------------------
+
+-- Internationalization
+local S = animals.S
+
+local random = math.random
+local floor = math.floor
+
+--energy
+local energy_max = 8000--secs it can survive without food
+local energy_egg = energy_max/2 --energy that goes to egg
+local hb_min = 1000 -- hibernate minimum requirement
+local egg_timer = 60*35
+local young_per_egg = 4 --will get this/energy_egg starting energy
+
+local lifespan = energy_max * 6
+
+
+
+-----------------------------------
+local function brain(self)
+
+ --die from damage
+ if not animals.core_hp(self) then
+ return
+ end
+
+ if mobkit.timer(self,1) then
+
+ local pos = mobkit.get_stand_pos(self)
+
+ local age, energy, hbnate = animals.core_life(self, lifespan, pos)
+ --die from exhaustion or age
+ if not age then
+ return
+ end
+
+ ------------------
+ --Emergency actions
+
+ --swim to shore
+ if self.isinliquid then
+ mobkit.hq_liquid_recovery(self,60)
+ end
+
+
+ local prty = mobkit.get_queue_priority(self)
+ -------------------
+ --High priority actions
+ if prty < 50 then
+
+ --Threats
+ local plyr = mobkit.get_nearby_player(self)
+ if plyr then
+ prty = 55
+ animals.fight_or_flight_plyr(self, plyr, prty, 0.15)
+ end
+
+ if (animals.predator_avoid(self, 55, 0.15) or plyr) then
+ prty = 55
+ hbnate = false -- on the move, no more hibernating
+ end
+
+ end
+
+
+ ----------------------
+ --Low priority actions
+
+ if prty < 20 and hbnate ~= true then
+
+ --territorial behaviour
+ local rival = animals.territorial(self, energy, true)
+
+
+ --feeding
+ --hunt prey
+ if energy < energy_max then
+ if not animals.prey_hunt(self, 25) then
+ --random search for darkness
+ animals.hq_roam_dark(self,15)
+
+ if (energy <= hb_min) then
+ hbnate = true
+ end
+ end
+ end
+
+ --reproduction
+ --asexual parthogenesis, eggs
+ --when in prime condition
+ if random() < 0.01
+ and not rival
+ and self.hp >= self.max_hp
+ and energy >= energy_egg + 100 then
+ energy = animals.place_egg(pos, "animals:kubwakubwa_eggs", energy, energy_egg, 'air')
+ end
+ elseif (hbnate == true) then
+ if (animals.prey_hunt(self,40)) then
+ hbnate = false -- found prey, get out of hibernation
+ end
+ end
+
+ -------------------
+ --generic behaviour
+ if mobkit.is_queue_empty_high(self) and hbnate ~= true then
+ mobkit.animate(self,'walk')
+ animals.hq_roam_dark(self,10,1)
+ end
+
+ -----------------
+ --housekeeping
+ --save energy, age
+ mobkit.remember(self,'energy',energy)
+ mobkit.remember(self,'age',age)
+ mobkit.remember(self,'hibernate',hbnate)
+
+ end
+end
+
+
+
+
+
+
+---------------
+-- the CREATURE
+---------------
+
+--eggs
+minetest.register_node("animals:kubwakubwa_eggs", {
+ description = S('Kubwakubwa Eggs'),
+ tiles = {"animals_gundu_eggs.png"},
+ stack_max = minimal.stack_max_medium,
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {-0.0625, -0.5, -0.0625, 0.0625, -0.375, 0.0625},
+ },
+ groups = {snappy = 3, falling_node = 1, dig_immediate = 3, flammable = 1, temp_pass = 1, edible = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(egg_timer,egg_timer*2))
+ end,
+ on_timer =function(pos, elapsed)
+ if minetest.get_node_light(pos, 0.5) >= 13 then
+ minetest.remove_node(pos)
+ else
+ return animals.hatch_egg(pos, 'air', 'air', "animals:kubwakubwa", energy_egg, young_per_egg)
+ end
+ end,
+})
+
+
+
+
+
+
+
+----------------------------------------------
+
+--The Animal
+minetest.register_entity("animals:kubwakubwa",{
+ --core
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {-0.14, -0.01, -0.14, 0.14, 0.27, 0.14},
+ visual = "mesh",
+ mesh = "animals_kubwakubwa.b3d",
+ textures = {"animals_kubwakubwa.png"},
+ visual_size = {x = 1, y = 1},
+ makes_footstep_sound = true,
+ timeout = 0,
+
+
+ --damage
+ max_hp = 80,
+ lung_capacity = 20,
+ min_temp = -15,
+ max_temp = 50,
+
+ --interaction
+ predators = animals.get_interactors("kubwakubwa","predators"),
+ rivals = animals.get_interactors("kubwakubwa","rivals"),
+ prey = animals.get_interactors("kubwakubwa","prey"),
+
+ -- is it land-borne (1), sea-borne (2), amphibious (3), or flying (4)?
+ class = 1,
+
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = brain,
+ -- optional mobkit props
+ -- or used by built in behaviors
+ --physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ walk={range={x=0,y=20},speed=20,loop=true},
+ fast={range={x=0,y=20},speed=50,loop=true},
+ stand={range={x=20,y=40},speed=10,loop=true},
+ },
+ sounds = {
+ warn = {
+ name = "animals_kubwakubwa_warn",
+ gain={0.4, 0.8},
+ fade={0.5, 1.5},
+ pitch={0.9, 1.1},
+ },
+ punch = {
+ name = "animals_punch",
+ gain={0.5, 1},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ },
+
+ --movement
+ springiness=0,
+ buoyancy = 1.01,
+ max_speed = 0.75, -- m/s
+ jump_height = 1.5, -- nodes/meters
+ view_range = 4, -- nodes/meters
+
+ --attack
+ attack={range=0.5, damage_groups={fleshy=4}},
+ armor_groups = {fleshy=100},
+
+ --on actions
+ drops = {
+ {name = "animals:carcass_invert_large", chance = 1, min = 1, max = 1,},
+ },
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ animals.on_punch(self, tool_capabilities, puncher, 55, 0.75)
+ end,
+ on_rightclick = function(self, clicker)
+ if not clicker or not clicker:is_player() then
+ return
+ end
+ animals.stun_catch_mob(self, clicker, 0.1)
+ end,
+})
+
+
+
+
+--spawn egg (i.e. live animal in inventory)
+animals.register_egg("animals:kubwakubwa", S("Live Kubwakubwa"), "animals_kubwakubwa_item.png", minimal.stack_max_medium, energy_egg)
diff --git a/games/globo/mods/animals/locale/animals.es.tr b/games/globo/mods/animals/locale/animals.es.tr
new file mode 100644
index 000000000..916fe7475
--- /dev/null
+++ b/games/globo/mods/animals/locale/animals.es.tr
@@ -0,0 +1,42 @@
+# textdomain: animals
+
+# crafts.lua
+@1 Carcass=Cadáver de un @1
+Cooked @1=@1 Asado
+Burned @1=@1 Quemado
+
+# darkasthaan.lua
+Darkasthaan Eggs=Huevo de Darkasthaan
+Live Darkasthaan=Darkasthaan Vivo
+
+# gundu.lua
+Gundu Eggs=Huevo de Gundu
+Live Gundu=Gundu Vivo
+
+# impethu.lua
+Impethu Eggs=Huevo de Impethu
+Live Impethu=Impethu Vivo
+
+# kubwakubwa.lua
+Kubwakubwa Eggs=Huevo de Kubwakubwa
+Live Kubwakubwa=Kubwakubwa Vivo
+
+# pegasun.lua
+Pegasun Egg=Huevo de Pegasun
+Live Pegasun (male)=Pegasum Macho Vivo
+Live Pegasun (female)=Pegasum Hembra Viva
+
+# sarkamos.lua
+Sarkamos Eggs=Huevo de Sarkamos
+Live Sarkamos=Sarkamos Vivo
+
+# sneachan.lua
+Sneachan Eggs=Huevo de Sneachan
+Live Sneachan=Sneachan Vivo
+
+# crafts.lua
+Small Invertebrate=Invertebrado Pequeño
+Large Invertebrate=Invertebrado Grande
+Small Bird=Pajaro Pequeño
+Small Fish=Pez Pequeño
+Large Fish=Pez Grande
\ No newline at end of file
diff --git a/games/globo/mods/animals/locale/animals.fr.tr b/games/globo/mods/animals/locale/animals.fr.tr
new file mode 100644
index 000000000..11148caca
--- /dev/null
+++ b/games/globo/mods/animals/locale/animals.fr.tr
@@ -0,0 +1,35 @@
+# textdomain: animals
+
+# crafts.lua
+@1 Carcass=Carcasse de @1
+Cooked @1=@1 cuit
+Burned @1=@1 brulé
+
+# darkasthaan.lua
+Darkasthaan Eggs=Œufs de darkasthaan
+Live Darkasthaan=Darkasthaan
+
+# gundu.lua
+Gundu Eggs=Œufs de gundu
+Live Gundu=Gundu
+
+# impethu.lua
+Impethu Eggs=Œufs d'impethu
+Live Impethu=Impethu
+
+# kubwakubwa.lua
+Kubwakubwa Eggs=Œufs de kubwakubwa
+Live Kubwakubwa=Kubwakubwa
+
+# pegasun.lua
+Pegasun Egg=Œuf de pegasun
+Live Pegasun (male)=Pegasun (male)
+Live Pegasun (female)=Pegasun (femelle)
+
+# sarkamos.lua
+Sarkamos Eggs=Œufs de sarkamos
+Live Sarkamos=Sarkamos
+
+# sneachan.lua
+Sneachan Eggs=Œufs de sneachan
+Live Sneachan=Sneachan
diff --git a/games/globo/mods/animals/locale/animals.ru.tr b/games/globo/mods/animals/locale/animals.ru.tr
new file mode 100644
index 000000000..e952d81c2
--- /dev/null
+++ b/games/globo/mods/animals/locale/animals.ru.tr
@@ -0,0 +1,42 @@
+# textdomain: animals
+
+# crafts.lua
+@1 Carcass=Туша @1
+Cooked @1=Приготовленный @1
+Burned @1=Сожжённый @1
+
+# darkasthaan.lua
+Darkasthaan Eggs=Яйца даркастаана
+Live Darkasthaan=Живой даркастаан
+
+# gundu.lua
+Gundu Eggs=Яйца Гунду
+Live Gundu=Живой Гунду
+
+# impethu.lua
+Impethu Eggs=Яйца Импету
+Live Impethu=Живой Импету
+
+# kubwakubwa.lua
+Kubwakubwa Eggs=Яйца Кубвакубва
+Live Kubwakubwa=Живой Кубвакубва
+
+# pegasun.lua
+Pegasun Egg=Яйцо Пегаса
+Live Pegasun (male)=Живой Пегас (самец)
+Live Pegasun (female)=Живой Пегас (самка)
+
+# sarkamos.lua
+Sarkamos Eggs=Яйца Саркамоса
+Live Sarkamos=Живой Саркамос
+
+# sneachan.lua
+Sneachan Eggs=Яйца Сничана
+Live Sneachan=Живой Сничан
+
+# crafts.lua
+Small Invertebrate=Маленький беспозвоночный
+Large Invertebrate=Большой беспозвоночный
+Small Bird=Маленькая птица
+Small Fish=Маленькая рыба
+Large Fish=Большая рыба
diff --git a/games/globo/mods/animals/locale/template.txt b/games/globo/mods/animals/locale/template.txt
new file mode 100644
index 000000000..953a2e760
--- /dev/null
+++ b/games/globo/mods/animals/locale/template.txt
@@ -0,0 +1,42 @@
+# textdomain: animals
+
+# crafts.lua
+@1 Carcass=
+Cooked @1=
+Burned @1=
+
+# darkasthaan.lua
+Darkasthaan Eggs=
+Live Darkasthaan=
+
+# gundu.lua
+Gundu Eggs=
+Live Gundu=
+
+# impethu.lua
+Impethu Eggs=
+Live Impethu=
+
+# kubwakubwa.lua
+Kubwakubwa Eggs=
+Live Kubwakubwa=
+
+# pegasun.lua
+Pegasun Egg=Œuf de pegasun
+Live Pegasun (male)=
+Live Pegasun (female)=
+
+# sarkamos.lua
+Sarkamos Eggs=
+Live Sarkamos=
+
+# sneachan.lua
+Sneachan Eggs=
+Live Sneachan=
+
+# crafts.lua
+Small Invertebrate=
+Large Invertebrate=
+Small Bird=
+Small Fish=
+Large Fish=
\ No newline at end of file
diff --git a/games/globo/mods/animals/mod.conf b/games/globo/mods/animals/mod.conf
new file mode 100644
index 000000000..c3c6dc301
--- /dev/null
+++ b/games/globo/mods/animals/mod.conf
@@ -0,0 +1,4 @@
+name = animals
+description = Animals using mobkit
+depends = mobkit, nodes_nature, health, climate
+author = Dokimi
diff --git a/games/globo/mods/animals/models/animals_darkasthaan.b3d b/games/globo/mods/animals/models/animals_darkasthaan.b3d
new file mode 100644
index 000000000..e1b1662fc
Binary files /dev/null and b/games/globo/mods/animals/models/animals_darkasthaan.b3d differ
diff --git a/games/globo/mods/animals/models/animals_gundu.b3d b/games/globo/mods/animals/models/animals_gundu.b3d
new file mode 100644
index 000000000..848e17dac
Binary files /dev/null and b/games/globo/mods/animals/models/animals_gundu.b3d differ
diff --git a/games/globo/mods/animals/models/animals_impethu.b3d b/games/globo/mods/animals/models/animals_impethu.b3d
new file mode 100644
index 000000000..c3cefdfbd
Binary files /dev/null and b/games/globo/mods/animals/models/animals_impethu.b3d differ
diff --git a/games/globo/mods/animals/models/animals_kubwakubwa.b3d b/games/globo/mods/animals/models/animals_kubwakubwa.b3d
new file mode 100644
index 000000000..aec461a6b
Binary files /dev/null and b/games/globo/mods/animals/models/animals_kubwakubwa.b3d differ
diff --git a/games/globo/mods/animals/models/animals_pegasun.b3d b/games/globo/mods/animals/models/animals_pegasun.b3d
new file mode 100644
index 000000000..167d10ef3
Binary files /dev/null and b/games/globo/mods/animals/models/animals_pegasun.b3d differ
diff --git a/games/globo/mods/animals/models/animals_sarkamos.b3d b/games/globo/mods/animals/models/animals_sarkamos.b3d
new file mode 100644
index 000000000..d5ad73b4f
Binary files /dev/null and b/games/globo/mods/animals/models/animals_sarkamos.b3d differ
diff --git a/games/globo/mods/animals/models/animals_sneachan.b3d b/games/globo/mods/animals/models/animals_sneachan.b3d
new file mode 100644
index 000000000..b550d563b
Binary files /dev/null and b/games/globo/mods/animals/models/animals_sneachan.b3d differ
diff --git a/games/globo/mods/animals/pegasun.lua b/games/globo/mods/animals/pegasun.lua
new file mode 100644
index 000000000..0ebef56d2
--- /dev/null
+++ b/games/globo/mods/animals/pegasun.lua
@@ -0,0 +1,640 @@
+----------------------------------------------------------------------
+-- Pegasun
+--chicken like bird
+--[[
+males and females, must mate to reproduce.
+lives off flora, spreading surface and insects
+]]
+---------------------------------------------------------------------
+
+-- Internationalization
+local S = animals.S
+
+local random = math.random
+local floor = math.floor
+
+--energy
+local energy_max = 8000--secs it can survive without food
+local energy_egg = energy_max/2 --energy that goes to egg
+local egg_timer = 60*60
+local young_per_egg = 1 --will get this/energy_egg starting energy
+
+local lifespan = energy_max * 10
+local lifespan_male = lifespan * 1.2 --if the flock male dies they go extinct
+
+
+-----------------------------------
+local function brain(self)
+
+ --die from damage
+ if not animals.core_hp(self) then
+ return
+ end
+
+ if mobkit.timer(self,1) then
+
+ local pos = mobkit.get_stand_pos(self)
+
+ local age, energy = animals.core_life(self, lifespan, pos)
+ --die from exhaustion or age
+ if not age then
+ return
+ end
+
+ ------------------
+ --Emergency actions
+
+ --swim to shore
+ if self.isinliquid then
+ mobkit.hq_liquid_recovery(self,60)
+ end
+
+
+ local prty = mobkit.get_queue_priority(self)
+ -------------------
+ --High priority actions
+ if prty < 50 then
+
+
+ --Threats
+ local plyr = mobkit.get_nearby_player(self)
+ if plyr then
+ animals.fight_or_flight_plyr(self, plyr, 55, 0.01)
+ end
+
+ animals.predator_avoid(self, 55, 0.01)
+
+
+ end
+
+
+ ----------------------
+ --Low priority actions
+ if prty < 20 then
+
+
+ --random choice between
+ --feeding, exploring, social
+ --chance differs by time
+ local ce = 0.1
+ local cs = 0.1
+ -- c feeding is simply what happens if no
+ --others are selected
+ local tod = minetest.get_timeofday()
+ if tod <0.2 or tod >0.8 then
+ --more social at night
+ ce = 0.01
+ cs = 0.75
+ elseif tod >0.55 and tod <0.55 then
+ --explore during midday
+ ce = 0.5
+ cs = 0.1
+ end
+
+
+ if random() < ce then
+ if random() < 0.95 then
+ --wander random
+ mobkit.animate(self,'walk')
+ mobkit.hq_roam(self,10)
+ else
+ --wander temp
+ mobkit.animate(self,'walk')
+ animals.hq_roam_comfort_temp(self,12, 21)
+ end
+
+ elseif random() < cs then
+
+ --social
+ if random()< 0.3 then
+ animals.flock(self, 25, 3)
+ elseif random()< 0.01 then
+ animals.territorial(self, energy, false)
+ elseif random() < 0.05 then
+
+ --reproduction
+ if self.hp >= self.max_hp
+ and energy >= energy_max - 100 then
+
+ --are we already pregnant?
+ local preg = mobkit.recall(self,'pregnant') or false
+ if preg == true then
+ mobkit.lq_idle(self,3)
+ if random() < 0.05 then
+ energy = animals.place_egg(pos, "animals:pegasun_eggs", energy, energy_egg, 'air')
+ mobkit.remember(self,'pregnant',false)
+ end
+
+ else
+
+ --we are randy
+ mobkit.remember(self,'sexual',true)
+ local mate = animals.mate_assess(self, 'animals:pegasun_male')
+ if mate then
+ --go get him!
+ mobkit.make_sound(self,'mating')
+ if random() < 0.5 then
+ animals.hq_mate(self, 25, mate)
+ end
+ end
+ end
+ else
+ --I'm too tired darling
+ mobkit.remember(self,'sexual',false)
+ end
+ end
+
+ elseif energy < energy_max then
+
+ --feed via a method
+ if random()< 0.85 then
+ --scratch dirt
+ if animals.eat_spreading_under(pos, 0.001) == true then
+ energy = energy + 6
+ else
+ --wander to food source
+ mobkit.animate(self,'walk')
+ --mobkit.hq_roam(self,10)
+ animals.hq_roam_surface_group(self, 'spreading', 20)
+ end
+ elseif random()< 0.75 then
+ --veg
+ if animals.eat_flora(pos, 0.005) == true then
+ energy = energy + 20
+ else
+ --wander random
+ mobkit.animate(self,'walk')
+ --mobkit.hq_roam(self,10)
+ animals.hq_roam_walkable_group(self, 'flora', 10)
+ end
+ else
+ --hunt
+ if not animals.prey_hunt(self, 25) then
+ --random search
+ mobkit.animate(self,'walk')
+ mobkit.hq_roam(self,10)
+ --animals.hq_roam_surface_group(self, 'spreading', 10)
+ end
+ end
+ end
+
+ end
+
+ -------------------
+ --generic behaviour
+ if mobkit.is_queue_empty_high(self) then
+ mobkit.animate(self,'walk')
+ mobkit.hq_roam(self,10)
+ end
+
+ -----------------
+ --housekeeping
+ --save energy, age
+ mobkit.remember(self,'energy',energy)
+ mobkit.remember(self,'age',age)
+
+ end
+end
+
+
+
+
+
+-----------------------------------
+--MALE BEHAVIOUR
+local function brain_male(self)
+
+ --die from damage
+ if not animals.core_hp(self) then
+ return
+ end
+
+ if mobkit.timer(self,1) then
+
+ local pos = mobkit.get_stand_pos(self)
+
+ local age, energy = animals.core_life(self, lifespan_male, pos)
+ --die from exhaustion or age
+ if not age then
+ return
+ end
+
+
+ ------------------
+ --Emergency actions
+
+ --swim to shore
+ if self.isinliquid then
+ mobkit.hq_liquid_recovery(self,60)
+ end
+
+
+ local prty = mobkit.get_queue_priority(self)
+ -------------------
+ --High priority actions
+ if prty < 50 then
+
+
+ --Threats
+ local plyr = mobkit.get_nearby_player(self)
+ if plyr then
+ animals.fight_or_flight_plyr(self, plyr, 55, 0.6)
+ end
+
+ animals.predator_avoid(self, 55, 0.6)
+
+ end
+
+
+ ----------------------
+ --Low priority actions
+
+ if prty < 20 then
+
+
+ --random choice between
+ --feeding, exploring, social
+ --chance differs by time
+ local ce = 0.2
+ local cs = 0.4
+ -- c feeding is simply what happens if no
+ --others are selected
+ local tod = minetest.get_timeofday()
+ if tod <0.2 or tod >0.8 then
+ --more social at night
+ ce = 0.01
+ cs = 0.95
+ elseif tod >0.55 and tod <0.55 then
+ --explore during midday
+ ce = 0.6
+ cs = 0.2
+ end
+
+
+ if random() < ce then
+ if random() < 0.95 then
+ --wander random
+ mobkit.animate(self,'walk')
+ mobkit.hq_roam(self,10)
+ else
+ --wander temp
+ mobkit.animate(self,'walk')
+ animals.hq_roam_comfort_temp(self,10, 21)
+ end
+
+ elseif random() < cs then
+
+ --social
+ if random()< 0.5 then
+ animals.flock(self, 25, 1)
+ elseif random()< 0.85 then
+ animals.territorial(self, energy, false)
+ elseif random() < 0.1 then
+
+ --reproduction
+ if self.hp >= self.max_hp
+ and energy >= energy_max/2 then
+
+ --set status as randy
+ --find nearby prospect and try to mate
+ mobkit.remember(self, 'sexual', true)
+ local mate = animals.mate_assess(self, 'animals:pegasun')
+
+ if mate then
+ --go get her!
+ mobkit.make_sound(self,'mating')
+ if random() < 0.5 then
+ mobkit.remember(self, "energy", energy - 1000) -- energy use for mating lol
+ animals.hq_mate(self, 25, mate)
+ end
+ end
+
+ else
+ --in no state for hankypanky
+ mobkit.remember(self, 'sexual', false)
+ end
+ end
+
+ elseif energy < energy_max then
+
+ --feed via a method
+ if random()< 0.75 then
+ --scratch dirt
+ if animals.eat_spreading_under(pos, 0.001) == true then
+ energy = energy + 6
+ else
+ --wander random
+ mobkit.animate(self,'walk')
+ --mobkit.hq_roam(self,10)
+ animals.hq_roam_surface_group(self, 'spreading', 20)
+ end
+ elseif random()< 0.5 then
+ --veg
+ if animals.eat_flora(pos, 0.005) == true then
+ energy = energy + 20
+ else
+ --wander random
+ mobkit.animate(self,'walk')
+ --mobkit.hq_roam(self,10)
+ animals.hq_roam_walkable_group(self, 'flora', 10)
+ end
+ else
+ --hunt
+ if not animals.prey_hunt(self, 25) then
+ --random search
+ mobkit.animate(self,'walk')
+ mobkit.hq_roam(self,10)
+ --animals.hq_roam_surface_group(self, 'spreading', 10)
+ end
+ end
+ end
+
+ end
+
+ -------------------
+ --generic behaviour
+ if mobkit.is_queue_empty_high(self) then
+ mobkit.animate(self,'walk')
+ mobkit.hq_roam(self,10)
+ end
+
+ -----------------
+ --housekeeping
+ --save energy, age
+ mobkit.remember(self,'energy',energy)
+ mobkit.remember(self,'age',age)
+
+ end
+end
+
+
+
+
+---------------
+-- the CREATURE
+---------------
+
+--eggs
+minetest.register_node("animals:pegasun_eggs", {
+ description = S('Pegasun Egg'),
+ tiles = {"animals_gundu_eggs.png"},
+ stack_max = minimal.stack_max_medium,
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {-0.125, -0.5, -0.125, 0.125, -0.125, 0.125},
+ },
+ groups = {snappy = 3, falling_node = 1, dig_immediate = 3, flammable = 1, temp_pass = 1, edible = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(egg_timer,egg_timer*2))
+ end,
+ on_timer =function(pos, elapsed)
+ if random()<=0.4 then -- 40% for female, 60% for male
+ return animals.hatch_egg(pos, 'air', 'air', "animals:pegasun", energy_egg, young_per_egg)
+ else
+ return animals.hatch_egg(pos, 'air', 'air', "animals:pegasun_male", energy_egg, young_per_egg)
+ end
+
+ end,
+})
+
+
+
+
+
+
+
+
+
+----------------------------------------------
+--THE MALE
+
+minetest.register_entity("animals:pegasun_male",{
+ --core
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {-0.16, -0.75, -0.16, 0.16, -0.25, 0.16},
+ visual = "mesh",
+ mesh = "animals_pegasun.b3d",
+ textures = {"animals_pegasun_male.png"},
+ visual_size = {x = 1, y = 1},
+ makes_footstep_sound = true,
+ timeout = 0,
+
+ --damage
+ max_hp = 45,
+ lung_capacity = 25,
+ min_temp = -20,
+ max_temp = 45,
+ energy_loss = 1,
+
+ --interaction
+ predators = {"animals:kubwakubwa", "animals:darkasthaan"},
+ prey = {"animals:sneachan", "animals:impethu"},
+ friends = {"animals:pegasun"},
+ rivals = {"animals:pegasun_male"},
+ sex = "male",
+
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = brain_male,
+ -- optional mobkit props
+ -- or used by built in behaviors
+ --physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ walk={range={x=71, y=90}, speed=24, loop=true},
+ fast={range={x=91, y=110}, speed=24, loop=true},
+ stand={
+ {range={x=1, y=30}, speed=28, loop=true},
+ {range={x=31, y=70}, speed=32, loop=true},
+ },
+ },
+ sounds = {
+ warn = {
+ name = "animals_pegasun_warn",
+ gain={0.3, 0.6},
+ fade={0.5, 1.5},
+ pitch={0.9, 1.1},
+ },
+ scared = {
+ name = "animals_pegasun_scared",
+ gain={0.3, 0.4},
+ fade={0.5, 1.5},
+ pitch={1.2, 1.3},
+ },
+ call = {
+ name = "animals_pegasun_call",
+ gain={0.2, 0.5},
+ fade={0.5, 1.5},
+ pitch={0.9, 1.1},
+ },
+ mating = {
+ name = "animals_pegasun_mate",
+ gain={0.5, 0.9},
+ fade={0.5, 1.5},
+ pitch={0.8, 1.2},
+ },
+ attack = {
+ name = "animals_pegasun_attack",
+ gain={0.6, 0.8},
+ fade={0.5, 1.5},
+ pitch={0.7, 1.1},
+ },
+ punch = {
+ name = "animals_punch",
+ gain={0.5, 1.5},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ },
+
+ --movement
+ springiness=0,
+ buoyancy = 1.01,
+ max_speed = 2.5, -- m/s
+ jump_height = 1.5, -- nodes/meters
+ view_range = 7, -- nodes/meters
+
+ --attack
+ attack={range=0.5, damage_groups={fleshy=4}},
+ armor_groups = {fleshy=100},
+
+ --on actions
+ drops = {
+ {name = "animals:carcass_bird_small", chance = 1, min = 1, max = 1,},
+ },
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ animals.on_punch(self, tool_capabilities, puncher, 55, 0.6)
+ end,
+ on_rightclick = function(self, clicker)
+ if not clicker or not clicker:is_player() then
+ return
+ end
+ animals.stun_catch_mob(self, clicker, 0.15)
+ end,
+})
+
+
+
+
+
+--spawn egg (i.e. live animal in inventory)
+animals.register_egg("animals:pegasun_male", S("Live Pegasun (male)"), "animals_pegasun_item.png", minimal.stack_max_medium, energy_egg)
+
+
+
+------------------------------------------------------------------------
+--FEMALE
+
+minetest.register_entity("animals:pegasun",{
+ --core
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {-0.16, -0.75, -0.16, 0.16, -0.25, 0.16},
+ visual = "mesh",
+ mesh = "animals_pegasun.b3d",
+ textures = {"animals_pegasun.png"},
+ visual_size = {x = 1, y = 1},
+ makes_footstep_sound = true,
+ timeout = 0,
+
+ --damage
+ max_hp = 40,
+ lung_capacity = 20,
+ min_temp = -20,
+ max_temp = 45,
+ energy_loss = 1,
+
+ --interaction
+ predators = {"animals:kubwakubwa", "animals:darkasthaan"},
+ prey = {"animals:sneachan", "animals:impethu"},
+ friends = {"animals:pegasun", "animals:pegasun_male"},
+ rivals = {"animals:pegasun"},
+
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = brain,
+ -- optional mobkit props
+ -- or used by built in behaviors
+ --physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ walk={range={x=71, y=90}, speed=24, loop=true},
+ fast={range={x=91, y=110}, speed=24, loop=true},
+ stand={
+ {range={x=1, y=30}, speed=28, loop=true},
+ {range={x=31, y=70}, speed=32, loop=true},
+ },
+ },
+ sounds = {
+ warn = {
+ name = "animals_pegasun_warn",
+ gain={0.2, 0.5},
+ fade={0.5, 1.5},
+ pitch={0.9, 1.1},
+ },
+ scared = {
+ name = "animals_pegasun_scared",
+ gain={0.2, 0.3},
+ fade={0.5, 1.5},
+ pitch={1.3, 1.4},
+ },
+ call = {
+ name = "animals_pegasun_call",
+ gain={0.2, 0.4},
+ fade={0.5, 1.5},
+ pitch={0.9, 1.1},
+ },
+ mating = {
+ name = "animals_pegasun_mate",
+ gain={0.4, 0.7},
+ fade={0.5, 1.5},
+ pitch={0.9, 1.4},
+ },
+ attack = {
+ name = "animals_pegasun_attack",
+ gain={0.4, 0.7},
+ fade={0.5, 1.5},
+ pitch={0.9, 1.4},
+ },
+ punch = {
+ name = "animals_punch",
+ gain={0.5, 1.5},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ },
+
+ --movement
+ springiness=0,
+ buoyancy = 1.01,
+ max_speed = 2, -- m/s
+ jump_height = 1.2, -- nodes/meters
+ view_range = 7, -- nodes/meters
+
+ --attack
+ attack={range=0.3, damage_groups={fleshy=2}},
+ armor_groups = {fleshy=100},
+
+ --on actions
+ drops = {
+ {name = "animals:carcass_bird_small", chance = 1, min = 1, max = 1,},
+ },
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ animals.on_punch(self, tool_capabilities, puncher, 55, 0.05)
+ end,
+ on_rightclick = function(self, clicker)
+ if not clicker or not clicker:is_player() then
+ return
+ end
+ animals.stun_catch_mob(self, clicker, 0.25)
+ end,
+})
+
+
+
+--spawn egg (i.e. live animal in inventory)
+animals.register_egg("animals:pegasun", S("Live Pegasun (female)"), "animals_pegasun_item.png", minimal.stack_max_medium, energy_egg)
diff --git a/games/globo/mods/animals/sarkamos.lua b/games/globo/mods/animals/sarkamos.lua
new file mode 100644
index 000000000..704a33dc2
--- /dev/null
+++ b/games/globo/mods/animals/sarkamos.lua
@@ -0,0 +1,234 @@
+----------------------------------------------------------------------
+-- Sarkamos
+--[[
+predator fish
+]]
+---------------------------------------------------------------------
+
+-- Internationalization
+local S = animals.S
+
+local random = math.random
+local floor = math.floor
+
+--energy
+local energy_max = 14000--secs it can survive without food
+local energy_egg = energy_max/8 --energy that goes to egg
+local egg_timer = 60*45
+local young_per_egg = 2 --will get this/energy_egg starting energy
+
+local lifespan = energy_max * 8
+
+
+
+
+-----------------------------------
+local function brain(self)
+
+ --die from damage
+ if not animals.core_hp_water(self) then
+ return
+ end
+
+ if mobkit.timer(self,1) then
+
+ local pos = mobkit.get_stand_pos(self)
+
+ local age, energy = animals.core_life(self, lifespan, pos)
+ --die from exhaustion or age
+ if not age then
+ return
+ end
+
+
+ local prty = mobkit.get_queue_priority(self)
+ -------------------
+ --High priority actions
+ --if prty < 50 then
+
+ --Threats
+
+ --currently none
+ --animals.predator_avoid_water(self, 65, 0.01)
+
+ --end
+
+
+ ----------------------
+ --Low priority actions
+ if prty < 20 then
+
+ --territorial behaviour
+ local rival = animals.territorial_water(self, energy, false)
+
+ --feeding
+ if energy < energy_max then
+ --You are prey
+ local plyr = mobkit.get_nearby_player(self)
+ if plyr then
+ animals.fight_or_flight_plyr_water(self, plyr, 25, 0.4)
+ end
+
+ if not animals.prey_hunt_water(self, 25) then
+ --random search for darkness
+ mobkit.hq_aqua_roam(self,15,self.max_speed/3)
+ end
+ end
+
+ if energy >= energy_max then
+ -- heavy with eggs, sink to look for a laying spot
+ self.object:add_velocity({ x = 0, y = -0.2,
+ z = 0})
+ end
+
+
+ --reproduction
+ --asexual parthogenesis, eggs
+ --when in prime condition
+ --in dark
+ local light = minetest.get_node_light(pos, 0.5) or 0
+
+ if random() < 0.02
+ and not rival
+ and light < 10
+ and self.hp >= self.max_hp
+ and energy >= energy_max then
+ energy = animals.place_egg(pos, "animals:sarkamos_eggs", energy, energy_egg, 'nodes_nature:salt_water_source')
+ end
+
+ end
+
+ -------------------
+ --generic behaviour
+ if mobkit.is_queue_empty_high(self) then
+ mobkit.animate(self,'def')
+ mobkit.hq_aqua_roam(self,10,1)
+ end
+
+
+ -----------------
+ --housekeeping
+ --save energy, age
+ mobkit.remember(self,'energy',energy)
+ mobkit.remember(self,'age',age)
+
+ end
+end
+
+
+
+
+
+
+---------------
+-- the CREATURE
+---------------
+
+--eggs
+minetest.register_node("animals:sarkamos_eggs", {
+ description = S('Sarkamos Eggs'),
+ tiles = {"animals_gundu_eggs.png"},
+ stack_max = minimal.stack_max_bulky,
+ groups = {snappy = 3, edible = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(egg_timer,egg_timer*2))
+ end,
+ on_timer =function(pos, elapsed)
+ return animals.hatch_egg(pos, 'nodes_nature:salt_water_source', 'nodes_nature:salt_water_flowing', "animals:sarkamos", energy_egg, young_per_egg)
+ end,
+})
+
+
+
+
+
+
+----------------------------------------------
+
+--The Animal
+minetest.register_entity("animals:sarkamos",{
+ --core
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {-0.2, -0.2, -0.2, 0.2, 0.15, 0.2},
+ visual = "mesh",
+ mesh = "animals_sarkamos.b3d",
+ textures = {"animals_sarkamos.png"},
+ visual_size = {x = 1, y = 1},
+ makes_footstep_sound = false,
+ timeout = 0,
+
+ --damage
+ max_hp = 200,
+ lung_capacity = 40,
+ min_temp = 1,
+ max_temp = 35,
+
+ --interaction
+ --predators = {"animals:sarkamos"},
+ rivals = {"animals:sarkamos"},
+ prey = {"animals:gundu"},
+
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = brain,
+ -- optional mobkit props
+ -- or used by built in behaviors
+ --physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ def={range={x=1,y=59},speed=40,loop=true},
+ fast={range={x=1,y=59},speed=80,loop=true},
+ stand={range={x=1,y=15},speed=15,loop=true},
+ },
+ sounds = {
+ flee = {
+ name = "animals_water_swish",
+ gain={0.5, 1.5},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ punch = {
+ name = "animals_punch",
+ gain={0.5, 1},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ bite = {
+ name = "animals_bite",
+ gain={0.4, 0.8},
+ fade={0.5, 1.5},
+ pitch={0.6, 1.1},
+ },
+ },
+
+ --movement
+ springiness=0.5,
+ buoyancy = 1,
+ max_speed = 3, -- m/s
+ jump_height = 2, -- nodes/meters
+ view_range = 7, -- nodes/meters
+
+ --attack
+ attack={range=0.6, damage_groups={fleshy=10}},
+ armor_groups = {fleshy=100},
+
+ --on actions
+ drops = {
+ {name = "animals:carcass_fish_large", chance = 1, min = 1, max = 1,},
+ },
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ animals.on_punch_water(self, tool_capabilities, puncher, 55, 0.75)
+ end,
+ on_rightclick = function(self, clicker)
+ if not clicker or not clicker:is_player() then
+ return
+ end
+ animals.stun_catch_mob(self, clicker, 0.01)
+ end,
+})
+
+
+--spawn egg (i.e. live animal in inventory)
+animals.register_egg("animals:sarkamos", S("Live Sarkamos"), "animals_sarkamos_item.png", minimal.stack_max_medium/2, energy_egg)
diff --git a/games/globo/mods/animals/sneachan.lua b/games/globo/mods/animals/sneachan.lua
new file mode 100644
index 000000000..8ab4d6d17
--- /dev/null
+++ b/games/globo/mods/animals/sneachan.lua
@@ -0,0 +1,278 @@
+----------------------------------------------------------------------
+-- Sneachan
+--small insect.
+--[[
+Land living
+Dislikes bright light, eats sediment, plants,
+]]
+---------------------------------------------------------------------
+
+-- Internationalization
+local S = animals.S
+
+local random = math.random
+local floor = math.floor
+
+--energy
+local energy_max = 5000--secs it can survive without food
+local energy_egg = energy_max-100 --energy that goes to egg
+local egg_timer = 60*10
+local young_per_egg = 5 --will get this/energy_egg starting energy
+
+local lifespan = energy_max * 5
+
+
+
+-----------------------------------
+local function brain(self)
+
+ --die from damage
+ if not animals.core_hp(self) then
+ return
+ end
+
+ if mobkit.timer(self,1) then
+
+ local pos = mobkit.get_stand_pos(self)
+
+ local age, energy = animals.core_life(self, lifespan, pos)
+ --die from exhaustion or age
+ if not age then
+ return
+ end
+
+ ------------------
+ --Emergency actions
+
+ --swim to shore
+ if self.isinliquid then
+ mobkit.hq_liquid_recovery(self,60)
+ end
+
+
+ local prty = mobkit.get_queue_priority(self)
+ -------------------
+ --High priority actions
+ local pred
+
+ if prty < 50 then
+
+
+ --Threats
+ local plyr = mobkit.get_nearby_player(self)
+ if plyr then
+ animals.fight_or_flight_plyr(self, plyr, 55, 0.01)
+ end
+
+ pred = animals.predator_avoid(self, 55, 0.01)
+
+ end
+
+
+ ----------------------
+ --Low priority actions
+
+ if prty < 20 then
+
+ --territorial behaviour
+ local rival = animals.territorial(self, energy, true)
+
+
+ --feeding
+ local light = (minetest.get_node_light(pos) or 0)
+
+ if light <= 12 then
+ --hungry eat stuff in the dark
+ if energy < energy_max then
+ if animals.eat_sediment_under(pos, 0.001) == true then
+ energy = energy + 3
+ elseif animals.eat_flora(pos, 0.001) == true then
+ energy = energy + 4
+ else
+ --wander random
+ mobkit.animate(self,'walk')
+ --mobkit.hq_roam(self,10)
+ animals.hq_roam_surface_group(self, 'sediment', 20)
+ end
+ else
+ --full
+ mobkit.hq_roam(self,1)
+ end
+ elseif random()<0.5 and energy < energy_max then
+ --slower, less effective feeding during day
+ if animals.eat_sediment_under(pos, 0.001) then
+ energy = energy + 1
+ elseif animals.eat_flora(pos, 0.001) then
+ energy = energy + 2
+ else
+ --wander random
+ mobkit.animate(self,'walk')
+ animals.hq_roam_dark(self,10)
+ end
+ else
+ --get out of the light
+ animals.hq_roam_dark(self,15)
+ end
+
+
+
+
+ --reproduction
+ --asexual parthogenesis, eggs
+ if random() < 0.005
+ and not rival
+ and not pred
+ and self.hp >= self.max_hp
+ and energy >= energy_max then
+ energy = animals.place_egg(pos, "animals:sneachan_eggs", energy, energy_egg, 'air')
+ end
+
+ end
+
+ -------------------
+ --generic behaviour
+ if mobkit.is_queue_empty_high(self) then
+ mobkit.animate(self,'walk')
+ animals.hq_roam_dark(self,10,1)
+ end
+
+ -----------------
+ --housekeeping
+ --save energy, age
+ mobkit.remember(self,'energy',energy)
+ mobkit.remember(self,'age',age)
+
+ end
+end
+
+
+
+
+
+
+---------------
+-- the CREATURE
+---------------
+
+--eggs
+minetest.register_node("animals:sneachan_eggs", {
+ description = S('Sneachan Eggs'),
+ tiles = {"animals_gundu_eggs.png"},
+ stack_max = minimal.stack_max_medium,
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {-0.08, -0.5, -0.08, 0.08, -0.4375, 0.08},
+ },
+ groups = {snappy = 3, falling_node = 1, dig_immediate = 3, flammable = 1, temp_pass = 1, edible = 1},
+ sounds = nodes_nature.node_sound_defaults(),
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(egg_timer,egg_timer*2))
+ end,
+ on_timer =function(pos, elapsed)
+ local light = (minetest.get_node_light(pos) or 0)
+ if light <= 10 then
+ return animals.hatch_egg(pos, 'air', 'air', "animals:sneachan", energy_egg, young_per_egg)
+ else
+ if random()<0.3 then
+ return animals.hatch_egg(pos, 'air', 'air', "animals:sneachan", energy_egg, young_per_egg)
+ end
+ return true
+ end
+ end,
+})
+
+
+
+
+
+
+
+----------------------------------------------
+
+--The Animal
+minetest.register_entity("animals:sneachan",{
+ --core
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {-0.1, -0.01, -0.1, 0.1, 0.15, 0.1},
+ visual = "mesh",
+ mesh = "animals_sneachan.b3d",
+ textures = {"animals_sneachan.png"},
+ visual_size = {x = 1, y = 1},
+ makes_footstep_sound = true,
+ timeout = 0,
+
+ --damage
+ max_hp = 10,
+ lung_capacity = 10,
+ min_temp = -28,
+ max_temp = 48,
+
+ --interaction
+ predators = animals.get_interactors("sneachan","predators"),
+ rivals = animals.get_interactors("sneachan","rivals"),
+
+ -- is it land-borne (1), sea-borne (2), amphibious (3), or flying (4)?
+ class = 1,
+
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = brain,
+ -- optional mobkit props
+ -- or used by built in behaviors
+ --physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ walk={range={x=0, y=20}, speed=20, loop=true},
+ fast={range={x=0, y=20}, speed=40, loop=true},
+ stand={range={x=0, y=20}, speed=10, loop=true},
+ },
+ sounds = {
+ warn = {
+ name = "animals_sneachan_warn",
+ gain={0.05, 0.2},
+ fade={0.5, 1.5},
+ pitch={0.6, 1.3},
+ },
+ punch = {
+ name = "animals_punch",
+ gain={0.3, 0.9},
+ fade={0.5, 1.5},
+ pitch={0.5, 1.5},
+ },
+ },
+
+ --movement
+ springiness=0,
+ buoyancy = 1.01,
+ max_speed = 1, -- m/s
+ jump_height = 1, -- nodes/meters
+ view_range = 2, -- nodes/meters
+
+ --attack
+ attack={range=0.3, damage_groups={fleshy=1}},
+ armor_groups = {fleshy=100},
+
+ --on actions
+ drops = {
+ {name = "animals:carcass_invert_small", chance = 1, min = 1, max = 1,},
+ },
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ animals.on_punch(self, tool_capabilities, puncher, 55, 0.1)
+ end,
+ on_rightclick = function(self, clicker)
+ if not clicker or not clicker:is_player() then
+ return
+ end
+ animals.stun_catch_mob(self, clicker, 0.75, true)
+ end,
+})
+
+
+
+
+
+--spawn egg (i.e. live animal in inventory)
+animals.register_egg("animals:sneachan", S("Live Sneachan"), "animals_sneachan_item.png", minimal.stack_max_medium, energy_egg)
diff --git a/games/globo/mods/animals/sounds/animals_bite.ogg b/games/globo/mods/animals/sounds/animals_bite.ogg
new file mode 100644
index 000000000..961015946
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_bite.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_darkasthaan_warn.ogg b/games/globo/mods/animals/sounds/animals_darkasthaan_warn.ogg
new file mode 100644
index 000000000..5ef5eff8f
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_darkasthaan_warn.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_gundu_call.ogg b/games/globo/mods/animals/sounds/animals_gundu_call.ogg
new file mode 100644
index 000000000..5e07a1773
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_gundu_call.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_hatch_egg.ogg b/games/globo/mods/animals/sounds/animals_hatch_egg.ogg
new file mode 100644
index 000000000..23e58d487
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_hatch_egg.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_impethu_warn.ogg b/games/globo/mods/animals/sounds/animals_impethu_warn.ogg
new file mode 100644
index 000000000..b74980118
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_impethu_warn.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.1.ogg b/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.1.ogg
new file mode 100644
index 000000000..ff782fdf4
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.1.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.2.ogg b/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.2.ogg
new file mode 100644
index 000000000..c039c79ce
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.2.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.ogg b/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.ogg
new file mode 100644
index 000000000..41050067a
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_kubwakubwa_warn.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_pegasun_attack.ogg b/games/globo/mods/animals/sounds/animals_pegasun_attack.ogg
new file mode 100644
index 000000000..844c3a70f
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_pegasun_attack.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_pegasun_call.ogg b/games/globo/mods/animals/sounds/animals_pegasun_call.ogg
new file mode 100644
index 000000000..b8f22eca2
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_pegasun_call.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_pegasun_mate.ogg b/games/globo/mods/animals/sounds/animals_pegasun_mate.ogg
new file mode 100644
index 000000000..ce79ff6dd
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_pegasun_mate.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_pegasun_scared.ogg b/games/globo/mods/animals/sounds/animals_pegasun_scared.ogg
new file mode 100644
index 000000000..af74a4730
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_pegasun_scared.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_pegasun_warn.ogg b/games/globo/mods/animals/sounds/animals_pegasun_warn.ogg
new file mode 100644
index 000000000..7f3d1831d
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_pegasun_warn.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_punch.ogg b/games/globo/mods/animals/sounds/animals_punch.ogg
new file mode 100644
index 000000000..9f568c06d
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_punch.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_sneachan_warn.ogg b/games/globo/mods/animals/sounds/animals_sneachan_warn.ogg
new file mode 100644
index 000000000..dbfc41b4d
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_sneachan_warn.ogg differ
diff --git a/games/globo/mods/animals/sounds/animals_water_swish.ogg b/games/globo/mods/animals/sounds/animals_water_swish.ogg
new file mode 100644
index 000000000..403f4848b
Binary files /dev/null and b/games/globo/mods/animals/sounds/animals_water_swish.ogg differ
diff --git a/games/globo/mods/animals/textures/animals_carcass.png b/games/globo/mods/animals/textures/animals_carcass.png
new file mode 100644
index 000000000..0a7c2b4c6
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_carcass.png differ
diff --git a/games/globo/mods/animals/textures/animals_carcass_burned.png b/games/globo/mods/animals/textures/animals_carcass_burned.png
new file mode 100644
index 000000000..435b62546
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_carcass_burned.png differ
diff --git a/games/globo/mods/animals/textures/animals_darkasthaan.png b/games/globo/mods/animals/textures/animals_darkasthaan.png
new file mode 100644
index 000000000..ae96dcc9e
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_darkasthaan.png differ
diff --git a/games/globo/mods/animals/textures/animals_darkasthaan_item.png b/games/globo/mods/animals/textures/animals_darkasthaan_item.png
new file mode 100644
index 000000000..86b1a061b
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_darkasthaan_item.png differ
diff --git a/games/globo/mods/animals/textures/animals_gundu.png b/games/globo/mods/animals/textures/animals_gundu.png
new file mode 100644
index 000000000..d9bbb69cf
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_gundu.png differ
diff --git a/games/globo/mods/animals/textures/animals_gundu_eggs.png b/games/globo/mods/animals/textures/animals_gundu_eggs.png
new file mode 100644
index 000000000..0dc88d3c6
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_gundu_eggs.png differ
diff --git a/games/globo/mods/animals/textures/animals_gundu_item.png b/games/globo/mods/animals/textures/animals_gundu_item.png
new file mode 100644
index 000000000..153319a8b
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_gundu_item.png differ
diff --git a/games/globo/mods/animals/textures/animals_impethu.png b/games/globo/mods/animals/textures/animals_impethu.png
new file mode 100644
index 000000000..b3cf3a9c6
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_impethu.png differ
diff --git a/games/globo/mods/animals/textures/animals_impethu_item.png b/games/globo/mods/animals/textures/animals_impethu_item.png
new file mode 100644
index 000000000..2c986a985
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_impethu_item.png differ
diff --git a/games/globo/mods/animals/textures/animals_kubwakubwa.png b/games/globo/mods/animals/textures/animals_kubwakubwa.png
new file mode 100644
index 000000000..9fb9d35e5
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_kubwakubwa.png differ
diff --git a/games/globo/mods/animals/textures/animals_kubwakubwa_item.png b/games/globo/mods/animals/textures/animals_kubwakubwa_item.png
new file mode 100644
index 000000000..d5f453de8
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_kubwakubwa_item.png differ
diff --git a/games/globo/mods/animals/textures/animals_pegasun.png b/games/globo/mods/animals/textures/animals_pegasun.png
new file mode 100644
index 000000000..fddae04cb
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_pegasun.png differ
diff --git a/games/globo/mods/animals/textures/animals_pegasun_item.png b/games/globo/mods/animals/textures/animals_pegasun_item.png
new file mode 100644
index 000000000..ccaca249e
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_pegasun_item.png differ
diff --git a/games/globo/mods/animals/textures/animals_pegasun_male.png b/games/globo/mods/animals/textures/animals_pegasun_male.png
new file mode 100644
index 000000000..2066e33c8
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_pegasun_male.png differ
diff --git a/games/globo/mods/animals/textures/animals_sarkamos.png b/games/globo/mods/animals/textures/animals_sarkamos.png
new file mode 100644
index 000000000..d6f3a788a
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_sarkamos.png differ
diff --git a/games/globo/mods/animals/textures/animals_sarkamos_item.png b/games/globo/mods/animals/textures/animals_sarkamos_item.png
new file mode 100644
index 000000000..6218fcba0
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_sarkamos_item.png differ
diff --git a/games/globo/mods/animals/textures/animals_sneachan.png b/games/globo/mods/animals/textures/animals_sneachan.png
new file mode 100644
index 000000000..956af9ce7
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_sneachan.png differ
diff --git a/games/globo/mods/animals/textures/animals_sneachan_item.png b/games/globo/mods/animals/textures/animals_sneachan_item.png
new file mode 100644
index 000000000..5561016fc
Binary files /dev/null and b/games/globo/mods/animals/textures/animals_sneachan_item.png differ
diff --git a/games/globo/mods/basenodes/init.lua b/games/globo/mods/basenodes/init.lua
new file mode 100644
index 000000000..39e308875
--- /dev/null
+++ b/games/globo/mods/basenodes/init.lua
@@ -0,0 +1,326 @@
+local FIRE_SPREAD_CHANCE = 30 -- A chance out of 100 that fire will spread each second
+local FIRE_BURN_TIME = 10 -- Time in seconds before a flammable item is destroyed
+local FIRE_EXTINGUISH_TIME = 2 -- Time in seconds before fire without fuel goes out
+local WATER_ALPHA = "^[opacity:" .. 160
+local WATER_VISC = 1
+local LAVA_VISC = 7
+
+
+
+minetest.register_node("basenodes:fire", {
+ description = "Fire",
+ drawtype = "firelike",
+ tiles = {{
+ name = "fire_basic_flame_animated.png",
+ animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 1},
+ }},
+ inventory_image = "fire_basic_flame.png",
+ light_source = 14,
+ groups = {igniter = 2, dig_immediate = 3},
+ drop = '',
+ walkable = false,
+ buildable_to = true,
+ damage_per_second = 4,
+ on_timer = function(pos, elapsed)
+ -- Check for flammable things around the fire
+ if not spread_fire(pos) then
+ -- Extinguish fire if there are no flammable things to burn
+ minetest.get_node_timer(pos):start(FIRE_EXTINGUISH_TIME)
+ else
+ minetest.get_node_timer(pos):start(1)
+ end
+ end,
+ on_construct = function(pos)
+ -- Start a timer that tries to spread the fire every second
+ local timer = minetest.get_node_timer(pos)
+ timer:start(1)
+ end,
+ on_blast = function() end, -- Fire cannot be exploded
+})
+
+-- Function to check for flammable nodes, spread fire, or extinguish fire
+function spread_fire(pos)
+ -- flammable group is used to determine if nodes are flammable
+ local has_flammable_around = false
+ local positions = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1}, {"group:flammable"}
+ )
+ for _, flammable_pos in ipairs(positions) do
+ has_flammable_around = true
+ if math.random(0, 99) < FIRE_SPREAD_CHANCE then
+ minetest.set_node(flammable_pos, {name = "basenodes:fire"})
+ end
+ end
+
+ local positions_water = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1}, {"group:water"}
+ )
+ for _, water_pos in ipairs(positions_water) do
+ minetest.remove_node(pos)
+ return false -- fire extinguished by water
+ end
+
+ return has_flammable_around
+end
+
+-- Function to destroy flammable items
+minetest.register_abm({
+ label = "Fire consumes flammable items",
+ nodenames = {"group:flammable"},
+ neighbors = {"basenodes:fire"},
+ interval = 1.0,
+ chance = 1,
+ action = function(pos, node)
+ local timer = minetest.get_node_timer(pos)
+ if not timer:is_started() then
+ timer:start(FIRE_BURN_TIME)
+ end
+ end,
+ on_timer = function(pos, elapsed)
+ minetest.remove_node(pos) -- Destroy the flammable node
+ minetest.check_for_falling(pos) -- Check for falling nodes
+ return false -- Stop the timer
+ end
+})
+
+minetest.register_node("basenodes:dirt_with_grass", {
+ description = "Dirt with Grass",
+ tiles = {
+ "default_grass.png", -- Top texture
+ "default_dirt.png", -- Bottom texture
+ "default_dirt.png^default_grass_side.png" -- Side textures
+ },
+ groups = {crumbly=3, soil=1},
+})
+
+--[[
+minetest.register_node("basenodes:dirt_with_grass", {
+ description = "Dirt with Grass",
+ tiles ={"default_grass.png",
+ "default_dirt.png",
+ {name = "default_dirt.png^default_grass_side.png",
+ tileable_vertical = false}},
+ groups = {crumbly=3, soil=1,falling_node = 1},
+})
+]]--
+
+minetest.register_node("basenodes:dirt", {
+ description = "Dirt",
+ tiles ={"default_dirt.png"},
+ groups = {crumbly=3, soil=1, falling_node = 1},
+})
+
+minetest.register_node("basenodes:stone", {
+ description = "Stone",
+ tiles = {"default_stone.png"},
+ groups = {cracky=3},
+})
+
+minetest.register_node("basenodes:sand", {
+ description = "Sand",
+ tiles ={"default_sand.png"},
+ groups = {crumbly=3, falling_node = 1},
+})
+
+
+minetest.register_node("basenodes:water_source", {
+ description = "Water Source".."\n"..
+ "Swimmable, spreading, renewable liquid".."\n"..
+ "Drowning damage: 1",
+ drawtype = "liquid",
+ waving = 3,
+ tiles = {"default_water.png"..WATER_ALPHA},
+ special_tiles = {
+ {name = "default_water.png"..WATER_ALPHA, backface_culling = false},
+ {name = "default_water.png"..WATER_ALPHA, backface_culling = true},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ liquidtype = "source",
+ liquid_alternative_flowing = "basenodes:water_flowing",
+ liquid_alternative_source = "basenodes:water_source",
+ liquid_viscosity = WATER_VISC,
+ post_effect_color = {a = 64, r = 100, g = 100, b = 200},
+ post_effect_color_shaded = true,
+ groups = {water = 3, liquid = 3},
+})
+
+minetest.register_node("basenodes:water_flowing", {
+ description = "Flowing Water".."\n"..
+ "Swimmable, spreading, renewable liquid".."\n"..
+ "Drowning damage: 1",
+ drawtype = "flowingliquid",
+ waving = 3,
+ tiles = {"default_water_flowing.png"},
+ special_tiles = {
+ {name = "default_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ {name = "default_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ liquidtype = "flowing",
+ liquid_alternative_flowing = "basenodes:water_flowing",
+ liquid_alternative_source = "basenodes:water_source",
+ liquid_viscosity = WATER_VISC,
+ post_effect_color = {a = 64, r = 100, g = 100, b = 200},
+ post_effect_color_shaded = true,
+ groups = {water = 3, liquid = 3},
+})
+
+minetest.register_node("basenodes:river_water_source", {
+ description = "River Water Source".."\n"..
+ "Swimmable, spreading, non-renewable liquid".."\n"..
+ "Drowning damage: 1",
+ drawtype = "liquid",
+ waving = 3,
+ tiles = { "default_river_water.png"..WATER_ALPHA },
+ special_tiles = {
+ {name = "default_river_water.png"..WATER_ALPHA, backface_culling = false},
+ {name = "default_river_water.png"..WATER_ALPHA, backface_culling = true},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ liquidtype = "source",
+ liquid_alternative_flowing = "basenodes:river_water_flowing",
+ liquid_alternative_source = "basenodes:river_water_source",
+ liquid_viscosity = 1,
+ liquid_renewable = false,
+ liquid_range = 2,
+ post_effect_color = {a = 103, r = 30, g = 76, b = 90},
+ post_effect_color_shaded = true,
+ groups = {water = 3, liquid = 3, },
+})
+
+minetest.register_node("basenodes:river_water_flowing", {
+ description = "Flowing River Water".."\n"..
+ "Swimmable, spreading, non-renewable liquid".."\n"..
+ "Drowning damage: 1",
+ drawtype = "flowingliquid",
+ waving = 3,
+ tiles = {"default_river_water_flowing.png"..WATER_ALPHA},
+ special_tiles = {
+ {name = "default_river_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ {name = "default_river_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ liquidtype = "flowing",
+ liquid_alternative_flowing = "basenodes:river_water_flowing",
+ liquid_alternative_source = "basenodes:river_water_source",
+ liquid_viscosity = 1,
+ liquid_renewable = false,
+ liquid_range = 2,
+ post_effect_color = {a = 103, r = 30, g = 76, b = 90},
+ post_effect_color_shaded = true,
+ groups = {water = 3, liquid = 3, },
+})
+
+
+minetest.register_node("basenodes:lava_flowing", {
+ description = "Flowing Lava".."\n"..
+ "Swimmable, spreading, renewable liquid".."\n"..
+ "4 damage per second".."\n"..
+ "Drowning damage: 1",
+ drawtype = "flowingliquid",
+ tiles = {"default_lava_flowing.png"},
+ special_tiles = {
+ {name="default_lava_flowing.png", backface_culling = false},
+ {name="default_lava_flowing.png", backface_culling = false},
+ },
+ paramtype = "light",
+ light_source = minetest.LIGHT_MAX,
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ damage_per_second = 4,
+ liquidtype = "flowing",
+ liquid_alternative_flowing = "basenodes:lava_flowing",
+ liquid_alternative_source = "basenodes:lava_source",
+ liquid_viscosity = LAVA_VISC,
+ post_effect_color = {a=192, r=255, g=64, b=0},
+ groups = {lava=3, liquid=1},
+})
+
+minetest.register_node("basenodes:lava_source", {
+ description = "Lava Source".."\n"..
+ "Swimmable, spreading, renewable liquid".."\n"..
+ "4 damage per second".."\n"..
+ "Drowning damage: 1",
+ drawtype = "liquid",
+ tiles = { "default_lava.png" },
+ special_tiles = {
+ {name = "default_lava.png", backface_culling = false},
+ {name = "default_lava.png", backface_culling = true},
+ },
+ paramtype = "light",
+ light_source = minetest.LIGHT_MAX,
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
+ damage_per_second = 4,
+ liquidtype = "source",
+ liquid_alternative_flowing = "basenodes:lava_flowing",
+ liquid_alternative_source = "basenodes:lava_source",
+ liquid_viscosity = LAVA_VISC,
+ post_effect_color = {a=192, r=255, g=64, b=0},
+ groups = {lava=3, liquid=1},
+})
+
+
+minetest.register_node("basenodes:pine_tree", {
+ description = "Pine Tree Trunk",
+ tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", "default_pine_tree.png"},
+ is_ground_content = false,
+ groups = {choppy=2,oddly_breakable_by_hand=1},
+})
+
+minetest.register_node("basenodes:pine_needles", {
+ description = "Pine Needles",
+ drawtype = "allfaces_optional",
+ tiles = {"default_pine_needles.png"},
+ paramtype = "light",
+ is_ground_content = false,
+ groups = {snappy=3},
+})
+
+
+
+
diff --git a/games/globo/mods/basenodes/mod.conf b/games/globo/mods/basenodes/mod.conf
new file mode 100644
index 000000000..25024dc63
--- /dev/null
+++ b/games/globo/mods/basenodes/mod.conf
@@ -0,0 +1,2 @@
+name = basenodes
+description = Contains basic nodes for mapgen
diff --git a/games/globo/mods/basenodes/textures/basenodes_dirt_with_snow.png b/games/globo/mods/basenodes/textures/basenodes_dirt_with_snow.png
new file mode 100644
index 000000000..7ea2d8d31
Binary files /dev/null and b/games/globo/mods/basenodes/textures/basenodes_dirt_with_snow.png differ
diff --git a/games/globo/mods/basenodes/textures/basenodes_snow_sheet.png b/games/globo/mods/basenodes/textures/basenodes_snow_sheet.png
new file mode 100644
index 000000000..455332093
Binary files /dev/null and b/games/globo/mods/basenodes/textures/basenodes_snow_sheet.png differ
diff --git a/games/globo/mods/basenodes/textures/default_blueberries.png b/games/globo/mods/basenodes/textures/default_blueberries.png
new file mode 100644
index 000000000..1dbb0d64f
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_blueberries.png differ
diff --git a/games/globo/mods/basenodes/textures/default_blueberry_bush_leaves.png b/games/globo/mods/basenodes/textures/default_blueberry_bush_leaves.png
new file mode 100644
index 000000000..355f0ee45
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_blueberry_bush_leaves.png differ
diff --git a/games/globo/mods/basenodes/textures/default_blueberry_bush_sapling.png b/games/globo/mods/basenodes/textures/default_blueberry_bush_sapling.png
new file mode 100644
index 000000000..c22a374fa
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_blueberry_bush_sapling.png differ
diff --git a/games/globo/mods/basenodes/textures/default_blueberry_overlay.png b/games/globo/mods/basenodes/textures/default_blueberry_overlay.png
new file mode 100644
index 000000000..f61efe085
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_blueberry_overlay.png differ
diff --git a/games/globo/mods/basenodes/textures/default_cobble.png b/games/globo/mods/basenodes/textures/default_cobble.png
new file mode 100644
index 000000000..5b859e9c2
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_cobble.png differ
diff --git a/games/globo/mods/basenodes/textures/default_desert_sand.png b/games/globo/mods/basenodes/textures/default_desert_sand.png
new file mode 100644
index 000000000..19ec87dc0
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_desert_sand.png differ
diff --git a/games/globo/mods/basenodes/textures/default_desert_stone.png b/games/globo/mods/basenodes/textures/default_desert_stone.png
new file mode 100644
index 000000000..5126fb61c
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_desert_stone.png differ
diff --git a/games/globo/mods/basenodes/textures/default_dirt.png b/games/globo/mods/basenodes/textures/default_dirt.png
new file mode 100644
index 000000000..4ed965a95
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_dirt.png differ
diff --git a/games/globo/mods/basenodes/textures/default_fern_3.png b/games/globo/mods/basenodes/textures/default_fern_3.png
new file mode 100644
index 000000000..2c1f605e7
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_fern_3.png differ
diff --git a/games/globo/mods/basenodes/textures/default_grass.png b/games/globo/mods/basenodes/textures/default_grass.png
new file mode 100644
index 000000000..5778caa1d
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_grass.png differ
diff --git a/games/globo/mods/basenodes/textures/default_grass_1.png b/games/globo/mods/basenodes/textures/default_grass_1.png
new file mode 100644
index 000000000..d16b307e2
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_grass_1.png differ
diff --git a/games/globo/mods/basenodes/textures/default_grass_2.png b/games/globo/mods/basenodes/textures/default_grass_2.png
new file mode 100644
index 000000000..6a1dac2c1
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_grass_2.png differ
diff --git a/games/globo/mods/basenodes/textures/default_grass_3.png b/games/globo/mods/basenodes/textures/default_grass_3.png
new file mode 100644
index 000000000..e67727a47
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_grass_3.png differ
diff --git a/games/globo/mods/basenodes/textures/default_grass_4.png b/games/globo/mods/basenodes/textures/default_grass_4.png
new file mode 100644
index 000000000..80269d7ec
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_grass_4.png differ
diff --git a/games/globo/mods/basenodes/textures/default_grass_5.png b/games/globo/mods/basenodes/textures/default_grass_5.png
new file mode 100644
index 000000000..df457605d
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_grass_5.png differ
diff --git a/games/globo/mods/basenodes/textures/default_grass_side.png b/games/globo/mods/basenodes/textures/default_grass_side.png
new file mode 100644
index 000000000..77aa65578
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_grass_side.png differ
diff --git a/games/globo/mods/basenodes/textures/default_gravel.png b/games/globo/mods/basenodes/textures/default_gravel.png
new file mode 100644
index 000000000..7e5ff616f
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_gravel.png differ
diff --git a/games/globo/mods/basenodes/textures/default_ice.png b/games/globo/mods/basenodes/textures/default_ice.png
new file mode 100644
index 000000000..c4bddd223
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_ice.png differ
diff --git a/games/globo/mods/basenodes/textures/default_junglegrass.png b/games/globo/mods/basenodes/textures/default_junglegrass.png
new file mode 100644
index 000000000..d64e33abc
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_junglegrass.png differ
diff --git a/games/globo/mods/basenodes/textures/default_jungleleaves.png b/games/globo/mods/basenodes/textures/default_jungleleaves.png
new file mode 100644
index 000000000..1fa67e83a
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_jungleleaves.png differ
diff --git a/games/globo/mods/basenodes/textures/default_jungletree.png b/games/globo/mods/basenodes/textures/default_jungletree.png
new file mode 100644
index 000000000..053850fa7
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_jungletree.png differ
diff --git a/games/globo/mods/basenodes/textures/default_jungletree_top.png b/games/globo/mods/basenodes/textures/default_jungletree_top.png
new file mode 100644
index 000000000..e80de8a69
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_jungletree_top.png differ
diff --git a/games/globo/mods/basenodes/textures/default_lava.png b/games/globo/mods/basenodes/textures/default_lava.png
new file mode 100644
index 000000000..a4cf649f1
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_lava.png differ
diff --git a/games/globo/mods/basenodes/textures/default_lava_flowing.png b/games/globo/mods/basenodes/textures/default_lava_flowing.png
new file mode 100644
index 000000000..07066a6e3
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_lava_flowing.png differ
diff --git a/games/globo/mods/basenodes/textures/default_leaves.png b/games/globo/mods/basenodes/textures/default_leaves.png
new file mode 100644
index 000000000..c0475d4d2
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_leaves.png differ
diff --git a/games/globo/mods/basenodes/textures/default_mossycobble.png b/games/globo/mods/basenodes/textures/default_mossycobble.png
new file mode 100644
index 000000000..69585e37b
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_mossycobble.png differ
diff --git a/games/globo/mods/basenodes/textures/default_pine_needles.png b/games/globo/mods/basenodes/textures/default_pine_needles.png
new file mode 100644
index 000000000..137caa2a3
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_pine_needles.png differ
diff --git a/games/globo/mods/basenodes/textures/default_pine_tree.png b/games/globo/mods/basenodes/textures/default_pine_tree.png
new file mode 100644
index 000000000..5743183c0
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_pine_tree.png differ
diff --git a/games/globo/mods/basenodes/textures/default_pine_tree_top.png b/games/globo/mods/basenodes/textures/default_pine_tree_top.png
new file mode 100644
index 000000000..cc18f3462
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_pine_tree_top.png differ
diff --git a/games/globo/mods/basenodes/textures/default_river_water.png b/games/globo/mods/basenodes/textures/default_river_water.png
new file mode 100644
index 000000000..e1074d2ef
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_river_water.png differ
diff --git a/games/globo/mods/basenodes/textures/default_river_water_flowing.png b/games/globo/mods/basenodes/textures/default_river_water_flowing.png
new file mode 100644
index 000000000..4a756b2bd
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_river_water_flowing.png differ
diff --git a/games/globo/mods/basenodes/textures/default_sand.png b/games/globo/mods/basenodes/textures/default_sand.png
new file mode 100644
index 000000000..0ed0e4ceb
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_sand.png differ
diff --git a/games/globo/mods/basenodes/textures/default_sapling.png b/games/globo/mods/basenodes/textures/default_sapling.png
new file mode 100644
index 000000000..3fd64f02e
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_sapling.png differ
diff --git a/games/globo/mods/basenodes/textures/default_snow_side.png b/games/globo/mods/basenodes/textures/default_snow_side.png
new file mode 100644
index 000000000..f34d10991
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_snow_side.png differ
diff --git a/games/globo/mods/basenodes/textures/default_stone.png b/games/globo/mods/basenodes/textures/default_stone.png
new file mode 100644
index 000000000..763b4396a
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_stone.png differ
diff --git a/games/globo/mods/basenodes/textures/default_tree.png b/games/globo/mods/basenodes/textures/default_tree.png
new file mode 100644
index 000000000..189ec1593
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_tree.png differ
diff --git a/games/globo/mods/basenodes/textures/default_tree_top.png b/games/globo/mods/basenodes/textures/default_tree_top.png
new file mode 100644
index 000000000..d1a4fa704
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_tree_top.png differ
diff --git a/games/globo/mods/basenodes/textures/default_water.png b/games/globo/mods/basenodes/textures/default_water.png
new file mode 100644
index 000000000..3e385ae8b
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_water.png differ
diff --git a/games/globo/mods/basenodes/textures/default_water_flowing.png b/games/globo/mods/basenodes/textures/default_water_flowing.png
new file mode 100644
index 000000000..7cdafd51d
Binary files /dev/null and b/games/globo/mods/basenodes/textures/default_water_flowing.png differ
diff --git a/games/globo/mods/basenodes/textures/fire_basic_flame_animated.png b/games/globo/mods/basenodes/textures/fire_basic_flame_animated.png
new file mode 100644
index 000000000..434bdffdd
Binary files /dev/null and b/games/globo/mods/basenodes/textures/fire_basic_flame_animated.png differ
diff --git a/games/globo/mods/basenodes/textures/info.txt b/games/globo/mods/basenodes/textures/info.txt
new file mode 100644
index 000000000..2d4ef7efa
--- /dev/null
+++ b/games/globo/mods/basenodes/textures/info.txt
@@ -0,0 +1,7 @@
+
+The dirt_with_grass folder is for testing loading textures from subfolders.
+If it works correctly, the default_grass_side.png file in the folder is used but
+default_grass.png is not overwritten by the file in the folder.
+
+default_dirt.png should be overwritten by the default_dirt.png in the unittests
+mod which depends on basenodes.
diff --git a/games/globo/mods/climate/README.txt b/games/globo/mods/climate/README.txt
new file mode 100644
index 000000000..cea0663d8
--- /dev/null
+++ b/games/globo/mods/climate/README.txt
@@ -0,0 +1,85 @@
+Exile mod: Climate
+=============================
+Adds seasonal weather, as well as functions for checking point temperature, exposure to rain etc.
+
+
+Register weather:
+-----------------
+climate.register_weather(name{def})
+see weathers for examples.
+Can include sky, cloud, and particle effects.
+
+For the weather to occur is must be included in the `Chain` of another weather,
+which is in turn link by link connected into the network of all possible weather
+states.
+This is a Markov chain with temperature adjusted probabilities of switching
+from one state to another.
+
+
+Functions to check weather exposure:
+-----------------------------------
+Only give light if it has already been calculated, otherwise the function will recalculate it.
+
+`climate.get_rain(pos, light[optional])`
+Checks if the position is exposed to significant rain.
+Returns true if raining.
+
+`climate.get_snow(pos, light[optional])`
+Checks if the position is exposed to significant snow.
+Returns true if snowing.
+
+`climate.can_evaporate(pos, light[optional])`
+For water. Temperature based chance of returning true.
+e.g. at 100 degrees it will be 100% chance. At 1 degree it will be a 1% chance.
+
+`climate.can_freeze(pos)`
+For water. Temperature based chance of returning true.
+
+`climate.can_thaw(pos)`
+For ice/snow. Temperature based chance of returning true.
+
+`climate.get_damage_weather(pos, light[optional])`
+Checks if the position is exposed to player harming weather. e.g. duststorms
+
+
+Temperature:
+-----------
+`climate.get_point_temp(pos)`
+Returns the temperature at position. Calculated based on air temperature, and
+the distance adjusted sum of nearby by nodes in `temp_effect` group.
+
+Nodes must be in line of sight (via air or `temp_pass` group) to have an effect.
+Effect weakens with distance.
+Node definition `temp_effect` is the amount the node raises or lowers temperature.
+Node definition `temp_effect_max` is the maximum/minimum effect that node can have.
+
+e.g. `temp_effect` = 50 `temp_effect_max` = 100, will raise temperature by 50 degrees
+but max out at 100.
+e.g. `temp_effect` = -50 `temp_effect_max` = 0, will lower temperature by 50 degrees
+but bottom out at 0.
+e.g. `temp_effect` = 50 `temp_effect_max` = -100, this strange thing will only heat up to -100
+
+air_temp can be used for powerful heating/cooling effects where air movements are important.
+e.g. for ovens, fridges, i.e. the ability to trap air matters.
+
+
+Authors of source code
+----------------------
+Dokimi (GPLv3)
+
+
+
+Authors of media
+----------------
+xeranas:
+-heavy_rain_drops.png - CC-0
+-light_rain_raindrop_*.png - CC-0
+-light_snow_snowflake_*.png - CC-0
+
+inchadney (http://freesound.org/people/inchadney/):
+-rain_drop.ogg - CC-BY-SA 3.0 (cut from http://freesound.org/people/inchadney/sounds/58835/)
+rcproductions54 (http://freesound.org/people/rcproductions54/):
+-light_rain_drop.ogg - CC-0 (http://freesound.org/people/rcproductions54/sounds/265045/)
+
+uberhuberman
+-heavy_rain_drop.ogg - CC BY 3.0 (https://www.freesound.org/people/uberhuberman/sounds/21189/)
diff --git a/games/globo/mods/climate/history.lua b/games/globo/mods/climate/history.lua
new file mode 100644
index 000000000..e877d39ae
--- /dev/null
+++ b/games/globo/mods/climate/history.lua
@@ -0,0 +1,191 @@
+---------------------------------------------------------
+--HISTORY
+--A record of recent climatic conditions
+
+--History is kept in a hexadecimal string for relatively compact storage
+--We have to record four things: sunlight, rainfall, growing temperatures
+-- and crop killing temperatures
+
+--We only store data once every 600 ticks (60 seconds), it changes every
+--60-120 seconds anyway. In-game days take 20 minutes so that's
+-- 20 chunks of data per day, 140 per week 1600 bytes for a season
+-- 6400 (6kb) for a year -- Maybe set that as max? Do we need two+ years?
+
+--Also assumes sunlight between 0.3 and 0.7 timeofday; plants should check
+-- whether they can have sun before calling crop_rewind
+-- ^ minetest.get_natural_light(pos, [timeofday=]0.5)
+
+local floor = math.floor
+climate_history = ""
+
+function load_climate_history(chist)
+ --get history from storage
+ climate_history = chist or ""
+end
+
+function get_climate_history()
+ return climate_history
+end
+
+--record a chunk of climate history
+function record_climate_history(climate)
+ local ch = 0
+ local dtime = minetest.get_timeofday()
+ if dtime >= 0.25 and dtime <= 0.75 then
+ ch = ch + 1 -- sunlight: 0001
+ end
+ local w = climate.active_weather.name
+ if (w == 'overcast_heavy_rain'
+ or w == 'overcast_rain'
+ or w == 'thunderstorm'
+ or w == 'superstorm') then
+ ch = ch + 4 -- rain: 0100
+ end
+ local t = climate.active_temp
+ if t < -30 or t > 60 then
+ ch = ch + 8 -- kill: 1000
+ elseif t >= 0 and t <= 40 then
+ ch = ch + 2 -- grow: 0010
+ end
+ local cstring=string.format("%x", ch)
+ climate_history = cstring..climate_history
+end
+
+
+--read out a specified chunk from the history
+local function history(age)
+ local chunk = {sun=false,grow=false,rain=false,kill=false}
+ local len = #climate_history
+ if len == 0 then
+ return -- No history? Why did we get called then?
+ end
+ --age%len: if we run out of history, loop back and fake it from what we have
+ age = age%(len)
+ local x = tonumber("0x"..string.sub(climate_history, age+1, age+1))
+ -- age+1, strings don't start counting at 0 in lua because someone hates programmers
+
+ --Wish I had lua 5.3 bit operators, but some distros (mine) have old lua
+ if x >= 8 then
+ chunk.kill = true
+ return chunk
+ end
+ if x >= 4 then
+ chunk.rain = true
+ x = x - 4
+ end
+ if x >= 2 then
+ chunk.grow = true
+ x = x - 2
+ end
+ if x >= 1 then
+ chunk.sun = true
+ end
+ return chunk
+end
+
+
+------------------------------
+-- checks the climate record, and returns how much growth to simulate
+-- a -1 indicates killing temperatures were reached, and the crop is dead
+--This function is only valid for the surface, underground crops are separate
+function crop_rewind(duration, timer_avg, mushroom)
+ local growth_ticks = 0
+ local timeradjust = 60/timer_avg -- how many growth ticks per 60 second chunk
+ local chunks = floor(duration / 60)
+ for i = 0,chunks,1 do
+ local conditions = history(i)
+ if conditions == nil then -- we don't have any history!
+ growth_ticks = 0
+ return growth_ticks
+ end
+ if conditions.kill == true then
+ growth_ticks = -1
+ return growth_ticks
+ end
+ if ( conditions.sun == true or mushroom == true )
+ and conditions.grow == true then
+ if conditions.rain == true then
+ growth_ticks = growth_ticks + ( 4 * timeradjust )
+ else
+ growth_ticks = growth_ticks + ( 1 * timeradjust )
+ end
+ end
+ end
+ return floor(growth_ticks)
+end
+
+------------------------------
+-- checks the climate record, and returns how long it rained
+function climate.rain_amount(duration)
+ local chunks = floor(duration / 60)
+ local total = 0
+ for i = 0,chunks,1 do
+ local conditions = history(i)
+ if conditions.rain == true then
+ total = total + 1
+ end
+ end
+ return total
+end
+
+local last_rained -- caches the gametime value of the last rain
+
+function climate.time_since_rain(max_seek)
+ if last_rained then
+ local timesincelast = minetest.get_gametime() - last_rained
+ if timesincelast < max_seek then
+ return timesincelast
+ end
+ end
+
+ local max_chunks = 0
+ if max_seek then
+ max_chunks = floor(max_seek / 60)
+ end
+ for i = 1,max_chunks,1 do
+ local conditions = history(i)
+ if conditions.rain == true
+ then
+ last_rained = minetest.get_gametime() - i*60
+ return i*60
+ end
+ end
+ return 0
+end
+
+--[[
+function exiledatestring()
+ local days = minetest.get_day_count()
+ local time = minetest.get_timeofday()
+ local year = floor((days)/80)+1
+ local cdays = (days)%80 -- days into the current year
+ local seasonnumber = floor((cdays)/20)+1
+ local sdays = cdays%20+1 --days into the current season
+ local season = "Birth"
+ if seasonnumber == 2 then
+ season = "Thirst"
+ elseif seasonnumber == 3 then
+ season = "Retreat"
+ elseif seasonnumber == 4 then
+ season = "Hunger"
+ end
+ local timestr = "small hours"
+ if time >= 0.75 then
+ timestr = "evening"
+ elseif time >= 0.5 then
+ timestr = "afternoon"
+ elseif time >= 0.25 then
+ timestr = "morning"
+ end
+ return ("It is the "..timestr.." of day "..sdays.." of the season of "..season..", in the year of our exile "..year)
+end
+
+minetest.register_chatcommand("date", {
+ params = "",
+ description = "Shows the current date and year of exile.",
+ privs = {},
+ func = function(name, param)
+ minetest.chat_send_player(name, exiledatestring())
+ end,
+})
+]]--
diff --git a/games/globo/mods/climate/init.lua b/games/globo/mods/climate/init.lua
new file mode 100644
index 000000000..59fd50345
--- /dev/null
+++ b/games/globo/mods/climate/init.lua
@@ -0,0 +1,511 @@
+--CLIMATE
+
+--[[
+Uses a markov chain to switch between weather states.
+Has seasonal and diurnal fluctations in temperature, which adjust
+the probability for which switch will occur (e.g rain more likely in cold)
+
+This is climate rather than "weather" in the sense it treats the whole map
+as the same, i.e. not big enough to get regional variation.
+
+
+A specific locations Temperature and more can be called elsewhere (e.g. for health)
+
+]]
+
+
+
+climate = {
+ active_weather = {},
+ active_temp = {},
+ active_sea_temp = {}
+
+}
+
+local modpath = minetest.get_modpath("climate")
+local store = minetest.get_mod_storage()
+
+
+-- Adds weather to register_weathers table
+--all possible weather states
+local registered_weathers = {}
+
+-- Keeps sound handler references
+local sound_handlers = {}
+
+climate.register_weather = function(weather_obj)
+ table.insert(registered_weathers, weather_obj)
+end
+
+dofile(modpath .. "/particles.lua")
+dofile(modpath .. "/temperature.lua")
+dofile(modpath .. "/history.lua")
+--weathers
+dofile(modpath .. "/weathers/clear.lua")
+dofile(modpath .. "/weathers/light_cloud.lua")
+dofile(modpath .. "/weathers/medium_cloud.lua")
+dofile(modpath .. "/weathers/sun_shower.lua")
+dofile(modpath .. "/weathers/light_rain.lua")
+dofile(modpath .. "/weathers/overcast_light_rain.lua")
+dofile(modpath .. "/weathers/overcast.lua")
+dofile(modpath .. "/weathers/overcast_rain.lua")
+dofile(modpath .. "/weathers/overcast_heavy_rain.lua")
+dofile(modpath .. "/weathers/thunderstorm.lua")
+dofile(modpath .. "/weathers/superstorm.lua")
+dofile(modpath .. "/weathers/light_haze.lua")
+dofile(modpath .. "/weathers/haze.lua")
+dofile(modpath .. "/weathers/duststorm.lua")
+dofile(modpath .. "/weathers/snow_flurry.lua")
+dofile(modpath .. "/weathers/light_snow.lua")
+dofile(modpath .. "/weathers/overcast_light_snow.lua")
+dofile(modpath .. "/weathers/overcast_snow.lua")
+dofile(modpath .. "/weathers/overcast_heavy_snow.lua")
+dofile(modpath .. "/weathers/snowstorm.lua")
+dofile(modpath .. "/weathers/fog.lua")
+
+
+
+--setting...for random intervals
+local base_interval = 90
+local base_int_range = 30
+
+--temp classes for probabilities
+local plvl_froz = -1
+local plvl_cold = 15
+local plvl_mid = 25
+
+
+--what weather is on, and how long it will last, and temp
+--random values that should get overriden by mod storage
+climate.active_weather = registered_weathers[math.random(#registered_weathers)]
+climate.active_temp = math.random(15,25)
+climate.sea_temp = climate.active_temp * math.random(0.6,8)
+local active_weather_interval = 1
+
+
+--random walk, for temp
+local ran_walk_range = 10
+local ran_walk = math.random(-ran_walk_range,ran_walk_range)
+
+--------------------------
+-- Functions
+--------------------------
+
+--------------------
+--create a random interval for the weather to last
+local function set_active_interval()
+ local intv = base_interval + math.random(-base_int_range, base_int_range)
+ return intv
+end
+
+local function get_seasonal_waves()
+ --get seasonal wave
+ local dc = minetest.get_day_count() - 10
+ --diff +/- from yearly mean (seasonal variation)
+ local dc_amp = 17
+ --~80 day year, 20 day seasons
+ local dc_period = (2*math.pi)/80
+ --yearly average,
+ local dc_mean = 13
+ local dc_wav = dc_amp * math.sin(dc * dc_period) + dc_mean
+ --seawater temp change has lower amplitude, behind 2 days from mass of water
+ --Fudged loosely from McCombie's 1959 "Some Relations Between Air
+ -- Temperatures and the Surface Temperature of Lakes", Wiley Online Library
+ local sea_wav = (dc_amp-5) * math.sin((dc - 2) * dc_period) + dc_mean
+ return dc_wav, sea_wav
+end
+
+-----------------
+--set the sky, for on join and when new weather set
+local function set_sky_clouds(player)
+ local active_weather = climate.active_weather
+
+ player:set_sky(active_weather.sky_data)
+ player:set_clouds(active_weather.cloud_data)
+ local wth = table.copy(active_weather)
+ local actmp, _ = get_seasonal_waves()
+ actmp = actmp - 15 -- move centerpoint
+ wth.moon_data.scale = wth.moon_data.scale + (-actmp / 50 + 0.3)
+ wth.sun_data.scale = wth.sun_data.scale + (actmp / 50 + 0.3)
+ player:set_moon(wth.moon_data)
+ player:set_sun(wth.sun_data)
+ player:set_stars(active_weather.star_data)
+end
+
+-----------------
+local function get_weather_table(name, registered_weathers)
+ for i, reg_weather in ipairs(registered_weathers) do
+ if name == reg_weather.name then
+ local active_weather = reg_weather
+ return active_weather
+ end
+ end
+ --error, got a name it can't find
+ --currently will likely make it crash
+ minetest.log("error", "Climate: "..name.." not found")
+ return
+
+end
+
+-------------------------
+--SAVE AND LOAD
+
+--[[
+--on_leave seems incapable of saving stuff :-(
+minetest.register_on_leaveplayer(function(player)
+ --save climate info it your the last one out
+ local num_p = minetest.get_connected_players()
+ if #num_p <=1 then
+ local name = climate.active_weather.name
+ local t = climate.active_temp
+ store:set_string("weather", name)
+ store:set_float("temp", t)
+ end
+end)
+]]--
+
+minetest.register_on_joinplayer(function(player)
+ --get weather from storage, override random start values
+ local num_p = minetest.get_connected_players()
+ if #num_p <=1 then
+
+ local w_name = store:get_string("weather")
+
+ if w_name ~= "" then
+ --check valid
+ local weather = get_weather_table(w_name, registered_weathers)
+ if weather then
+ climate.active_weather = weather
+ minetest.log("action", "Loaded a valid weather: "..w_name)
+ else
+ minetest.log("error", "Invalid weather loaded: "..w_name)
+ end
+ else
+ minetest.log("warning", "No previous weather could be loaded")
+ end
+
+ --same again, but for temperature
+ local temp = store:get_float("temp")
+ if temp then
+ climate.active_temp = temp
+ end
+ local stemp = store:get_float("sea_temp")
+ if stemp then
+ climate.active_sea_temp = stemp
+ end
+
+ --same again, but for ran_walk
+ local ranw = store:get_float("ran_walk")
+ if ranw then
+ ran_walk = ranw
+ end
+
+ --load climate_history
+ local ch = store:get_string("climate_history")
+ if ch ~= nil then
+ load_climate_history(ch)
+ end
+
+ end
+
+ --set weather effects for this player
+ set_sky_clouds(player)
+ local p_name = player:get_player_name()
+ if climate.active_weather.sound_loop then
+ sound_handlers[p_name] = minetest.sound_play(
+ climate.active_weather.sound_loop, {to_player = p_name, loop = true})
+ end
+ -- minetest.chat_send_player(p_name, exiledatestring())
+end)
+
+local function select_new_active_weather()
+ --select a new active_weather from probabilities
+ --it will loop through and try to change the weather
+ local new_weather_name
+ for n, next in pairs(climate.active_weather.chain) do
+ --roll dice
+ local c = math.random()
+ --use temperature adjusted probability
+ if climate.active_temp < plvl_froz then
+ --frozen temperature
+ if next[2] > c then
+ new_weather_name = next[1]
+ end
+ elseif climate.active_temp < plvl_cold then
+ --cold temperature
+ if next[3] > c then
+ new_weather_name = next[1]
+ end
+ elseif climate.active_temp < plvl_mid then
+ --mid temperature
+ if next[4] > c then
+ new_weather_name = next[1]
+ end
+ else
+ --hot temperature
+ if next[5] > c then
+ new_weather_name = next[1]
+ end
+ end
+ end
+
+ --did it succeed in getting a new state?
+ if new_weather_name and new_weather_name ~= climate.active_weather.name then
+
+ --we need to update the sky and set the new
+ climate.active_weather = get_weather_table(new_weather_name,
+ registered_weathers)
+ end
+ --do for each player
+ for _,player in ipairs(minetest.get_connected_players()) do
+ --set sky and clouds for new state using the new active_weather
+ set_sky_clouds(player)
+ end
+end
+
+local function set_world_temperature()
+ --this is a universal temperature for the whole map
+ --we treat the whole map as one coherent region, with a single climate
+ --specific player temp adjusted from this (e.g. by altitude)
+
+ --get day night wave
+ local tod = minetest.get_timeofday()
+ --diff between day and night is this x2
+ local dn_amp = -8
+ local dn_period = (2*math.pi)/1 ---match day length
+ local dn_wav = dn_amp * math.cos(tod * dn_period)
+
+ --random walk...an incremental fluctuation that is capped
+ ran_walk = ran_walk + math.random(-2, 2)
+ if ran_walk > ran_walk_range or ran_walk < -ran_walk_range then
+ ran_walk = ran_walk/1.04
+ end
+ local dc_wav, sea_wav = get_seasonal_waves()
+ --sum waves plus some random noise
+ climate.active_temp = dc_wav + dn_wav + ran_walk
+ climate.active_sea_temp = sea_wav + ((dn_wav + ran_walk) * 0.3)
+ --save state so can be reloaded.
+ --only actually needed on log out,... but that doesn't work
+ store:set_string("weather", climate.active_weather.name)
+ store:set_float("temp", climate.active_temp)
+ store:set_float("sea_temp", climate.active_sea_temp)
+ store:set_float("ran_walk", ran_walk)
+end
+
+local function update_player_sounds(p_name)
+ --remove old sounds
+ local sound = sound_handlers[p_name]
+ if sound ~= nil then
+ minetest.sound_stop(sound)
+ sound_handlers[p_name] = nil
+ end
+ --add new loop
+ if climate.active_weather.sound_loop then
+ sound_handlers[p_name] = minetest.sound_play(
+ climate.active_weather.sound_loop, {to_player = p_name, loop = true})
+ end
+end
+
+--------------------------
+-- Main step
+--------------------------
+
+local timer = 0
+local timer_p = 0
+local timer_r = 0
+
+minetest.register_globalstep(function(dtime)
+ local updatesound = false
+ timer = timer + dtime
+ timer_r = timer_r + dtime
+ --update weather state
+ if timer > active_weather_interval then
+ --timer has expired, switch to a new weather state
+ --print(" Updating weather at "..minetest.get_gametime())
+ --reset timer and interval
+ timer = 0
+ active_weather_interval = set_active_interval()
+ --save interval
+ --mod_storage:set_float('active_weather_interval', active_weather_interval)
+ set_world_temperature()
+ select_new_active_weather()
+ updatesound = true
+ end
+ if timer_r >= 60 then -- it's time to record changes
+ record_climate_history(climate)
+ store:set_string("climate_history", get_climate_history())
+ timer_r = 0
+ end
+ timer_p = timer_p + dtime
+ for _,player in ipairs(minetest.get_connected_players()) do
+ local pos = player:get_pos()
+ local p_name = player:get_player_name()
+ local sound = sound_handlers[p_name]
+ if pos.y > -12 then
+ if updatesound or sound == nil then
+ update_player_sounds(p_name)
+ end
+ --fast weather effects for aboveground players
+ if (climate.active_weather.particle_interval and
+ timer_p > climate.active_weather.particle_interval) then
+ -- do particle effects for current weather
+ climate.active_weather.particle_function(player)
+ end
+ elseif pos.y < -11 and sound then
+ local x = 1-(-1*pos.y-12)/5
+ if x < 0 then
+ minetest.sound_stop(sound)
+ sound_handlers[p_name] = nil
+ else
+ minetest.sound_fade(sound, 0.5, x)
+ end
+ elseif pos.y > -17 and not sound then
+ sound_handlers[p_name] =
+ minetest.sound_play(climate.active_weather.sound_loop,
+ {to_player = p_name, loop = true, gain = 0.1})
+ end
+ end
+
+ if (climate.active_weather.particle_interval and
+ timer_p > climate.active_weather.particle_interval) then
+ timer_p = 0
+ end
+
+end)
+
+--------------------------------------------------------------------
+--CHAT COMMANDS
+
+
+minetest.register_privilege("set_temp", {
+ description = "Set the Climate active temperature",
+ give_to_singleplayer = false
+})
+
+
+minetest.register_chatcommand("set_temp", {
+ params = "",
+ description = "Set the Climate active temperature",
+ privs = {privs=true},
+ func = function(name, param)
+ local newtemp = tonumber(param)
+ if not newtemp then
+ return false, ("Unadjusted base temp: "..climate.active_temp)
+ end
+ if newtemp < -100 or newtemp > 100 then
+ return false, "Invalid temperature"
+ end
+ if minetest.check_player_privs(name, {set_temp = true}) then
+ climate.active_temp = newtemp
+
+ --only actually needed on log out,... but that doesn't work
+ store:set_float("temp", climate.active_temp)
+
+ return true, "Climate active temperature set to: "..newtemp
+
+ else
+ return false, "You need the set_temp privilege to use this command."
+ end
+ end,
+})
+
+
+
+-------------
+
+minetest.register_privilege("set_weather", {
+ description = "Set the Climate active weather",
+ give_to_singleplayer = false
+})
+
+
+minetest.register_chatcommand("set_weather", {
+ params = " | help",
+ description = "Set the Climate active weather",
+ privs = {set_weather=true},
+ func = function(name, param)
+ if minetest.check_player_privs(name, {set_weather = true}) then
+ --check valid
+ if param == "help" then
+ local wlist = "Available weather states:\n"
+ for i = 1,#registered_weathers do
+ wlist = wlist..registered_weathers[i].name.."\n"
+ end
+ return false, wlist
+ end
+
+ local weather = get_weather_table(param, registered_weathers)
+ if weather then
+ climate.active_weather = weather
+ --do for each player
+ for _,player in ipairs(minetest.get_connected_players()) do
+ --set sky and clouds for new state using the new active_weather
+
+ set_sky_clouds(player)
+
+ --remove old sounds
+ local p_name = player:get_player_name()
+ local sound = sound_handlers[p_name]
+ if sound ~= nil then
+ minetest.sound_stop(sound)
+ sound_handlers[p_name] = nil
+ end
+ --add new loop
+ if climate.active_weather.sound_loop then
+ sound_handlers[p_name] = minetest.sound_play(climate.active_weather.sound_loop, {to_player = p_name, loop = true})
+ end
+
+ end
+ --only actually needed on log out,... but that doesn't work
+ store:set_string("weather", climate.active_weather.name)
+
+ return true, "Climate active weather set to: "..param
+ else
+ return false, ("Current weather is "..climate.active_weather.name)
+ end
+
+ else
+ return false, "You need the set_temp privilege to use this command."
+ end
+ end,
+})
+
+-------------
+
+minetest.register_chatcommand("set_tempscale", {
+ params = "c | f | k",
+ description = "Sets the temperature scale used for your own display",
+ func = function(name, param)
+ if param == "" or param == "help" then
+ local wlist = "/set_tempscale:\n"..
+ "Sets the temperature scale used for your own display.\n" ..
+ "Valid settings are c for Celsius, f for Fahrenheit, and "..
+ "k for Kelvin."
+ return false, wlist
+ end
+ if param ~= "f" and param ~= "c" and param ~= "k" then
+ return false, "Invalid scale. Use c, f, or k."
+ end
+ local player = minetest.get_player_by_name(name)
+ local meta = player:get_meta()
+ if param == "f" then
+ meta:set_string("TempScalePref", "Fahrenheit")
+ elseif param == "k" then
+ meta:set_string("TempScalePref", "Kelvin")
+ else
+ meta:set_string("TempScalePref", "Celsius")
+ end
+ end,
+})
+
+--[[
+minetest.register_on_mods_loaded(function()
+ if beerchat then -- we have beerchat installed, add a date command
+ beerchat.register_relaycommand("date", function()
+ local date = exiledatestring()
+ return date
+ end)
+ end
+end)
+
+]]--
diff --git a/games/globo/mods/climate/mod.conf b/games/globo/mods/climate/mod.conf
new file mode 100644
index 000000000..2336f5409
--- /dev/null
+++ b/games/globo/mods/climate/mod.conf
@@ -0,0 +1,3 @@
+name = climate
+description = Weather and temperature.
+author = Dokimi
diff --git a/games/globo/mods/climate/particles.lua b/games/globo/mods/climate/particles.lua
new file mode 100644
index 000000000..734362ca9
--- /dev/null
+++ b/games/globo/mods/climate/particles.lua
@@ -0,0 +1,205 @@
+---------------------------------------
+-- Particles helpers
+---------------------------------------
+
+
+-- trying to locate position for particles by player look direction for performance reason.
+-- it is costly to generate many particles around player so goal is focus mainly on front view.
+local get_random_pos = function(player, offset)
+ local look_dir = player:get_look_dir()
+ local player_pos = player:get_pos()
+
+ local random_pos_x = 0
+ local random_pos_y = 0
+ local random_pos_z = 0
+
+ if look_dir.x > 0 then
+ if look_dir.z > 0 then
+ random_pos_x = math.random(player_pos.x - offset.back, player_pos.x + offset.front) + math.random()
+ random_pos_z = math.random(player_pos.z - offset.back, player_pos.z + offset.front) + math.random()
+ else
+ random_pos_x = math.random(player_pos.x - offset.back, player_pos.x + offset.front) + math.random()
+ random_pos_z = math.random(player_pos.z - offset.front, player_pos.z + offset.back) + math.random()
+ end
+ else
+ if look_dir.z > 0 then
+ random_pos_x = math.random(player_pos.x - offset.front, player_pos.x + offset.back) + math.random()
+ random_pos_z = math.random(player_pos.z - offset.back, player_pos.z + offset.front) + math.random()
+ else
+ random_pos_x = math.random(player_pos.x - offset.front, player_pos.x + offset.back) + math.random()
+ random_pos_z = math.random(player_pos.z - offset.front, player_pos.z + offset.back) + math.random()
+ end
+ end
+
+ if offset.bottom ~= nil then
+ random_pos_y = math.random(player_pos.y - offset.bottom, player_pos.y + offset.top)
+ else
+ random_pos_y = player_pos.y + offset.top
+ end
+
+ return {x=random_pos_x, y=random_pos_y, z=random_pos_z}
+end
+
+
+
+-- checks if player is undewater. This is needed in order to
+-- turn off weather particles generation.
+local is_underwater = function(player)
+ local ppos = player:get_pos()
+ if not ppos then return end -- player disconnected
+ local offset = player:get_eye_offset()
+ local player_eye_pos = {
+ x = ppos.x + offset.x,
+ y = ppos.y + offset.y + 1.5,
+ z = ppos.z + offset.z}
+ local node_level = minetest.get_node_level(player_eye_pos)
+ if node_level == 8 or node_level == 7 then
+ return true
+ end
+ return false
+end
+
+
+-- outdoor check based on node light level
+local is_outdoor = function(pos, offset_y)
+ if offset_y == nil then
+ offset_y = 0
+ end
+
+ if minimal.get_daylight({x=pos.x, y=pos.y + offset_y, z=pos.z}, 0.5) == 15 then
+ return true
+ end
+ return false
+end
+
+
+
+
+climate.add_particle = function(vel, acc, ext, size, tex, player)
+ if not player then
+ return
+ end
+ if is_underwater(player) then
+ return
+ end
+
+ --Far particle
+ local offset = {
+ front = 8,
+ back = 5,
+ top = 12
+ }
+
+ local random_pos = get_random_pos(player, offset)
+ local name = player:get_player_name()
+
+ --check if under cover
+ if is_outdoor(random_pos) then
+
+ minetest.add_particle({
+ pos = {x=random_pos.x, y=random_pos.y, z=random_pos.z},
+ velocity = {x=0, y= vel, z=0},
+ acceleration = {x=0, y=acc, z=0},
+ expirationtime = ext,
+ size = math.random(size/2, size),
+ collisiondetection = true,
+ collision_removal = true,
+ vertical = true,
+ texture = tex,
+ playername = name
+ })
+
+ end
+
+ --close particle
+ offset = {
+ front = 2,
+ back = 0,
+ top = 6
+ }
+
+ local random_pos = get_random_pos(player, offset)
+
+ --check if under cover
+ if is_outdoor(random_pos) then
+
+ minetest.add_particle({
+ pos = {x=random_pos.x, y=random_pos.y, z=random_pos.z},
+ velocity = {x=0, y= vel, z=0},
+ acceleration = {x=0, y=acc, z=0},
+ expirationtime = ext/2,
+ size = math.random(size/2, size),
+ collisiondetection = true,
+ collision_removal = true,
+ vertical = true,
+ texture = tex,
+ playername = name
+ })
+ end
+end
+
+--e.g. duststorm, or more floaty
+climate.add_blizzard_particle = function(velxz, vely, accxz, accy, ext,
+ size, tex, player)
+ if not player then
+ return
+ end
+ if is_underwater(player) then
+ return
+ end
+
+ --Far particle
+ local offset = {
+ front = 7,
+ back = 3,
+ top = 6
+ }
+
+ local random_pos = get_random_pos(player, offset)
+
+ local name = player:get_player_name()
+
+ --check if under cover
+ if is_outdoor(random_pos) then
+
+ minetest.add_particle({
+ pos = {x=random_pos.x, y=random_pos.y, z=random_pos.z},
+ velocity = {x=velxz, y= vely, z=velxz},
+ acceleration = {x=accxz, y=accy, z=accxz},
+ expirationtime = ext,
+ size = math.random(size/2, size),
+ collisiondetection = true,
+ collision_removal = true,
+ vertical = true,
+ texture = tex,
+ playername = name
+ })
+
+ end
+
+ --close particle
+ offset = {
+ front = 3,
+ back = 1,
+ top = 3
+ }
+
+ local random_pos = get_random_pos(player, offset)
+
+ --check if under cover
+ if is_outdoor(random_pos) then
+
+ minetest.add_particle({
+ pos = {x=random_pos.x, y=random_pos.y, z=random_pos.z},
+ velocity = {x=velxz, y= vely, z=velxz},
+ acceleration = {x=accxz, y=accy, z=accxz},
+ expirationtime = ext/2,
+ size = math.random(size/2, size),
+ collisiondetection = true,
+ collision_removal = true,
+ vertical = true,
+ texture = tex,
+ playername = name
+ })
+ end
+end
diff --git a/games/globo/mods/climate/sounds/duststorm_loop.ogg b/games/globo/mods/climate/sounds/duststorm_loop.ogg
new file mode 100644
index 000000000..805b97a8c
Binary files /dev/null and b/games/globo/mods/climate/sounds/duststorm_loop.ogg differ
diff --git a/games/globo/mods/climate/sounds/duststorm_loop_light.ogg b/games/globo/mods/climate/sounds/duststorm_loop_light.ogg
new file mode 100644
index 000000000..faf10bc1b
Binary files /dev/null and b/games/globo/mods/climate/sounds/duststorm_loop_light.ogg differ
diff --git a/games/globo/mods/climate/sounds/heavy_rain_loop.ogg b/games/globo/mods/climate/sounds/heavy_rain_loop.ogg
new file mode 100644
index 000000000..a5a055858
Binary files /dev/null and b/games/globo/mods/climate/sounds/heavy_rain_loop.ogg differ
diff --git a/games/globo/mods/climate/sounds/light_rain_loop.ogg b/games/globo/mods/climate/sounds/light_rain_loop.ogg
new file mode 100644
index 000000000..cc2efafb7
Binary files /dev/null and b/games/globo/mods/climate/sounds/light_rain_loop.ogg differ
diff --git a/games/globo/mods/climate/sounds/rain_loop.ogg b/games/globo/mods/climate/sounds/rain_loop.ogg
new file mode 100644
index 000000000..ba2ea2721
Binary files /dev/null and b/games/globo/mods/climate/sounds/rain_loop.ogg differ
diff --git a/games/globo/mods/climate/sounds/snowstorm_loop.ogg b/games/globo/mods/climate/sounds/snowstorm_loop.ogg
new file mode 100644
index 000000000..2419b0d08
Binary files /dev/null and b/games/globo/mods/climate/sounds/snowstorm_loop.ogg differ
diff --git a/games/globo/mods/climate/sounds/snowstorm_loop_light.ogg b/games/globo/mods/climate/sounds/snowstorm_loop_light.ogg
new file mode 100644
index 000000000..e5ddce455
Binary files /dev/null and b/games/globo/mods/climate/sounds/snowstorm_loop_light.ogg differ
diff --git a/games/globo/mods/climate/temperature.lua b/games/globo/mods/climate/temperature.lua
new file mode 100644
index 000000000..467026a34
--- /dev/null
+++ b/games/globo/mods/climate/temperature.lua
@@ -0,0 +1,798 @@
+----------------------------------------------
+--TEMPERATURE
+--functions for calculating position temperature
+--also for getting weather status
+-- for use by other mods (e.g. health)
+
+local c_alpha = minimal.compat_alpha
+
+
+-------------------------------
+--OUTDOORS AND EXPOSED TO ELEMENTS
+
+--significantly raining/wet
+--i.e. will expose to significant water, put out fires etc
+climate.get_rain = function(pos, l)
+ if pos.y < -30 then
+ return false
+ end
+ --check if raining and outside
+ if not l then
+ l = minimal.get_daylight({x=pos.x, y=pos.y + 1, z=pos.z}, 0.5)
+ end
+
+ local w = climate.active_weather.name
+
+ if l == 15
+ and (w == 'overcast_heavy_rain'
+ or w == 'overcast_rain'
+ or w == 'thunderstorm'
+ or w == 'superstorm') then
+ return true
+ else
+ return false
+ end
+end
+
+--significant snowing
+--e.g. enough for snow build up
+climate.get_snow = function(pos, l)
+ if pos.y < -30 then
+ return false
+ end
+ --check if raining and outside
+ if not l then
+ l = minimal.get_daylight({x=pos.x, y=pos.y + 1, z=pos.z}, 0.5)
+ end
+
+ local w = climate.active_weather.name
+
+ if l == 15
+ and (w == 'overcast_heavy_snow'
+ or w == 'overcast_snow'
+ or w == 'snowstorm') then
+ return true
+ else
+ return false
+ end
+end
+
+
+--evaporatable
+climate.can_evaporate = function(pos, l)
+
+ --must have air to be taken up by
+ local posa = {x=pos.x, y=pos.y + 1, z=pos.z}
+ if minetest.get_node(posa).name ~= "air" then
+ return false
+ end
+
+ if not l then
+ l = minimal.get_daylight(posa, 0.5)
+ end
+
+ --not when raining, i.e high humidity
+ if not climate.get_rain(pos, l) then
+
+ --higher chance of evap at higher temp.
+ local t = climate.get_point_temp(pos)
+ if t > 500 then
+ --so hot things would get steamy fast
+ return true
+ elseif t > math.random(0,1000) then
+ --none below 0 C, 10% chance at 100 C
+ return true
+ end
+ end
+
+ return false
+end
+
+
+--freeze
+climate.can_freeze = function(pos)
+
+ local c = math.random(-50,0)
+
+ --stop freezing underwater
+ --although technically you should be able to do it
+ --given large volume of seas means lots of underwater ice
+ --even if probabilities are low
+ local t
+
+ local posa = {x=pos.x, y=pos.y + 1, z=pos.z}
+ local node = minetest.get_node(posa).name
+ if minetest.get_item_group(node, "water") > 0 then
+ return false
+ elseif minetest.get_item_group(node, "air") > 0 then
+ --use air temp for air exposed ()
+ t = climate.get_point_temp(posa)
+ else
+ t = climate.get_point_temp(pos)
+ end
+
+ --higher chance of freeze at lower temp.
+ if t <= c then
+ -- e.g. at -25 will freeze half the time.
+ return true
+ end
+
+ return false
+end
+
+
+--thaw frozen
+climate.can_thaw = function(pos)
+
+ local posa = {x=pos.x, y=pos.y + 1, z=pos.z}
+
+ --threshold must be low,
+ --as its getting cooled by the ice itself
+ local c = math.random(0,12)
+
+ --rain washes it away
+ if c < 2 then
+ if climate.get_rain(posa) then
+ return true
+ end
+ end
+
+ --frozen nodes are also temp-source so have to
+ --check outside the nodes
+ --check above, or check below
+ --water is an effective melting agent, so adjust c
+ local node
+
+ if c <6 then
+ --above
+ node = minetest.get_node(posa).name
+ else
+ --below
+ posa.y = posa.y - 2
+ node = minetest.get_node(posa).name
+ end
+
+ if minetest.get_item_group(node, "water") > 0 then
+ c = math.floor(c/3)
+ end
+
+ if climate.get_point_temp(posa) > c then
+ return true
+ end
+
+ return false
+end
+
+
+--exposed to lethal weather e.g. choking duststorm
+--i.e. will expose to significant harm, do player damage
+climate.get_damage_weather = function(pos, l)
+ if pos.y < -30 then
+ return false
+ end
+ --check if a damage weather and outside
+ if not l then
+ l = minimal.get_daylight({x=pos.x, y=pos.y + 1, z=pos.z}, 0.5)
+ end
+
+ if l == 15 and climate.active_weather.damage then
+ return true
+ else
+ return false
+ end
+end
+
+
+
+---------------------------------
+--POINT TEMPERATURE
+
+--apply heatable group if node is heatable
+--heatable nodes carry extra heat or cooling gained from sources
+local adjust_for_heatable = function(pos, name, temp)
+
+ local heatable = minetest.get_item_group(name,"heatable")
+ if heatable then
+ local meta = minetest.get_meta(pos)
+ local boost = meta:get_float("temp")
+ temp = temp + boost
+ end
+
+ return temp
+end
+
+--Shelter.
+local adjust_for_shelter = function(pos, temp, av_temp)
+ --Shelter. Brings temp closer to average
+ --daytime dark is the closest proxy for shelter.
+ local light = minimal.get_daylight({x=pos.x, y=pos.y+1, z=pos.z}, 0.5)
+ if light and light <= 14 then
+ if light <= 10 then -- 1-10
+ temp = (temp*0.25)+(av_temp*0.75)
+ elseif light <= 12 then -- 11-12
+ temp = (temp*0.5)+(av_temp*0.5)
+ else -- 13-14
+ temp = (temp*0.75)+(av_temp*0.25)
+ end
+ end
+
+ return temp
+
+end
+
+
+--adjust raw air temperature to be more appropriate for the location
+local adjust_active_temp = function(pos, temp)
+
+ --average temp (make sure it matches climate)
+ local av_temp = minetest.settings:get("exile_av_temp")
+ av_temp = av_temp and tonumber(av_temp) or 15
+ --Depth calculated to reach av_temp
+ local av_temp_depth = minetest.settings:get("exile_av_temp_depth")
+ av_temp_depth = av_temp_depth and tonumber(av_temp_depth) or -12
+ local name = minetest.get_node(pos).name
+ local water = minetest.get_item_group(name,"water")
+
+
+ --sea water for deep ocean --stratification and density set a constant temperature
+ if water == 2 and pos.y < -40 then
+ temp = 4
+ return temp
+ end
+
+ -------------------------------
+ --Underground
+ if pos.y < av_temp_depth then
+ --average temp, heating under the earth. ~ 25C/km
+ --calculate depth factor based on temp of 40 at -1000
+ local av_depth_factor = (40 - av_temp) / (-1000-av_temp_depth)
+ temp = av_depth_factor*(pos.y-av_temp_depth) + av_temp
+ temp = adjust_for_heatable(pos, name, temp)
+ return temp
+ end
+
+ --transition to underground
+ if pos.y <= 0 and water ==0 then
+ --below ground is closer to average
+ --should probably match to heightmap rather than y = 0 (maybe unnecessarily complicated)
+ local x = (-1*pos.y+av_temp_depth)*(1/av_temp_depth)
+ temp = (temp*x)+(av_temp*(1-x))
+ temp = adjust_for_shelter(pos, temp, av_temp)
+ temp = adjust_for_heatable(pos, name, temp)
+ return temp
+ end
+
+ -------------------------
+ --Above ground and oceans
+
+ --altitude cooling. ~ -2C per 300m
+ if pos.y > 50 and pos.y <= 9000 then
+ temp = -0.0067*pos.y + temp
+ end
+
+ --Shelter.
+ temp = adjust_for_shelter(pos, temp, av_temp)
+
+
+ --Water and oceans
+ if water ~= 0 then
+
+ --water is closer to average than air...
+ --also a little colder +(av_sea_temp *0.75)
+ temp = climate.active_sea_temp
+ temp = adjust_for_heatable(pos, name, temp) --currently nothing fits this
+
+ --apply caps (not frozen or boiling)
+ --freezing/boiling dynamics should kick in (in nodes_nature)
+ if temp > 100 then
+ temp = 100
+ return temp
+ elseif temp < 0 then
+ temp = 0
+ return temp
+ else
+ return temp
+ end
+ end
+
+ temp = adjust_for_heatable(pos, name, temp)
+ return temp
+
+end
+
+
+
+
+
+
+
+
+
+
+---------------------------------------------------------------
+--Heatable
+--nodes which can hold a temperature
+--can be significantly heated or cooled e.g. for smelting
+
+
+local function swap_air(old_pos, new_pos, temp_m)
+ local oldname = minetest.get_node(old_pos).name
+ if minetest.get_node(new_pos).name == "air" then
+ local timer = 8
+ minetest.set_node(old_pos, {name = 'air'})
+ minetest.set_node(new_pos, {name = oldname})
+ local meta = minetest.get_meta(new_pos)
+ meta:set_float("temp", temp_m)
+ minetest.get_node_timer(new_pos):start(math.random(timer, timer*2))
+ return true
+ end
+end
+
+
+--For air_temp. Heat based movement. returns if moved or not
+local move_air_nodes = function(pos, meta, temp_m)
+ --heat rises -cold sink
+ local pos_new
+ if temp_m > 0 then
+ pos_new = {x=pos.x, y=pos.y +1, z=pos.z}
+ else
+ pos_new = {x=pos.x, y=pos.y -1, z=pos.z}
+ end
+
+ --movement
+ if pos_new and swap_air(pos, pos_new, temp_m) then
+ return true
+ end
+ --blocked above/below, so look for nearby air or temp_flow nodes
+ local targets = {}
+ local pos_air = minetest.find_node_near(pos, 1, 'air')
+ if pos_air then
+ table.insert(targets, pos_air)
+ end
+ local pos_pass = minetest.find_node_near(pos, 1, 'group:temp_flow')
+ if pos_pass then
+ local tf = minetest.get_item_group(minetest.get_node(pos_pass).name,
+ "temp_flow")
+ if tf > math.random(0, 100) then
+ local vec = vector.direction(pos, pos_pass)
+ pos_pass = vector.add(pos_pass, vec)
+ table.insert(targets, pos_pass)
+ end
+ end
+ if #targets >=1 then -- pick one if we have two options
+ local num = math.random(1, #targets)
+ if swap_air(pos, targets[num], temp_m) then
+ return true
+ end
+ end
+ return false
+end
+
+
+
+
+
+--anything in heatable group must already be running a node timer,
+--and call heat_transfer function.
+-- (e.g. as part of the smelting function. )
+
+--replace is optional node to turn it into when its heat effect is gone
+--e.g. air_temp -> air (has to makes sense with both cooling and heating)
+function climate.heat_transfer(pos, nodename, replace)
+
+ --get current accumulated temperature
+ --remember meta temp is a booster, not the positions actual temp
+ local meta = minetest.get_meta(pos)
+ local temp_m = meta:get_float("temp")
+
+ --remove node when boost is too small (if set)
+ if replace then
+ if temp_m <= 1 and temp_m >= -1 then
+ minetest.set_node(pos, {name = replace})
+ return false
+ end
+ end
+
+ --heat transfers (exchange heat with other 'heatable')
+
+ local pos_neighs = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
+ {"group:heatable"})
+
+ if #pos_neighs > 0 then
+ --doing this instead of minetest.find_node_near due to directional bias
+ local neighbor = pos_neighs[math.random(#pos_neighs)]
+
+ --heat flows down a gradient
+ local meta_new = minetest.get_meta(neighbor)
+ local temp_new = meta_new:get_float("temp")
+ local t_diff = temp_m - temp_new
+ local t_mo = math.abs(t_diff/4)
+ --move quarter the difference to the colder one.
+ --e.g. 8 vs 4. move 1, -> 7, 5
+ --e.g. 20, 2, move 4.5 -> 15.5, 6.5
+
+ --new is colder
+ if t_diff > 0 then
+ temp_m = temp_m - t_mo
+ meta:set_float("temp", temp_m)
+ meta_new:set_int("temp", temp_new + t_mo)
+ else
+ --old is colder
+ temp_m = temp_m + t_mo
+ meta:set_float("temp", temp_m)
+ meta_new:set_int("temp", temp_new - t_mo)
+ end
+
+ end
+
+ --dissappation..lose heat to environment
+ local pos_max = {x=pos.x +1, y=pos.y +1, z=pos.z +1}
+ local pos_min = {x=pos.x -1, y=pos.y -1, z=pos.z -1}
+ local air, cn = minetest.find_nodes_in_area(pos_min, pos_max,
+ {'group:air', 'group:water' })
+ --including group:temp_pass causes problems for doing pottery etc in groups (cools down bc of neighbors).
+ --taking them out of temp_pass would allow exploits (e.g. furnaces built from pots)
+ -- it seems good to let air_temp self cool. Any other temp_pass nodes that ought to be here
+ --will need to be added individually
+ local amb = #air
+
+ --factors: base rate + ambient exposure X strength. * dis_speed = %reduction
+ --dis_speed: 100 % means disspates fast. 0% means disspates slow
+
+ local dis_speed = minetest.get_item_group(nodename, "heatable") /100
+ local dis_rate = ( 0.02 + (amb*0.035) ) * dis_speed
+
+ temp_m = temp_m *(1 - dis_rate)
+ meta:set_float("temp", temp_m)
+
+ if string.sub(nodename,9,16) == "air_temp" then
+ local moved = move_air_nodes(pos, meta, temp_m)
+ --no longer here, stop timer
+ if moved then
+ return false
+ end
+ end
+
+ --made it here without removing the node
+ return true
+
+end
+
+
+
+
+--Air
+--these will move
+local air_def = {
+ description = "Temperature Effect Air",
+ tiles = {"climate_air.png"},
+ drawtype = "airlike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ floodable = true,
+ groups = {temp_pass = 1, heatable = 100, air = 1},
+ on_timer =function(pos, elapsed)
+ return climate.heat_transfer(pos, "climate:air_temp", 'air')
+ end,
+ post_effect_color = {a = 5, r = 254, g = 254, b = 254},
+ color = {a=0, r=254, g = 254, b = 254},
+ use_texture_alpha = c_alpha.blend
+}
+minetest.register_node("climate:air_temp", air_def)
+air_def.description = "Temperature Effect Air (Visible)"
+air_def.drawtype = "allfaces"
+air_def.on_timer = function(pos, elapsed)
+ return climate.heat_transfer(pos, "climate:air_temp_visible", 'air')
+end
+minetest.register_node("climate:air_temp_visible", air_def)
+
+
+--Water
+--add here if that ever becomes necessary
+
+
+
+--node timers call this to heat/cool `heatable` group.
+--if only air around it will create air_temp nodes
+function climate.air_temp_source(pos, temp_effect, temp_max, chance, timer)
+ local at_node = 'climate:air_temp'
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("hot_air") ~= "" then
+ at_node = "climate:air_temp_visible"
+ end
+ --get all surrounding air positions, and heatables
+ local pos_max = {x=pos.x +1, y=pos.y +1, z=pos.z +1}
+ local pos_min = {x=pos.x -1, y=pos.y -1, z=pos.z -1}
+ local heatable = minetest.find_nodes_in_area(pos_min, pos_max, {'air', 'group:heatable'})
+
+ --heat/cool or create air nodes
+ for _, node in pairs(heatable) do
+ --use chance to decide if that postion will be affected
+ --chance is determined by the source (i.e. how powerful it is)
+ if math.random() > chance then
+ local name = minetest.get_node(node).name
+
+ --create air_temp
+ if name == 'air' then
+ --if it is air then create air_temp
+ minetest.set_node(node, {name = at_node })
+ --save temp_effect in meta. This can accumulate over time
+ --and will be added to temp adjust calculations
+ local meta = minetest.get_meta(node)
+ local temp = temp_effect
+ meta:set_float("temp", temp)
+ --set air_temp's timer for movement and dissappation
+ --(first timer step based on the source node e.g. fire's burn rate)...
+ --so that it matches production
+ minetest.get_node_timer(node):start(math.random(timer, timer*2))
+
+ else
+ --heatable group
+ --includes air_temp and anything else
+ --accumulate meta temp from temp_effect capped by temp_max
+ --add a diminishing % of effect the closer gets to cap
+ local meta = minetest.get_meta(node)
+ local temp = meta:get_float("temp")
+
+ local temp_apply = temp_effect*(1-(temp/temp_max))
+
+ --apply temp caps
+ local temp_new = temp + temp_apply
+ --heaters
+ if temp_effect > 0 then
+ if temp_new < temp_max then
+ --still below cap... apply full heat.
+ temp = temp_new
+ elseif temp < temp_max then
+ --can't add full heat, but not yet at cap
+ --so raise it to the cap
+ temp = temp_max
+ end
+ --coolers
+ elseif temp_effect < 0 then
+ if temp_new > temp_max then
+ --still above cap... apply cooling.
+ temp = temp_new
+ elseif temp > temp_max then
+ --can't add full cooling, but not yet at cap
+ --so lower it to the cap
+ temp = temp_max
+ end
+ end
+
+ --update temp
+ meta:set_float("temp", temp)
+ end
+ end
+ end
+
+end
+
+
+
+----------------------------------------------
+--"Radiation" based point temperature method
+--this works, but doesn't allow for realistic furnace design on its own, so...
+--make anything where air movements matter (e.g. fires) produce the above air nodes too
+
+
+--Get line of temperature, can source transmit effect through to the target.
+--returns boolean, and position (though position not currently useds)
+local line_of_temp = function(node_pos, tgt_pos)
+ --how close it needs to get
+ local step = 0.5
+
+ --get neighboring node, round new_pos to prevent infinite loop at +0.5
+ local target_pos = vector.round(tgt_pos)
+ local stepv = vector.direction(node_pos, target_pos)
+ local new_pos = vector.round(vector.add(node_pos, stepv))
+
+ --checks
+ local new_name = minetest.get_node(new_pos).name
+ local pass = minetest.get_item_group(new_name,"temp_pass")
+
+ --have reached target
+ if vector.distance(new_pos, target_pos) <= step then
+ return true, new_pos
+ end
+
+ --loop through
+ while new_name == 'air' or pass > 0 do
+ --check neighbor
+ stepv = vector.direction(new_pos, target_pos)
+ new_pos = vector.add(new_pos, stepv)
+ new_name = minetest.get_node(new_pos).name
+ pass = minetest.get_item_group(new_name,"temp_pass")
+
+ --have reached target
+ if vector.distance(new_pos, target_pos) <= step then
+ return true, new_pos
+ end
+ end
+
+ --made it through without finding target
+ --return as blocked, with position
+ return false, new_pos
+end
+
+
+
+
+-- Gets three lines from the faces of the nodes facing the player.
+--los can spread through one temp_effect node e.g. to allow stacked fires to work
+local get_los = function(node_pos, target_pos)
+ local results = {}
+
+ if target_pos.x > node_pos.x then
+ --local los, lpos = minetest.line_of_sight({x=node_pos.x+0.51, y=node_pos.y, z=node_pos.z}, target_pos)
+ local los, lpos = line_of_temp(node_pos, target_pos)
+ table.insert(results, {los, lpos})
+ else
+ --local los, lpos = minetest.line_of_sight({x=node_pos.x-0.51, y=node_pos.y, z=node_pos.z}, target_pos)
+ local los, lpos = line_of_temp(node_pos, target_pos)
+ table.insert(results, {los, lpos})
+ end
+
+ if target_pos.y > node_pos.y then
+ --local los, lpos = minetest.line_of_sight({x=node_pos.x, y=node_pos.y + 0.51, z=node_pos.z}, target_pos)
+ local los, lpos = line_of_temp(node_pos, target_pos)
+ table.insert(results, {los, lpos})
+ else
+ --local los, lpos = minetest.line_of_sight({x=node_pos.x, y=node_pos.y - 0.51, z=node_pos.z}, target_pos)
+ local los, lpos = line_of_temp(node_pos, target_pos)
+ table.insert(results, {los, lpos})
+ end
+
+ if target_pos.z > node_pos.z then
+ --local los, lpos = minetest.line_of_sight({x=node_pos.x, y=node_pos.y, z=node_pos.z +0.51}, target_pos)
+ local los, lpos = line_of_temp(node_pos, target_pos)
+ table.insert(results, {los, lpos})
+ else
+ --local los, lpos = minetest.line_of_sight({x=node_pos.x, y=node_pos.y, z=node_pos.z -0.51}, target_pos)
+ local los, lpos = line_of_temp(node_pos, target_pos)
+ table.insert(results, {los, lpos})
+ end
+
+ return results
+end
+
+
+
+
+
+
+-- temp source adjusts it based on distance.
+local radiate_temp = function(target_pos, source_pos, temp_effect)
+ local dist = vector.distance(target_pos, source_pos)
+
+ if dist <=1 and target_pos.y > source_pos.y then
+ --you are standing in it.
+ return temp_effect * 6
+ elseif dist <= 1 then
+ -- just next to fire
+ return temp_effect
+ end
+
+ --{{b,o},{b,o},{b,o}}
+ local sight_lines = get_los(source_pos, target_pos)
+ local los = false
+
+ for k, v in pairs(sight_lines) do
+ if v[1] then
+ los = true
+ break
+ end
+ end
+
+
+ --check for line of sight, can any direction "see"
+ if los then
+ --adjust by distance
+ temp_effect = temp_effect/dist
+ return temp_effect
+ else
+ --completely blocked
+ return 0
+ end
+
+
+end
+
+
+
+
+
+
+--Function for getting the temperature of a specific location
+climate.get_point_temp = function(pos, full)
+
+ --if it's a temp_effect node then thats how hot it is by definition
+ -- but for players/animals we need to know more, so we set "full" to true
+ local nodename = minetest.get_node(pos).name
+ local t_effect = minetest.get_item_group(nodename,"temp_effect")
+ local t_effect_max
+ if t_effect ~= 0 then
+ t_effect_max = minetest.registered_nodes[nodename].temp_effect_max
+ if full ~= true then
+ return t_effect_max
+ end
+ end
+
+ --correct the general temperature for location
+ local temp = climate.active_temp
+ if t_effect_max then
+ temp = temp + (t_effect_max / 3) -- it's partly counted twice, so reduce it
+ end
+ temp = adjust_active_temp(pos, temp)
+
+ --take into account heat and cooling sources nearby
+ local r = 4
+ local a = minetest.find_nodes_in_area({x=pos.x-r, y=pos.y-r, z=pos.z-r}, {x=pos.x+r, y=pos.y+r, z=pos.z+r}, {"group:temp_effect"})
+
+ if #a < 1 then
+ return temp
+ end
+
+ for i, no in pairs(a) do
+ local name = minetest.get_node(no).name
+ local effect = minetest.registered_nodes[name].temp_effect
+ --adjust by distance
+ effect = radiate_temp(pos, no, effect)
+
+ --check caps. If temp has already gone too far it cannot contribute more
+ local temp_effect_max = minetest.registered_nodes[name].temp_effect_max
+ local temp_new = temp + effect
+ --heaters
+ if effect > 0 then
+ if temp_new < temp_effect_max then
+ --still below cap... apply full heat.
+ temp = temp_new
+ elseif temp < temp_effect_max then
+ --can't add full heat, but not yet at cap
+ --so raise it to the cap
+ temp = temp_effect_max
+ end
+ --coolers
+ elseif effect < 0 then
+ if temp_new > temp_effect_max then
+ --still above cap... apply cooling.
+ temp = temp_new
+ elseif temp > temp_effect_max then
+ --can't add full cooling, but not yet at cap
+ --so lower it to the cap
+ temp = temp_effect_max
+ end
+ end
+ end
+
+ return temp
+end
+
+--function for getting a temperature string set to the user's chosen scale
+climate.get_temp_string = function(v, meta)
+ local scale = minetest.settings:get('exile_temp_scale')
+ if meta then
+ local tempscalepref = meta:get_string("TempScalePref")
+ if tempscalepref ~= "" then -- override the sitewide temp scale
+ scale = tempscalepref
+ end
+ end
+ local t = math.floor(v*10)/10 .." °C"
+ if scale == "Fahrenheit" then
+ v = v / 5 * 9 + 32
+ v = math.floor(v*10)/10
+ t = v .." °F"
+ elseif scale == "Kelvin" then
+ v = v + 273.15
+ v = math.floor(v*10)/10
+ t = v .."K"
+ end
+ return t
+end
+
diff --git a/games/globo/mods/climate/textures/climate_air.png b/games/globo/mods/climate/textures/climate_air.png
new file mode 100644
index 000000000..585136bc8
Binary files /dev/null and b/games/globo/mods/climate/textures/climate_air.png differ
diff --git a/games/globo/mods/climate/textures/duststorm.png b/games/globo/mods/climate/textures/duststorm.png
new file mode 100644
index 000000000..99d782fc2
Binary files /dev/null and b/games/globo/mods/climate/textures/duststorm.png differ
diff --git a/games/globo/mods/climate/textures/heavy_rain_drops.png b/games/globo/mods/climate/textures/heavy_rain_drops.png
new file mode 100644
index 000000000..6b8b7ec23
Binary files /dev/null and b/games/globo/mods/climate/textures/heavy_rain_drops.png differ
diff --git a/games/globo/mods/climate/textures/light_rain_raindrop_1.png b/games/globo/mods/climate/textures/light_rain_raindrop_1.png
new file mode 100644
index 000000000..708794aee
Binary files /dev/null and b/games/globo/mods/climate/textures/light_rain_raindrop_1.png differ
diff --git a/games/globo/mods/climate/textures/light_rain_raindrop_2.png b/games/globo/mods/climate/textures/light_rain_raindrop_2.png
new file mode 100644
index 000000000..10f6521f3
Binary files /dev/null and b/games/globo/mods/climate/textures/light_rain_raindrop_2.png differ
diff --git a/games/globo/mods/climate/textures/light_rain_raindrop_3.png b/games/globo/mods/climate/textures/light_rain_raindrop_3.png
new file mode 100644
index 000000000..f7b3b5605
Binary files /dev/null and b/games/globo/mods/climate/textures/light_rain_raindrop_3.png differ
diff --git a/games/globo/mods/climate/textures/light_rain_raindrop_4.png b/games/globo/mods/climate/textures/light_rain_raindrop_4.png
new file mode 100644
index 000000000..17c532d69
Binary files /dev/null and b/games/globo/mods/climate/textures/light_rain_raindrop_4.png differ
diff --git a/games/globo/mods/climate/textures/moon.png b/games/globo/mods/climate/textures/moon.png
new file mode 100644
index 000000000..ae5edb078
Binary files /dev/null and b/games/globo/mods/climate/textures/moon.png differ
diff --git a/games/globo/mods/climate/textures/moon_tonemap.png b/games/globo/mods/climate/textures/moon_tonemap.png
new file mode 100644
index 000000000..603dc2a15
Binary files /dev/null and b/games/globo/mods/climate/textures/moon_tonemap.png differ
diff --git a/games/globo/mods/climate/textures/snowflake_1.png b/games/globo/mods/climate/textures/snowflake_1.png
new file mode 100644
index 000000000..bfdc6b7c7
Binary files /dev/null and b/games/globo/mods/climate/textures/snowflake_1.png differ
diff --git a/games/globo/mods/climate/textures/snowflake_2.png b/games/globo/mods/climate/textures/snowflake_2.png
new file mode 100644
index 000000000..d2c8d81c6
Binary files /dev/null and b/games/globo/mods/climate/textures/snowflake_2.png differ
diff --git a/games/globo/mods/climate/textures/snowflake_3.png b/games/globo/mods/climate/textures/snowflake_3.png
new file mode 100644
index 000000000..591a24517
Binary files /dev/null and b/games/globo/mods/climate/textures/snowflake_3.png differ
diff --git a/games/globo/mods/climate/textures/snowstorm.png b/games/globo/mods/climate/textures/snowstorm.png
new file mode 100644
index 000000000..ebad9e8d6
Binary files /dev/null and b/games/globo/mods/climate/textures/snowstorm.png differ
diff --git a/games/globo/mods/climate/textures/sun.png b/games/globo/mods/climate/textures/sun.png
new file mode 100644
index 000000000..81c2b7fb6
Binary files /dev/null and b/games/globo/mods/climate/textures/sun.png differ
diff --git a/games/globo/mods/climate/textures/sun_tonemap.png b/games/globo/mods/climate/textures/sun_tonemap.png
new file mode 100644
index 000000000..aac8559ff
Binary files /dev/null and b/games/globo/mods/climate/textures/sun_tonemap.png differ
diff --git a/games/globo/mods/climate/textures/sunrisebg.png b/games/globo/mods/climate/textures/sunrisebg.png
new file mode 100644
index 000000000..948c3c07e
Binary files /dev/null and b/games/globo/mods/climate/textures/sunrisebg.png differ
diff --git a/games/globo/mods/climate/weathers/README.txt b/games/globo/mods/climate/weathers/README.txt
new file mode 100644
index 000000000..60c2b5859
--- /dev/null
+++ b/games/globo/mods/climate/weathers/README.txt
@@ -0,0 +1,9 @@
+More weather sets
+=============================
+
+Contains alternative weather files for Climate mod.
+
+Need to be copy pasted into climate > weathers
+
+
+weathers_main_balanced: a reasonably well balanced set for a standard game
\ No newline at end of file
diff --git a/games/globo/mods/climate/weathers/clear.lua b/games/globo/mods/climate/weathers/clear.lua
new file mode 100644
index 000000000..f492c9e1a
--- /dev/null
+++ b/games/globo/mods/climate/weathers/clear.lua
@@ -0,0 +1,83 @@
+------------------------------
+-- Clear weather
+-- blue sky weather, few to small clouds
+
+------------------------------
+
+local clear = {}
+
+clear.name = 'clear'
+
+
+clear.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#BBDDF6",
+ day_horizon = "#c1e0f6",
+ dawn_sky = "#9EADFF",
+ dawn_horizon ="#b1bdff",
+ night_sky = "#020042",
+ night_horizon = "#343267",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+clear.cloud_data = {
+ color = "#FFFFFF",
+ density = 0.1,
+ height = 500,
+ thickness = 4,
+ speed = {x=1, z=0}
+}
+
+
+clear.moon_data = {
+ visible = true,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+clear.sun_data = {
+ visible = true,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = true,
+ scale = 0.4
+}
+
+clear.star_data = {
+ visible = true,
+ count = 2000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+--probabilities in each temp class
+
+clear.chain = {
+ --name, p_forz, p_cold, p_mid , p_hot
+ {'light_cloud', 0.3, 0.3, 0.3, 0.3},
+ {'light_haze', 0.0, 0.0, 0.0, 0.05}
+
+
+}
+
+
+
+
+--add this weather to register
+climate.register_weather(clear)
+
+
+
+------
diff --git a/games/globo/mods/climate/weathers/duststorm.lua b/games/globo/mods/climate/weathers/duststorm.lua
new file mode 100644
index 000000000..35b8446dd
--- /dev/null
+++ b/games/globo/mods/climate/weathers/duststorm.lua
@@ -0,0 +1,103 @@
+------------------------------
+-- Duststorm
+-- clouds of dust
+-- sky color yellowish, damaging
+------------------------------
+
+local duststorm = {}
+
+
+duststorm.name = 'duststorm'
+
+
+duststorm.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#F4DFBE",
+ day_horizon = "#f6e5cb",
+ dawn_sky = "#F9A09C",
+ dawn_horizon ="#fab3af",
+ night_sky = "#513200",
+ night_horizon = "#735a32",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+duststorm.cloud_data = {
+ color = "#ac9673",
+ density = 0.6,
+ height = 100,
+ thickness = 180,
+ speed = {x=0, z=4}
+}
+
+
+duststorm.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+duststorm.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+duststorm.star_data = {
+ visible = false,
+ count = 500,
+ color = "#80FCFEFF"
+}
+
+
+
+
+duststorm.sound_loop = 'duststorm_loop'
+
+duststorm.damage = true
+
+
+--probabilities in each temp class
+duststorm.chain = {
+ --name, p_froz, p_cold, p_mid , p_hot
+ {'haze', 1, 1, 0.97, 0.35}
+
+}
+
+duststorm.particle_interval = 0.0007
+
+duststorm.particle_function = function(player)
+ local velxz = math.random(-5, 2)
+ local vely = math.random(-3, 2)
+ local accxz = math.random(-3,2)
+ local accy = math.random(-2, 2)
+ local ext = 10
+ local size = 20
+ local tex = "duststorm.png"
+
+ climate.add_blizzard_particle(velxz, vely, accxz, accy, ext, size,
+ tex, player)
+
+ if math.random() < 0.00016 then
+ lightning.strike()
+ end
+end
+
+
+--add this weather to register
+climate.register_weather(duststorm)
+
+
+
+------
diff --git a/games/globo/mods/climate/weathers/fog.lua b/games/globo/mods/climate/weathers/fog.lua
new file mode 100644
index 000000000..30b0d69ee
--- /dev/null
+++ b/games/globo/mods/climate/weathers/fog.lua
@@ -0,0 +1,83 @@
+------------------------------
+-- Fog
+-- ground level cloud.
+------------------------------
+
+local fog = {}
+
+
+fog.name = 'fog'
+
+
+fog.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#B5B6B6",
+ day_horizon = "#bcbdbd",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+fog.cloud_data = {
+ color = "#FFFFFFD0",
+ density = 1,
+ height = 2.1,
+ thickness = 428,
+ speed = {x=0, z=0}
+}
+
+
+fog.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+fog.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+fog.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+
+--probabilities in each temp class
+fog.chain = {
+ --name, p_froz, p_cold, p_mid , p_hot
+ {'overcast_light_rain', 0, 0.01, 0.01, 0.05},
+ {'overcast_light_snow', 0.05, 0, 0, 0},
+ {'overcast', 0.02, 0.02, 0.02, 0.05},
+ {'clear', 0, 0, 0.01, 0.05}
+
+}
+
+
+
+--add this weather to register
+climate.register_weather(fog)
+
+
+
+------
diff --git a/games/globo/mods/climate/weathers/haze.lua b/games/globo/mods/climate/weathers/haze.lua
new file mode 100644
index 000000000..01586da5a
--- /dev/null
+++ b/games/globo/mods/climate/weathers/haze.lua
@@ -0,0 +1,86 @@
+------------------------------
+-- Haze
+-- looming dust storm
+-- sky color
+------------------------------
+
+local haze = {}
+
+
+haze.name = 'haze'
+
+
+haze.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#F4DFBE",
+ day_horizon = "#f6e5cb",
+ dawn_sky = "#F9A09C",
+ dawn_horizon ="#fab3af",
+ night_sky = "#513200",
+ night_horizon = "#735a32",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+haze.cloud_data = {
+ color = "#ddc194",
+ density = 0.4,
+ height = 150,
+ thickness = 64,
+ speed = {x=0, z=3}
+}
+
+
+haze.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+haze.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+haze.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+
+haze.sound_loop = 'duststorm_loop_light'
+
+
+ --probabilities in each temp class
+
+haze.chain = {
+ --name, p_froz, p_cold, p_mid , p_hot
+ {'light_haze', 1, 0.95, 0.5, 0.1},
+ {'duststorm', 0, 0, 0.0, 0.2}
+
+}
+
+
+
+--add this weather to register
+climate.register_weather(haze)
+
+
+
+------
diff --git a/games/globo/mods/climate/weathers/light_cloud.lua b/games/globo/mods/climate/weathers/light_cloud.lua
new file mode 100644
index 000000000..948cd1efb
--- /dev/null
+++ b/games/globo/mods/climate/weathers/light_cloud.lua
@@ -0,0 +1,83 @@
+------------------------------
+-- light cloud weather
+-- blue sky weather, a few clouds
+
+------------------------------
+
+local light_cloud = {}
+
+
+light_cloud.name = 'light_cloud'
+
+
+light_cloud.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#BBDDF6",
+ day_horizon = "#c1e0f6",
+ dawn_sky = "#9EADFF",
+ dawn_horizon ="#b1bdff",
+ night_sky = "#020042",
+ night_horizon = "#343267",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+light_cloud.cloud_data = {
+ color = "#FFFFFF",
+ density = 0.2,
+ height = 380,
+ thickness = 8,
+ speed = {x=2, z=0}
+}
+
+
+light_cloud.moon_data = {
+ visible = true,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+light_cloud.sun_data = {
+ visible = true,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = true,
+ scale = 0.4
+}
+
+light_cloud.star_data = {
+ visible = true,
+ count = 2000,
+ color = "#80FCFEFF"
+}
+
+
+
+--probabilities in each temp class
+
+light_cloud.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'clear', 0.1, 0.2, 0.4, 0.5},
+ {'medium_cloud', 0.75, 0.5, 0.3, 0.3},
+ {'snow_flurry', 0.1, 0, 0, 0}
+
+}
+
+
+
+
+--add this weather to register
+climate.register_weather(light_cloud)
+
+
+
+------
diff --git a/games/globo/mods/climate/weathers/light_haze.lua b/games/globo/mods/climate/weathers/light_haze.lua
new file mode 100644
index 000000000..bcb5ae018
--- /dev/null
+++ b/games/globo/mods/climate/weathers/light_haze.lua
@@ -0,0 +1,81 @@
+------------------------------
+-- Light Haze
+-- entry into dust storm pathway
+--drought, hot weather, sky color paler
+
+------------------------------
+
+local light_haze = {}
+
+
+light_haze.name = 'light_haze'
+
+
+light_haze.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#DAEDFB",
+ day_horizon = "#F9FBE7",
+ dawn_sky = "daacfb",
+ dawn_horizon ="#fbacf4",
+ night_sky = "#0600A9",
+ night_horizon = "#615f98",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+
+light_haze.cloud_data = {
+ color = "#FFFFFF",
+ density = 0.1,
+ height = 500,
+ thickness = 4,
+ speed = {x=1, z=0}
+}
+
+
+light_haze.moon_data = {
+ visible = true,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+light_haze.sun_data = {
+ visible = true,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = true,
+ scale = 0.4
+}
+
+light_haze.star_data = {
+ visible = true,
+ count = 1500,
+ color = "#80FCFEFF"
+}
+
+
+
+--probabilities in each temp class
+light_haze.chain = {
+ --name, p_froz, p_cold, p_mid , p_hot
+ {'clear', 1, 0.85, 0.4, 0.1},
+ {'haze', 0, 0, 0, 0.25}
+ }
+
+
+
+--add this weather to register
+climate.register_weather(light_haze)
+
+
+
+------
diff --git a/games/globo/mods/climate/weathers/light_rain.lua b/games/globo/mods/climate/weathers/light_rain.lua
new file mode 100644
index 000000000..bc0fd84d9
--- /dev/null
+++ b/games/globo/mods/climate/weathers/light_rain.lua
@@ -0,0 +1,107 @@
+------------------------------
+-- light_rain weather
+-- gentle rain, blue sky still visible
+
+------------------------------
+
+local light_rain = {}
+
+
+light_rain.name = 'light_rain'
+
+
+
+light_rain.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#91CDF9",
+ day_horizon = "#a7d7fa",
+ dawn_sky = "#9EADFF",
+ dawn_horizon ="#b1bdff",
+ night_sky = "#020042",
+ night_horizon = "#343267",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+light_rain.cloud_data = {
+ color = "#D6D6D6",
+ density = 0.5,
+ height = 320,
+ thickness = 64,
+ speed = {x=2, z=0}
+}
+
+
+
+light_rain.moon_data = {
+ visible = true,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+light_rain.sun_data = {
+ visible = true,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = true,
+ scale = 0.4
+}
+
+light_rain.star_data = {
+ visible = true,
+ count = 2000,
+ color = "#80FCFEFF"
+}
+
+
+light_rain.sound_loop = 'light_rain_loop'
+
+--probabilities in each temp class
+light_rain.chain = {
+ --name, p_froz, p_cold, p_mid , p_hot
+ {'sun_shower', 0, 0.25, 0.5, 0.5},
+ {'overcast_light_rain', 0, 0.5, 0.25, 0.12},
+ {'overcast', 0.1, 0.2, 0.3, 0.4},
+ {'light_snow', 1, 0, 0, 0}
+
+}
+
+
+-- Random texture getter
+local random_texture = function()
+ local base_name = "light_rain_raindrop_"
+ local number = math.random(1, 4)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+
+light_rain.particle_interval = 0.1
+
+light_rain.particle_function = function(player)
+ local vel = -10
+ local acc = -10
+ local ext = 5
+ local size = 1
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_particle(vel, acc, ext, size, tex, player)
+end
+
+
+
+--add this weather to register
+climate.register_weather(light_rain)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/light_snow.lua b/games/globo/mods/climate/weathers/light_snow.lua
new file mode 100644
index 000000000..b5e90b28b
--- /dev/null
+++ b/games/globo/mods/climate/weathers/light_snow.lua
@@ -0,0 +1,107 @@
+------------------------------
+-- light_snow weather
+-- gentle snow
+
+------------------------------
+-- Random texture getter
+local random_texture = function()
+ local base_name = "snowflake_"
+ local number = math.random(1, 3)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+
+
+local light_snow = {}
+
+light_snow.name = 'light_snow'
+
+light_snow.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#97C0F9",
+ day_horizon = "#ABCCFA",
+ dawn_sky = "#9EADFF",
+ dawn_horizon ="#b1bdff",
+ night_sky = "#0600A9",
+ night_horizon = "#3732ba",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+light_snow.cloud_data = {
+ color = "#C9CCDB",
+ density = 0.5,
+ height = 320,
+ thickness = 64,
+ speed = {x=0, z=-2}
+}
+
+
+light_snow.moon_data = {
+ visible = true,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+light_snow.sun_data = {
+ visible = true,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = true,
+ scale = 0.4
+}
+
+light_snow.star_data = {
+ visible = true,
+ count = 2000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+
+--probabilities in each temp class
+light_snow.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'overcast_light_rain', 0, 0.75, 1, 1},
+ {'overcast', 0.15, 1, 1, 1},
+ {'snow_flurry', 0.25, 0, 0, 0},
+ {'overcast_light_snow', 0.25, 0, 0, 0}
+
+}
+
+
+light_snow.particle_interval = 0.1
+
+light_snow.particle_function = function(player)
+
+ local velxz = math.random(-1,-0.1)
+ local vely = math.random(-1.5,-0.5)
+ local accxz = math.random(-1,-0.1)
+ local accy = -0.5
+ local ext = 7
+ local size = 2
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_blizzard_particle(velxz, vely, accxz, accy, ext, size,
+ tex, player)
+end
+
+
+
+--add this weather to register
+climate.register_weather(light_snow)
+
+------
diff --git a/games/globo/mods/climate/weathers/medium_cloud.lua b/games/globo/mods/climate/weathers/medium_cloud.lua
new file mode 100644
index 000000000..cb4d64c70
--- /dev/null
+++ b/games/globo/mods/climate/weathers/medium_cloud.lua
@@ -0,0 +1,84 @@
+------------------------------
+-- medium cloud weather
+-- blue sky weather, but a few more clouds
+
+------------------------------
+
+local medium_cloud = {}
+
+
+medium_cloud.name = 'medium_cloud'
+
+medium_cloud.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#BBDDF6",
+ day_horizon = "#c1e0f6",
+ dawn_sky = "#9EADFF",
+ dawn_horizon ="#b1bdff",
+ night_sky = "#020042",
+ night_horizon = "#343267",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+medium_cloud.cloud_data = {
+ color = "#FFFFFF",
+ density = 0.3,
+ height = 360,
+ thickness = 15,
+ speed = {x=2, z=0}
+}
+
+
+medium_cloud.moon_data = {
+ visible = true,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+medium_cloud.sun_data = {
+ visible = true,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = true,
+ scale = 0.4
+}
+
+medium_cloud.star_data = {
+ visible = true,
+ count = 2000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+--probabilities in each temp class
+
+medium_cloud.chain = {
+ --name, p_froz, p_cold, p_mid , p_hot
+ {'light_cloud', 0.2, 0.2, 0.3, 0.5},
+ {'overcast', 0.06, 0.06, 0.06, 0.06},
+ {'sun_shower', 0, 0.5, 0.3, 0.02},
+ {'snow_flurry', 0.25, 0, 0, 0}
+
+}
+
+
+
+
+--add this weather to register
+climate.register_weather(medium_cloud)
+
+
+
+------
diff --git a/games/globo/mods/climate/weathers/overcast.lua b/games/globo/mods/climate/weathers/overcast.lua
new file mode 100644
index 000000000..5e4f925fa
--- /dev/null
+++ b/games/globo/mods/climate/weathers/overcast.lua
@@ -0,0 +1,86 @@
+------------------------------
+-- overcast weather
+-- grey sky but no rain
+
+------------------------------
+
+local overcast = {}
+
+
+overcast.name = 'overcast'
+
+
+
+overcast.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#B5B6B6",
+ day_horizon = "#bcbdbd",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+overcast.cloud_data = {
+ color = "#777985",
+ density = 0.6,
+ height = 300,
+ thickness = 128,
+ speed = {x=2, z=0}
+}
+
+
+
+overcast.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+overcast.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+overcast.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+--probabilities in each temp class
+overcast.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'overcast_light_rain',0.01, 0.2, 0.1, 0.5},
+ {'light_rain', 0.01, 0.05, 0.15, 0.25},
+ {'medium_cloud', 0.01, 0.01, 0.01, 0.1},
+ {'overcast_light_snow', 0.25, 0, 0, 0},
+ {'light_snow', 0.1, 0, 0, 0},
+ {'fog', 0.15, 0.1, 0.01, 0.01}
+
+}
+
+
+
+
+--add this weather to register
+climate.register_weather(overcast)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/overcast_heavy_rain.lua b/games/globo/mods/climate/weathers/overcast_heavy_rain.lua
new file mode 100644
index 000000000..612481a6a
--- /dev/null
+++ b/games/globo/mods/climate/weathers/overcast_heavy_rain.lua
@@ -0,0 +1,99 @@
+------------------------------
+-- overcast_heavy_rainn weather
+-- grey sky rain, heavy intensity
+
+------------------------------
+
+local overcast_heavy_rain = {}
+
+
+overcast_heavy_rain.name = 'overcast_heavy_rain'
+
+
+overcast_heavy_rain.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#656D7C",
+ day_horizon = "#747b89",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+overcast_heavy_rain.cloud_data = {
+ color = "#494B54",
+ density = 0.6,
+ height = 260,
+ thickness = 128,
+ speed = {x=2, z=0}
+}
+
+
+overcast_heavy_rain.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+overcast_heavy_rain.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+overcast_heavy_rain.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+overcast_heavy_rain.sound_loop = 'heavy_rain_loop'
+
+--probabilities in each temp class
+overcast_heavy_rain.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'overcast_rain', 0, 0.75, 0.75, 0.85},
+ {'overcast_heavy_snow', 1, 0, 0, 0},
+ {'thunderstorm', 0, 0.05, 0.25, 0.5}
+
+}
+
+
+
+
+overcast_heavy_rain.particle_interval = 0.001
+
+overcast_heavy_rain.particle_function = function(player)
+ local vel = -10
+ local acc = -10
+ local ext = 6
+ local size = 20
+ local tex = "heavy_rain_drops.png"
+ local sound = ""
+
+ climate.add_particle(vel, acc, ext, size, tex, player)
+end
+
+
+
+--add this weather to register
+climate.register_weather(overcast_heavy_rain)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/overcast_heavy_snow.lua b/games/globo/mods/climate/weathers/overcast_heavy_snow.lua
new file mode 100644
index 000000000..86ac1ef40
--- /dev/null
+++ b/games/globo/mods/climate/weathers/overcast_heavy_snow.lua
@@ -0,0 +1,114 @@
+------------------------------
+-- overcast_heavy_snow weather
+-- grey sky snow, heavy intensity
+
+------------------------------
+
+-- Random texture getter
+local random_texture = function()
+ local base_name = "snowflake_"
+ local number = math.random(1, 3)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+
+local overcast_heavy_snow = {}
+
+
+overcast_heavy_snow.name = 'overcast_heavy_snow'
+
+
+overcast_heavy_snow.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#8596AB",
+ day_horizon = "#9dabbb",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+overcast_heavy_snow.cloud_data = {
+ color = "#6F7694",
+ density = 0.6,
+ height = 260,
+ thickness = 128,
+ speed = {x=0, z=-3}
+}
+
+
+overcast_heavy_snow.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+overcast_heavy_snow.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+overcast_heavy_snow.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+overcast_heavy_snow.sound_loop = 'snowstorm_loop_light'
+
+
+--probabilities in each temp class
+overcast_heavy_snow.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'overcast_rain', 0, 1, 1, 1},
+ {'overcast_heavy_rain', 0, 1, 1, 1},
+ {'thunderstorm', 0, 0, 0, 1},
+ {'overcast_snow', 0.15, 0, 0, 0},
+ {'snowstorm', 0.05, 0, 0, 0}
+
+}
+
+
+overcast_heavy_snow.particle_interval = 0.0009
+
+overcast_heavy_snow.particle_function = function(player)
+
+ local velxz = math.random(-1,-0.1)
+ local vely = math.random(-2,-0.5)
+ local accxz = math.random(-1,-0.1)
+ local accy = -0.5
+ local ext = 7
+ local size = 3
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_blizzard_particle(velxz, vely, accxz, accy, ext, size,
+ tex, player)
+end
+
+
+
+
+--add this weather to register
+climate.register_weather(overcast_heavy_snow)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/overcast_light_rain.lua b/games/globo/mods/climate/weathers/overcast_light_rain.lua
new file mode 100644
index 000000000..677f1d4a1
--- /dev/null
+++ b/games/globo/mods/climate/weathers/overcast_light_rain.lua
@@ -0,0 +1,106 @@
+------------------------------
+-- overcast_light_rain weather
+-- grey sky rain
+
+------------------------------
+
+local overcast_light_rain = {}
+
+overcast_light_rain.name = 'overcast_light_rain'
+
+
+overcast_light_rain.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#979AA1",
+ day_horizon = "#a1a4aa",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+overcast_light_rain.cloud_data = {
+ color = "#5D5F69",
+ density = 0.6,
+ height = 300,
+ thickness = 128,
+ speed = {x=2, z=0}
+}
+
+
+
+overcast_light_rain.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+overcast_light_rain.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+overcast_light_rain.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+overcast_light_rain.sound_loop = 'light_rain_loop'
+
+--probabilities in each temp class
+overcast_light_rain.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'light_rain', 0.01, 0.25, 0.5, 0.75},
+ {'overcast', 0.5, 0.5, 0.5, 0.75},
+ {'overcast_rain', 0.01, 0.3, 0.2, 0.5},
+ {'overcast_light_snow', 0.25, 0, 0, 0}
+
+}
+
+
+-- Random texture getter
+local random_texture = function()
+ local base_name = "light_rain_raindrop_"
+ local number = math.random(1, 4)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+
+overcast_light_rain.particle_interval = 0.1
+
+overcast_light_rain.particle_function = function(player)
+ local vel = -10
+ local acc = -10
+ local ext = 5
+ local size = 1
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_particle(vel, acc, ext, size, tex, player)
+end
+
+
+
+--add this weather to register
+climate.register_weather(overcast_light_rain)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/overcast_light_snow.lua b/games/globo/mods/climate/weathers/overcast_light_snow.lua
new file mode 100644
index 000000000..84780a152
--- /dev/null
+++ b/games/globo/mods/climate/weathers/overcast_light_snow.lua
@@ -0,0 +1,108 @@
+------------------------------
+-- overcast_light_snow weather
+-- grey sky snow
+
+------------------------------
+local random_texture = function()
+ local base_name = "snowflake_"
+ local number = math.random(1, 3)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+
+
+local overcast_light_snow = {}
+
+
+overcast_light_snow.name = 'overcast_light_snow'
+
+
+overcast_light_snow.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#BCC7D4",
+ day_horizon = "#c9d2dc",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+overcast_light_snow.cloud_data = {
+ color = "#A7ADC9",
+ density = 0.6,
+ height = 300,
+ thickness = 128,
+ speed = {x=0, z=-2}
+}
+
+
+overcast_light_snow.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+overcast_light_snow.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+overcast_light_snow.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+--probabilities in each temp class
+overcast_light_snow.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'overcast', 0.15, 1, 1, 1},
+ {'overcast_snow', 0.25, 0, 0, 0},
+ {'overcast_light_rain', 0, 1, 1, 1},
+ {'light_snow', 0.1, 0, 0, 0}
+
+}
+
+overcast_light_snow.particle_interval = 0.1
+
+overcast_light_snow.particle_function = function(player)
+
+ local velxz = math.random(-1,-0.1)
+ local vely = math.random(-2,-0.5)
+ local accxz = math.random(-1,-0.1)
+ local accy = -0.5
+ local ext = 7
+ local size = 2
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_blizzard_particle(velxz, vely, accxz, accy, ext, size,
+ tex, player)
+end
+
+
+
+
+
+--add this weather to register
+climate.register_weather(overcast_light_snow)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/overcast_rain.lua b/games/globo/mods/climate/weathers/overcast_rain.lua
new file mode 100644
index 000000000..faf501d10
--- /dev/null
+++ b/games/globo/mods/climate/weathers/overcast_rain.lua
@@ -0,0 +1,106 @@
+------------------------------
+-- overcast_rain weather
+-- grey sky rain, moderate intensity
+
+------------------------------
+
+local overcast_rain = {}
+
+
+overcast_rain.name = 'overcast_rain'
+
+
+overcast_rain.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#777D89",
+ day_horizon = "#848a94",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+overcast_rain.cloud_data = {
+ color = "#5D5F69",
+ density = 0.6,
+ height = 280,
+ thickness = 128,
+ speed = {x=2, z=0}
+}
+
+overcast_rain.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+overcast_rain.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+overcast_rain.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+overcast_rain.sound_loop = 'rain_loop'
+
+--probabilities in each temp class
+overcast_rain.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'overcast_light_rain', 0.01, 0.3, 0.4, 0.75},
+ {'overcast_heavy_rain', 0.01, 0.2, 0.1, 0.5},
+ {'overcast_snow', 0.5, 0, 0, 0}
+
+
+}
+
+
+-- Random texture getter
+local random_texture = function()
+ local base_name = "light_rain_raindrop_"
+ local number = math.random(1, 4)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+
+overcast_rain.particle_interval = 0.004
+
+overcast_rain.particle_function = function(player)
+ local vel = -12
+ local acc = -10
+ local ext = 6
+ local size = 1
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_particle(vel, acc, ext, size, tex, player)
+end
+
+
+
+--add this weather to register
+climate.register_weather(overcast_rain)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/overcast_snow.lua b/games/globo/mods/climate/weathers/overcast_snow.lua
new file mode 100644
index 000000000..6e037e4b6
--- /dev/null
+++ b/games/globo/mods/climate/weathers/overcast_snow.lua
@@ -0,0 +1,103 @@
+------------------------------
+-- overcast_snow weather
+-- grey sky snow, moderate intensity
+
+------------------------------
+
+-- Random texture getter
+local random_texture = function()
+ local base_name = "snowflake_"
+ local number = math.random(1, 3)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+local overcast_snow = {}
+
+overcast_snow.name = 'overcast_snow'
+
+overcast_snow.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#9EACBD",
+ day_horizon = "#b1bcca",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+overcast_snow.cloud_data = {
+ color = "#848CB0",
+ density = 0.6,
+ height = 280,
+ thickness = 128,
+ speed = {x=0, z=-2}
+}
+
+
+overcast_snow.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+overcast_snow.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+overcast_snow.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+--probabilities in each temp class
+overcast_snow.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'overcast_rain', 0, 1, 1, 1},
+ {'overcast_light_snow', 0.15, 0, 0, 0},
+ {'overcast_heavy_snow', 0.15, 0, 0, 0}
+
+}
+
+
+overcast_snow.particle_interval = 0.004
+
+overcast_snow.particle_function = function(player)
+
+ local velxz = math.random(-1,-0.1)
+ local vely = math.random(-2,-0.5)
+ local accxz = math.random(-1,-0.1)
+ local accy = -0.5
+ local ext = 7
+ local size = 3
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_blizzard_particle(velxz, vely, accxz, accy, ext, size,
+ tex, player)
+end
+
+--add this weather to register
+climate.register_weather(overcast_snow)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/snow_flurry.lua b/games/globo/mods/climate/weathers/snow_flurry.lua
new file mode 100644
index 000000000..96a6de341
--- /dev/null
+++ b/games/globo/mods/climate/weathers/snow_flurry.lua
@@ -0,0 +1,108 @@
+------------------------------
+-- snow_flurry
+-- patchy clouds and a few snow flakes
+
+------------------------------
+-- Random texture getter
+ local random_texture = function()
+ local base_name = "snowflake_"
+ local number = math.random(1, 3)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+
+
+local snow_flurry = {}
+
+snow_flurry.name = 'snow_flurry'
+
+snow_flurry.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#A5D4F6",
+ day_horizon = "#b7dcf7",
+ dawn_sky = "#9EADFF",
+ dawn_horizon ="#b1bdff",
+ night_sky = "#020042",
+ night_horizon = "#343267",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+snow_flurry.cloud_data = {
+ color = "#FFFFFF",
+ density = 0.4,
+ height = 340,
+ thickness = 32,
+ speed = {x=0, z=-2}
+}
+
+
+
+snow_flurry.moon_data = {
+ visible = true,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+snow_flurry.sun_data = {
+ visible = true,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = true,
+ scale = 0.4
+}
+
+snow_flurry.star_data = {
+ visible = true,
+ count = 2000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+ --probabilities in each temp class
+
+snow_flurry.chain = {
+ --name, p_froz p_cold, p_mid , p_hot
+ {'medium_cloud', 0.15, 1, 1, 1},
+ {'sun_shower', 0, 1, 1, 1},
+ {'light_snow', 0.5, 0, 0, 0}
+
+}
+
+
+snow_flurry.particle_interval = 0.5
+
+snow_flurry.particle_function = function(player)
+
+ local velxz = math.random(-1,-0.1)
+ local vely = math.random(-1, 0)
+ local accxz = math.random(-1,-0.1)
+ local accy = -0.5
+ local ext = 7
+ local size = 2
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_blizzard_particle(velxz, vely, accxz, accy, ext, size,
+ tex, player)
+end
+
+
+
+--add this weather to register
+climate.register_weather(snow_flurry)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/snowstorm.lua b/games/globo/mods/climate/weathers/snowstorm.lua
new file mode 100644
index 000000000..129ac6195
--- /dev/null
+++ b/games/globo/mods/climate/weathers/snowstorm.lua
@@ -0,0 +1,104 @@
+------------------------------
+-- snowstorm
+-- very heavy blustery snow
+------------------------------
+
+local snowstorm = {}
+
+
+snowstorm.name = 'snowstorm'
+
+snowstorm.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#62758D",
+ day_horizon = "#8190a3",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+snowstorm.cloud_data = {
+ color = "#656A83",
+ density = 0.6,
+ height = 260,
+ thickness = 148,
+ speed = {x=0, z=-3}
+}
+
+
+snowstorm.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+snowstorm.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+snowstorm.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+snowstorm.damage = true
+
+snowstorm.sound_loop = 'snowstorm_loop'
+
+--probabilities in each temp class
+snowstorm.chain = {
+ --name, p_froz, p_cold, p_mid , p_hot
+ --{'thunderstorm', 0, 1, 1, 1},
+ --{'superstorm', 0, 1, 1, 1},
+ {'overcast_heavy_snow', 0.15, 1, 1, 1}
+
+}
+
+
+snowstorm.particle_interval = 0.0006
+
+snowstorm.particle_function = function(player)
+ local velxz = math.random(-3,1.5)
+ local vely = math.random(-3, 1.5)
+ local accxz = math.random(-4, 1.5)
+ local accy = -1.5
+ local ext = 10
+ local size = 40
+ local tex = "snowstorm.png"
+
+ climate.add_blizzard_particle(velxz, vely, accxz, accy, ext, size,
+ tex, player)
+
+ if math.random() < 0.0001 then
+ lightning.strike()
+ end
+end
+
+
+
+
+--add this weather to register
+climate.register_weather(snowstorm)
+
+
+
+------
diff --git a/games/globo/mods/climate/weathers/sun_shower.lua b/games/globo/mods/climate/weathers/sun_shower.lua
new file mode 100644
index 000000000..88f3b2c38
--- /dev/null
+++ b/games/globo/mods/climate/weathers/sun_shower.lua
@@ -0,0 +1,105 @@
+------------------------------
+-- sun_shower weather
+-- patchy clouds and a few spots of rain
+
+------------------------------
+
+local sun_shower = {}
+
+
+sun_shower.name = 'sun_shower'
+
+
+sun_shower.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#A5D4F6",
+ day_horizon = "#b7dcf7",
+ dawn_sky = "#9EADFF",
+ dawn_horizon ="#b1bdff",
+ night_sky = "#020042",
+ night_horizon = "#343267",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+sun_shower.cloud_data = {
+ color = "#FFFFFF",
+ density = 0.4,
+ height = 340,
+ thickness = 32,
+ speed = {x=2, z=0}
+}
+
+
+
+sun_shower.moon_data = {
+ visible = true,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+sun_shower.sun_data = {
+ visible = true,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = true,
+ scale = 0.4
+}
+
+sun_shower.star_data = {
+ visible = true,
+ count = 2000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+sun_shower.sound_loop = 'light_rain_loop'
+
+--probabilities in each temp class
+
+sun_shower.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'medium_cloud',0.25, 0.25, 0.5, 0.75},
+ {'light_rain', 0, 0.5, 0.5, 0.05},
+ {'snow_flurry', 1, 0, 0, 0}
+
+}
+
+-- Random texture getter
+local random_texture = function()
+ local base_name = "light_rain_raindrop_"
+ local number = math.random(1, 4)
+ local extension = ".png"
+ return base_name .. number .. extension
+end
+
+
+sun_shower.particle_interval = 0.5
+
+sun_shower.particle_function = function(player)
+ local vel = -10
+ local acc = -10
+ local ext = 5
+ local size = 1
+ local tex = random_texture()
+ local sound = ""
+
+ climate.add_particle(vel, acc, ext, size, tex, player)
+end
+
+--add this weather to register
+climate.register_weather(sun_shower)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/superstorm.lua b/games/globo/mods/climate/weathers/superstorm.lua
new file mode 100644
index 000000000..04cbfc8e4
--- /dev/null
+++ b/games/globo/mods/climate/weathers/superstorm.lua
@@ -0,0 +1,101 @@
+------------------------------
+-- superstorm weather
+-- grey sky rain, heavy intensity, a barrage of lightning
+
+------------------------------
+
+local superstorm = {}
+
+
+superstorm.name = 'superstorm'
+
+
+superstorm.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#40434F",
+ day_horizon = "#535560",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+superstorm.cloud_data = {
+ color = "#2E3036",
+ density = 0.6,
+ height = 260,
+ thickness = 128,
+ speed = {x=3, z=0}
+}
+
+
+superstorm.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+superstorm.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+superstorm.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+
+
+superstorm.sound_loop = 'heavy_rain_loop'
+
+ --probabilities in each temp class
+superstorm.chain = {
+ --name, p_froz, p_cold, p_mid , p_hot
+ {'thunderstorm', 0, 1, 1, 1},
+ {'snowstorm', 1, 0, 0, 0}
+
+}
+
+
+superstorm.particle_interval = 0.0009
+
+superstorm.particle_function = function(player)
+ local vel = -10
+ local acc = -10
+ local ext = 6
+ local size = 20
+ local tex = "heavy_rain_drops.png"
+ local sound = ""
+
+ climate.add_particle(vel, acc, ext, size, tex, player)
+
+ if math.random() < 0.02 then
+ lightning.strike()
+ end
+ end
+
+
+--add this weather to register
+climate.register_weather(superstorm)
+
+
+------
diff --git a/games/globo/mods/climate/weathers/thunderstorm.lua b/games/globo/mods/climate/weathers/thunderstorm.lua
new file mode 100644
index 000000000..97a8f9281
--- /dev/null
+++ b/games/globo/mods/climate/weathers/thunderstorm.lua
@@ -0,0 +1,101 @@
+------------------------------
+-- thunderstorm weather
+-- grey sky rain, heavy intensity, lightning
+
+------------------------------
+
+local thunderstorm = {}
+
+thunderstorm.name = 'thunderstorm'
+
+
+thunderstorm.sky_data = {
+ type = "regular",
+ clouds = true,
+ sky_color = {
+ day_sky = "#4E5160",
+ day_horizon = "#5f626f",
+ dawn_sky = "#CBC0D6",
+ dawn_horizon ="#d5ccde",
+ night_sky = "#4B3C5A",
+ night_horizon = "#6e627a",
+ indoors = "#2B2B2B",
+ --fog_sun_tint = "#FB7F55",
+ --fog_moon_tint = "#C5C9C9",
+ --fog_tint_type = "custom"
+ }
+}
+
+
+thunderstorm.cloud_data = {
+ color = "#393B42",
+ density = 0.6,
+ height = 260,
+ thickness = 128,
+ speed = {x=3, z=0}
+}
+
+
+
+
+thunderstorm.moon_data = {
+ visible = false,
+ texture = "moon.png",
+ tonemap = "moon_tonemap.png",
+ scale = 0.5
+}
+
+
+thunderstorm.sun_data = {
+ visible = false,
+ texture = "sun.png",
+ tonemap = "sun_tonemap.png",
+ sunrise = "sunrisebg.png",
+ sunrise_visible = false,
+ scale = 0.4
+}
+
+thunderstorm.star_data = {
+ visible = false,
+ count = 1000,
+ color = "#80FCFEFF"
+}
+
+
+
+
+thunderstorm.sound_loop = 'heavy_rain_loop'
+
+ --probabilities in each temp class
+thunderstorm.chain = {
+ --name, p_cold, p_mid , p_hot
+ {'overcast_heavy_rain', 0.05, 0.5, 0.5, 0.5},
+ {'superstorm', 0, 0, 0, 0.1},
+ {'snowstorm', 1, 0, 0, 0}
+
+}
+
+
+thunderstorm.particle_interval = 0.001
+
+thunderstorm.particle_function = function(player)
+ local vel = -10
+ local acc = -10
+ local ext = 6
+ local size = 20
+ local tex = "heavy_rain_drops.png"
+ local sound = ""
+
+ climate.add_particle(vel, acc, ext, size, tex, player)
+
+ if math.random() < 0.002 then
+ lightning.strike()
+ end
+end
+
+
+--add this weather to register
+climate.register_weather(thunderstorm)
+
+
+------
diff --git a/games/globo/mods/health/LICENSE.txt b/games/globo/mods/health/LICENSE.txt
new file mode 100644
index 000000000..4596486dc
--- /dev/null
+++ b/games/globo/mods/health/LICENSE.txt
@@ -0,0 +1,655 @@
+License of source code
+----------------------
+Copyright (C) 2019 Dokimi
+
+----------------------
+
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ 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.
+
+
+ Copyright (C)
+
+ 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 .
diff --git a/games/globo/mods/health/README.txt b/games/globo/mods/health/README.txt
new file mode 100644
index 000000000..c39713af2
--- /dev/null
+++ b/games/globo/mods/health/README.txt
@@ -0,0 +1,42 @@
+Exile mod: Health
+=============================
+Adds player health effects e.g. hunger, thirst, fatigue, hypothermia, poisoning, disease
+
+
+
+
+Consummable items:
+-----------------
+HEALTH.use_item(itemstack, user, hp_change, thirst_change, hunger_change, energy_change, temp_change, replace_with_item)
+
+call from on_use.
+e.g. adds 5 food, minus 10 energy.
+on_use = function(itemstack, user, pointed_thing)
+ return HEALTH.use_item(itemstack, user, 0, 0, 5, -10, 0)
+end,
+
+
+
+
+Authors of source code
+----------------------
+Dokimi (GPLv3)
+
+
+
+Authors of media
+-----------------
+Health_alert http://soundbible.com/1669-Robot-Blip-2.html, Attribution 3.0, Marianne Gagnon
+Health_vomit http://soundbible.com/173-Puke-Vomit-Ralph.html Attribution 3.0 Mike Koenig
+health_hallucinate http://soundbible.com/2010-Laughter.html Attribution 3.0 Mike Koenig,
+and http://soundbible.com/139-Evil-Laugh-Male-2.html Public Domain,
+and http://soundbible.com/1257-Jolly-Laugh.html Attribution 3.0 Mike Koenig,
+and http://soundbible.com/2191-Hyena-Laughing.html Attribution 3.0 Daniel Simion
+and http://soundbible.com/366-Alien-Creatures.html Attribution 3.0 Mike Koenig,
+and http://soundbible.com/863-Dolphins.html sampling Plus 1.0, acclivity
+and http://soundbible.com/1071-Bouncing-Golf-Ball.html Attribution 3.0 Mike Koenig,
+and http://soundbible.com/1412-Yahoo.html sampling Plus 1.0, UncleSigmund
+Health_heart http://soundbible.com/672-Beating-Heart.html Sampling Plus 1.0 greyseraohim
+weather_hud_frost.png https://github.com/t-affeldt/climate CC-BY-SA, cap
+weather_hud_heat.png CC-BY-SA IAmInnocent
+
diff --git a/games/globo/mods/health/data_food.lua b/games/globo/mods/health/data_food.lua
new file mode 100644
index 000000000..a6de0d14c
--- /dev/null
+++ b/games/globo/mods/health/data_food.lua
@@ -0,0 +1,162 @@
+
+--food_data.lua
+--Contains data for all the predefined foods in Exile.
+--[[Some notes:
+ Calculating sensible values for food:
+ (intervals/day) * hunger_rate = daily basal food needs
+ i.e. 20 min/1 min * 2 = 40 units per day
+
+ Therefore 40 units = 2,000 Calories.
+ calories -> units = 2,000/40 = 50 kcal/unit
+
+ Sugar 3,900 kcal/kg = 78.0 units/kg 172.0 per lb.
+ Bread 2,600 kcal/kg = 52.0 units/kg 115.0 per lb.
+ Potato 750 kcal/kg = 15.0 units/kg 33.0 per lb.
+ Meat 2,000 kcal/kg = 40.0 units/kg 88.0 per lb.
+ cabbage 240 kcal/kg = 4.8 units/kg 10.5 per lb.
+ ]]--
+
+food_table = {
+ --name hp th hu en temp, replacewithitem (not implemented yet)
+ ["tech:maraka_bread_cooked"] = { 0, 0, 24, 14, 0 },
+ ["tech:maraka_bread_burned"] = { 0, 0, 12, 7, 0 },
+ ["tech:peeled_anperla_cooked"] = { 0, 2, 12, 7, 0 },
+ --example: burned anperla tubers are inedible, so no entry
+ ["tech:mashed_anperla_cooked"] = { 0, 12, 72, 42, 0 },
+ ["tech:mashed_anperla_burned"] = { 0, 6, 36, 21, 0 },
+ ["nodes_nature:sea_lettuce"] = { 0, 0, 5,-10, 0 },
+ ["nodes_nature:sea_lettuce_cooked"] = { 0, 0, 5, 0, 0 },
+ ["nodes_nature:vansano_seed"] = { 0, 0, 1, 0, 0 },
+ ["nodes_nature:tikusati_seed"] = { 0, 0, -2, 2, 0 },
+ --food and water hp th hu en te
+ ["nodes_nature:wiha"] = { 0, 4, 2, 0, 0 },
+ ["nodes_nature:zufani"] = { 0, 0, 6, 0, 0 },
+ ["nodes_nature:galanta"] = { 0, 1, 3, 0, 0 },
+ ["nodes_nature:lambakap"] = { 0, 10, 10, 0, 0 },
+ ["nodes_nature:tangkal_fruit"] = { 0, 5, 10, 10, 0 },
+ ["nodes_nature:momo"] = { 0, 1, 12, 0, 0 },
+ ["nodes_nature:snow"] = { 0, 50, 0,-100, -1 },
+ ["nodes_nature:snow_block"] = { 0,100, 0,-200, -2 },
+ --meat
+ ["animals:carcass_invert_small"] = { 0, 0, 3, -2, 0 },
+ ["animals:carcass_invert_small_cooked"]= { 0, 0, 6, 1, 0 },
+ ["animals:carcass_invert_small_burned"]= { 0, -1, 1, -3, 0 },
+ ["animals:carcass_invert_large"] = { 0, 1, 10, -6, 0 },
+ ["animals:carcass_invert_large_cooked"]= { 0, 1, 20, 3, 0 },
+ ["animals:carcass_invert_large_burned"]= { 0, -1, 2, -7, 0 },
+ ["animals:carcass_bird_small"] = { 0, 1 , 20, -4, 0 },
+ ["animals:carcass_bird_small_cooked"] = { 0, 1, 40, 2, 0 },
+ ["animals:carcass_bird_small_burned"] = { 0, -1, 5, -5, 0 },
+ ["animals:carcass_fish_small"] = { 0, 1, 15, -4, 0 },
+ ["animals:carcass_fish_small_cooked"] = { 0, 2, 30, 2, 0 },
+ ["animals:carcass_fish_small_burned"] = { 0, -1, 5, -5, 0 },
+ ["animals:carcass_fish_large"] = { 0, 3, 45,-12, 0 },
+ ["animals:carcass_fish_large_cooked"] = { 0, 3, 90, 6, 0 },
+ ["animals:carcass_fish_large_burned"] = { 0, -1, 21,-13, 0 },
+ --eggs
+ ["animals:darkasthaan_eggs"] = { 0, 1, 10, 0, 0 },
+ ["animals:gundu_eggs"] = { 0, 10, 30, 0, 0 },
+ ["animals:impethu_eggs"] = { 0, 0, 4, 0, 0 },
+ ["animals:kubwakubwa_eggs"] = { 0, 0, 6, 0, 0 },
+ ["animals:pegasun_eggs"] = { 0, 0, 5, 0, 0 },
+ ["animals:sarkamos_eggs"] = { 0, 10, 40, 0, 0 },
+ ["animals:sneachan_eggs"] = { 0, 0, 3, 0, 0 },
+ --drugs
+ ["nodes_nature:tikusati"] = { 0, 0, -2, 2, 0 },
+ --toxic
+ ["nodes_nature:nebiyi"] = { 0, 0, 1, -10, 0 },
+ ["nodes_nature:marbhan"] = { 0, 0, 1, -10, 0 },
+ -- Maraka nut is dangerous poisonous until processed,
+ -- causes photosensitivity, and risk of hepatotoxicity.
+ -- You can eat it raw if you want to take the risk... famine food for the desperate.
+ ["nodes_nature:maraka_nut"] = { 0, 0, 5, 5, 0 },
+ --medicine hp th hu en te
+ ["nodes_nature:hakimi"] = { 1, 0, 0, -5, 0 },
+ ["nodes_nature:merki"] = { 1, 0, 0, -5, 0 },
+ }
+
+bake_table = {
+ --name temp, duration, optional food value?
+ ["tech:maraka_bread"] = { 160, 10 },
+ ["tech:peeled_anperla"] = { 100, 7 },
+ ["tech:mashed_anperla"] = { 100, 35 },
+ ["nodes_nature:sea_lettuce"] = { 100, 3 },
+ ["animals:carcass_invert_small"] = { 100, 1 },
+ ["animals:carcass_invert_large"] = { 100, 3 },
+ ["animals:carcass_bird_small"] = { 100, 6 },
+ ["animals:carcass_fish_small"] = { 100, 6 },
+ ["animals:carcass_fish_large"] = { 100, 18 },
+}
+
+food_harm_table = {
+ --name { {tag, chance, severity}, {t, c, s}, etc }
+ ["tech:maraka_bread_cooked"] = { { "Food Poisoning", 0.001, 1} },
+ ["tech:maraka_bread_burned"] = { { "Food Poisoning", 0.001, 1} },
+ ["tech:peeled_anperla_cooked"] = { { "Food Poisoning", 0.002, 1} },
+
+ ["tech:mashed_anperla_cooked"] = { { "Food Poisoning", 0.002, 1} },
+ ["tech:mashed_anperla_burned"] = { { "Food Poisoning", 0.002, 1} },
+ ["nodes_nature:sea_lettuce"] = { { "Food Poisoning", 0.050, 1},
+ {"Intestinal Parasites", 0.010 } },
+ ["nodes_nature:sea_lettuce_cooked"] = { { "Food Poisoning", 0.002, 1} },
+ ["nodes_nature:vansano_seed"] = { { "Food Poisoning", 0.001, 1} },
+ ["nodes_nature:tikusati_seed"] = { { "Food Poisoning", 0.001, 1} },
+ ["nodes_nature:tikusati"] = { { "Food Poisoning", 0.001, 1} },
+ ["nodes_nature:nebiyi"] = { { "Food Poisoning", 0.001, 1} },
+ ["nodes_nature:marbhan"] = { { "Food Poisoning", 0.001, 1} },
+ ["nodes_nature:hakimi"] = { { "Food Poisoning", 0.001, 1} },
+ ["nodes_nature:merki"] = { { "Food Poisoning", 0.001, 1} },
+ ["nodes_nature:wiha"] = { { "Food Poisoning", 0.005, 1} },
+ ["nodes_nature:zufani"] = { { "Food Poisoning", 0.010, 1} },
+ ["nodes_nature:galanta"] = { { "Food Poisoning", 0.008, 1} },
+ ["nodes_nature:momo"] = { { "Food Poisoning", 0.001, 1} },
+ ["nodes_nature:maraka_nut"] = { { "Food Poisoning", 0.001, 1},
+ { "Hepatotoxicity", 0.005, math.floor(math.random(1,4)) },
+ { "Photosensitivity", 0.300, 1} },
+ --Tangkal Fruit is good food, but bulky, contains small amounts of alcohol.
+ ["nodes_nature:tangkal_fruit"] = { { "Food Poisoning", 0.001, 1},
+ { "Drunk", 0.005, 1} },
+ --meat
+ ["animals:carcass_invert_small"] = { { "Food Poisoning", 0.1, 1},
+ { "Intestinal Parasites",0.01, 1} },
+ ["animals:carcass_invert_small_cooked"] = { { "Food Poisoning", 0.002, 1} },
+ ["animals:carcass_invert_small_burned"] = { { "Food Poisoning", 0.001, 1} },
+ ["animals:carcass_invert_large"] = { { "Food Poisoning", 0.2, 1},
+ { "Intestinal Parasites",0.02, 1} },
+ ["animals:carcass_invert_large_cooked"] = { { "Food Poisoning",0.002, 1} },
+ ["animals:carcass_invert_large_burned"] = { { "Food Poisoning",0.001, 1} },
+ ["animals:carcass_bird_small"] = { { "Food Poisoning", 0.05, 1},
+ { "Intestinal Parasites",0.02, 1} },
+ ["animals:carcass_bird_small_cooked"] = { { "Food Poisoning", 0.002, 1} },
+ ["animals:carcass_bird_small_burned"] = { { "Food Poisoning", 0.001, 1} },
+ ["animals:carcass_fish_small"] = { { "Food Poisoning", 0.05, 1},
+ { "Intestinal Parasites",0.02, 1} },
+ ["animals:carcass_fish_small_cooked"] = { { "Food Poisoning", 0.002, 1} },
+ ["animals:carcass_fish_small_burned"] = { { "Food Poisoning", 0.001, 1} },
+ ["animals:carcass_fish_large"] = { { "Food Poisoning", 0.1, 1},
+ { "Intestinal Parasites",0.04, 1} },
+ ["animals:carcass_fish_large_cooked"] = { { "Food Poisoning", 0.004, 1} },
+ ["animals:carcass_fish_large_burned"] = { { "Food Poisoning", 0.002, 1} },
+ --eggs
+ ["animals:darkasthaan_eggs"] = { { "Food Poisoning", 0.1,
+ math.floor(math.random(1,4))},
+ { "Intestinal Parasites",0.01, 1} },
+ ["animals:gundu_eggs"] = { { "Food Poisoning", 0.05,
+ math.floor(math.random(1,4))},
+ { "Intestinal Parasites",0.1, 1} },
+ ["animals:impethu_eggs"] = { { "Food Poisoning", 0.1,
+ math.floor(math.random(1,4))},
+ { "Intestinal Parasites",0.1, 1} },
+ ["animals:kubwakubwa_eggs"] = { { "Food Poisoning", 0.1,
+ math.floor(math.random(1,4))},
+ { "Intestinal Parasites",0.01, 1} },
+ ["animals:pegasun_eggs"] = { { "Food Poisoning", 0.02,
+ math.floor(math.random(1,2))},
+ { "Intestinal Parasites",0.005, 1} },
+ ["animals:sarkamos_eggs"] = { { "Food Poisoning", 0.3,
+ math.floor(math.random(1,4))},
+ { "Intestinal Parasites",0.05, 1} },
+ ["animals:sneachan_eggs"] = { { "Food Poisoning", 0.5,
+ math.floor(math.random(1,4))},
+ { "Intestinal Parasites",0.5, 1} },
+ }
diff --git a/games/globo/mods/health/food.lua b/games/globo/mods/health/food.lua
new file mode 100644
index 000000000..1b0b5fb79
--- /dev/null
+++ b/games/globo/mods/health/food.lua
@@ -0,0 +1,237 @@
+--food.lua
+--handles the intake of food and drink
+
+--Modding info:
+--[[
+ To add new foods, define your node(s), then pass a table with food info to
+exile_add_food(table). Its on_use will be set automatically.
+ Make sure all your nodes have been defined BEFORE you send any tables!
+ exile_add_food() will override a node's on_use.
+
+ For cookable things, define the node, and a name_cooked/name_burned version,
+then pass the cooking data to exile_add_bake(table). Don't forget to add the
+cooked version to the food table.
+ If the burned version is not also added to foods, it will be inedible.
+ exile_add_bake() will override a node's on_construct and on_timer.
+
+ If a food can only be cooked in a pot, don't define a name_cooked node,
+but add it to the food table anyway. The cooking pot will make a soup using
+the food table's data, but the food will not be able to bake in an oven or
+over a fire.
+#TODO: Test this ^^ after the cooking pot supports both tables
+]]--
+
+-- Internationalization
+local S = HEALTH.S
+
+dofile(minetest.get_modpath('health')..'/data_food.lua')
+
+-- Declare globals
+food_harm_table = food_harm_table
+food_table = food_table
+bake_table = bake_table
+
+local function do_food_harm(user, nodename)
+ if not food_harm_table[nodename] then return end
+ local fht = food_harm_table[nodename]
+ for i = 1, #fht do
+ if math.random() < fht[i][2] then
+ HEALTH.add_new_effect(user, {fht[i][1], fht[i][3]})
+ end
+ end
+end
+
+local __eat_click_settings_cache = {}
+minetest.register_chatcommand("eat2x", {
+ params = "true | false",
+ description = "Toggles double-click to eat",
+ func = function(name, param)
+ local player = minetest.get_player_by_name(name)
+ local meta = player:get_meta()
+ local eat2x=meta:get_string("conf_eat2x") or minetest.settings:get("exile_eat_doubleclick") or "false"
+ if param and param ~="" then
+ local wlist = "/eat2x:\n"..
+ "Toggle double-click to eat"
+ return false, wlist
+ end
+ if eat2x == "true" then
+ eat2x = "false"
+ else
+ eat2x = "true"
+ end
+
+ meta:set_string("conf_eat2x", eat2x)
+ minetest.chat_send_player(name,"Double-Click to eat: "..eat2x)
+ if eat2x == 'true' then
+ eat2x = true
+ else
+ eat2x = false
+ end
+ __eat_click_settings_cache[name] = not eat2x
+ end,
+})
+
+function eat_ok (itemstack, user, pointed_thing)
+ local pt_pos = minetest.get_pointed_thing_position(pointed_thing)
+ local pname = user:get_player_name()
+ local single_click = __eat_click_settings_cache
+ if single_click[pname] == nil then
+ local pmeta = user:get_meta()
+ local eat2x = pmeta:get_string("conf_eat2x") or minetest.settings:get('exile_eat_doubleclick') or 'false'
+ if eat2x == 'true' then
+ eat2x = true
+ else
+ eat2x = false
+ end
+ single_click[pname] = not eat2x
+ end
+ if ( single_click[pname] ) or minimal.click_count_ready(pname,
+ "eat2x",
+ pt_pos,
+ 2, 2) then
+ return true
+ else
+ minetest.chat_send_player(pname, S("double click to eat"))
+ end
+end
+
+function exile_eatdrink_playermade(itemstack, user, pointed_thing)
+ local imeta = itemstack:get_meta()
+ local pname = user:get_player_name()
+ local t = minetest.deserialize(imeta:get_string("eat_value"))
+ if t == nil then minetest.log("warning", pname..
+ " ate an invalid food of type "..
+ itemstack:get_name())
+ return
+ end
+ if eat_ok(itemstack, user, pointed_thing) then
+ return HEALTH.use_item(itemstack, user, t[1], t[2], t[3], t[4], t[5], t[6])
+ end
+end
+
+function exile_eatdrink(itemstack, user, pointed_thing)
+ local name = itemstack:get_name()
+
+ if minetest.registered_aliases[name] then
+ name = minetest.registered_aliases[name]
+ end
+ if not food_table[name] then
+ minetest.chat_send_player(user:get_player_name(),
+ S("This is inedible."))
+ return
+ end
+ if eat_ok(itemstack, user, pointed_thing) then
+ do_food_harm(user, name)
+ local t = food_table[name]
+ return HEALTH.use_item(itemstack, user, t[1], t[2], t[3], t[4], t[5], t[6])
+ else
+ return
+ end
+end
+
+
+-- Overrides for edible and bakable nodes
+local eat_redef = {
+ on_use = function(itemstack, user, pointed_thing)
+ return exile_eatdrink(itemstack, user, pointed_thing)
+end}
+
+local function bake_error(pos, selfname)
+ local posstr = minetest.pos_to_string(pos)
+ minetest.log("error", "Warning, attempting to use a bake timer at "..
+ "pos: "..posstr..", set on a non-bakeable node:"..selfname)
+end
+
+local bake_redef = {
+ on_construct = function(pos)
+ local selfname = minetest.get_node(pos).name
+ selfname = selfname:gsub("_cooked","") -- ensure we have the base name
+ if bake_table[selfname] == nil then
+ bake_error(pos, selfname)
+ return true
+ end
+ ncrafting.start_bake(pos, bake_table[selfname][2])
+ end,
+ on_timer = function(pos, elapsed)
+ local selfname = minetest.get_node(pos).name
+ selfname = selfname:gsub("_cooked","") -- ensure we have the base name
+ if bake_table[selfname] == nil then
+ bake_error(pos, selfname)
+ return true
+ end
+ return ncrafting.do_bake(pos, elapsed,
+ bake_table[selfname][1],
+ bake_table[selfname][2])
+end}
+
+function exile_add_food(table)
+ --Add new foods, mod must send a table in the food_data.lua format
+ for k, v in pairs(table) do
+ food_table[k] = v
+ if minetest.registered_nodes[k] then
+ minetest.override_item(k, eat_redef)
+ end
+ end
+end
+function exile_add_bake(table)
+ --Add new bakables, mod must send a table in the food_data.lua format
+ for k, v in pairs(table) do
+ bake_table[k] = v
+ if minetest.registered_nodes[k] then
+ minetest.override_item(k, bake_redef)
+ end
+ end
+end
+function exile_add_harm(table)
+ --Add new food harm, mod must send a table in the food_data.lua format
+ for k, v in pairs(table) do
+ food_harm_table[k] = v
+ end
+end
+
+function exile_add_food_hooks(name)
+ if (minetest.get_item_group(name,'edible') > 0) or food_table[name] then
+ minetest.override_item(name, eat_redef)
+ end
+ if bake_table[name] then
+ minetest.override_item(name, bake_redef)
+ end
+ if string.match(name, "_cooked") then
+ minetest.override_item(name, bake_redef)
+ end
+end
+
+-- Add food hooks to all nodes in edible group
+minetest.register_on_mods_loaded(function()
+ for name,_ in pairs(minetest.registered_nodes) do
+ if minetest.get_item_group(name,'edible') > 0 then
+ exile_add_food_hooks(name)
+ end
+ end
+end)
+
+-- Finalized table list
+--Outputs a compilned list of all added foods to the minetest log, info level
+minetest.after(1, function()
+ minetest.log("info", "Finalized list of food_table entries:")
+ for k, v in pairs(food_table) do
+ if minetest.registered_nodes[k] then
+ minetest.log("info",k)
+ end
+ end
+ minetest.log("info","-------")
+ minetest.log("info", "Finalized list of bake_table entries:")
+ for k, v in pairs(bake_table) do
+ if not minetest.registered_nodes[k] then
+ minetest.log("info", "Bake table contains an undefined node: "..k)
+ else
+ if minetest.registered_nodes[k.."_cooked"] then
+ minetest.log("info",k)
+ else
+ minetest.log("info", "undefined node (cooking pot only entry): "..
+ k.."_cooked")
+ end
+ end
+ end
+ minetest.log("info","-------")
+end)
diff --git a/games/globo/mods/health/health_effects.lua b/games/globo/mods/health/health_effects.lua
new file mode 100644
index 000000000..c5ddfdde3
--- /dev/null
+++ b/games/globo/mods/health/health_effects.lua
@@ -0,0 +1,1487 @@
+-------------------------------------
+--HEALTH EFFECTS
+------------------------------------
+--[[
+Persistent changes e.g. disease, drug trips, venom, parasites
+
+Names
+A string name is used both for checks and is displayed on Char Tab (Lore)
+This string has an associated function.
+
+Effects List:
+Stored as string in the player meta. {{name, order},{name2, order},... }
+
+Run health function:
+Applies the health effect. Returns modifiers to main helath loop, runs
+other health processes (e.g. vomiting, staggering). Checks for internal means
+of progression or ending (timers, chance).
+Called by malus_bonus (i.e. the players internal metabolism)
+
+
+Triggers for adding:
+e.g. from eating, getting bitten, ...
+update_list_add_new,
+
+Triggers for swapping or removal
+-Internal:
+ - on_timer:
+ - chance:
+ - conditional:
+-external: something outside the disease process itself e.g eat item.
+
+
+each health effect has its three functions:
+- one for adding symptoms and calls for internal adding, swapping, removing (e.g. due to timers)
+- progression: for adding, worsening effects. Called internally and can be called externally (e.g. when eating items).
+- regression: for removing, lessening effects. Ditto
+(can use defaults for progress and regress)
+
+Any new effect must be listed in:
+- do_effects_list (so it can be run at all)
+- HEALTH.remove_new_effect (so it can be removed externally - not everything will need this)
+- HEALTH.add_new_effect (so it can be added)
+
+
+component effects:
+various minor effects (symptoms) shared by many diseases (e.g. vomiting). Called by the health effects internal function
+
+
+
+]]
+
+local random = math.random
+player_monoids = player_monoids
+HEALTH = HEALTH
+
+------------------------------------------------------------------
+-- VERIFYING FUNCTIONS
+------------------------------------------------------------------
+
+local function get_life_num(player) -- gets player's "lives" and returns it
+ --assert(type(player) == "userdata","get_life_num: invalid argument for 'player'")
+ --assert(player:is_player(),"get_life_num: player is not a player")
+ if (type(player) ~= "userdata") then
+ return 0,"get_life_num: invalid argument for 'player'"
+ end
+ if (player:is_player() ~= true) then
+ return 0,"get_life_num: 'player' is not a player"
+ end
+
+ local pmeta = player:get_meta()
+
+ return pmeta:get_int("lives") or 0
+end
+
+local function is_illness_valid(player,life_num)
+ -- general function that will decide whether a sickness
+ -- should continue or not
+ --if (type(sickdata) ~= "table") then
+ --return false
+ --end
+
+ --local life_num = sickdata.life_num
+
+ if (type(life_num) ~= "number") then
+ return false
+ elseif (life_num == get_life_num(player)) then
+ -- if assigned life_num to effect was the current player then say illness
+ -- is valid and good to go :D (poor player lol)
+ return true
+ else
+ return false
+ end
+end
+
+------------------------------------------------------------------
+--COMPONENT EFFECTS
+------------------------------------------------------------------
+
+
+--throw up losing some food and water
+local function vomit(player, meta, repeat_min, repeat_max, delay_min, delay_max, t_min, t_max, h_min, h_max )
+ --vomit repeatedly after time
+ local life_num = get_life_num(player)
+
+ local ranrep = random(repeat_min, repeat_max)
+
+ local randel = 0
+
+ for i=1, ranrep do
+ randel = randel + random(delay_min, delay_max)
+ minetest.after(randel, function()
+ if (is_illness_valid(player,life_num) ~= true) then
+ return
+ end
+
+ local pos = player:get_pos()
+ minetest.sound_play("health_vomit", {pos = pos, gain = 0.5, max_hear_distance = 2})
+
+ local rant = random(t_min, t_max)
+ local ranh = random(h_min, h_max)
+
+ --must directly set them, as time delay means it isn't feeding into main health loop
+ local thirst = meta:get_int("thirst")
+ local hunger = meta:get_int("hunger")
+
+ thirst = thirst - rant
+ hunger = hunger - ranh
+ if thirst < 0 then
+ thirst = 0
+ end
+ if hunger < 0 then
+ hunger = 0
+ end
+
+ meta:set_int("thirst", thirst)
+ meta:set_int("hunger", hunger)
+ end)
+ end
+end
+
+
+--stagger, make player hard to control
+local function stagger(player, repeat_min, repeat_max, delay_min, delay_max, stag)
+
+ local life_num = get_life_num(player)
+
+ local name = player:get_player_name()
+
+ --move erraticly repeatedly after time
+ local ranrep = random(repeat_min, repeat_max)
+ local randel = 0
+
+ for i=1, ranrep do
+ randel = randel + random(delay_min, delay_max)
+ minetest.after(randel, function()
+ if (is_illness_valid(player,life_num) ~= true) then
+ return
+ end
+
+ if not bed_rest.player[name] then
+ local xr = random(-stag, stag)
+ local zr = random(-stag, stag)
+ player:add_velocity({x=xr, y=0, z=zr})
+ --player_api.set_animation(player, "walk", 10) --doesn't work
+ end
+ end)
+ end
+end
+
+
+--organ failure... time to die...
+local function organ_failure(player, repeat_min, repeat_max, delay_min, delay_max, dam_min, dam_max)
+ local life_num = get_life_num(player)
+
+ local ranrep = random(repeat_min, repeat_max)
+ local name = player:get_player_name()
+ minetest.sound_play("health_heart", {to_player = name, gain = 0.5})
+
+ local randel = 0
+
+ for i=1, ranrep do
+ randel = randel + random(delay_min, delay_max)
+ minetest.after(randel, function()
+ if (is_illness_valid(player,life_num) ~= true) then
+ return
+ end
+
+ local ran_dam = random(dam_min, dam_max)
+
+ local health = player:get_hp()
+ health = health - ran_dam
+
+ if health < 0 then
+ health = 0
+ elseif health > 20 then
+ health = 20
+ end
+
+ player:set_hp(health)
+
+ end)
+ end
+
+end
+
+
+--hallucinate
+local function auditory_hallucination(player, repeat_min, repeat_max, delay_min, delay_max, min_gain, max_gain)
+ --hear things repeatedly after time
+ local life_num = get_life_num(player)
+
+ local ranrep = random(repeat_min, repeat_max)
+ local name = player:get_player_name()
+
+ local randel = 0
+
+ for i=1, ranrep do
+ randel = randel + random(delay_min, delay_max)
+ minetest.after(randel, function()
+
+ if (is_illness_valid(player,life_num) ~= true) then
+ return
+ end
+
+ local pos = player:get_pos()
+ -- happens after randel delay, so player may be gone
+ if pos == nil then return end
+
+ pos = {x=pos.x+random(-15,15), y=pos.y+random(-15,15), z=pos.z+random(-15,15)}
+
+ minetest.sound_play("health_hallucinate", {to_player = name, pos = pos, gain = random(min_gain,max_gain)})
+
+ end)
+ end
+end
+
+
+--tunnel vision
+
+--collapse
+
+
+
+
+
+
+
+
+---------------------------------------------------------------------------
+--Timers for ending:
+---------------------------------------------------------------------------
+
+
+--if not set will set the timer, save to meta
+--otherwise it will tick down
+--if zero it will return true so progression can take place
+local function do_timer(meta, t_name, t_min, t_max)
+ --is timer present?
+ if not meta:contains(t_name) then
+ local duration = random(t_min, t_max)
+ meta:set_int(t_name, duration)
+ return false
+ else
+ --count down
+ local time = meta:get_int(t_name)
+ time = time - 1
+ if time <= 0 then
+ meta:set_int(t_name,0)
+ return true
+ else
+ meta:set_int(t_name,time)
+ return false
+ end
+ end
+end
+
+
+--add (or subtract) to the value for a timer that already exists
+local function extend_timer(meta, t_name, t_min, t_max)
+
+ local time = meta:get_int(t_name)
+ local duration = random(t_min, t_max)
+ time = time + duration
+
+ if time <= 0 then
+ time = 0
+ end
+ meta:set_int(t_name,time)
+
+end
+
+--end timer, e.g. when removing an effect
+local function end_timer(meta, t_name)
+ meta:set_int(t_name,0)
+end
+
+
+---------------------------------------------------------------------------
+--Update Effects List
+---------------------------------------------------------------------------
+--swap an effect that currently exists, including swap to nil
+--finds given effect, removes it and replaces it (optional)
+-- name e.g. "Food Poisoning" (the general type of effect)
+--replace is the table inserted e.g. {"Food Poisoning", 2}
+local function update_list_swap(meta, effects_list, name, replace)
+
+ for i, effect in ipairs(effects_list) do
+ if effect[1] == name then
+ table.remove(effects_list, i)
+ end
+ end
+
+ --replace
+ if replace then
+ table.insert(effects_list, replace)
+ end
+
+ -- update HUD number, save
+ local num = #effects_list or 0
+ meta:set_int("effects_num", num )
+
+ meta:set_string("effects_list", minetest.serialize(effects_list))
+
+end
+
+---------------------------------------------------------------------------
+--RUN health functions:
+---------------------------------------------------------------------------
+--Default progression and regression, for effects with timers
+local function default_timer_progress(effect_name, t_min, t_max, max_order,
+ c_boost, meta, effects_list,
+ current_order, added_order, internal)
+
+ --was called internally so can skip comparisons (it will be higher)
+ if internal == true then
+ update_list_swap(meta, effects_list, effect_name, {effect_name, added_order})
+ extend_timer(meta, effect_name, t_min, t_max)
+ return
+ end
+
+ --current order vs the order of what we are trying to add
+ --higher replaces lower, and extends the timer.
+ if current_order < added_order then
+ update_list_swap(meta, effects_list, effect_name, {effect_name, added_order})
+ extend_timer(meta, effect_name, t_min, t_max)
+
+ else
+ --lower and equal extends the timer
+ extend_timer(meta, effect_name, t_min, t_max)
+ --with chance to increase severity
+ if current_order < max_order and random() < c_boost then
+ current_order = current_order + 1
+ if current_order > max_order then
+ current_order = max_order
+ end
+ update_list_swap(meta, effects_list, effect_name, {effect_name, current_order})
+ end
+ end
+end
+
+
+local function default_timer_regress(player, effect_name, t_min, t_max, meta,
+ effects_list, current_order, removed_order,
+ replace_nil, internal)
+ --was called internally so can skip comparisons
+ if internal == true then
+ if current_order <= 0 then
+ --remove from effects list
+ update_list_swap(meta, effects_list, effect_name)
+ end_timer(meta, effect_name)
+
+ if replace_nil then
+ --swtich to a different effect rather than nothing
+ HEALTH.add_new_effect(player, replace_nil)
+ end
+
+ else
+ --swap with new lower value
+ update_list_swap(meta, effects_list, effect_name, {effect_name, current_order})
+ extend_timer(meta, effect_name, t_min, t_max)
+ end
+ return
+ end
+
+ --current order vs the order of what we are trying to remove
+ if current_order > removed_order then
+ --trying to remove lower than current (i.e. not powerful enough)
+ --chance it does some small help
+ if random() <0.1 then
+ extend_timer(meta, effect_name, -t_max, -t_min)
+ end
+ else
+ --removing higher or equal than current (i.e. effective treatment)
+ --lower the order
+ local order = current_order - 1
+ if order <= 0 then
+ --remove from effects list
+ update_list_swap(meta, effects_list, effect_name)
+ end_timer(meta, effect_name)
+ if replace_nil then
+ --swtich to a different effect rather than nothing
+ HEALTH.add_new_effect(player, replace_nil)
+ end
+ else
+ --swap with new lower value
+ update_list_swap(meta, effects_list, effect_name, {effect_name, order})
+ extend_timer(meta, effect_name, t_min, t_max)
+ end
+ end
+
+
+end
+
+
+----------------------------------
+--Food Poisoning
+--[[
+effect_name = "Food Poisoning"
+
+Ate something bad.
+vomiting, fever, etc
+
+]]--
+
+
+function HEALTH.food_poisoning(order, player, meta, effects_list, r_rate,
+ mov, jum, temperature)
+
+ --APPLY SYMPTOMS
+ if order == 1 then
+ --slow recovery, movement
+ r_rate = r_rate - 1
+ mov = mov - 2
+ jum = jum - 2
+ --some vomiting
+ if random()<0.3 then
+ vomit(player, meta, 1, 3, 1, 10, 1, 5, 1, 5 )
+ end
+
+ elseif order == 2 then
+ --slow recovery, movement
+ r_rate = r_rate - 2
+ mov = mov - 4
+ jum = jum - 4
+ --some vomiting
+ if random()<0.6 then
+ vomit(player, meta, 1, 4, 1, 10, 1, 10, 1, 10 )
+ end
+
+ elseif order == 3 then
+ --slow recovery, movement
+ r_rate = r_rate - 4
+ mov = mov - 20
+ jum = jum - 20
+ --fever
+ if temperature <= 42 then
+ temperature = temperature + random(2,3)
+ end
+ --vomiting
+ vomit(player, meta, 1, 5, 1, 10, 5, 10, 5, 10 )
+ --mild staggering
+ stagger(player, 1, 5, 1, 5, 3)
+
+ elseif order == 4 then
+ --slow recovery, movement
+ r_rate = r_rate - 8
+ mov = mov - 30
+ jum = jum - 30
+ --fever
+ if temperature <= 42 then
+ temperature = temperature + random(2,3)
+ end
+ --vomiting
+ vomit(player, meta, 5, 10, 1, 10, 5, 10, 5, 10 )
+ --mild staggering
+ stagger(player, 1, 5, 1, 5, 3)
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Food Poisoning", 3, 6) == true then
+ --small chance of worsening, otherwise recover
+
+ if random()<0.1 then
+ local added_order = order + 1
+ if added_order > 4 then
+ added_order = 4
+ end
+ --food_poisoning_progress(meta, effects_list, order, added_order, true)
+ default_timer_progress("Food Poisoning", 3, 6, 4, 0.2, meta, effects_list, order, added_order, true)
+ else
+ --food_poisoning_regress(meta, effects_list, order-1, nil, true)
+ default_timer_regress(player, "Food Poisoning", 3, 6, meta, effects_list, order-1, nil, nil, true)
+ end
+
+ end
+
+ --send back modified values
+ return r_rate, mov, jum, temperature
+
+end
+
+
+----------------------------------
+--Fungal Infection
+--[[
+effect_name = "Fungal Infection"
+Soil fungus got into your skin. Something vaguely like Mycetoma.
+For Exile, you get it from wet soil, a reason not to live in a mud hole.
+]]--
+
+function HEALTH.fungal_infection(order, player, meta, effects_list, r_rate,
+ mov, jum, temperature)
+
+ --APPLY SYMPTOMS
+ if order == 1 then
+ --slow recovery, movement
+ r_rate = r_rate - 1
+ mov = mov - 1
+ jum = jum - 1
+
+ elseif order == 2 then
+ --slow recovery, movement
+ r_rate = r_rate - 2
+ mov = mov - 2
+ jum = jum - 2
+
+ elseif order == 3 then
+ --slow recovery, movement
+ r_rate = r_rate - 4
+ mov = mov - 8
+ jum = jum - 8
+
+ elseif order == 4 then
+ --slow recovery, movement
+ r_rate = r_rate - 8
+ mov = mov - 16
+ jum = jum - 16
+ --fever
+ if temperature <= 39 then
+ temperature = temperature + 1
+ end
+
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Fungal Infection", 6, 12) == true then
+ --small chance of worsening, otherwise recover
+ if random()<0.1 then
+ local added_order = order + 1
+ if added_order > 4 then
+ added_order = 4
+ end
+ default_timer_progress("Fungal Infection", 6, 12, 4, 0.2, meta, effects_list, order, added_order, true)
+ else
+ default_timer_regress(player, "Fungal Infection", 6, 12, meta, effects_list, order-1, nil, nil, true)
+ end
+
+ end
+
+ --send back modified values
+ return r_rate, mov, jum, temperature
+
+end
+
+----------------------------------
+--Dust Fever
+--[[
+effect_name = "Dust Fever"
+Dust storm born soil fungus got into your lungs. Something vaguely like Valley Fever.
+
+]]--
+
+function HEALTH.dust_fever(order, player, meta, effects_list, r_rate, mov,
+ jum, temperature)
+
+ --APPLY SYMPTOMS
+ if order == 1 then
+ --slow recovery, movement
+ r_rate = r_rate - 4
+ jum = jum - 1
+ --fever
+ if temperature <= 39 then
+ temperature = temperature + 1
+ end
+
+ elseif order == 2 then
+ --slow recovery, movement
+ r_rate = r_rate - 8
+ mov = mov - 1
+ jum = jum - 2
+ --fever
+ if temperature <= 39 then
+ temperature = temperature + 1
+ end
+
+ elseif order == 3 then
+ --slow recovery, movement
+ r_rate = r_rate - 16
+ mov = mov - 2
+ jum = jum - 4
+ --fever
+ if temperature <= 40 then
+ temperature = temperature + 1
+ end
+
+ elseif order == 4 then
+ --slow recovery, movement
+ r_rate = r_rate - 32
+ mov = mov - 4
+ jum = jum - 8
+ --fever
+ if temperature <= 41 then
+ temperature = temperature + 1
+ end
+
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Dust Fever", 6, 12) == true then
+ --small chance of worsening, otherwise recover
+ if random()<0.1 then
+ local added_order = order + 1
+ if added_order > 4 then
+ added_order = 4
+ end
+ default_timer_progress("Dust Fever", 6, 12, 4, 0.2, meta, effects_list, order, added_order, true)
+ else
+ default_timer_regress(player, "Dust Fever", 6, 12, meta, effects_list, order-1, nil, nil, true)
+ end
+
+ end
+
+ --send back modified values
+ return r_rate, mov, jum, temperature
+
+end
+
+
+----------------------------------
+--Drunkeness
+--[[
+effect_name = "Drunk"
+Alcohol intoxication. Stumble around. Extreme level is alcohol poisoning
+
+]]--
+
+
+function HEALTH.drunk(order, player, meta, effects_list, r_rate, mov, jum,
+ h_rate, temperature)
+ local max_drunk = meta:get_int("max_hangover") or 0
+ --APPLY SYMPTOMS
+ if order == 1 then
+ if max_drunk < 1 then
+ max_drunk = 1
+ meta:set_int("max_hangover", max_drunk)
+ end
+
+ r_rate = r_rate - 1
+ mov = mov - 2
+ jum = jum - 5
+ --mild staggering
+ stagger(player, 1, 5, 1, 5, 3)
+
+ elseif order == 2 then
+ if max_drunk < 2 then
+ max_drunk = 2
+ meta:set_int("max_hangover", max_drunk)
+ end
+
+ r_rate = r_rate - 2
+ mov = mov - 5
+ jum = jum - 10
+ --staggering
+ stagger(player, 5, 10, 0.5, 5, 4)
+
+ elseif order == 3 then
+ if max_drunk < 3 then
+ max_drunk = 3
+ meta:set_int("max_hangover", max_drunk)
+ end
+
+ r_rate = r_rate - 4
+ mov = mov - 10
+ jum = jum - 15
+ --vomit chance
+ if random()<0.5 then
+ vomit(player, meta, 1, 3, 1, 10, 1, 5, 1, 5 )
+ end
+ --major staggering
+ stagger(player, 30, 60, 0.5, 1, 4)
+
+ elseif order == 4 then
+ if max_drunk < 4 then
+ max_drunk = 4
+ meta:set_int("max_hangover", max_drunk)
+ end
+
+ r_rate = r_rate - 4
+ h_rate = h_rate - 2
+ mov = mov - 20
+ jum = jum - 20
+
+ --vomiting and hypothermia
+ vomit(player, meta, 1, 5, 1, 10, 5, 10, 5, 10 )
+ if temperature >= 34 then
+ temperature = temperature - random(1,3)
+ end
+ --damage
+ if random()<0.25 then
+ organ_failure(player, 1, 3, 1, 8, 2, 3)
+ end
+ --major staggering
+ stagger(player, 30, 60, 0.5, 1, 4)
+
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Drunk", 3, 6) == true then
+ order = order - 1
+ -- recover with a hangover that matches most extreme point achieved
+ default_timer_regress(player, "Drunk", 3, 6, meta, effects_list, order, nil, {"Hangover", max_drunk}, true)
+
+ --reset to zero
+ if order <= 0 then
+ meta:set_int("max_hangover", 0)
+ end
+ end
+
+ --send back modified values
+ return r_rate, mov, jum, h_rate, temperature
+
+end
+
+----------------------------------
+--Hangover
+--[[
+effect_name = "Hangover"
+After effects of drugs and alcohol
+
+]]--
+
+function HEALTH.hangover(order, player, meta, effects_list, mov, jum )
+
+ --APPLY SYMPTOMS
+ if order == 1 then
+ mov = mov - 2
+ jum = jum - 2
+
+ elseif order == 2 then
+ mov = mov - 4
+ jum = jum - 4
+
+ elseif order == 3 then
+ mov = mov - 6
+ jum = jum - 6
+ --mild staggering
+ stagger(player, 1, 5, 1, 5, 3)
+
+ elseif order == 4 then
+ mov = mov - 8
+ jum = jum - 8
+ --mild staggering
+ stagger(player, 1, 5, 1, 5, 3)
+
+ end
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Hangover", 4, 8) == true then
+ order = order - 1
+ -- recover
+ default_timer_regress(player, "Hangover", 4, 8, meta, effects_list, order, nil, nil, true)
+
+ end
+
+ --send back modified values
+ return mov, jum
+
+end
+
+
+----------------------------------
+--Intestinal Parasites
+--[[
+effect_name = "Intestinal Parasites"
+Gut worms etc. Increased hunger.
+
+]]--
+
+
+function HEALTH.intestinal_parasites(order, player, meta, effects_list,
+ r_rate, hun_rate)
+ --no orders, or progression.
+ --you get them, then hope they go away (or cure them)
+ --hunger quicker, recover slower
+ r_rate = r_rate - 2
+ hun_rate = hun_rate - 6
+
+ --end chance
+ if random()<0.001 then
+ update_list_swap(meta, effects_list, "Intestinal Parasites")
+ end
+
+ --send back modified values
+ return r_rate, hun_rate
+
+end
+
+
+
+----------------------------------
+--Tiku Stimulants
+--[[
+effect_name = "Tiku High"
+For a crazy drug fueled bender, with a chance of losing control of it.
+Extreme is an overdose
+
+]]--
+
+
+function HEALTH.tiku_high(order, player, meta, effects_list, r_rate,
+ hun_rate, mov, jum, temperature)
+ local max_drunk = meta:get_int("max_hangover") or 0
+ --APPLY SYMPTOMS
+ if order == 1 then
+ if max_drunk < 1 then
+ max_drunk = 1
+ meta:set_int("max_hangover", max_drunk)
+ end
+
+ r_rate = r_rate + 6
+ hun_rate = hun_rate - 2
+ mov = mov + 24
+ jum = jum + 12
+ if random()<0.1 then
+ auditory_hallucination(player, 1, 3, 3, 10, 0.01, 0.02)
+ end
+
+ elseif order == 2 then
+ if max_drunk < 2 then
+ max_drunk = 2
+ meta:set_int("max_hangover", max_drunk)
+ end
+ r_rate = r_rate + 12
+ hun_rate = hun_rate - 4
+ mov = mov + 36
+ jum = jum + 24
+ -- mild fever
+ if temperature < 38 and random()<0.3 then
+ temperature = temperature + random(2,3)
+ end
+ if random()<0.1 then
+ auditory_hallucination(player, 1, 4, 2, 10, 0.02, 0.08)
+ end
+
+
+ elseif order == 3 then
+ if max_drunk < 3 then
+ max_drunk = 3
+ meta:set_int("max_hangover", max_drunk)
+ end
+ r_rate = r_rate + 24
+ hun_rate = hun_rate - 8
+ mov = mov + 48
+ jum = jum + 45
+ -- mild fever
+ if temperature <= 38 and random()<0.6 then
+ temperature = temperature + random(2,3)
+ end
+ --time to go crazy
+ auditory_hallucination(player, 30, 60, 0.4, 1, 0.5, 4)
+ --mild staggering
+ stagger(player, 1, 5, 1, 5, 3)
+
+
+ elseif order == 4 then
+ if max_drunk < 4 then
+ max_drunk = 4
+ meta:set_int("max_hangover", max_drunk)
+ end
+ r_rate = r_rate - 24
+ hun_rate = hun_rate - 8
+ mov = mov - 5
+ jum = jum - 5
+
+ -- fever
+ if temperature <= 43 then
+ temperature = temperature + random(2,4)
+ end
+ --time to go crazy
+ auditory_hallucination(player, 30, 60, 0.5, 1, 1, 4)
+ --major staggering
+ stagger(player, 30, 60, 0.5, 1, 4)
+ --vomit chance
+ if random()<0.75 then
+ vomit(player, meta, 1, 3, 1, 10, 1, 5, 1, 5 )
+ end
+ --damage
+ if random()<0.33 then
+ organ_failure(player, 1, 5, 1, 8, 1, 2)
+ end
+
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Tiku High", 6, 12) == true then
+ --small chance of worsening, otherwise recover
+ if random()<0.1 then
+ local added_order = order + 1
+ if added_order > 4 then
+ added_order = 4
+ end
+ default_timer_progress("Tiku High", 3, 6, 3, 0.2, meta, effects_list, order, added_order, true)
+ else
+ order = order - 1
+ -- recover with a hangover that matches most extreme point achieved
+ default_timer_regress(player, "Tiku High", 3, 6, meta, effects_list, order, nil, {"Hangover", max_drunk}, true)
+
+ --reset to zero
+ if order <= 0 then
+ meta:set_int("max_hangover", 0)
+ end
+ end
+ end
+
+ --send back modified values
+ return r_rate, hun_rate, mov, jum, temperature
+
+end
+
+
+----------------------------------
+--Neurotoxicity (brain)
+--[[
+effect_name = "Neurotoxicity"
+ nerve poison. staggering, movement problems, death
+
+]]--
+
+function HEALTH.neurotoxicity(order, player, meta, effects_list, mov, jum)
+
+ --APPLY SYMPTOMS
+ if order == 1 then
+ --restrict movement
+ mov = mov - 7
+ jum = jum - 7
+ --major staggering
+ stagger(player, 10, 15, 0.3, 1, 4)
+
+ elseif order == 2 then
+ --restrict movement
+ mov = mov - 15
+ jum = jum - 15
+ --major staggering
+ stagger(player, 20, 30, 0.3, 1, 4)
+ --damage
+ if random()<0.05 then
+ organ_failure(player, 1, 3, 1, 5, 1, 5)
+ end
+
+ elseif order == 3 then
+ --restrict movement
+ mov = mov - 30
+ jum = jum - 30
+ --major staggering
+ stagger(player, 50, 60, 0.3, 1, 4)
+ --damage
+ if random()<0.25 then
+ organ_failure(player, 1, 3, 1, 5, 1, 5)
+ end
+
+ elseif order == 4 then
+ --restrict movement
+ mov = mov - 30
+ jum = jum - 30
+ --major staggering
+ stagger(player, 50, 60, 0.3, 1, 4)
+ --damage
+ organ_failure(player, 1, 3, 1, 5, 1, 5)
+
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Neurotoxicity", 6, 12) == true then
+ -- recover
+ default_timer_regress(player, "Neurotoxicity", 3, 6, meta, effects_list, order-1, nil, nil, true)
+
+ end
+
+ --send back modified values
+ return mov, jum
+
+end
+
+
+
+----------------------------------
+--Hepatotoxicity (liver)
+--[[
+effect_name = "Hepatotoxicity"
+liver poison. vomiting, death
+
+]]--
+function HEALTH.hepatotoxicity(order, player, meta, effects_list, mov, jum,
+ r_rate, h_rate)
+
+ --APPLY SYMPTOMS
+ --you're fine until you really aren't
+ if random()<0.3 then
+
+ if order == 1 then
+ vomit(player, meta, 2, 6, 0.75, 3, 1, 2, 5, 10 )
+ mov = mov - 7
+ jum = jum - 7
+ r_rate = r_rate - 7
+ h_rate = h_rate - 1
+ --damage
+ if random()<0.05 then
+ organ_failure(player, 1, 2, 1, 5, 5, 8)
+ end
+
+ elseif order == 2 then
+ vomit(player, meta, 5, 10, 0.75, 3, 1, 5, 10, 20 )
+ mov = mov - 15
+ jum = jum - 15
+ r_rate = r_rate - 15
+ h_rate = h_rate - 3
+ --damage
+ if random()<0.25 then
+ organ_failure(player, 1, 2, 1, 5, 5, 8)
+ end
+
+ elseif order == 3 then
+ vomit(player, meta, 10, 20, 0.75, 3, 1, 5, 20, 40 )
+ mov = mov - 30
+ jum = jum - 30
+ r_rate = r_rate - 30
+ h_rate = h_rate - 6
+ --damage
+ if random()<0.5 then
+ organ_failure(player, 1, 2, 1, 5, 5, 8)
+ end
+
+ elseif order == 4 then
+ vomit(player, meta, 10, 20, 0.75, 3, 2, 10, 40, 60 )
+ mov = mov - 30
+ jum = jum - 30
+ r_rate = r_rate - 60
+ h_rate = h_rate - 6
+ --damage
+ organ_failure(player, 1, 2, 1, 5, 5, 8)
+
+ end
+
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Hepatotoxicity", 6, 12) == true then
+ -- recover
+ default_timer_regress(player, "Hepatotoxicity", 6, 12, meta, effects_list, order-1, nil, nil, true)
+
+ end
+
+ --send back modified values
+ return mov, jum, r_rate, h_rate
+
+end
+
+
+----------------------------------
+--Phototoxin (light and skin)
+--[[
+effect_name = "Photosensitivity"
+Light sensitivity
+i.e. you are coming up in blisters if exposed to sun
+]]--
+
+function HEALTH.photosensitivity(order, player, meta, effects_list,
+ h_rate, r_rate )
+
+ --APPLY SYMPTOMS
+ --you're fine unless in the sun
+ local pos = player:get_pos()
+ pos.y = pos.y + 0.8
+ local light = minetest.get_node_light(pos) or 0
+ if light >= 13 then
+
+ if order == 1 then
+ h_rate = h_rate - 3
+ r_rate = r_rate - 8
+ stagger(player, 1, 2, 1, 5, 1)
+
+ elseif order == 2 then
+ h_rate = h_rate - 6
+ r_rate = r_rate - 12
+ stagger(player, 1, 3, 1, 5, 1)
+
+ elseif order == 3 then
+ h_rate = h_rate - 12
+ r_rate = r_rate - 24
+ stagger(player, 1, 2, 1, 5, 1)
+
+ elseif order == 4 then
+ h_rate = h_rate - 9
+ r_rate = r_rate - 48
+ stagger(player, 1, 4, 1, 5, 1)
+ end
+
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Photosensitivity", 12, 24) == true then
+ -- recover
+ default_timer_regress(player, "Photosensitivity", 12, 24, meta, effects_list, order-1, nil, nil, true)
+
+ end
+
+ --send back modified values
+ return h_rate, r_rate
+
+end
+
+----------------------------------
+--Meta-Stim
+--[[
+effect_name = Meta-Stim
+from artifact. Super powers for a price.
+Increasing powers unlocked the more you inject.
+A slight bit of a techno-vampire vibe
+
+]]--
+
+
+function HEALTH.meta_stim(order, player, meta, effects_list, h_rate,
+ r_rate, hun_rate, t_rate)
+ local max_metastim = meta:get_int("max_metastim") or 0
+
+
+ --only applies effect if not in bright light
+ local pos = player:get_pos()
+ pos.y = pos.y + 0.8
+ local light = minetest.get_node_light(pos) or 0
+ if light <= 14 then
+
+
+ --APPLY SYMPTOMS
+ if order == 1 then
+ if max_metastim < 1 then
+ max_metastim = 1
+ meta:set_int("max_metastim", max_metastim)
+ end
+
+ --Get boosters
+ h_rate = h_rate + 8
+ r_rate = r_rate + 32
+ hun_rate = hun_rate + 5
+ t_rate = t_rate + 5
+
+
+ elseif order == 2 then
+ if max_metastim < 2 then
+ max_metastim = 2
+ meta:set_int("max_metastim", max_metastim)
+ end
+
+ --Get boosters
+ h_rate = h_rate + 16
+ r_rate = r_rate + 64
+ hun_rate = hun_rate + 10
+ t_rate = t_rate + 10
+
+ --cures mild ailments
+ HEALTH.remove_new_effect(player, {"Food Poisoning", 2})
+ HEALTH.remove_new_effect(player, {"Dust Fever", 2})
+ HEALTH.remove_new_effect(player, {"Fungal Infection", 2})
+ HEALTH.remove_new_effect(player, {"Hangover", 2})
+ HEALTH.remove_new_effect(player, {"Intestinal Parasites"})
+
+
+
+ elseif order == 3 then
+ if max_metastim < 3 then
+ max_metastim = 3
+ meta:set_int("max_metastim", max_metastim)
+ end
+
+ --Get boosters
+ h_rate = h_rate + 32
+ r_rate = r_rate + 128
+ hun_rate = hun_rate + 20
+ t_rate = t_rate + 20
+
+ --cures serious ailments
+ HEALTH.remove_new_effect(player, {"Food Poisoning", 4})
+ HEALTH.remove_new_effect(player, {"Dust Fever", 4})
+ HEALTH.remove_new_effect(player, {"Fungal Infection", 4})
+ HEALTH.remove_new_effect(player, {"Drunk", 4})
+ HEALTH.remove_new_effect(player, {"Hangover", 4})
+ HEALTH.remove_new_effect(player, {"Intestinal Parasites"})
+ HEALTH.remove_new_effect(player, {"Tiku High", 4})
+ HEALTH.remove_new_effect(player, {"Neurotoxicity", 4})
+ HEALTH.remove_new_effect(player, {"Hepatotoxicity", 4})
+
+
+ elseif order == 4 then
+ if max_metastim < 4 then
+ max_metastim = 4
+ meta:set_int("max_metastim", max_metastim)
+ end
+
+
+ --Get boosters
+ h_rate = h_rate + 32
+ r_rate = r_rate + 128
+ hun_rate = hun_rate + 20
+ t_rate = t_rate + 20
+
+ --cures serious ailments
+ HEALTH.remove_new_effect(player, {"Food Poisoning", 4})
+ HEALTH.remove_new_effect(player, {"Dust Fever", 4})
+ HEALTH.remove_new_effect(player, {"Fungal Infection", 4})
+ HEALTH.remove_new_effect(player, {"Drunk", 4})
+ HEALTH.remove_new_effect(player, {"Hangover", 4})
+ HEALTH.remove_new_effect(player, {"Intestinal Parasites"})
+ HEALTH.remove_new_effect(player, {"Tiku High", 4})
+ HEALTH.remove_new_effect(player, {"Neurotoxicity", 4})
+ HEALTH.remove_new_effect(player, {"Hepatotoxicity", 4})
+
+
+ --Achieve God like powers
+ if pos.y < 200 then
+ player_monoids.fly:add_change(player, true, "health:metastim")
+ player_monoids.gravity:add_change(player, 0.1, "health:metastim")
+ --player_monoids.noclip:add_change(player, true, "health:metastim") --does weird stuff with stagger?
+ else
+ --no flying into space!
+ player_monoids.fly:del_change(player, "health:metastim")
+ player_monoids.gravity:del_change(player, "health:metastim")
+ end
+
+ --I am a GOD!
+ minetest.sound_play( {name="health_superpower", gain=1}, {pos=pos, max_hear_distance=20})
+ minetest.add_particlespawner({
+ amount = 80,
+ time = 18,
+ minpos = {x=pos.x+7, y=pos.y+7, z=pos.z+7},
+ maxpos = {x=pos.x-7, y=pos.y-7, z=pos.z-7},
+ minvel = {x = -5, y = -5, z = -5},
+ maxvel = {x = 5, y = 5, z = 5},
+ minacc = {x = -3, y = -3, z = -3},
+ maxacc = {x = 3, y = 3, z = 3},
+ minexptime = 0.2,
+ maxexptime = 1,
+ minsize = 0.5,
+ maxsize = 2,
+ texture = "health_superpower.png",
+ glow = 15,
+ })
+
+
+ end
+
+ else
+ --in bright light
+
+ --can't fly
+ player_monoids.fly:del_change(player, "health:metastim")
+ player_monoids.gravity:del_change(player, "health:metastim")
+
+ --get photosensitivity
+ if order == 1 then
+ HEALTH.add_new_effect(player, {"Photosensitivity", 1})
+ elseif order == 2 then
+ HEALTH.add_new_effect(player, {"Photosensitivity", 2})
+ elseif order == 3 then
+ HEALTH.add_new_effect(player, {"Photosensitivity", 3})
+ elseif order == 4 then
+ HEALTH.add_new_effect(player, {"Photosensitivity", 4})
+ end
+
+
+
+ end
+
+
+ --PROGRESSION (timers, conditionals, chance)
+ if do_timer(meta, "Meta-Stim", 12, 24) == true then
+ order = order - 1
+ -- end with a toxic hangover that matches most extreme point achieved
+ default_timer_regress(player, "Meta-Stim", 12, 24, meta,
+ effects_list, order, nil,
+ {"Neurotoxicity", max_metastim}, true)
+
+ --reset to zero
+ if order <= 0 then
+ meta:set_int("max_metastim", 0)
+ player_monoids.fly:del_change(player, "health:metastim")
+ player_monoids.gravity:del_change(player, "health:metastim")
+ --player_monoids.noclip:del_change(player, "health:metastim")
+ end
+ end
+
+ --send back modified values
+ return h_rate, r_rate, hun_rate, t_rate
+
+end
+
+----------------------------------
+--Stimulant addiction, withdrawal
+
+
+----------------------------------
+--Enterotoxin (gut)
+--Cytotoxin (all cells)
+--Necrotoxin (necrotizing)
+--Myotoxin (muscles)
+
+
+----------------------------------
+--indigestion (eat too much and throw up)?
+--infection
+--venom (requires duplicating chains of stuff from mobkit just to add one line to attacking??)
+--radiation
+--plague
+--trench foot
+--frost bite
+
+
+
+-------------------------------------------------------------------
+--ADD/REMOVE NEW
+-------------------------------------------------------------------
+--add a new effect
+--if it finds the effect currently in place, it must know how to progress it.
+--this is specific to each health effect so must call that function
+function HEALTH.add_new_effect(player, name)
+
+ if player == nil then return end -- we don't give effects to sneachans
+ local meta = player:get_meta()
+ local effects_list = meta:get_string("effects_list")
+ effects_list = minetest.deserialize(effects_list) or {}
+
+ --effect already present. call function to decide how to progress it
+ for i, effect in ipairs(effects_list) do
+
+ if effect[1] == name[1] then
+
+ --min timer, max timer (for extensions), max order, chance of adding an equal or lower boosting to a higher order
+ if name[1] == "Food Poisoning" then
+ default_timer_progress("Food Poisoning", 3, 6, 4, 0.2, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Fungal Infection" then
+ default_timer_progress("Fungal Infection", 6, 12, 4, 0.2, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Dust Fever" then
+ default_timer_progress("Dust Fever", 6, 12, 4, 0.2, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Drunk" then
+ default_timer_progress("Drunk", 3, 6, 4, 0.4, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Hangover" then
+ default_timer_progress("Hangover", 4, 8, 4, 0.4, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Intestinal Parasites" then
+ --no progression, only need to block it
+ return
+ elseif name[1] == "Tiku High" then
+ default_timer_progress("Tiku High", 3, 6, 4, 0.3, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Neurotoxicity" then
+ default_timer_progress("Neurotoxicity", 3, 6, 4, 0.75, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Hepatotoxicity" then
+ default_timer_progress("Hepatotoxicity", 6, 12, 4, 0.75, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Photosensitivity" then
+ default_timer_progress("Photosensitivity", 12, 24, 4, 0.1, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Meta-Stim" then
+ default_timer_progress("Meta-Stim", 12, 24, 4, 1, meta, effects_list, effect[2], name[2])
+ end
+
+
+ return
+ end
+ end
+
+ --doesn't currently exist, so add and update HUD, list
+ table.insert(effects_list, name)
+ local num = #effects_list or 0
+ meta:set_int("effects_num", num )
+ meta:set_string("effects_list", minetest.serialize(effects_list))
+
+end
+
+
+
+--Remove a new effect
+--(new in the sense that we don't know if it is actually on or not)
+--if it finds the effect currently in place, it must know how to regress it.
+--this is specific to each health effect so must call that function
+function HEALTH.remove_new_effect(player, name)
+
+ local meta = player:get_meta()
+ local effects_list = meta:get_string("effects_list")
+ effects_list = minetest.deserialize(effects_list) or {}
+
+ --effect is present. call function to decide how to regress it
+ for i, effect in ipairs(effects_list) do
+
+ if effect[1] == name[1] then
+ --min timer, max timer,
+ if name[1] == "Food Poisoning" then
+ default_timer_regress(player, "Food Poisoning", 3, 6, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Fungal Infection" then
+ default_timer_regress(player, "Fungal Infection", 6, 12, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Dust Fever" then
+ default_timer_regress(player, "Dust Fever", 6, 12, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Drunk" then
+ default_timer_regress(player, "Drunk", 3, 6, meta, effects_list, effect[2], name[2], {"Hangover", meta:get_int("max_hangover") or 1})
+ elseif name[1] == "Hangover" then
+ default_timer_regress(player, "Hangover", 4, 8, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Intestinal Parasites" then
+ update_list_swap(meta, effects_list, "Intestinal Parasites")
+ elseif name[1] == "Tiku High" then
+ default_timer_regress(player, "Tiku High", 3, 6, meta, effects_list, effect[2], name[2], {"Hangover", meta:get_int("max_hangover") or 1})
+ elseif name[1] == "Neurotoxicity" then
+ default_timer_regress(player, "Neurotoxicity", 3, 6, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Hepatotoxicity" then
+ default_timer_regress(player, "Hepatotoxicity", 6, 12, meta, effects_list, effect[2], name[2])
+ elseif name[1] == "Photosensitivity" then
+ default_timer_regress(player, "Photosensitivity", 12, 24, meta, effects_list, effect[2], name[2])
+ --elseif name[1] == "Meta-Stim" then
+ --note, this wont remove flying effects. Not needed at this point,
+ -- but will need something better if want to have an item that removes meta-stim
+ -- default_timer_regress(player, "Meta-Stim", 12, 24, meta, effects_list, effect[2], name[2], {"Neurotoxicity", meta:get_int("max_metastim") or 1})
+
+ end
+
+ end
+ end
+
+
+ --Otherwise doesn't currently exist, so nothing to do...
+
+end
+
+
+-------------------------------------------------------------------
+--TEST!!!!
+-------------------------------------------------------------------
+--[[
+minetest.register_craftitem("health:bug_test_food", {
+ description = "Bug TESTING Poison",
+ inventory_image = "tech_vegetable_oil.png",
+ stack_max = 500,
+ groups = {flammable = 1},
+
+
+ on_use = function(itemstack, user, pointed_thing)
+
+ --HEALTH.add_new_effect(user, {"Food Poisoning", 1})
+ --HEALTH.add_new_effect(user, {"Drunk", 1})
+ --HEALTH.add_new_effect(user, {"Intestinal Parasites"})
+ --HEALTH.add_new_effect(user, {"Tiku High", 1})
+ --HEALTH.add_new_effect(user, {"Neurotoxicity", 1})
+ --HEALTH.add_new_effect(user, {"Hepatotoxicity", 1})
+ --HEALTH.add_new_effect(user, {"Photosensitivity", 1})
+ --HEALTH.add_new_effect(user, {"Meta-Stim", 1})
+
+ end,
+})
+
+minetest.register_craftitem("health:bug_test_food2", {
+ description = "Bug TESTING Panacea",
+ inventory_image = "tech_vegetable_oil.png",
+ stack_max = 500,
+ groups = {flammable = 1},
+
+
+ on_use = function(itemstack, user, pointed_thing)
+
+ local meta = user:get_meta()
+ meta:set_int("effects_num", 0 )
+ meta:set_string("effects_list", minetest.serialize({}))
+ end,
+})
+
+]]--
diff --git a/games/globo/mods/health/hud.lua b/games/globo/mods/health/hud.lua
new file mode 100644
index 000000000..0b7df3b30
--- /dev/null
+++ b/games/globo/mods/health/hud.lua
@@ -0,0 +1,529 @@
+----------------------------------------------------------------------
+--HUD
+----------------------------------------------------------------------
+
+-- Internationalization
+local S = HEALTH.S
+
+local hud = {}
+local hudupdateseconds = tonumber(minetest.settings:get("exile_hud_update"))
+-- global setting for whether to show stats
+local mtshowstats = minetest.settings:get_bool("exile_hud_show_stats") or true
+local mthudopacity = minetest.settings:get("exile_hud_icon_transparency") or 127
+
+-- These are color values for the various status levels. They have to be modified
+-- per-function below because textures expect one color format and text another.
+-- This is a minetest caveat.
+
+-- In texture coloring we simply concat a #.
+-- "#"..stat_color
+
+-- In text coloring we concat an 0x and convert the resulting string to a number.
+-- tostring("0x"..stat_color)
+
+local stat_fine = "FFFFFF"
+local stat_slight = "FDFF46"
+local stat_problem = "FF8100"
+local stat_major = "DF0000"
+local stat_extreme = "8008FF"
+
+local hud_vert_pos = -128 -- all HUD icon vertical position
+local hud_extra_y = -16 -- pixel offset for hot/cold icons
+local hud_text_y = 32 -- optional text stat offset
+
+local longbarpos = {
+ [true] = { ["y"] = 0, ["x"] = 64 },
+ [false] = { ["y"] = 80, ["x"] = 0}
+}
+
+local hud_health_x = -300
+local hud_hunger_x = -300
+local hud_thirst_x = -64
+local hud_energy_x = 0
+local hud_air_temp_x = 64
+local hud_sick_x = 300
+local hud_body_temp_x = 300
+
+local icon_scale = {x = 1, y = 1} -- all HUD icon image scale
+
+wielded_hud = {}
+wielded_hud.list = {}
+
+function wielded_hud.register_hudwield(itemname, updatefunc, unwieldfunc)
+ -- functions should accept (player, pname, playermeta)
+ -- updatefunc should set up and/or update your hud elements
+ -- unwieldfunc is called so you can clean up and delete hud elements
+ wielded_hud.list[itemname] = { update = updatefunc,
+ unwield = unwieldfunc }
+end
+
+local function tobool(str)
+ if str == "true" then
+ return true
+ end
+ return false
+end
+
+local function are_stats_visible(hud_data)
+ return (( hud_data.showstats and hud_data.showstats == true ) or
+ ( hud_data.showstats == nil and mtshowstats == true ) )
+end
+
+local stdpos = { x = .5, y = 1}
+
+local function make_image_hud(player, offset, text)
+ return player:hud_add({ hud_elem_type = "image", scale = icon_scale,
+ offset = offset, position = stdpos, text = text })
+end
+
+local function make_text_hud(player, offset)
+ return player:hud_add{ hud_elem_type = "text", offset = offset,
+ position = stdpos, text = "" }
+end
+
+local setup_hud = function(player)
+
+ player:hud_set_flags({healthbar = false})
+ local playername = player:get_player_name()
+
+ local hud_data = {}
+
+ hud[playername] = hud_data
+
+ local meta = player:get_meta()
+ hud_data.show_stats = meta:get("exile_hud_show_stats")
+ if hud_data.show_stats then -- string to bool, or leave it nil
+ hud_data.show_stats = tobool(hud_data.show_stats)
+ end
+
+ local lb = tobool(meta:get_string("hud16")) -- nil -> default false
+
+ hud_data.p_health = make_image_hud(player,
+ {x = hud_health_x - longbarpos[lb].x,
+ y = hud_vert_pos + longbarpos[lb].y},
+ "hud_health.png" )
+
+ hud_data.p_hunger = make_image_hud(player,
+ {x = hud_hunger_x, y = hud_vert_pos},
+ "hud_hunger.png" )
+
+ hud_data.p_thirst = make_image_hud(player,
+ {x = hud_thirst_x, y = hud_vert_pos},
+ "hud_thirst.png" )
+
+ hud_data.p_energy = make_image_hud(player,
+ {x = hud_energy_x, y = hud_vert_pos},
+ "hud_energy.png" )
+
+ hud_data.p_body_temp = make_image_hud(player,
+ {x = hud_body_temp_x, y = hud_vert_pos},
+ "hud_body_temp.png" )
+
+ hud_data.p_body_temp_type = make_image_hud(player,
+ {x = hud_body_temp_x, y = hud_vert_pos + hud_extra_y},
+ "hud_temp_normal.png" )
+
+ hud_data.p_air_temp = make_image_hud(player,
+ {x = hud_air_temp_x, y = hud_vert_pos},
+ "hud_air_temp.png" )
+
+ hud_data.p_air_temp_type = make_image_hud(player,
+ {x = hud_air_temp_x, y = hud_vert_pos + hud_extra_y},
+ "hud_temp_normal.png" )
+
+ hud_data.p_sick = make_image_hud(player,
+ {x = hud_sick_x + longbarpos[lb].x,
+ y = hud_vert_pos + longbarpos[lb].y},
+ "hud_sick.png" )
+
+ hud_data.p_health_text = make_text_hud(player,
+ {x = hud_health_x + longbarpos[lb].x,
+ y = hud_vert_pos + hud_text_y + longbarpos[lb].y} )
+
+ hud_data.p_hunger_text = make_text_hud(player,
+ {x = hud_hunger_x, y = hud_vert_pos + hud_text_y} )
+
+ hud_data.p_thirst_text = make_text_hud(player,
+ {x = hud_thirst_x, y = hud_vert_pos + hud_text_y} )
+
+ hud_data.p_energy_text = make_text_hud(player,
+ {x = hud_energy_x, y = hud_vert_pos + hud_text_y} )
+
+ hud_data.p_body_temp_text = make_text_hud(player,
+ {x = hud_body_temp_x, y = hud_vert_pos + hud_text_y} )
+
+ hud_data.p_air_temp_text = make_text_hud(player,
+ {x = hud_air_temp_x, y = hud_vert_pos + hud_text_y} )
+
+ hud_data.p_sick_text = make_text_hud(player,
+ {x = hud_sick_x, y = hud_vert_pos + hud_text_y + longbarpos[lb].y} )
+
+end
+
+minetest.register_on_joinplayer(function(player) setup_hud(player) end)
+
+-- status indicator colors for use in stat display option
+
+local function color(v)
+ local stat_col = stat_fine
+ if v <= 20 then
+ stat_col = stat_extreme
+ elseif v <= 40 then
+ stat_col = stat_major
+ elseif v <= 60 then
+ stat_col = stat_problem
+ elseif v <= 80 then
+ stat_col = stat_slight
+ end
+ return stat_col
+end
+
+local function color_bodytemp(v)
+ local stat_col = stat_fine
+ local ttype = "hud_temp_normal"
+ if v > 47 or v < 27 then
+ stat_col = stat_extreme
+ if v > 47 then ttype = "hud_temp_hot" end
+ if v < 27 then ttype = "hud_temp_cold" end
+ elseif v > 43 or v < 32 then
+ stat_col = stat_major
+ if v > 43 then ttype = "hud_temp_hot" end
+ if v < 32 then ttype = "hud_temp_cold" end
+ elseif v > 38 or v < 37 then
+ stat_col = stat_problem
+ if v > 38 then ttype = "hud_temp_hot" end
+ if v < 37 then ttype = "hud_temp_cold" end
+ end
+ return stat_col, ttype
+end
+
+local function color_envirotemp(v, meta)
+ --make sure matches actual values used!
+ local comfort_low = meta:get_int("clothing_temp_min")
+ local comfort_high = meta:get_int("clothing_temp_max")
+ local stress_low = comfort_low - 10
+ local stress_high = comfort_high + 10
+ local danger_low = stress_low - 40
+ local danger_high = stress_high +40
+ local overlay
+
+ local stat_col = stat_fine
+ local ttype = "hud_temp_normal"
+
+ if v > danger_high or v < danger_low then
+ stat_col = stat_extreme
+ if v > danger_high then ttype = "hud_temp_hot" end
+ if v < danger_low then ttype = "hud_temp_cold" end
+ elseif v > stress_high or v < stress_low then
+ stat_col = stat_major
+ if v > stress_high then ttype = "hud_temp_hot" end
+ if v < stress_low then ttype = "hud_temp_cold" end
+ elseif v > comfort_high or v < comfort_low then
+ stat_col = stat_slight
+ if v > comfort_high then ttype = "hud_temp_hot" end
+ if v < comfort_low then ttype = "hud_temp_cold" end
+ end
+ if v < stress_low then
+ overlay = "weather_hud_frost.png"
+ end
+ if v > stress_high then
+ overlay = "weather_hud_heat.png"
+ end
+
+ return stat_col, ttype, overlay
+end
+
+local function health(player, hud_data)
+ local v = player:get_hp()
+ v = (v/20)*100
+ local stat_col = color(v)
+ local t = v .." %"
+ local hud1 = hud_data.p_health
+ local opac = hud_data.opacity or mthudopacity
+ player:hud_change(hud1, "text", "hud_health.png^[colorize:#"..stat_col.."^[opacity:"..opac)
+
+ local hud2 = hud_data.p_health_text
+ player:hud_change(hud2, "number", tonumber("0x"..stat_col))
+ if ( hud_data.showstats and hud_data.showstats == true ) or
+ ( hud_data.showstats == nil and mtshowstats == true ) then
+ player:hud_change(hud2, "text", t)
+ else
+ player:hud_change(hud2, "text", "")
+ end
+end
+
+local function energy(player, hud_data, meta)
+ local v = meta:get_int("energy")
+ v = (v/1000)*100
+ local stat_col = color(v)
+ local t = v .." %"
+ local hud1 = hud_data.p_energy
+ local opac = hud_data.opacity or mthudopacity
+ player:hud_change(hud1, "text", "hud_energy.png^[colorize:#"..stat_col.."^[opacity:"..opac)
+ local hud2 = hud_data.p_energy_text
+ player:hud_change(hud2, "number", tonumber("0x"..stat_col))
+ if ( hud_data.showstats and hud_data.showstats == true ) or
+ ( hud_data.showstats == nil and mtshowstats == true ) then
+ player:hud_change(hud2, "text", t)
+ else
+ player:hud_change(hud2, "text", "")
+ end
+end
+
+local function thirst(player, hud_data, meta)
+ local v = meta:get_int("thirst")
+ v = (v/100)*100
+ local t = v .." %"
+ local stat_col = color(v)
+ local hud1 = hud_data.p_thirst
+ local opac = hud_data.opacity or mthudopacity
+ player:hud_change(hud1, "text", "hud_thirst.png^[colorize:#"..stat_col.."^[opacity:"..opac)
+ local hud2 = hud_data.p_thirst_text
+ player:hud_change(hud2, "number", tonumber("0x"..stat_col))
+ if ( hud_data.showstats and hud_data.showstats == true ) or
+ ( hud_data.showstats == nil and mtshowstats == true ) then
+ player:hud_change(hud2, "text", t)
+ else
+ player:hud_change(hud2, "text", "")
+ end
+end
+
+local function hunger(player, hud_data, meta)
+ local v = meta:get_int("hunger")
+ v = (v/1000)*100
+ local t = v .." %"
+ local stat_col = color(v)
+ local hud1 = hud_data.p_hunger
+ local opac = hud_data.opacity or mthudopacity
+ player:hud_change(hud1, "text", "hud_hunger.png^[colorize:#"..stat_col.."^[opacity:"..opac)
+ local hud2 = hud_data.p_hunger_text
+ player:hud_change(hud2, "number", tonumber("0x"..stat_col))
+ if ( hud_data.showstats and hud_data.showstats == true ) or
+ ( hud_data.showstats == nil and mtshowstats == true ) then
+ player:hud_change(hud2, "text", t)
+ else
+ player:hud_change(hud2, "text", "")
+ end
+end
+
+
+local function temp(player, hud_data, meta)
+ local v = meta:get_int("temperature")
+ local stat_col, ttype = color_bodytemp(v)
+ local t = climate.get_temp_string(v, meta)
+ local hud1 = hud_data.p_body_temp
+ local opac = hud_data.opacity or mthudopacity
+ player:hud_change(hud1, "text", "hud_body_temp.png^[colorize:#"..stat_col.."^[opacity:"..opac)
+ local hudtype = hud_data.p_body_temp_type
+ local hudtext = hud_data.p_body_temp_text
+ player:hud_change(hudtype, "text", ttype..".png^[opacity:"..opac) -- don't colorize)
+ player:hud_change(hudtext, "number", tonumber("0x"..stat_col))
+ if are_stats_visible(hud_data) then
+ player:hud_change(hudtext, "text", t)
+ else
+ player:hud_change(hudtext, "text", "")
+ end
+end
+
+local function do_overlay(player, pname, pos, overlay)
+ local handle = player:hud_add({
+ name = overlay,
+ hud_elem_type = "image",
+ position = {x = 0, y = 0},
+ alignment = {x = 1, y = 1},
+ scale = { x = -100, y = -100},
+ z_index = hud.z_index,
+ text = overlay,
+ offset = {x = 0, y = 0}
+ })
+ hud[pname].overlay = handle
+end
+
+local function enviro_temp(player, hud_data, meta)
+ local pname = player:get_player_name()
+ local player_pos = player:get_pos()
+ player_pos.y = player_pos.y + 0.6 --adjust to body height
+ local v = math.floor(climate.get_point_temp(player_pos, true))
+ local stat_col, ttype, overlay = color_envirotemp(v, meta)
+ if overlay then
+ if not hud_data.overlay then
+ do_overlay(player, pname, player_pos, overlay)
+ elseif player:hud_get(hud_data.overlay) and
+ ( overlay ~= player:hud_get(hud_data.overlay).name ) then
+ -- direct transition from one overlay to another
+ player:hud_remove(hud_data.overlay)
+ do_overlay(player, pname, player_pos, overlay)
+ end
+ elseif hud_data.overlay then -- remove overlay
+ player:hud_remove(hud_data.overlay)
+ hud_data.overlay = nil
+ end
+ local t = climate.get_temp_string(v, meta)
+ local newhud = hud_data.p_air_temp
+ local newhud2 = hud_data.p_air_temp_type
+ local opac = hud_data.opacity or mthudopacity
+ player:hud_change(newhud, "text", "hud_air_temp.png^[colorize:#"..stat_col.."^[opacity:"..opac)
+ player:hud_change(newhud2, "text", ttype..".png^[opacity:"..opac) -- don't colorize)
+ local hud2 = hud_data.p_air_temp_text
+ player:hud_change(hud2, "number", tonumber("0x"..stat_col))
+ if ( hud_data.showstats and hud_data.showstats == true ) or
+ ( hud_data.showstats == nil and mtshowstats == true ) then
+ player:hud_change(hud2, "text", t)
+ else
+ player:hud_change(hud2, "text", "")
+ end
+end
+
+local function effects(player, hud_data, meta)
+ local stat_col = stat_fine
+ local v = meta:get_int("effects_num")
+ local t = "x"..v
+ if v > 0 then
+ stat_col = stat_slight
+ elseif v > 1 then
+ stat_col = stat_problem
+ elseif v > 2 then
+ stat_col = stat_major
+ elseif v > 3 then
+ stat_col = stat_extreme
+ end
+ local hud1 = hud_data.p_sick
+ local opac = hud_data.opacity or mthudopacity
+ player:hud_change(hud1, "text", "hud_sick.png^[colorize:#"..stat_col.."^[opacity:"..opac)
+ local hud2 = hud_data.p_sick_text
+ player:hud_change(hud2, "number", tonumber("0x"..stat_col))
+ if ( hud_data.showstats and hud_data.showstats == true ) or
+ ( hud_data.showstatsd == nil and mtshowstats == true ) then
+ player:hud_change(hud2, "text", t)
+ else
+ player:hud_change(hud2, "text", "")
+ end
+end
+
+local timer = 0
+
+minetest.register_globalstep(function(dtime)
+ timer = timer + dtime
+
+ if timer > hudupdateseconds then
+ for _0, player in ipairs(minetest.get_connected_players()) do
+
+ local name = player:get_player_name()
+ local meta = player:get_meta()
+ local hud_data = hud[name]
+ if not hud_data then
+ return
+ end
+ health(player, hud_data)
+ energy(player, hud_data, meta)
+ thirst(player, hud_data, meta)
+ hunger(player, hud_data, meta)
+ temp(player, hud_data, meta)
+ enviro_temp(player, hud_data, meta)
+ effects(player, hud_data, meta)
+ local wi = player:get_wielded_item():get_name()
+ if hud_data.wh ~= wi then -- changed, remove it
+ if wielded_hud.list[hud_data.wh] then
+ wielded_hud.list[hud_data.wh].unwield(player, name, meta)
+ end
+ hud_data.wh = nil
+ end
+ if wielded_hud.list[wi] then
+ hud_data.wh = wi
+ wielded_hud.list[wi].update(player, name, meta)
+ end
+
+ local lb = tobool(meta:get_string("hud16"))
+
+ player:hud_change(hud_data.p_health, "offset",
+ {x = hud_health_x - longbarpos[lb].x,
+ y = hud_vert_pos + longbarpos[lb].y})
+ player:hud_change(hud_data.p_health_text, "offset",
+ {x = hud_health_x - longbarpos[lb].x,
+ y = hud_vert_pos + hud_text_y + longbarpos[lb].y})
+ player:hud_change(hud_data.p_sick, "offset",
+ {x = hud_body_temp_x + longbarpos[lb].x,
+ y = hud_vert_pos + longbarpos[lb].y})
+ player:hud_change(hud_data.p_sick_text, "offset",
+ {x = hud_body_temp_x + longbarpos[lb].x,
+ y = hud_vert_pos + hud_text_y + longbarpos[lb].y})
+ end
+ timer = 0
+ return nil
+ end
+end)
+
+minetest.register_chatcommand("show_stats", {
+ params = S("[ help | clear ]"),
+ description = S("Enable or disable stats showing below icons. "..
+ "Pass 'clear' as a parameter to revert to defaults."),
+ func = function(name, param)
+ local player = minetest.get_player_by_name(name)
+ local meta = player:get_meta()
+ local hud_data = hud[name]
+ if param == "help" then
+ local wlist = S("/show_stats:\n"..
+ "Toggle stats showing below icons. Use '/show_stats "..
+ "clear' to revert to defaults")
+ return false, wlist
+ elseif param == "clear" then
+ meta:set_string("exile_hud_show_stats", "")
+ hud_data.showstats = nil
+ return true, S("Cleared setting")
+ else
+ local show_stats = meta:get("exile_hud_show_stats")
+ if not show_stats then
+ show_stats = tostring(mtshowstats)
+ end
+ local newval = not tobool(show_stats)
+ meta:set_string("exile_hud_show_stats", tostring(newval))
+ hud_data.showstats = newval
+ if newval == true then
+ return true, S("Enabled stats.")
+ else
+ return true, S("Disabled stats.")
+ end
+ end
+ end
+})
+
+minetest.register_chatcommand("icon_transparency", {
+ params = "",
+ description = S("Set stat icon transparency between 0 and 255 or "..
+ "default ").."("..mthudopacity..")",
+ func = function(name, param)
+ local player = minetest.get_player_by_name(name)
+ local meta = player:get_meta()
+ local hud_data = hud[name]
+ if param == "" or param == "help" then
+ local wlist = S("/show_stats:\n"..
+ "Set stat icon transparency between 0 and 255.\n"..
+ "Valid value is an integer between 0 and 255 or default.\n")
+ return false, wlist
+ end
+ if param == "default" then
+ meta:set_string("exile_hud_icon_transparency", "")
+ hud_data.opacity = nil
+ return true, S("Returned setting to default")
+ else
+ local num = tonumber(param)
+ if type(num) == "number" then
+ if num < 0 then
+ meta:set_string("exile_hud_icon_transparency", "0")
+ hud_data.opacity = 0
+ return false, S("Icon transparency set to 0")
+ elseif num > 255 then
+ meta:set_string("exile_hud_icon_transparency", "255")
+ hud_data.opacity = 255
+ return false, S("Icon transparency set to 255")
+ else
+ meta:set_string("exile_hud_icon_transparency", tostring(math.floor(num)))
+ hud_data.opacity = num
+ return false, S("Icon transparency set to ")..math.floor(num)
+ end
+ else
+ return false, S("Invalid value. Please use a whole number between 0 and 255")
+ end
+ end
+ end
+})
diff --git a/games/globo/mods/health/init.lua b/games/globo/mods/health/init.lua
new file mode 100644
index 000000000..6dfefa316
--- /dev/null
+++ b/games/globo/mods/health/init.lua
@@ -0,0 +1,633 @@
+-------------------------------------
+--HEALTH
+
+--[[
+Two global step functions
+Fast, and slow.
+
+Fast applies environmental and action based effects (in on_actions)
+Slow applies internal metabolism effects (here)
+]]
+
+------------------------------------
+
+HEALTH = {}
+
+-- Internationalization
+HEALTH.S = minetest.get_translator("health")
+HEALTH.FS = function(...)
+ return minetest.formspec_escape(HEALTH.S(...))
+end
+
+dofile(minetest.get_modpath('health')..'/health_effects.lua')
+dofile(minetest.get_modpath('health')..'/on_actions.lua')
+dofile(minetest.get_modpath('health')..'/hud.lua')
+dofile(minetest.get_modpath('health')..'/food.lua')
+
+
+--frequency of updating and applying effects
+local interval = 60
+
+-----------------------------
+--Player Attibutes
+--
+--use standard values base, so it doesn't compound each time called
+--Only adjusted values saved in player meta so they can be accessed without recalculating
+--cf hunger etc which do get change and have no base value
+local heal_rate = 1 -- 4
+local thirst_rate = -1
+local hunger_rate = -3 -- -2
+local recovery_rate = 4 -- 5
+local move = 0
+local jump = 0
+
+--no clothing temperature comfort zone
+local temp_min = 18--20
+local temp_max = 32--30
+
+--e.g. for new players
+local function set_default_attibutes(player)
+ local meta = player:get_meta()
+ meta:set_int("thirst", 100)
+ meta:set_int("hunger", 1000)
+ meta:set_int("energy", 1000)
+ meta:set_int("temperature", 37)
+ meta:set_int("heal_rate", heal_rate)
+ meta:set_int("thirst_rate", thirst_rate)
+ meta:set_int("hunger_rate", hunger_rate)
+ meta:set_int("recovery_rate", recovery_rate)
+ meta:set_int("move", move)
+ meta:set_int("jump", jump)
+ meta:set_int("clothing_temp_min", temp_min)
+ meta:set_int("clothing_temp_max", temp_max )
+
+end
+
+
+
+--[[
+-----------------------------
+--Forms for sfinv
+--only for bug testing
+
+
+--get data and create form
+local function sfinv_get(self, player, context)
+ local meta = player:get_meta()
+
+ local player_pos = player:get_pos()
+ player_pos.y = player_pos.y + 0.6 --adjust to body height
+ local enviro_temp = tostring(math.floor(climate.get_point_temp(player_pos)))
+
+ local health = tostring(player:get_hp())
+ local thirst = tostring(meta:get_int("thirst"))
+ local hunger = tostring(meta:get_int("hunger"))
+ local energy = tostring(meta:get_int("energy"))
+ local temperature = tostring(meta:get_int("temperature"))
+ local heal_rate = tostring(meta:get_int("heal_rate"))
+ local thirst_rate = tostring(meta:get_int("thirst_rate"))
+ local hunger_rate = tostring(meta:get_int("hunger_rate"))
+ local recovery_rate = tostring(meta:get_int("recovery_rate"))
+ local move = tostring(meta:get_int("move"))
+ local jump = tostring(meta:get_int("jump"))
+
+
+
+ local formspec = "label[0.1,0.1; Health: " .. health .. " / 20]"..
+ "label[0.1,0.6; Thirst: " .. thirst .. " / 100]"..
+ "label[0.1,1.1; Hunger: " .. hunger .. " / 1000]"..
+ "label[0.1,1.6; Energy: " .. energy .. " / 1000]"..
+ "label[0.1,2.1; Body Temperature: " .. temperature .. " C]"..
+ "label[0.1,3.1; Move Speed: " .. move .. " % change]"..
+ "label[0.1,3.6; Jumping: " .. jump .. " % change]"..
+
+ "label[4,0.1; Heal Rate: " .. heal_rate .. " ]"..
+ "label[4,0.6; Thirst Rate: " .. thirst_rate .. " ]"..
+ "label[4,1.1; Hunger Rate: " .. hunger_rate .. " ]"..
+ "label[4,1.6; Recovery Rate: " .. recovery_rate .. " ]"..
+ "label[4,2.1; External Temperature: " .. enviro_temp .. " C]"..
+ "button[4,3.1;1,1;toggle_health_hud;HUD]"
+ --..
+ --"textarea[0.5,5.1;6,6;;Active Effects:;"..active_list.." ]"
+
+ return formspec
+end
+
+
+
+local function register_tab()
+ sfinv.register_page("health:health_tab", {
+ title = "Health",
+ on_enter = function(self, player, context)
+ sfinv.set_player_inventory_formspec(player)
+ end,
+ get = function(self, player, context)
+ local formspec = sfinv_get(self, player, context)
+ return sfinv.make_formspec(player, context, formspec, true)
+ end
+ })
+end
+
+register_tab()
+
+
+]]
+
+-----------------------------
+--Applies Health Effects
+--called by malus_bonus
+--runs through player's current effects, runs the function for that effect
+--takes all the same variables, and outputs as any effect may use them.
+--adjusted outputs feed back into malus_bonus
+local function do_effects_list(meta, player, health, energy, thirst, hunger, temperature, h_rate, r_rate, t_rate, hun_rate, mov, jum)
+ local effects_list = meta:get_string("effects_list")
+ effects_list = minetest.deserialize(effects_list) or {}
+
+ if not effects_list then
+ return h_rate, r_rate, t_rate, hun_rate, mov, jum, health, energy, thirst, hunger, temperature
+ end
+
+ for key, effect in ipairs(effects_list) do
+
+ local name = effect[1]
+ local order = effect[2]
+ local valid = false
+
+ ----------
+ if name == "Food Poisoning" then
+ r_rate, mov, jum, temperature
+ = HEALTH.food_poisoning(order, player, meta, effects_list,
+ r_rate, mov, jum, temperature)
+ valid = true
+ end
+
+ ----------
+ if name == "Fungal Infection" then
+ r_rate, mov, jum, temperature
+ = HEALTH.fungal_infection(order, player, meta,
+ effects_list, r_rate, mov, jum,
+ temperature)
+ valid = true
+ end
+
+ ----------
+ if name == "Dust Fever" then
+ r_rate, mov, jum, temperature
+ = HEALTH.dust_fever(order, player, meta, effects_list,
+ r_rate, mov, jum, temperature)
+ valid = true
+ end
+
+ ----------
+ if name == "Drunk" then
+ r_rate, mov, jum, h_rate, temperature
+ = HEALTH.drunk(order, player, meta, effects_list,
+ r_rate, mov, jum, h_rate, temperature)
+ valid = true
+ end
+
+ ----------
+ if name == "Hangover" then
+ mov, jum = HEALTH.hangover(order, player, meta,
+ effects_list, mov, jum)
+ valid = true
+ end
+
+ ----------
+ if name == "Intestinal Parasites" then
+ r_rate, hun_rate
+ = HEALTH.intestinal_parasites(order, player, meta,
+ effects_list, r_rate,
+ hun_rate)
+ valid = true
+ end
+
+ ----------
+ if name == "Tiku High" then
+ r_rate, hun_rate, mov, jum, temperature
+ = HEALTH.tiku_high(order, player, meta, effects_list,
+ r_rate, hun_rate, mov, jum, temperature)
+ valid = true
+ end
+
+ ----------
+ if name == "Neurotoxicity" then
+ mov, jum = HEALTH.neurotoxicity(order, player, meta,
+ effects_list, mov, jum)
+ valid = true
+ end
+
+ ----------
+ if name == "Hepatotoxicity" then
+ mov, jum, r_rate, h_rate
+ = HEALTH.hepatotoxicity(order, player, meta, effects_list,
+ mov, jum, r_rate, h_rate)
+ valid = true
+ end
+
+ ----------
+ if name == "Photosensitivity" then
+ h_rate, r_rate
+ = HEALTH.photosensitivity(order, player, meta,
+ effects_list, h_rate, r_rate)
+ valid = true
+ end
+
+ ---------
+ if name == "Meta-Stim" then
+ h_rate, r_rate, hun_rate, t_rate
+ = HEALTH.meta_stim(order, player, meta, effects_list,
+ h_rate, r_rate, hun_rate, t_rate)
+ valid = true
+ end
+
+ if valid == false then
+ table.remove(effects_list, key)
+ meta:set_string("effects_list",
+ minetest.serialize(effects_list))
+ meta:set_int("effects_num", #effects_list)
+ end
+ end
+
+ return h_rate, r_rate, t_rate, hun_rate, mov, jum, health, energy, thirst, hunger, temperature
+
+end
+
+
+
+
+
+-----------------------------
+--Bonus Malus... so can be called whenever player status is changed
+--takes standard rates and adjusts them based on player status.
+--saves adjusted rates and applies physics.
+--send it attributes to adjust by,
+--also give name and meta, bc anything calling it should already have that
+-- returns the adjusted rates so they can be used if desired
+--
+function HEALTH.malus_bonus(player, name, meta, health, energy, thirst, hunger, temperature)
+
+ --use standard values, so it doesn't compound each time adjusted.
+ --Only saved to player meta so they can be accessed without recalculating
+ local h_rate = heal_rate
+ local t_rate = thirst_rate
+ local hun_rate = hunger_rate
+ local r_rate = recovery_rate
+ local mov = move
+ local jum = jump
+
+
+ --(hunger/Energy has 10x stock)
+ --0-20 starving/severe dehydrated: malus, no heal
+ --20-40 malnourished/dehydrated: malus
+ --40-60 hungry/thirsty: small malus
+ --60-80 good:
+ --80-100 overfull: small malus
+
+ --80-100 well rested. bonus
+ --60-80 rested.
+ --40-60 tired. small malus
+ --20-40 fatigued. malus
+ --0-20 exhausted. malus no heal
+
+ --<27 death
+ --27-32: severe hypo. malus no heal
+ --32-37: hypothermia. malus
+ --36-38: normal
+ --38-43: hyperthermia. malus.
+ --43-47: severe heat stroke. malus no heal
+ -->47 death
+
+ --
+ --update rates
+ --
+
+ --bonus/malus from health
+ if health <= 1 then
+ mov = mov - 50
+ jum = jum - 50
+ h_rate = h_rate - 3
+ r_rate = r_rate - 4
+ elseif health < 4 then
+ mov = mov - 25
+ jum = jum - 25
+ h_rate = h_rate - 2
+ r_rate = r_rate - 2
+ elseif health < 8 then
+ mov = mov - 20
+ jum = jum - 20
+ h_rate = h_rate - 1
+ r_rate = r_rate - 1
+ elseif health < 12 then
+ mov = mov - 15
+ jum = jum - 15
+ elseif health < 16 then
+ mov = mov - 10
+ jum = jum - 10
+ end
+
+ --bonus/malus from energy
+ if energy > 800 then
+ h_rate = h_rate + 2
+ mov = mov + 15
+ jum = jum + 15
+ elseif energy < 1 then
+ h_rate = h_rate - 1
+ mov = mov - 40
+ jum = jum - 40
+ t_rate = t_rate - 12
+ hun_rate = hun_rate - 24
+ elseif energy < 200 then
+ h_rate = h_rate - 1
+ mov = mov - 20
+ jum = jum - 20
+ t_rate = t_rate - 4
+ hun_rate = hun_rate - 8
+ elseif energy < 400 then
+ mov = mov - 10
+ jum = jum - 10
+ t_rate = t_rate - 3
+ hun_rate = hun_rate - 4
+ elseif energy < 600 then
+ mov = mov - 5
+ jum = jum - 5
+ t_rate = t_rate - 2
+ hun_rate = hun_rate - 2
+ elseif energy < 700 then
+ hun_rate = hun_rate - 1
+ end
+
+
+ --bonus/malus from thirst
+ if thirst > 80 then
+ h_rate = h_rate + 1
+ r_rate = r_rate + 2
+ mov = mov + 1
+ jum = jum + 1
+ elseif thirst < 1 then
+ h_rate = h_rate - 12
+ r_rate = r_rate - 10
+ mov = mov - 30
+ jum = jum - 30
+ elseif thirst < 20 then
+ h_rate = h_rate - 2
+ r_rate = r_rate - 2
+ mov = mov - 20
+ jum = jum - 20
+ elseif thirst < 40 then
+ h_rate = h_rate - 1
+ r_rate = r_rate - 1
+ mov = mov - 10
+ jum = jum - 10
+ elseif thirst < 60 then
+ mov = mov - 1
+ jum = jum - 1
+ end
+
+ --bonus/malus from hunger
+ if hunger > 800 then
+ h_rate = h_rate + 1
+ r_rate = r_rate + 2
+ mov = mov + 1
+ jum = jum + 1
+ elseif hunger < 1 then
+ h_rate = h_rate - 12
+ r_rate = r_rate - 10
+ mov = mov - 30
+ jum = jum - 30
+ elseif hunger < 200 then
+ h_rate = h_rate - 2
+ r_rate = r_rate - 2
+ mov = mov - 20
+ jum = jum - 20
+ elseif hunger < 400 then
+ h_rate = h_rate - 1
+ r_rate = r_rate - 1
+ mov = mov - 10
+ jum = jum - 10
+ elseif hunger < 600 then
+ mov = mov - 1
+ jum = jum - 1
+ end
+
+ --temp malus..severe..having this happen would make you very ill
+ if temperature >= 100 or temperature <= 0 then -- now will cause immediate death
+ --you dead
+ h_rate = h_rate - 10000
+ r_rate = r_rate - 10000
+ mov = mov - 10000
+ jum = jum - 10000
+ elseif temperature > 47 or temperature < 27 then
+ h_rate = h_rate - 16
+ r_rate = r_rate - 64
+ mov = mov - 80
+ jum = jum - 80
+ elseif temperature > 43 or temperature < 32 then
+ h_rate = h_rate - 8
+ r_rate = r_rate - 32
+ mov = mov - 40
+ jum = jum - 40
+ elseif temperature > 38 or temperature < 37 then
+ h_rate = h_rate - 4
+ r_rate = r_rate - 8
+ mov = mov - 20
+ jum = jum - 20
+ end
+
+ --health effects
+ local HE_mov
+ local HE_jum
+ h_rate, r_rate, t_rate, hun_rate, HE_mov, HE_jum, health, energy, thirst, hunger, temperature = do_effects_list(meta, player, health, energy, thirst, hunger, temperature, h_rate, r_rate, t_rate, hun_rate, mov, jum)
+
+
+ --save adjusted rates for access (e.g. by a medical tab/equipment etc)
+ meta:set_int("heal_rate", h_rate)
+ meta:set_int("thirst_rate", t_rate)
+ meta:set_int("hunger_rate", hun_rate)
+ meta:set_int("recovery_rate", r_rate)
+ meta:set_int("move", HE_mov)
+ meta:set_int("jump", HE_jum)
+
+ --apply player physics
+ --don't do in bed or it buggers the physics
+ if not bed_rest.player[name] then
+ player_monoids.speed:add_change(player, 1 + (mov/100), "health:physics")
+ player_monoids.jump:add_change(player, 1 + (jum/100), "health:physics")
+ --split physics from hunger etc from that from health effects
+ --this means quick_physics can fiddle with one half, without overriding the half from effects
+ HE_mov = HE_mov - mov
+ HE_jum = HE_jum - jum
+ player_monoids.speed:add_change(player, 1 + (HE_mov/100), "health:physics_HE")
+ player_monoids.jump:add_change(player, 1 + (HE_jum/100), "health:physics_HE")
+
+
+ end
+
+ --return adjusted rates so can be applied if necessary
+ return h_rate, r_rate, t_rate, hun_rate, mov, jum, health, energy, thirst, hunger, temperature
+
+end
+
+
+-----------------------------
+--Main
+--
+minetest.register_on_newplayer(function(player)
+ set_default_attibutes(player)
+end)
+
+function reset_attributes(player)
+ set_default_attibutes(player)
+end
+
+minetest.register_on_joinplayer(function(player)
+ sfinv.set_player_inventory_formspec(player)
+
+ --set physics etc
+ local name = player:get_player_name()
+ local meta = player:get_meta()
+ local health = player:get_hp()
+ local thirst = meta:get_int("thirst")
+ local hunger = meta:get_int("hunger")
+ local energy = meta:get_int("energy")
+ local temperature = meta:get_int("temperature")
+ HEALTH.malus_bonus(player, name, meta, health, energy, thirst, hunger, temperature)
+
+ local velo = meta:get_string("player_velocity")
+ if velo ~= nil then
+ local velo_vec = minetest.string_to_pos(velo)
+ if velo_vec ~= nil then
+ player:add_velocity(velo_vec)
+ end
+ meta:set_string("player_velocity", "")
+ end
+end)
+
+
+minetest.register_on_dieplayer(function(player)
+ --redo physics (to clear what killed them)
+ player_monoids.speed:del_change(player, "health:physics")
+ player_monoids.jump:del_change(player, "health:physics")
+ player_monoids.speed:del_change(player, "health:physics_HE")
+ player_monoids.jump:del_change(player, "health:physics_HE")
+ --clear Health effects list
+ local meta = player:get_meta()
+ meta:set_string("effects_list", "")
+ meta:set_int("effects_num", 0)
+end)
+
+minetest.register_on_respawnplayer(function(player)
+ set_default_attibutes(player)
+ sfinv.set_player_inventory_formspec(player)
+ clothing:update_temp(player)
+end)
+
+minetest.register_on_leaveplayer(function(player, timed_out)
+ --TODO: Find a way to save this on singleplayer or for 1st hosted player
+ local meta = player:get_meta()
+ local velo = player:get_velocity() or player:get_player_velocity()
+ meta:set_string("player_velocity", minetest.pos_to_string(velo))
+end)
+
+if minetest.settings:get_bool("enable_damage") then
+ --Main update values
+ local timer = 0
+ minetest.register_globalstep(function(dtime)
+ timer = timer + dtime
+
+ --run
+ if timer > interval then
+
+ for _,player in ipairs(minetest.get_connected_players()) do
+
+ local name = player:get_player_name()
+ local meta = player:get_meta()
+ local health = player:get_hp()
+ -- don't damage us if we're already dead
+ if health > 0 and
+ player:get_armor_groups().immortal ~= 1 then
+ local thirst = meta:get_int("thirst")
+ local hunger = meta:get_int("hunger")
+ local energy = meta:get_int("energy")
+ local temperature = meta:get_int("temperature")
+
+
+ --apply rate adjustments so they are correct for current player status
+ local h_rate, r_rate, t_rate, hun_rate, mov, jum, health, energy, thirst, hunger, temperature = HEALTH.malus_bonus(player, name, meta, health, energy, thirst, hunger, temperature)
+
+ --
+ --update attributes based on adjusted rates
+ --XXX1 is the new (healt/thirst etc) value
+ --so can be compared with old value, (which was useful...at one point)
+ --
+
+ --update and min max
+ local health1, thirst1, hunger1, energy1, temperature1
+
+ thirst1 = thirst + t_rate
+ if thirst1 < 0 then
+ thirst1 = 0
+ elseif thirst1 > 100 then
+ thirst1 = 100
+ end
+
+ hunger1 = hunger + hun_rate
+ if hunger1 < 0 then
+ hunger1 = 0
+ elseif hunger1 > 1000 then
+ hunger1 = 1000
+ end
+
+ energy1 = energy + r_rate
+ if energy1 < 0 then
+ energy1 = 0
+ elseif energy1 > 1000 then
+ energy1 = 1000
+ end
+
+ health1 = health + h_rate
+
+ if temperature > 37 then
+ temperature1 = temperature - 1
+ if temperature > 47 then
+ health1 = health1 - 1
+ end
+
+ elseif temperature < 37 then
+ temperature1 = temperature + 1
+ if temperature < 27 then
+ health1 = health1 - 1
+ end
+ else
+ temperature1 = temperature
+ end
+
+ if health1 < 0 then
+ health1 = 0
+ elseif health1 > 20 then
+ health1 = 20
+ end
+
+
+ --update
+ --
+ player:set_hp(health1)
+ meta:set_int("thirst", thirst1)
+ meta:set_int("hunger", hunger1)
+ meta:set_int("energy", energy1)
+ meta:set_int("temperature", temperature1)
+ --update form so can see change while looking
+ sfinv.set_player_inventory_formspec(player)
+
+
+ end
+ end
+ end
+ --reset
+ if timer > interval then
+ timer = 0
+ end
+
+ end)
+
+end
diff --git a/games/globo/mods/health/locale/health.es.tr b/games/globo/mods/health/locale/health.es.tr
new file mode 100644
index 000000000..d1a41b009
--- /dev/null
+++ b/games/globo/mods/health/locale/health.es.tr
@@ -0,0 +1,13 @@
+# textdomain: health
+
+# hud.lua
+Health:=Salud:
+Energy:=Energía:
+Thirst:=Hidratación:
+Hunger:=Saciedad:
+Body Temp:=Temp. Corporal:
+Temp:=Temp.:
+Effects:=Efectos:
+
+# food.lua
+This is inedible.=Esto no es comestible.
diff --git a/games/globo/mods/health/locale/health.fr.tr b/games/globo/mods/health/locale/health.fr.tr
new file mode 100644
index 000000000..463d7c9a1
--- /dev/null
+++ b/games/globo/mods/health/locale/health.fr.tr
@@ -0,0 +1,13 @@
+# textdomain: health
+
+# hud.lua
+Health:=Santé :
+Energy:=Énergie :
+Thirst:=Soif :
+Hunger:=Faim :
+Body Temp:=Corps :
+Temp:=Temp :
+Effects:=Effets :
+
+# food.lua
+This is inedible.=Ceci n'est pas comestible.
diff --git a/games/globo/mods/health/locale/health.ru.tr b/games/globo/mods/health/locale/health.ru.tr
new file mode 100644
index 000000000..79e98fd7a
--- /dev/null
+++ b/games/globo/mods/health/locale/health.ru.tr
@@ -0,0 +1,13 @@
+# textdomain: health
+
+# hud.lua
+Health:=Здоровье:
+Energy:=Энергия:
+Thirst:=Жажда:
+Hunger:=Голод:
+Body Temp:=Темп. тела:
+Temp:=Темп.:
+Effects:=Эффекты:
+
+# food.lua
+This is inedible.=Это несъедобно.
diff --git a/games/globo/mods/health/locale/template.txt b/games/globo/mods/health/locale/template.txt
new file mode 100644
index 000000000..16d342911
--- /dev/null
+++ b/games/globo/mods/health/locale/template.txt
@@ -0,0 +1,13 @@
+# textdomain: health
+
+# hud.lua
+Health:=
+Energy:=
+Thirst:=
+Hunger:=
+Body Temp:=
+Temp:=
+Effects:=
+
+# food.lua
+This is inedible.=
diff --git a/games/globo/mods/health/mod.conf b/games/globo/mods/health/mod.conf
new file mode 100644
index 000000000..a953ecbbe
--- /dev/null
+++ b/games/globo/mods/health/mod.conf
@@ -0,0 +1,4 @@
+name = health
+description = Adds health effects eg hunger, thirst etc.
+depends = player_monoids, climate
+author = Dokimi
diff --git a/games/globo/mods/health/on_actions.lua b/games/globo/mods/health/on_actions.lua
new file mode 100644
index 000000000..f594d220f
--- /dev/null
+++ b/games/globo/mods/health/on_actions.lua
@@ -0,0 +1,476 @@
+-----------------------------
+--ON ACTION EFFECTS
+--e.g. for eating items, exhaustion from moving etc
+
+-----------------------------
+local random = math.random
+
+-----------------------------
+--Quick physics
+-- update the physics immediately, without going through all of malus_bonus
+--(using malus_bonus itself produces conflicts)
+--for things that need to instantly update physics i.e. need the flow on from reduced hunger now.
+--only need the physics part as rates etc get applied from main health function
+--MUST MATCH malus_bonus as it will get overriden by that when it kicks in!!!!
+
+local function quick_physics(player, name, health, energy, thirst, hunger, temperature)
+ --use standard values
+ local mov = 0
+ local jum = 0
+
+ --
+ --update rates
+ --
+
+ --bonus/malus from health
+ if health <= 1 then
+ mov = mov - 50
+ jum = jum - 50
+ elseif health < 4 then
+ mov = mov - 25
+ jum = jum - 25
+ elseif health < 8 then
+ mov = mov - 20
+ jum = jum - 20
+ elseif health < 12 then
+ mov = mov - 15
+ jum = jum - 15
+ elseif health < 16 then
+ mov = mov - 10
+ jum = jum - 10
+ end
+
+ --bonus/malus from energy
+ if energy > 800 then
+ mov = mov + 15
+ jum = jum + 15
+ elseif energy < 1 then
+ mov = mov - 30
+ jum = jum - 30
+ elseif energy < 200 then
+ mov = mov - 20
+ jum = jum - 20
+ elseif energy < 400 then
+ mov = mov - 10
+ jum = jum - 10
+ elseif energy < 600 then
+ mov = mov - 1
+ jum = jum - 1
+ end
+
+
+ --bonus/malus from thirst
+ if thirst > 80 then
+ mov = mov + 1
+ jum = jum + 1
+ elseif thirst < 1 then
+ mov = mov - 30
+ jum = jum - 30
+ elseif thirst < 20 then
+ mov = mov - 20
+ jum = jum - 20
+ elseif thirst < 40 then
+ mov = mov - 10
+ jum = jum - 10
+ elseif thirst < 60 then
+ mov = mov - 1
+ jum = jum - 1
+ end
+
+ --bonus/malus from hunger
+ if hunger > 800 then
+ mov = mov + 1
+ jum = jum + 1
+ elseif hunger < 1 then
+ mov = mov - 30
+ jum = jum - 30
+ elseif hunger < 200 then
+ mov = mov - 20
+ jum = jum - 20
+ elseif hunger < 400 then
+ mov = mov - 10
+ jum = jum - 10
+ elseif hunger < 600 then
+ mov = mov - 1
+ jum = jum - 1
+ end
+
+ --temp malus..severe..having this happen would make you very ill
+ if temperature > 100 or temperature < 0 then
+ --you dead
+ mov = mov - 10000
+ jum = jum - 10000
+ elseif temperature > 47 or temperature < 27 then
+ mov = mov - 80
+ jum = jum - 80
+ elseif temperature > 43 or temperature < 32 then
+ mov = mov - 40
+ jum = jum - 40
+ elseif temperature > 38 or temperature < 37 then
+ mov = mov - 20
+ jum = jum - 20
+ end
+
+
+ --apply player physics
+ --don't do in bed or it buggers the physics
+ if not bed_rest.player[name] then
+ player_monoids.speed:add_change(player, 1 + (mov/100), "health:physics")
+ player_monoids.jump:add_change(player, 1 + (jum/100), "health:physics")
+ end
+
+
+
+end
+
+
+-----------------------------
+--On Actions
+--
+
+--Consummable items
+function HEALTH.use_item(itemstack, user, hp_change, thirst_change, hunger_change, energy_change, temp_change, replace_with_item)
+
+ if itemstack == nil or user == nil or not minetest.settings:get_bool("enable_damage") then
+ return
+ end
+
+ local item = itemstack:get_name()
+ local name = user:get_player_name()
+ local meta = user:get_meta()
+
+ local health = user:get_hp()
+ local thirst = meta:get_int("thirst")
+ local hunger = meta:get_int("hunger")
+ local energy = meta:get_int("energy")
+ local temperature = meta:get_int("temperature")
+
+ local mov = meta:get_int("move")
+ local jum = meta:get_int("jump")
+
+ --calc change with min max
+ health = health + hp_change
+ if health < 0 then
+ health = 0
+ elseif health > 20 then
+ health = 20
+ end
+
+ thirst = thirst + thirst_change
+ if thirst < 0 then
+ thirst = 0
+ elseif thirst > 100 then
+ thirst = 100
+ end
+
+ hunger = hunger + hunger_change
+ if hunger < 0 then
+ hunger = 0
+ elseif hunger > 1000 then
+ hunger = 1000
+ end
+
+ energy = energy + energy_change
+ if energy < 0 then
+ energy = 0
+ elseif energy > 1000 then
+ energy = 1000
+ end
+
+ if temp_change then
+ temperature = temperature + temp_change
+ end
+
+ --set new values
+ -- and update malus (need for setting correct physics) --conflicts with Health Effects!
+ --HEALTH.malus_bonus(user, name, meta, health, energy, thirst, hunger, temperature)
+ quick_physics(user, name, health, energy, thirst, hunger, temperature)
+
+ user:set_hp(health)
+ meta:set_int("thirst", thirst)
+ meta:set_int("hunger", hunger)
+ meta:set_int("energy", energy)
+ meta:set_int("temperature", temperature)
+ --update form so can see change while looking
+ sfinv.set_player_inventory_formspec(user)
+
+ --minetest.chat_send_player(name, minetest.registered_items[item].description .." effect = Health: "..hp_change..", Thirst: "..thirst_change.. ", Hunger: "..hunger_change.. ", Energy: "..energy_change.. ", Body Temperature: "..temp_change )
+ local pos = user:get_pos()
+ minetest.sound_play("health_eat", {pos = pos, gain = 0.5, max_hear_distance = 2}
+ )
+
+ --replace/take
+ itemstack:take_item()
+
+
+ if itemstack:get_count() == 0 then
+ itemstack:add_item(replace_with_item)
+ else
+ local inv = user:get_inventory()
+ if inv:room_for_item("main", replace_with_item) then
+ inv:add_item("main", replace_with_item)
+ else
+ minetest.add_item(user:get_pos(), replace_with_item)
+ end
+ end
+
+ return itemstack
+end
+
+
+--fast interval (cf main update)
+--Moving and digging and building
+--Environmental based, bed rest ...
+if minetest.settings:get_bool("enable_damage") then
+
+ local timer = 0
+ local interval = 4
+ minetest.register_globalstep(function(dtime)
+ timer = timer + dtime
+
+ --run
+ if timer > interval then
+ for _,player in ipairs(minetest.get_connected_players()) do
+ local name = player:get_player_name()
+ local meta = player:get_meta()
+
+ local health = player:get_hp()
+ -- if we're dead, no more healing/etc
+ if health > 0 and
+ player:get_armor_groups().immortal ~= 1 then
+ local thirst = meta:get_int("thirst")
+ local hunger = meta:get_int("hunger")
+ local energy = meta:get_int("energy")
+ local temperature = meta:get_int("temperature")
+
+ ----------------
+ --movement/digging
+ local controls = player:get_player_control()
+ -- Determine if the player is active,
+ --some actions more energetic
+ if controls.up
+ or controls.down
+ or controls.left
+ or controls.right
+ or controls.RMB
+ then
+ energy = energy - 3
+ --thirsty work
+ if random()<0.07 then
+ thirst = thirst - 1
+ hunger = hunger - 2
+ end
+ elseif controls.LMB
+ or controls.jump then
+ energy = energy - 8
+ --thirsty work
+ if random()<0.07 then
+ thirst = thirst - 2
+ hunger = hunger - 4
+ end
+ end
+
+ ----------------
+ --Environmental temperature
+ local player_pos = player:get_pos()
+ local node_name = minetest.get_node(player_pos).name
+ local water = minetest.get_item_group(node_name,"water")
+ player_pos.y = player_pos.y + 0.6 --adjust to body height (for radiant heat)
+ local enviro_temp = climate.get_point_temp(player_pos, true)
+ --being outside tolerance range will drain energy. When energy is drained will succumb.
+ --[safe] comfort zone ->[low cost]->stress zone ->[high cost]-> danger zone->[damage]
+
+ local comfort_low = meta:get_int("clothing_temp_min")
+ local comfort_high = meta:get_int("clothing_temp_max") + 1
+ -- comfort is rounded off in display, so you can be half a degree
+ -- over and still in the white. Don't confuse players by penalizing!
+ local stress_low = comfort_low - 10
+ local stress_high = comfort_high + 10
+ local danger_low = stress_low - 40
+ local danger_high = stress_high +40
+ --energy costs (extreme, danger, stress)
+ local costex = 8
+ local costd = 4
+ local costs = 1
+ --water conducts heat better
+ if water then
+ costex = 13
+ costd = 8
+ costs = 4
+ end
+
+
+ --burn or freeze
+ if enviro_temp < danger_low or enviro_temp > danger_high then
+ --tissue damaging freeze/burn
+ health = health - 1
+ energy = energy - costex
+ --exhaustion from temp
+ elseif energy > 0 then
+ --have energy to resist (and it is resistable cf extreme)
+ if enviro_temp < comfort_low or enviro_temp > comfort_high then
+ --outside comfort zone
+ if enviro_temp < stress_low or enviro_temp > stress_high then
+ energy = energy - costd
+ else
+ energy = energy - costs
+ end
+ end
+ end
+
+ --totally exhausted, heat stroke or hypothermia now sets in
+ if energy <= 0
+ and (enviro_temp < stress_low or enviro_temp > stress_high) then
+ --heat or cool to ambient temperature
+ temperature = (temperature*0.95) + (enviro_temp*0.05)
+ meta:set_int("temperature", temperature)
+ end
+
+
+ ------------------
+ local light = minetest.get_node_light(player_pos, 0.5)
+ local rain = climate.get_rain(player_pos, light)
+ local snow = climate.get_snow(player_pos, light)
+ local dam_weather = climate.get_damage_weather(player_pos, light)
+
+ --bed rest
+ --when in bed, under shelter boost energy
+ if energy < 1000 then
+ if bed_rest.player[name] then
+ --best rest is under shelter, in a non-extreme temperature
+ local lvl = bed_rest.level[name]
+ if rain
+ or snow
+ or dam_weather
+ or enviro_temp < stress_low
+ or enviro_temp > stress_high then
+ --terrible sleep in the rain etc
+ if random()>0.1 then
+ energy = energy + (2 * lvl)
+ end
+
+ elseif enviro_temp < comfort_low
+ or enviro_temp > comfort_high
+ or light >= 14 then
+ --okay sleep if in uncomfortable temp, exposed
+ energy = energy + (4 * lvl)
+
+ elseif enviro_temp < comfort_high and enviro_temp > comfort_low and light < 14 then
+ --best rest is under shelter, in a non-extreme temperature
+ energy = energy + (16 * lvl)
+ end
+ end
+ end
+
+ ------------------
+ --drink a little rain
+ if rain and thirst < 100 then
+ --only sometimes or too easy
+ if random()<0.2 then
+ thirst = thirst + 1
+ end
+ end
+
+ --thirsty in heat
+ if random()<0.1 then
+ if enviro_temp > stress_high then
+ thirst = thirst - 2
+ elseif enviro_temp > comfort_high then
+ thirst = thirst - 1
+ end
+ end
+
+ ------------------
+ --harmed by damaging weather,
+ --exhausted by rain, snow
+ if random()<0.5 then
+
+ if dam_weather then
+ health = health - 1
+ energy = energy - 15
+ if energy < 0 then
+ energy = 0
+ end
+
+ --dust fever
+ if random() < 0.02 then
+ if climate.active_weather.name == 'duststorm' then
+ HEALTH.add_new_effect(player, {"Dust Fever", 1})
+ end
+ end
+
+ elseif rain or snow then
+ energy = energy - 2
+ if energy < 0 then
+ energy = 0
+ end
+ end
+ end
+
+
+ ------------------
+ --Health effects
+
+ --zoonotic and contagious diseases
+ --in biome
+ --in node
+
+ -- Fungal Infection from standing on wet soil
+ if random() < 0.002 then
+ local posu = player_pos
+ posu.y = posu.y - 1.6
+
+ local s_name = minetest.get_node(posu).name
+ if minetest.get_item_group(s_name, "wet_sediment") > 0 then
+ HEALTH.add_new_effect(player, {"Fungal Infection", 1})
+ end
+ end
+
+
+
+
+
+ ------------------
+ --Final Housekeeping
+
+ --cap energy etc
+ if energy < 0 then
+ energy = 0
+ elseif energy > 1000 then
+ energy = 1000
+ end
+
+ if thirst < 0 then
+ thirst = 0
+ elseif thirst > 100 then
+ thirst = 100
+ end
+
+ if hunger < 0 then
+ hunger = 0
+ elseif hunger > 1000 then
+ hunger = 1000
+ end
+
+
+ --update
+ meta:set_int("energy", energy)
+ meta:set_int("thirst", thirst)
+ meta:set_int("hunger", hunger)
+ player:set_hp(health)
+ --update form so can see change while looking
+ sfinv.set_player_inventory_formspec(player)
+
+ end
+
+
+ end
+ end
+
+ --reset
+ if timer > interval then
+ timer = 0
+ end
+ end)
+
+end
diff --git a/games/globo/mods/health/sounds/health_alert.ogg b/games/globo/mods/health/sounds/health_alert.ogg
new file mode 100644
index 000000000..0aff9f8fe
Binary files /dev/null and b/games/globo/mods/health/sounds/health_alert.ogg differ
diff --git a/games/globo/mods/health/sounds/health_eat.ogg b/games/globo/mods/health/sounds/health_eat.ogg
new file mode 100644
index 000000000..d3fb82b27
Binary files /dev/null and b/games/globo/mods/health/sounds/health_eat.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.1.ogg b/games/globo/mods/health/sounds/health_hallucinate.1.ogg
new file mode 100644
index 000000000..04baf13a1
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.1.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.2.ogg b/games/globo/mods/health/sounds/health_hallucinate.2.ogg
new file mode 100644
index 000000000..309ebb08d
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.2.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.3.ogg b/games/globo/mods/health/sounds/health_hallucinate.3.ogg
new file mode 100644
index 000000000..b09c29f52
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.3.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.4.ogg b/games/globo/mods/health/sounds/health_hallucinate.4.ogg
new file mode 100644
index 000000000..5c86baf56
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.4.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.5.ogg b/games/globo/mods/health/sounds/health_hallucinate.5.ogg
new file mode 100644
index 000000000..544be166a
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.5.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.6.ogg b/games/globo/mods/health/sounds/health_hallucinate.6.ogg
new file mode 100644
index 000000000..80fe7d0a6
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.6.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.7.ogg b/games/globo/mods/health/sounds/health_hallucinate.7.ogg
new file mode 100644
index 000000000..89b8be819
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.7.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.8.ogg b/games/globo/mods/health/sounds/health_hallucinate.8.ogg
new file mode 100644
index 000000000..c60e86ce3
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.8.ogg differ
diff --git a/games/globo/mods/health/sounds/health_hallucinate.9.ogg b/games/globo/mods/health/sounds/health_hallucinate.9.ogg
new file mode 100644
index 000000000..185a48fe1
Binary files /dev/null and b/games/globo/mods/health/sounds/health_hallucinate.9.ogg differ
diff --git a/games/globo/mods/health/sounds/health_heart.ogg b/games/globo/mods/health/sounds/health_heart.ogg
new file mode 100644
index 000000000..5cf5edb00
Binary files /dev/null and b/games/globo/mods/health/sounds/health_heart.ogg differ
diff --git a/games/globo/mods/health/sounds/health_superpower.ogg b/games/globo/mods/health/sounds/health_superpower.ogg
new file mode 100644
index 000000000..c6b80eaa7
Binary files /dev/null and b/games/globo/mods/health/sounds/health_superpower.ogg differ
diff --git a/games/globo/mods/health/sounds/health_vomit.ogg b/games/globo/mods/health/sounds/health_vomit.ogg
new file mode 100644
index 000000000..28bde0634
Binary files /dev/null and b/games/globo/mods/health/sounds/health_vomit.ogg differ
diff --git a/games/globo/mods/health/textures/hud_air_temp.png b/games/globo/mods/health/textures/hud_air_temp.png
new file mode 100644
index 000000000..3fd93459f
Binary files /dev/null and b/games/globo/mods/health/textures/hud_air_temp.png differ
diff --git a/games/globo/mods/health/textures/hud_body_temp.png b/games/globo/mods/health/textures/hud_body_temp.png
new file mode 100644
index 000000000..41f524005
Binary files /dev/null and b/games/globo/mods/health/textures/hud_body_temp.png differ
diff --git a/games/globo/mods/health/textures/hud_energy.png b/games/globo/mods/health/textures/hud_energy.png
new file mode 100644
index 000000000..45d71a550
Binary files /dev/null and b/games/globo/mods/health/textures/hud_energy.png differ
diff --git a/games/globo/mods/health/textures/hud_health.png b/games/globo/mods/health/textures/hud_health.png
new file mode 100644
index 000000000..c4bbc1b13
Binary files /dev/null and b/games/globo/mods/health/textures/hud_health.png differ
diff --git a/games/globo/mods/health/textures/hud_hunger.png b/games/globo/mods/health/textures/hud_hunger.png
new file mode 100644
index 000000000..a75fd4b82
Binary files /dev/null and b/games/globo/mods/health/textures/hud_hunger.png differ
diff --git a/games/globo/mods/health/textures/hud_sick.png b/games/globo/mods/health/textures/hud_sick.png
new file mode 100644
index 000000000..ef4807899
Binary files /dev/null and b/games/globo/mods/health/textures/hud_sick.png differ
diff --git a/games/globo/mods/health/textures/hud_temp_cold.png b/games/globo/mods/health/textures/hud_temp_cold.png
new file mode 100644
index 000000000..07abc7ac5
Binary files /dev/null and b/games/globo/mods/health/textures/hud_temp_cold.png differ
diff --git a/games/globo/mods/health/textures/hud_temp_hot.png b/games/globo/mods/health/textures/hud_temp_hot.png
new file mode 100644
index 000000000..06a845c20
Binary files /dev/null and b/games/globo/mods/health/textures/hud_temp_hot.png differ
diff --git a/games/globo/mods/health/textures/hud_temp_normal.png b/games/globo/mods/health/textures/hud_temp_normal.png
new file mode 100644
index 000000000..0cd31a98b
Binary files /dev/null and b/games/globo/mods/health/textures/hud_temp_normal.png differ
diff --git a/games/globo/mods/health/textures/hud_thirst.png b/games/globo/mods/health/textures/hud_thirst.png
new file mode 100644
index 000000000..a3b16ffa0
Binary files /dev/null and b/games/globo/mods/health/textures/hud_thirst.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_black.png b/games/globo/mods/health/textures/unused/health_dot_black.png
new file mode 100644
index 000000000..d63e4850c
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_black.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_black_energy.png b/games/globo/mods/health/textures/unused/health_dot_black_energy.png
new file mode 100644
index 000000000..a34265b46
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_black_energy.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_black_env_temp.png b/games/globo/mods/health/textures/unused/health_dot_black_env_temp.png
new file mode 100644
index 000000000..ee1a05f1f
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_black_env_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_black_hunger.png b/games/globo/mods/health/textures/unused/health_dot_black_hunger.png
new file mode 100644
index 000000000..98496b66c
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_black_hunger.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_black_temp.png b/games/globo/mods/health/textures/unused/health_dot_black_temp.png
new file mode 100644
index 000000000..d19a6a9b4
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_black_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_black_thirst.png b/games/globo/mods/health/textures/unused/health_dot_black_thirst.png
new file mode 100644
index 000000000..9cd035fa4
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_black_thirst.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_green.png b/games/globo/mods/health/textures/unused/health_dot_green.png
new file mode 100644
index 000000000..723f512c6
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_green.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_green_energy.png b/games/globo/mods/health/textures/unused/health_dot_green_energy.png
new file mode 100644
index 000000000..5ad5ac625
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_green_energy.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_green_env_temp.png b/games/globo/mods/health/textures/unused/health_dot_green_env_temp.png
new file mode 100644
index 000000000..84981d06a
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_green_env_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_green_hunger.png b/games/globo/mods/health/textures/unused/health_dot_green_hunger.png
new file mode 100644
index 000000000..73f941606
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_green_hunger.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_green_temp.png b/games/globo/mods/health/textures/unused/health_dot_green_temp.png
new file mode 100644
index 000000000..43e4cef85
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_green_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_green_thirst.png b/games/globo/mods/health/textures/unused/health_dot_green_thirst.png
new file mode 100644
index 000000000..ba5c16a76
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_green_thirst.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_orange.png b/games/globo/mods/health/textures/unused/health_dot_orange.png
new file mode 100644
index 000000000..02d95d4fa
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_orange.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_orange_energy.png b/games/globo/mods/health/textures/unused/health_dot_orange_energy.png
new file mode 100644
index 000000000..43674201e
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_orange_energy.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_orange_env_temp.png b/games/globo/mods/health/textures/unused/health_dot_orange_env_temp.png
new file mode 100644
index 000000000..e42b56def
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_orange_env_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_orange_hunger.png b/games/globo/mods/health/textures/unused/health_dot_orange_hunger.png
new file mode 100644
index 000000000..fbce4c97a
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_orange_hunger.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_orange_temp.png b/games/globo/mods/health/textures/unused/health_dot_orange_temp.png
new file mode 100644
index 000000000..73b3b9af1
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_orange_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_orange_thirst.png b/games/globo/mods/health/textures/unused/health_dot_orange_thirst.png
new file mode 100644
index 000000000..4a0d6b296
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_orange_thirst.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_red.png b/games/globo/mods/health/textures/unused/health_dot_red.png
new file mode 100644
index 000000000..c8be085bb
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_red.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_red_energy.png b/games/globo/mods/health/textures/unused/health_dot_red_energy.png
new file mode 100644
index 000000000..40ac4a917
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_red_energy.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_red_env_temp.png b/games/globo/mods/health/textures/unused/health_dot_red_env_temp.png
new file mode 100644
index 000000000..a3d215d9e
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_red_env_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_red_hunger.png b/games/globo/mods/health/textures/unused/health_dot_red_hunger.png
new file mode 100644
index 000000000..38bedc65d
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_red_hunger.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_red_temp.png b/games/globo/mods/health/textures/unused/health_dot_red_temp.png
new file mode 100644
index 000000000..5b045da37
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_red_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_red_thirst.png b/games/globo/mods/health/textures/unused/health_dot_red_thirst.png
new file mode 100644
index 000000000..1ea384714
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_red_thirst.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_yellow.png b/games/globo/mods/health/textures/unused/health_dot_yellow.png
new file mode 100644
index 000000000..3998ec783
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_yellow.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_yellow_energy.png b/games/globo/mods/health/textures/unused/health_dot_yellow_energy.png
new file mode 100644
index 000000000..427221e55
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_yellow_energy.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_yellow_env_temp.png b/games/globo/mods/health/textures/unused/health_dot_yellow_env_temp.png
new file mode 100644
index 000000000..293f3b501
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_yellow_env_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_yellow_hunger.png b/games/globo/mods/health/textures/unused/health_dot_yellow_hunger.png
new file mode 100644
index 000000000..05f662d53
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_yellow_hunger.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_yellow_temp.png b/games/globo/mods/health/textures/unused/health_dot_yellow_temp.png
new file mode 100644
index 000000000..d308651cc
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_yellow_temp.png differ
diff --git a/games/globo/mods/health/textures/unused/health_dot_yellow_thirst.png b/games/globo/mods/health/textures/unused/health_dot_yellow_thirst.png
new file mode 100644
index 000000000..8871ed990
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_dot_yellow_thirst.png differ
diff --git a/games/globo/mods/health/textures/unused/health_overlay_red.png b/games/globo/mods/health/textures/unused/health_overlay_red.png
new file mode 100644
index 000000000..ee84d318e
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_overlay_red.png differ
diff --git a/games/globo/mods/health/textures/unused/health_overlay_tunnel.png b/games/globo/mods/health/textures/unused/health_overlay_tunnel.png
new file mode 100644
index 000000000..9aea9ddd8
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_overlay_tunnel.png differ
diff --git a/games/globo/mods/health/textures/unused/health_superpower.png b/games/globo/mods/health/textures/unused/health_superpower.png
new file mode 100644
index 000000000..c21f4aeef
Binary files /dev/null and b/games/globo/mods/health/textures/unused/health_superpower.png differ
diff --git a/games/globo/mods/health/textures/weather_hud_frost.png b/games/globo/mods/health/textures/weather_hud_frost.png
new file mode 100644
index 000000000..7b133f4ec
Binary files /dev/null and b/games/globo/mods/health/textures/weather_hud_frost.png differ
diff --git a/games/globo/mods/health/textures/weather_hud_haze.png b/games/globo/mods/health/textures/weather_hud_haze.png
new file mode 100644
index 000000000..265bcd9cc
Binary files /dev/null and b/games/globo/mods/health/textures/weather_hud_haze.png differ
diff --git a/games/globo/mods/health/textures/weather_hud_heat.png b/games/globo/mods/health/textures/weather_hud_heat.png
new file mode 100644
index 000000000..d8058f8cb
Binary files /dev/null and b/games/globo/mods/health/textures/weather_hud_heat.png differ
diff --git a/games/globo/mods/lightning/README.txt b/games/globo/mods/lightning/README.txt
new file mode 100644
index 000000000..21e74b8f9
--- /dev/null
+++ b/games/globo/mods/lightning/README.txt
@@ -0,0 +1,32 @@
+Exile mod: Lightning
+=============================
+Add lightning (for use by Climate)
+
+
+`lightning.strike()`
+Does a bolt of lightning
+
+
+Authors of source code
+----------------------
+Adapted for use in Exile game from Lightning mod for Minetest
+
+Copyright (C) 2016 - Auke Kok
+
+"lightning" is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1
+of the license, or (at your option) any later version.
+
+
+Authors of media
+----------------
+Textures: CC-BY-SA-4.0 by sofar
+ lightning_1.png
+ lightning_2.png
+ lightning_3.png
+
+Sounds:
+ thunder.1.ogg - CC-BY-SA - hantorio - http://www.freesound.org/people/hantorio/sounds/121945/
+ thunder.2.ogg - CC-BY-SA - juskiddink - http://www.freesound.org/people/juskiddink/sounds/101948/
+ thunder.3.ogg - CC-BY-SA - IllusiaProductions - http://www.freesound.org/people/IllusiaProductions/sounds/249950/
diff --git a/games/globo/mods/lightning/init.lua b/games/globo/mods/lightning/init.lua
new file mode 100644
index 000000000..55282a993
--- /dev/null
+++ b/games/globo/mods/lightning/init.lua
@@ -0,0 +1,196 @@
+
+--[[
+
+Copyright (C) 2016 - Auke Kok
+
+"lightning" is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1
+of the license, or (at your option) any later version.
+
+--]]
+
+lightning = {}
+
+lightning.interval_low = 17
+lightning.interval_high = 503
+lightning.range_h = 100
+lightning.range_v = 50
+lightning.size = 100
+lightning.effect_range = 400
+
+
+local rng = PcgRandom(32321123312123)
+
+local ps = {}
+local ttl = 1
+
+local revertsky = function()
+ if ttl == 0 then
+ return
+ end
+ ttl = ttl - 1
+ if ttl > 0 then
+ return
+ end
+
+ for playername, sky in pairs(ps) do
+ local player = minetest.get_player_by_name(playername)
+ -- check if the player is still online
+ if player then
+ player:set_sky({type = "regular", sky_color = {sky.sky_color}})
+ player:override_day_night_ratio(sky.ratio)
+ end
+ end
+
+ ps = {}
+end
+
+
+
+minetest.register_globalstep(revertsky)
+
+-- select a random strike point, midpoint
+local function choose_pos(pos)
+ if not pos then
+ local playerlist = minetest.get_connected_players()
+ local playercount = table.getn(playerlist)
+
+ -- nobody on
+ if playercount == 0 then
+ return nil, nil
+ end
+
+ local r = rng:next(1, playercount)
+ local randomplayer = playerlist[r]
+ pos = randomplayer:get_pos()
+
+ -- avoid striking underground
+ if pos.y < -20 then
+ return nil, nil
+ end
+
+ pos.x = math.floor(pos.x - (lightning.range_h / 2) + rng:next(1, lightning.range_h))
+ pos.y = pos.y + (lightning.range_v / 2)
+ pos.z = math.floor(pos.z - (lightning.range_h / 2) + rng:next(1, lightning.range_h))
+ end
+
+ local b, pos2 = minetest.line_of_sight(pos, {x = pos.x, y = pos.y - lightning.range_v, z = pos.z}, 1)
+
+ -- nothing but air found
+ if b then
+ return nil, nil
+ end
+
+ local n = minetest.get_node({x = pos2.x, y = pos2.y - 1/2, z = pos2.z})
+ if n.name == "air" or n.name == "ignore" then
+ return nil, nil
+ end
+
+ return pos, pos2
+end
+
+-- lightning strike API
+-- * pos: optional, if not given a random pos will be chosen
+-- * returns: bool - success if a strike happened
+lightning.strike = function(pos, cosmetic)
+ if lightning.auto then
+ minetest.after(rng:next(lightning.interval_low, lightning.interval_high), lightning.strike)
+ end
+
+ local pos2
+ pos, pos2 = choose_pos(pos)
+
+ if not pos then
+ return false
+ end
+
+ minetest.add_particlespawner({
+ amount = 1,
+ time = 0.2,
+ -- make it hit the top of a block exactly with the bottom
+ minpos = {x = pos2.x, y = pos2.y + (lightning.size / 2) + 1/2, z = pos2.z },
+ maxpos = {x = pos2.x, y = pos2.y + (lightning.size / 2) + 1/2, z = pos2.z },
+ minvel = {x = 0, y = 0, z = 0},
+ maxvel = {x = 0, y = 0, z = 0},
+ minacc = {x = 0, y = 0, z = 0},
+ maxacc = {x = 0, y = 0, z = 0},
+ minexptime = 0.2,
+ maxexptime = 0.2,
+ minsize = lightning.size * 10,
+ maxsize = lightning.size * 10,
+ collisiondetection = true,
+ vertical = true,
+ -- to make it appear hitting the node that will get set on fire, make sure
+ -- to make the texture lightning bolt hit exactly in the middle of the
+ -- texture (e.g. 127/128 on a 256x wide texture)
+ texture = "lightning_lightning_" .. rng:next(1,3) .. ".png",
+ -- 0.4.15+
+ glow = 14,
+ })
+
+ minetest.sound_play({ pos = pos, name = "lightning_thunder", gain = 10, max_hear_distance = 500 })
+
+ -- damage nearby objects, player or not
+ if not cosmetic then
+ for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 5)) do
+ -- nil as param#1 is supposed to work, but core can't handle it.
+ obj:punch(obj, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy=8}}, nil)
+ end
+ end
+
+
+ local playerlist = minetest.get_connected_players()
+ for i = 1, #playerlist do
+ local player = playerlist[i]
+ local distance = vector.distance(player:get_pos(), pos)
+ -- only affect players inside effect_range
+ if distance < lightning.effect_range then
+ local sky = {}
+ sky.sky_color = player:get_sky(true)
+ sky.ratio = player:get_day_night_ratio()
+
+ local name = player:get_player_name()
+ if ps[name] == nil then
+ ps[name] = sky
+ player:set_sky({type = "plain", base_color = "#CCFFFFFF"})
+ player:override_day_night_ratio(1)
+ end
+ end
+ end
+
+
+ -- trigger revert of skybox
+ ttl = 5
+
+ if cosmetic == true then return end
+
+ -- set the air node above it on fire
+ pos2.y = pos2.y + 1/2
+ if minetest.get_item_group(minetest.get_node({x = pos2.x, y = pos2.y - 1, z = pos2.z}).name, "liquid") < 1 then
+ if minetest.get_node(pos2).name == "air" then
+ -- only 1/4 of the time, something is changed
+ if rng:next(1,4) > 1 then
+ return
+ end
+ -- very rarely, potentially cause a fire
+ if rng:next(1,200) == 1 then
+ minetest.set_node(pos2, {name = "inferno:hungry_flame"})
+ end
+ end
+ end
+
+ -- perform block modifications
+ if rng:next(1,10) > 1 then
+ return
+ end
+ pos2.y = pos2.y - 1
+ local n = minetest.get_node(pos2)
+ if minetest.get_item_group(n.name, "tree") > 0 then
+ minetest.swap_node(pos2, { name = "tech:large_wood_fire_smoldering"})
+ --elseif minetest.get_item_group(n.name, "sand") > 0 then
+ --minetest.set_node(pos2, { name = "default:glass"})
+ --elseif minetest.get_item_group(n.name, "soil") > 0 then
+ -- minetest.set_node(pos2, { name = "default:gravel"})
+ end
+end
diff --git a/games/globo/mods/lightning/mod.conf b/games/globo/mods/lightning/mod.conf
new file mode 100644
index 000000000..608d533c2
--- /dev/null
+++ b/games/globo/mods/lightning/mod.conf
@@ -0,0 +1,4 @@
+name = lightning
+author = sofar
+description = A mod that adds thunder and lightning effects.
+title = Lightning
diff --git a/games/globo/mods/lightning/sounds/lightning_thunder.1.ogg b/games/globo/mods/lightning/sounds/lightning_thunder.1.ogg
new file mode 100644
index 000000000..18e011957
Binary files /dev/null and b/games/globo/mods/lightning/sounds/lightning_thunder.1.ogg differ
diff --git a/games/globo/mods/lightning/sounds/lightning_thunder.2.ogg b/games/globo/mods/lightning/sounds/lightning_thunder.2.ogg
new file mode 100644
index 000000000..c9e1b0d4f
Binary files /dev/null and b/games/globo/mods/lightning/sounds/lightning_thunder.2.ogg differ
diff --git a/games/globo/mods/lightning/sounds/lightning_thunder.3.ogg b/games/globo/mods/lightning/sounds/lightning_thunder.3.ogg
new file mode 100644
index 000000000..3690d200b
Binary files /dev/null and b/games/globo/mods/lightning/sounds/lightning_thunder.3.ogg differ
diff --git a/games/globo/mods/lightning/textures/lightning_lightning_1.png b/games/globo/mods/lightning/textures/lightning_lightning_1.png
new file mode 100644
index 000000000..37af59e04
Binary files /dev/null and b/games/globo/mods/lightning/textures/lightning_lightning_1.png differ
diff --git a/games/globo/mods/lightning/textures/lightning_lightning_2.png b/games/globo/mods/lightning/textures/lightning_lightning_2.png
new file mode 100644
index 000000000..7bab36b74
Binary files /dev/null and b/games/globo/mods/lightning/textures/lightning_lightning_2.png differ
diff --git a/games/globo/mods/lightning/textures/lightning_lightning_3.png b/games/globo/mods/lightning/textures/lightning_lightning_3.png
new file mode 100644
index 000000000..f090529ec
Binary files /dev/null and b/games/globo/mods/lightning/textures/lightning_lightning_3.png differ
diff --git a/games/globo/mods/main/compat.lua b/games/globo/mods/main/compat.lua
new file mode 100644
index 000000000..d90d909a1
--- /dev/null
+++ b/games/globo/mods/main/compat.lua
@@ -0,0 +1,72 @@
+minimal = {
+ stack_max_bulky = 2,
+ stack_max_medium = 24,
+ stack_max_light = 288,
+ --hand base abilities
+ hand_punch_int = 0.8,
+ hand_max_lvl = 1,
+ hand_crac = 3.5,
+ hand_chop = 1.5,
+ hand_crum = 1.0,
+ hand_snap = 0.5,
+ hand_dmg = 1,
+
+ t_scale2 = 3,
+ t_scale1 = 6,
+
+}
+
+minimal = minimal
+
+minimal.mtversion = {}
+
+local version = minetest.get_version()
+local tabstr = string.split(version.string,".")
+local major = tonumber(tabstr[1])
+local minor = tonumber(tabstr[2])
+local dev = tostring(string.match(tabstr[3], "-dev") ~= nil)
+-- '%d[%d]*' extracts the first string of consecutive numeric chars
+local patch = tonumber(string.match(tabstr[3], '%d[%d]*'))
+minetest.log("action", "Running on version: "..version.project.." "..
+ major.."."..minor.."."..patch.." Dev version: "..dev)
+minimal.mtversion = { project = version.project, major = major,
+ minor = minor, patch = patch, dev = dev }
+
+function minimal.mt_required_version(maj, min, pat)
+ if minimal.mtversion.project ~= "Minetest" then
+ return false -- Not running Minetest? #TODO check indiv feature support
+ end
+ if minimal.mtversion.major > maj or
+ ( minimal.mtversion.major == maj and
+ minimal.mtversion.minor > min ) or
+ ( minimal.mtversion.major == maj and
+ minimal.mtversion.minor == min and
+ minimal.mtversion.patch >= pat ) then
+ return true
+ else
+ return false
+ end
+end
+
+function minimal.get_daylight(pos, tod)
+ if minetest.get_natural_light then
+ return minetest.get_natural_light(pos, tod)
+ else
+ return minetest.get_node_light(pos,tod)
+ end
+end
+
+minimal.compat_alpha = {}
+if minimal.mt_required_version(5, 4, 0) then
+ minimal.compat_alpha = {
+ ["blend"] = "blend",
+ ["opaque"] = "opaque",
+ ["clip"] = "clip",
+ }
+else
+ minimal.compat_alpha = {
+ ["blend"] = true,
+ ["opaque"] = false,
+ ["clip"] = true, -- may be false for some draw types?
+ }
+end
diff --git a/games/globo/mods/main/creatures.lua b/games/globo/mods/main/creatures.lua
new file mode 100644
index 000000000..b2ded5437
--- /dev/null
+++ b/games/globo/mods/main/creatures.lua
@@ -0,0 +1,303 @@
+local creature_definitions = {
+ wolf = {
+ physical = true,
+ stepheight = 1.1,
+ collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.75, 0.3},
+ visual = "mesh",
+ visual_size = {x=10, y=10},
+ mesh = "wolf.b3d",
+ textures = {"creature_wolf.png"},
+ makes_footstep_sound = true,
+ view_range = 15,
+ walk_velocity = 2,
+ run_velocity = 4,
+ damage = 2,
+ drops = {"farming:meat_raw 2"},
+ armor = 200,
+ drawtype = "front",
+ water_damage = 0,
+ lava_damage = 5,
+ light_damage = 0,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ cow = {
+ physical = true,
+ stepheight = 1.1,
+ collisionbox = {-0.4, -0.01, -0.4, 0.4, 0.9, 0.4},
+ visual = "mesh",
+ visual_size = {x=10, y=10},
+ mesh = "cow.b3d",
+ textures = {"creature_cow.png"},
+ makes_footstep_sound = true,
+ view_range = 10,
+ walk_velocity = 1.2,
+ run_velocity = 1.8,
+ damage = 1,
+ drops = {"farming:meat_raw 3"},
+ armor = 250,
+ drawtype = "front",
+ water_damage = 1,
+ lava_damage = 10,
+ light_damage = 0,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ mongoose = {
+ physical = true,
+ stepheight = 1.0,
+ collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.5, 0.25},
+ visual = "mesh",
+ visual_size = {x=8, y=8},
+ mesh = "mongoose.b3d",
+ textures = {"creature_mongoose.png"},
+ makes_footstep_sound = true,
+ view_range = 12,
+ walk_velocity = 1.5,
+ run_velocity = 2.5,
+ damage = 1,
+ drops = {"farming:meat_raw 1"},
+ armor = 150,
+ drawtype = "front",
+ water_damage = 0,
+ lava_damage = 5,
+ light_damage = 0,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ zygon = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 1.0,
+ collisionbox = {-0.5, -0.01, -0.5, 0.5, 1.5, 0.5},
+ visual = "mesh",
+ visual_size = {x=12, y=12},
+ mesh = "zygon.b3d",
+ textures = {"creature_zygon.png"},
+ makes_footstep_sound = true,
+ view_range = 20,
+ walk_velocity = 2,
+ run_velocity = 3,
+ damage = 3,
+ drops = {"farming:alien_meat 2"},
+ armor = 220,
+ drawtype = "front",
+ water_damage = 1,
+ lava_damage = 0,
+ light_damage = 5,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ badger = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 0.6,
+ collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.45, 0.3},
+ visual = "mesh",
+ visual_size = {x=9, y=9},
+ mesh = "badger.b3d",
+ textures = {"creature_badger.png"},
+ makes_footstep_sound = true,
+ view_range = 12,
+ walk_velocity = 1.8,
+ run_velocity = 2.8,
+ damage = 2,
+ drops = {"farming:meat_raw 2"},
+ armor = 190,
+ drawtype = "front",
+ water_damage = 1,
+ lava_damage = 5,
+ light_damage = 0,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ lava_ox = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 1.1,
+ collisionbox = {-0.55, -0.01, -0.55, 0.55, 1.6, 0.55},
+ visual = "mesh",
+ visual_size = {x=18, y=18},
+ mesh = "lava_ox.b3d",
+ textures = {"creature_lava_ox.png"},
+ makes_footstep_sound = true,
+ view_range = 8,
+ walk_velocity = 0.8,
+ run_velocity = 1.5,
+ damage = 4,
+ drops = {"farming:meat_raw 5"},
+ armor = 300,
+ drawtype = "front",
+ water_damage = 5,
+ lava_damage = 0,
+ light_damage = 0,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ chaos_hawk = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 1.0,
+ collisionbox = {-0.35, -0.01, -0.35, 0.35, 0.8, 0.35},
+ visual = "mesh",
+ visual_size = {x=9, y=9},
+ mesh = "chaos_hawk.b3d",
+ textures = {"creature_chaos_hawk.png"},
+ makes_footstep_sound = true,
+ view_range = 25,
+ walk_velocity = 3,
+ run_velocity = 5,
+ damage = 3,
+ drops = {"farming:meat_raw 2"},
+ armor = 180,
+ drawtype = "front",
+ water_damage = 0,
+ lava_damage = 7,
+ light_damage = 0,
+ fear_height = 3,
+ on_rightclick = nil,
+ },
+ ogre = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 1.0,
+ collisionbox = {-0.7, -0.01, -0.7, 0.7, 2.5, 0.7},
+ visual = "mesh",
+ visual_size = {x=20, y=20},
+ mesh = "ogre.b3d",
+ textures = {"creature_ogre.png"},
+ makes_footstep_sound = true,
+ view_range = 20,
+ walk_velocity = 1.5,
+ run_velocity = 2.5,
+ damage = 6,
+ drops = {"farming:meat_raw 6"},
+ armor = 300,
+ drawtype = "front",
+ water_damage = 2,
+ lava_damage = 3,
+ light_damage = 0,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ snagon = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 2.0,
+ collisionbox = {-1.0, -0.01, -1.0, 1.0, 2.0, 1.0},
+ visual = "mesh",
+ visual_size = {x=25, y=25},
+ mesh = "snagon.b3d",
+ textures = {"creature_snagon.png"},
+ makes_footstep_sound = true,
+ view_range = 30,
+ walk_velocity = 4,
+ run_velocity = 6,
+ damage = 8,
+ drops = {"farming:meat_raw 8"},
+ armor = 350,
+ drawtype = "front",
+ water_damage = 3,
+ lava_damage = 2,
+ light_damage = 0,
+ fear_height = 4,
+ on_rightclick = nil,
+ },
+ giant_moth = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 1.0,
+ collisionbox = {-0.5, -0.01, -0.5, 0.5, 1.0, 0.5},
+ visual = "mesh",
+ visual_size = {x=15, y=15},
+ mesh = "giant_moth.b3d",
+ textures = {"creature_giant_moth.png"},
+ makes_footstep_sound = true,
+ view_range = 12,
+ walk_velocity = 3,
+ run_velocity = 5,
+ damage = 2,
+ drops = {"farming:meat_raw 2"},
+ armor = 200,
+ drawtype = "front",
+ water_damage = 1,
+ lava_damage = 10,
+ light_damage = 0,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ skipping_fungus = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 0.5,
+ collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.35, 0.25},
+ visual = "cube",
+ visual_size = {x=5, y=5},
+ tiles = {"creature_skipping_fungus.png"},
+ makes_footstep_sound = true,
+ view_range = 5,
+ walk_velocity = 1,
+ run_velocity = 1.5,
+ damage = 0,
+ drops = {"farming:mushroom 2"},
+ armor = 100,
+ drawtype = "front",
+ water_damage = 0,
+ lava_damage = 5,
+ light_damage = 0,
+ fear_height = 1,
+ on_rightclick = nil,
+ },
+ frost_mephit = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 1.0,
+ collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.7, 0.3},
+ visual = "mesh",
+ visual_size = {x=10, y=10},
+ mesh = "frost_mephit.b3d",
+ textures = {"creature_frost_mephit.png"},
+ makes_footstep_sound = true,
+ view_range = 15,
+ walk_velocity = 2,
+ run_velocity = 3.5,
+ damage = 3,
+ drops = {"farming:ice_crystal 2"},
+ armor = 160,
+ drawtype = "front",
+ water_damage = 0,
+ lava_damage = 9,
+ light_damage = 0,
+ fear_height = 2,
+ on_rightclick = nil,
+ },
+ sand_slug = {
+ -- Placeholder definition; customize as needed
+ physical = true,
+ stepheight = 0.0,
+ collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.15, 0.2},
+ visual = "cube",
+ visual_size = {x=4, y=4},
+ tiles = {"creature_sand_slug.png"},
+ makes_footstep_sound = true,
+ view_range = 7,
+ walk_velocity = 0.5,
+ run_velocity = 0.7,
+ damage = 0,
+ drops = {"farming:sand_particle 2"},
+ armor = 100,
+ drawtype = "front",
+ water_damage = 1,
+ lava_damage = 10,
+ light_damage = 0,
+ fear_height = 1,
+ on_rightclick = nil,
+ },
+ -- Add more creature definitions here...
+}
+
+for name, def in pairs(creature_definitions) do
+ minetest.register_entity("main:" .. name, def)
+end
+
+
diff --git a/games/globo/mods/main/decorations.lua b/games/globo/mods/main/decorations.lua
new file mode 100644
index 000000000..52adc3694
--- /dev/null
+++ b/games/globo/mods/main/decorations.lua
@@ -0,0 +1,114 @@
+
+function registerDecorations()
+ print("register decorations")
+
+ minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.005,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:brambles",
+ })
+
+ minetest.register_decoration({
+ name="thorn_deco",
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.003,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:thorns",
+ })
+
+ minetest.register_decoration({
+ name="potatoes_deco",
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.004,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:potatoes",
+ })
+
+ minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.002,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:sumac",
+ })
+
+ minetest.register_decoration({
+ name="pulse_blossom_deco",
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.002,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:pulse_blossom",
+ })
+
+ minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.003,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:sun_berry",
+ })
+
+ minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.001,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:coffee",
+ })
+
+ minetest.register_decoration({
+ name = "grib_weed_deco",
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.0001,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:grib_weed",
+ flags = {node_dust = "main:grib_weed", gen_notify = true},
+ })
+
+ minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 16,
+ fill_ratio = 0.004,
+ biomes = {"mapgen:grassland"},
+ decoration = "main:corn",
+ })
+
+ minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 80,
+ fill_ratio = 0.001,
+ decoration = "basenodes:glow_stone",
+ })
+
+ minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 80,
+ fill_ratio = 0.01,
+ decoration = "basenodes:apple",
+ })
+
+ minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"basenodes:dirt_with_grass"},
+ sidelen = 80,
+ fill_ratio = 0.01,
+ decoration = "basenodes:snowblock",
+ })
+end
diff --git a/games/globo/mods/main/init.lua b/games/globo/mods/main/init.lua
new file mode 100644
index 000000000..d36ca5450
--- /dev/null
+++ b/games/globo/mods/main/init.lua
@@ -0,0 +1,55 @@
+
+
+
+-- Values that need to be moved into a config file
+
+-- won't allow you to go below 64. World goes gray
+MAP_SIZE=256
+
+STARVE_1_MUL=7
+STARVE_2_MUL=5
+
+APPLE_CHANCE_DIE=25
+SNOW_CHANCE_DIE=25
+
+NUM_SNOW=20
+NUM_APPLE=20
+
+CHANCE_APPLE_SPAWN=10
+CHANCE_SNOW_SPAWN=10
+
+
+-- Globo settings
+START_TEMPERATURE=98
+
+-- Inventory settings
+INVENTORY_SIZE = 2 -- Players can only hold 2 items at a time in inventory
+
+HEAL_RATE = 0.5
+HEAL_RATE_SLEEP = 1
+
+PLAYER_STARVE_RATE = 0.5
+PLAYER_DEHYDRATION_RATE =0.5
+
+-- Energy settings
+ENERGY_MAX_START = 1000 -- Starting maximum energy
+ENERGY_RECOVERY_RATE = 2 -- Rate at which energy is recovered per second when still
+ENERGY_RECOVERY_RATE_SLEEP = 10
+ENERGY_WALK_COST = 3 -- Cost of energy per second while walking
+ENERGY_RUN_COST = 10 -- Cost of energy per second while running
+ENERGY_JUMP_COST = 20 -- Cost of energy per jump
+
+SLEEP_STARVE_COE=0.3
+TIRED_RATE=0.5
+
+GAME_SPEED = 1
+
+
+local default_path = minetest.get_modpath("main")
+dofile(default_path.."/compat.lua")
+dofile(default_path.."/player.lua")
+dofile(default_path.."/creatures.lua")
+dofile(default_path.."/nodes.lua")
+dofile(default_path.."/decorations.lua")
+dofile(default_path.."/moisture_spread.lua")
+dofile(default_path.."/mapgen.lua")
\ No newline at end of file
diff --git a/games/globo/mods/main/mapgen.lua b/games/globo/mods/main/mapgen.lua
new file mode 100644
index 000000000..c83f7202a
--- /dev/null
+++ b/games/globo/mods/main/mapgen.lua
@@ -0,0 +1,131 @@
+
+
+-- sets this for the NEXT map that is generated. very lame
+minetest.settings:set("mapgen_limit", MAP_SIZE)
+
+local gGribDecoID
+local gThornDecoID
+local gPotatoDecoID
+local gPulseBlossomDecoID
+minetest.register_on_mods_loaded(function()
+ gGribDecoID = minetest.get_decoration_id("grib_weed_deco")
+ gThornDecoID = minetest.get_decoration_id("thorn_deco")
+ gPotatoDecoID = minetest.get_decoration_id("potatoes_deco")
+ gPulseBlossomDecoID = minetest.get_decoration_id("pulse_blossom_deco")
+ print("GribID: " .. gGribDecoID)
+ print("ThornID: " .. gThornDecoID)
+ print("PotatoID: " .. gPotatoDecoID)
+ print("PulseBlossomID: " .. gPulseBlossomDecoID)
+ minetest.set_gen_notify("decoration", {gGribDecoID,gThornDecoID,gPotatoDecoID,gPulseBlossomDecoID})
+end)
+
+minetest.register_on_generated(function(minp, maxp, blockseed)
+ local gen_notify = minetest.get_mapgen_object("gennotify")
+
+ -- minetest.log("action", "gen_notify contents: " .. dump(gen_notify))
+
+ local your_nodes = gen_notify["decoration#".. gGribDecoID]
+ if your_nodes then
+ for _, pos in ipairs(your_nodes) do
+ local p={x=pos.x, y=pos.y+1, z=pos.z} -- WTF: why do they make us do this?
+ start_node_timer(p)
+ end
+ end
+
+ your_nodes = gen_notify["decoration#".. gThornDecoID]
+ if your_nodes then
+ for _, pos in ipairs(your_nodes) do
+ local p={x=pos.x, y=pos.y+1, z=pos.z} -- WTF: why do they make us do this?
+ start_node_timer(p)
+ end
+ end
+
+ your_nodes = gen_notify["decoration#".. gPotatoDecoID]
+ if your_nodes then
+ for _, pos in ipairs(your_nodes) do
+ local p={x=pos.x, y=pos.y+1, z=pos.z} -- WTF: why do they make us do this?
+ start_node_timer(p)
+ end
+ end
+
+ local node_def = minetest.registered_nodes["main:pulse_blossom"]
+ your_nodes = gen_notify["decoration#".. gPulseBlossomDecoID]
+ if your_nodes then
+ for _, pos in ipairs(your_nodes) do
+ local p={x=pos.x, y=pos.y+1, z=pos.z} -- WTF: why do they make us do this?
+ node_def.on_construct(p)
+ end
+ end
+end)
+
+
+
+
+
+
+
+minetest.register_on_mapgen_init(function(mgparams)
+
+ minetest.set_mapgen_setting("mg_name", "v7", true)
+ local flags = minetest.get_mapgen_setting("mg_flags")
+
+ if flags then
+ local new_flags = flags:gsub("caves", "nocaves")
+ minetest.set_mapgen_setting("mg_flags", new_flags, true)
+ end
+
+end)
+
+
+
+minetest.register_alias("mapgen_water_source", "basenodes:water_source")
+minetest.register_alias("mapgen_river_water_source", "basenodes:river_water_source")
+
+minetest.register_alias("mapgen_dirt", "basenodes:dirt")
+minetest.register_alias("mapgen_stone", "basenodes:dirt")
+minetest.register_alias("mapgen_dirt_with_grass", "basenodes:dirt_with_grass")
+minetest.register_alias("mapgen_apple", "basenodes:apple")
+
+
+minetest.clear_registered_biomes()
+minetest.clear_registered_decorations()
+
+
+minetest.register_biome({
+ name = "mapgen:grassland",
+ node_top = "basenodes:dirt_with_grass",
+ depth_top = 1,
+ node_filler = "basenodes:dirt",
+ depth_filler = 1,
+ node_riverbed = "basenodes:sand",
+ depth_riverbed = 2,
+ node_dungeon = "basenodes:cobble",
+ node_dungeon_alt = "basenodes:mossycobble",
+ node_dungeon_stair = "stairs:stair_cobble",
+ y_max = 31000,
+ y_min = 4,
+ heat_point = 50,
+ humidity_point = 50,
+})
+
+minetest.register_biome({
+ name = "mapgen:grassland_ocean",
+ node_top = "basenodes:sand",
+ depth_top = 1,
+ node_filler = "basenodes:sand",
+ depth_filler = 3,
+ node_riverbed = "basenodes:sand",
+ depth_riverbed = 2,
+ node_cave_liquid = "basenodes:water_source",
+ node_dungeon = "basenodes:cobble",
+ node_dungeon_alt = "basenodes:mossycobble",
+ node_dungeon_stair = "stairs:stair_cobble",
+ y_max = 3,
+ y_min = -255,
+ heat_point = 50,
+ humidity_point = 50,
+})
+
+registerDecorations()
+
+
diff --git a/games/globo/mods/main/mod.conf b/games/globo/mods/main/mod.conf
new file mode 100644
index 000000000..c07fe2799
--- /dev/null
+++ b/games/globo/mods/main/mod.conf
@@ -0,0 +1,2 @@
+name = main
+description = Main entry point for the package
\ No newline at end of file
diff --git a/games/globo/mods/main/moisture_spread.lua b/games/globo/mods/main/moisture_spread.lua
new file mode 100644
index 000000000..9a168e84d
--- /dev/null
+++ b/games/globo/mods/main/moisture_spread.lua
@@ -0,0 +1,530 @@
+-------------------------------------------------------------
+--MOISTURE SPREAD
+--move wettness through sediment
+--other water effects
+
+
+----------------------------------------------------------------
+--freeze water
+local function water_freeze(pos, node)
+ local n_name = node.name
+
+ if climate.can_freeze(pos) then
+
+ local water_type = minetest.get_item_group(n_name, "water")
+ if water_type == 1 then
+ minetest.set_node(pos, {name = "nodes_nature:ice"})
+ elseif water_type == 2 then
+ minetest.set_node(pos, {name = "nodes_nature:sea_ice"})
+ end
+
+ end
+end
+
+----------------------------------------------------------------
+--evaporate water
+local function water_evap(pos, node)
+
+ --evaporation
+ if climate.can_evaporate(pos) then
+ --lose it's own water to the atmosphere
+ minetest.remove_node(pos)
+ return
+ end
+
+end
+
+--------------------------
+--move sources down, otherwise erosion leaves them stranded
+local function fall_water(pos,node)
+
+ local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
+ local under_name = minetest.get_node(pos_under).name
+
+ if under_name == "nodes_nature:freshwater_flowing" or under_name == "nodes_nature:salt_water_flowing" then
+ minetest.remove_node(pos)
+ minetest.set_node(pos_under, {name = node.name})
+ return pos
+ end
+
+ --Fresh water should not float on top of the ocean
+ if ( under_name == "nodes_nature:salt_water_source" and
+ node.name == "nodes_nature:freshwater_source" ) then
+ minetest.remove_node(pos)
+ return nil
+ end
+ return pos
+end
+
+local function water_handler(pos, node)
+ pos = fall_water(pos, node)
+ if pos == nil then
+ return -- the water is not there anymore
+ end
+ if climate.active_temp < 2 then
+ water_freeze(pos, node)
+ else
+ water_evap(pos, node)
+ end
+end
+
+--
+minetest.register_abm({
+ label = "Water Source Handling",
+ nodenames = {"nodes_nature:freshwater_source", "nodes_nature:salt_water_source"},
+ interval = 120,
+ chance = 10,
+ action = function(...)
+ water_handler(...)
+ end
+})
+
+
+----------------------------------------------------------------
+--Thaw snow and ice
+
+local function thaw_frozen(pos, node)
+ --position gets overwritten by climate function otherwise,
+ --not clear why
+ local p = pos
+ if climate.can_thaw(p) then
+
+ local name = node.name
+ if name == "nodes_nature:snow_block" then
+ minetest.set_node(p, {name = "nodes_nature:freshwater_source"})
+ elseif name == "nodes_nature:snow" then
+ minetest.remove_node(p)
+ elseif name == "nodes_nature:ice" then
+ local under = minetest.get_node({x = p.x, y = p.y-1, z =p.z})
+ if under.name == "nodes_nature:salt_water_source" then
+ minetest.remove_node(p)
+ else
+ minetest.set_node(p, {name = "nodes_nature:freshwater_source"})
+ end
+ elseif name == "nodes_nature:sea_ice" then
+ minetest.set_node(p, {name = "nodes_nature:salt_water_source"})
+ return
+ end
+ minetest.check_for_falling(p)
+ return
+ end
+end
+
+
+minetest.register_abm({
+ label = "Thaw Ice and snow",
+ nodenames = {"nodes_nature:ice", "nodes_nature:snow_block", "nodes_nature:snow", "nodes_nature:sea_ice"},
+ interval = 103,
+ chance = 5,
+ action = function(...)
+ thaw_frozen(...)
+ end
+})
+
+
+
+------------------------------------------------------------------
+--
+local function snow_accumulate(pos, node)
+ if pos.y < -15 then
+ return
+ end
+
+ --
+ local posu = {x = pos.x, y = pos.y - 1, z = pos.z}
+ local under_name = minetest.get_node(posu).name
+
+ if under_name == "air" then
+ return
+ end
+
+ --is snowing
+ if not climate.get_snow(pos) then
+ return
+ end
+
+ local nodedef = minetest.registered_nodes[under_name]
+ if not nodedef then
+ return
+ end
+
+ --walkable under i.e. not on water etc
+ local walk = nodedef.walkable
+ if not walk then
+ return
+ end
+
+ --pile up snow
+ if under_name == "nodes_nature:snow" then
+ minetest.swap_node(posu, {name = "nodes_nature:snow_block"})
+ return
+ end
+
+ --not on stairs, meshes etc
+ local draw = nodedef.drawtype
+ if draw ~= 'normal' then
+ return
+ end
+
+ --thin snow
+ minetest.set_node(pos, {name = "nodes_nature:snow"})
+
+end
+
+
+--
+minetest.register_abm({
+ label = "snow accumulate",
+ nodenames = {"air", "nodes_nature:snow"},
+ neighbors = {"group:crumbly","group:cracky", "group:snappy"},
+ interval = 72,
+ chance = 770,
+ min_y = -15,
+ action = function(...)
+ snow_accumulate(...)
+ end
+})
+
+
+
+
+
+--puddle detect
+--check for sides that can hold water
+--intended to be call for an air node with solid below
+--i.e. somewhere to put a puddle
+local function puddle_detect(pos)
+ local sides = {
+ {x = pos.x + 1, y = pos.y, z = pos.z},
+ {x = pos.x - 1, y = pos.y, z = pos.z},
+ {x = pos.x, y = pos.y, z = pos.z + 1},
+ {x = pos.x, y = pos.y, z = pos.z - 1}
+ }
+ local puddle = true
+ for i, v in ipairs(sides) do
+ local s_name = minetest.get_node(v).name
+ if minetest.get_item_group(s_name, "wet_sediment") == 0
+ and minetest.get_item_group(s_name, "soft_stone") == 0
+ and minetest.get_item_group(s_name, "masonry") == 0
+ and minetest.get_item_group(s_name, "stone") == 0 then
+ puddle = false
+ break
+ end
+ end
+ if puddle then
+ return true
+ else
+ return false
+ end
+end
+
+----------------------------------------------------------------
+-- Wet nodes: move water down into dry sediment
+--drain if exposed side or under
+--evaporate at surface in hot sun
+
+local function moisture_spread(pos, node)
+
+
+ local nodename = node.name
+
+ --dry version
+ local nodedef = minetest.registered_nodes[nodename]
+ local dry_name = nodedef._dry_name
+ if not nodedef or not dry_name then
+ return
+ end
+
+ --evaporation
+ if climate.can_evaporate(pos) then
+ --lose it's own water to the atmosphere
+ minetest.swap_node(pos, {name = dry_name})
+ return
+ end
+
+ --1= fresh or 2 = salty
+ local water_type = minetest.get_item_group(nodename, "wet_sediment")
+
+
+ --move through the soil, with a bias downwards
+ local pos_sed = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y, z = pos.z + 1},
+ {"group:sediment"})
+
+ if #pos_sed > 0 then
+ --select a random one
+ local pos2 = pos_sed[math.random(#pos_sed)]
+ --is it dry?
+ local name2 = minetest.get_node(pos2).name
+ if minetest.get_item_group(name2, "wet_sediment") == 0 then
+ --lose it's own water, and move it
+ minetest.swap_node(pos, {name = dry_name})
+ --set wet version of what draining into
+ local nodedef2 = minetest.registered_nodes[name2]
+ if not nodedef2 then
+ return
+ end
+ if water_type == 1 then
+ minetest.swap_node(pos2, {name = nodedef2._wet_name})
+ else
+ --can it absorb salt or is it "destroyed" e.g. surface, ag
+ local salt = nodedef2._wet_salty_name
+ if not salt then
+ --set it to it's salted parent material
+ minetest.swap_node(pos2, {name = nodedef2.drop})
+ else
+ minetest.swap_node(pos2, {name = nodedef2._wet_salty_name})
+ end
+ end
+ return
+ end
+ end
+
+ --leach out
+ --move out of the soil, only downwards
+ local pos_air = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y - 1, z = pos.z + 1},
+ {"air"})
+
+ if #pos_air > 0 then
+ --select a random one
+ local pos2 = pos_air[math.random(#pos_air)]
+ --lose it's own water, and move it
+ minetest.swap_node(pos, {name = dry_name})
+ --source or flowing?
+ if puddle_detect(pos2) then
+ if water_type == 1 then
+ minetest.set_node(pos2, {name = "nodes_nature:freshwater_source"})
+ else
+ minetest.set_node(pos2, {name = "nodes_nature:salt_water_source"})
+ end
+ else
+ if water_type == 1 then
+ minetest.set_node(pos2, {name = "nodes_nature:freshwater_flowing"})
+ else
+ minetest.set_node(pos2, {name = "nodes_nature:salt_water_flowing"})
+ end
+ end
+ return
+ end
+
+
+
+
+end
+
+--
+--
+minetest.register_abm({
+ label = "Moisture Spread",
+ nodenames = {"group:wet_sediment"},
+ --neighbors = {"group:sediment"},
+ interval = 121,
+ chance = 15,
+ action = function(...)
+ moisture_spread(...)
+ end
+})
+
+
+----------------------------------------------------------------
+-- Water soaks into sediment
+local function water_soak(pos, node)
+
+ local nodename = node.name
+
+ --move into the soil, with a bais downwards
+ local pos_sed = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y, z = pos.z + 1},
+ {"group:sediment"})
+
+ if #pos_sed > 0 then
+ --select a random one
+ local pos2 = pos_sed[math.random(#pos_sed)]
+ --is it dry?
+ local name2 = minetest.get_node(pos2).name
+ if minetest.get_item_group(name2, "wet_sediment") == 0 then
+ --
+ if nodename == "nodes_nature:freshwater_source" then
+ --non-renew
+ minetest.swap_node(pos, {name = "air"})
+ --set wet version of what draining into
+ local nodedef2 = minetest.registered_nodes[name2]
+ if not nodedef2 then
+ return
+ end
+ minetest.swap_node(pos2, {name = nodedef2._wet_name})
+ return
+ else
+ --set salty wet version of what draining into
+ local nodedef2 = minetest.registered_nodes[name2]
+ if not nodedef2 then
+ return
+ end
+ minetest.swap_node(pos2, {name = nodedef2._wet_salty_name})
+ return
+ end
+ end
+ end
+
+end
+
+--
+--
+minetest.register_abm({
+ label = "Water Soak",
+ nodenames = {"nodes_nature:freshwater_source", "nodes_nature:salt_water_source"},
+ neighbors = {"group:sediment"},
+ interval = 147,
+ chance = 100,
+ action = function(...)
+ water_soak(...)
+ end
+})
+
+
+
+----------------------------------------------------------------
+-- flowing Water erode
+--will rearrange sediments until out of the path of flow..
+--and cannot shift them anywhere else
+--eventually getting a stable "river" bed shape if it can
+local function water_erode(pos, node)
+ --take the sediment under it and move it to the side
+ local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
+ local under_name = minetest.get_node(pos_under).name
+ if minetest.get_item_group(under_name, "sediment") > 0 then
+
+ --move it to another part of water, so long as it is grounded
+ local pos_flow = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y - 1, z = pos.z + 1},
+ {"nodes_nature:freshwater_flowing", "nodes_nature:salt_water_flowing" })
+
+ if #pos_flow > 0 then
+ --select a random one
+ local pos2 = pos_flow[math.random(#pos_flow)]
+ --check under
+ local pos_uf = {x = pos2.x, y = pos2.y - 1, z = pos2.z}
+ local uf_name = minetest.get_node(pos_uf).name
+
+ local nodedefu = minetest.registered_nodes[uf_name]
+ if not nodedefu then
+ return
+ end
+
+ if nodedefu.walkable then
+
+ --shift the sediment and put the water in its place
+ minetest.remove_node(pos)
+ minetest.set_node(pos_under, {name = node.name})
+ --set dropped
+ local nodedef = minetest.registered_nodes[under_name]
+ if not nodedef then
+ return
+ end
+ minetest.set_node(pos2, {name = nodedef.drop})
+ end
+ end
+
+ elseif minetest.get_item_group(under_name, "water") > 0 or under_name == "air" then
+ --it is a water fall
+ --take sediment from beside and move under to fill gap
+ --move it to another part of water, so long as it is grounded
+ local pos_flow = 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},
+ {"group:sediment"})
+
+ if #pos_flow > 0 then
+ --select a random one
+ local pos2 = pos_flow[math.random(#pos_flow)]
+
+ --check under is solid
+ local pos_uf = {x = pos_under.x, y = pos_under.y - 1, z = pos_under.z}
+ local uf_name = minetest.get_node(pos_uf).name
+
+ local nodedefu = minetest.registered_nodes[uf_name]
+ if not nodedefu then
+ return
+ end
+
+ if nodedefu.walkable then
+ --take it and drop it underneath
+ --set dropped
+ local side_name = minetest.get_node(pos2).name
+ local nodedef = minetest.registered_nodes[side_name]
+ if not nodedef then
+ return
+ end
+ minetest.remove_node(pos2)
+ minetest.set_node(pos_under, {name = nodedef.drop})
+ end
+ end
+
+ end
+end
+
+
+--
+--
+minetest.register_abm({
+ label = "Water Erode",
+ nodenames = {"nodes_nature:freshwater_flowing", "nodes_nature:salt_water_flowing"},
+ neighbors = {"group:sediment"},
+ interval = 120,
+ chance = 30,
+ action = function(...)
+ water_erode(...)
+ end
+})
+
+
+------------------------------------------------------------------
+--soak water into soil, catch water in puddles
+local function rain_soak(pos, node)
+ if pos.y < -15 then
+ return
+ end
+ local name = node.name
+
+
+ if climate.get_rain(pos) then
+ --dry sediment absorbs water, wet and solids can trap puddles
+ if minetest.get_item_group(name, "sediment") >0
+ and minetest.get_item_group(name, "wet_sediment") == 0
+ then
+ --set wet version of what draining into
+ local nodedef = minetest.registered_nodes[name]
+ if not nodedef then
+ return
+ end
+ minetest.swap_node(pos, {name = nodedef._wet_name})
+ return
+ elseif math.random()<0.3 then
+ local posa = {x = pos.x, y = pos.y + 1, z = pos.z}
+ if puddle_detect(posa) then
+ minetest.set_node(posa, {name = "nodes_nature:freshwater_source"})
+ end
+ end
+
+ end
+end
+
+
+--
+minetest.register_abm({
+ label = "Rain Soak",
+ --calling for stone is for puddles only, but means calling all stone
+ --nodenames = {"group:sediment", "group:stone", "group:soft_stone"},
+ nodenames = {"group:sediment"},
+ interval = 92,
+ chance = 180,
+ min_y = -15,
+ action = function(...)
+ rain_soak(...)
+ end
+})
diff --git a/games/globo/mods/main/nodes.lua b/games/globo/mods/main/nodes.lua
new file mode 100644
index 000000000..83d98eac2
--- /dev/null
+++ b/games/globo/mods/main/nodes.lua
@@ -0,0 +1,380 @@
+-- Node Definitions
+function start_node_timer(pos)
+ local timer = minetest.get_node_timer(pos)
+ timer:start(60*1*GAME_SPEED)
+end
+
+
+minetest.register_node("main:corpse", {
+ description = "Corpse".."\n"..
+ "Punch: Eat (+5)",
+ drawtype = "plantlike",
+ tiles = {"corpse.png"},
+ inventory_image = "corpse.png",
+ wield_image = "corpse.png",
+ paramtype = "light",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {dig_immediate=3},
+ on_timer = function(pos, elapsed)
+ minetest.set_node(pos, {name = "main:bones"})
+ end,
+ on_construct = function(pos)
+ local timer = minetest.get_node_timer(pos)
+ timer:start(180) -- time in seconds until the corpse turns into bones
+ end,
+ -- Eating the Corpse will reduce hunger
+ on_use = function(itemstack, user, pointed_thing)
+ addNutrient(user,"hunger",200) -- hunger reduction value may be changed as needed.
+ itemstack:take_item()
+ return itemstack
+ end,
+})
+
+minetest.register_node("main:bones", {
+ description = "Bones",
+ drawtype = "plantlike",
+ tiles = {"bones.png"},
+ inventory_image = "bones.png",
+ wield_image = "bones.png",
+ paramtype = "light",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {dig_immediate=3},
+ on_punch = function(pos, node, player)
+ minetest.remove_node(pos)
+ player:get_inventory():add_item('main', 'main:tool_bones')
+ end,
+})
+
+minetest.register_node("main:glow_stone", {
+ description = "Glow Stone",
+ drawtype = "normal",
+ tiles = {"glow_stone.png"},
+ light_source = 7,
+ groups = {cracky = 3},
+})
+
+minetest.register_node("main:apple", {
+ description = "Apple".."\n"..
+ "Punch: Eat (+2)",
+ drawtype = "plantlike",
+ tiles ={"default_apple.png"},
+ inventory_image = "default_apple.png",
+ paramtype = "light",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {dig_immediate=3},
+
+ -- Make eatable because why not?
+ on_use = minetest.item_eat(2),
+})
+
+minetest.register_node("main:snowblock", {
+ description = "Snow Block",
+ tiles ={"default_snow.png"},
+ groups = {crumbly=3},
+})
+
+minetest.register_node("main:brambles", {
+ description = "Brambles",
+ drawtype = "plantlike",
+ tiles = {"brambles.png"},
+ inventory_image = "brambles.png",
+ wield_image = "brambles.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 3, flora=1},
+ damage_per_second = 1,
+})
+
+minetest.register_node("main:pulse_blossom", {
+ description = "Pulse Blossom",
+ drawtype = "plantlike",
+ tiles = {"pulse_blossom.png"},
+ inventory_image = "pulse_blossom.png",
+ wield_image = "pulse_blossom.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 1},
+ on_construct = function(pos)
+ local timer = minetest.get_node_timer(pos)
+ local t=(math.random(60,270)+math.random(60,270))/2
+ timer:start(t*GAME_SPEED)
+ end,
+ on_timer = function(pos, elapsed)
+ print("start pulse")
+ minetest.set_node(pos, {name = "main:pulse_blossom_on"})
+
+ return false
+ end,
+})
+
+minetest.register_node("main:pulse_blossom_on", {
+ description = "Pulse Blossom",
+ drawtype = "plantlike",
+ tiles = {"pulse_blossom.png"},
+ inventory_image = "pulse_blossom.png",
+ wield_image = "pulse_blossom.png",
+ paramtype = "light",
+ light_source= 10,
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 1},
+ on_construct = function(pos)
+ start_node_timer(pos)
+ end,
+ on_timer = function(pos, elapsed)
+ local node = minetest.get_node(pos)
+ local p1=node.param1+1
+ if p1 > 10 then
+ minetest.set_node(pos, {name = "main:pulse_blossom"})
+ return false
+ end
+
+ local ret = true
+ if p1 == 1 then
+ ret=false
+ local timer = minetest.get_node_timer(pos)
+ timer:start(10*GAME_SPEED)
+ end
+ -- cause damage to any creature around
+ local objects = minetest.get_objects_inside_radius(pos, 3)
+ for _, obj in ipairs(objects) do
+ if obj:is_player() then
+ local player = obj:get_player_name()
+ changePlayerHP(player, -1)
+ elseif obj:is_player() == false and obj:get_luaentity() ~= nil then
+ local mob = obj:get_luaentity()
+ mob:set_hp(mob:get_hp() - 1)
+ end
+ end
+
+ minetest.swap_node(pos, {name = "main:pulse_blossom_on", param1 = p1})
+ return ret
+ end,
+})
+
+
+minetest.register_node("main:thorns", {
+ description = "Thorns",
+ drawtype = "plantlike",
+ tiles = {"thorns_1.png"},
+ inventory_image = "thorns_0.png",
+ wield_image = "thorns_0.png",
+ paramtype = "light",
+ damage_per_second = 1,
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 1},
+ on_construct = function(pos)
+ start_node_timer(pos)
+ end,
+ on_timer = function(pos, elapsed)
+ if math.random(1, 1000) <= 60 then
+ minetest.set_node(pos, {name = "main:thorns_fruit"})
+ end
+ return true -- Continue the cycle
+ end,
+})
+
+minetest.register_node("main:thorns_fruit", {
+ description = "Thorns",
+ drawtype = "plantlike",
+ tiles = {"thorns_3.png" },
+ inventory_image = "thorns_0.png",
+ wield_image = "thorns_0.png",
+ paramtype = "light",
+ damage_per_second = 1,
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 1},
+ on_punch = function(pos, node, player, pointed_thing)
+ addNutrient(player,"hunger",100)
+ minetest.set_node(pos, {name = "main:thorns"})
+ end,
+})
+
+minetest.register_node("main:potatoes", {
+ description = "Potatoes",
+ drawtype = "plantlike",
+ tiles = {"potato_plant.png"},
+ inventory_image = "potato.png",
+ wield_image = "potato.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 3, flammable = 2, flora=1},
+ on_construct = function(pos)
+ start_node_timer(pos)
+ end,
+ on_timer = function(pos, elapsed)
+ local node = minetest.get_node(pos)
+ local p1=node.param1+1
+ local p2=node.param2
+
+ if p1 > 10 then
+ if p2 == 0 then -- Check if potato
+ p2=1 -- Set potato state
+ end
+ if p1 > 30 then
+ if potatoes_spred(pos) then
+ p1=10
+ end
+ end
+ end
+ minetest.swap_node(pos, {name = "main:potatoes", param1 = p1, param2=p2})
+ return true -- Continue the cycle
+ end,
+ on_use = function(itemstack, player, pointed_thing)
+ addNutrient(player,"hunger",100)
+ itemstack:take_item()
+ return itemstack
+ end,
+ on_punch = function(pos, node, player, pointed_thing)
+ if node.param2 == 1 then -- Check if potato
+ local inv=player:get_inventory()
+ if inv:room_for_item("main", "main:potatoes") then
+ --minetest.chat_send_player("singleplayer", "potato harvest taken")
+ inv:add_item("main", "main:potatoes")
+ minetest.swap_node(pos, {name = "main:potatoes", param1 = 0, param2 = 0}) -- Set potato state
+ end
+ end
+ end,
+})
+
+
+function potatoes_spred(pos)
+ -- Chance of spreading potatoes to adjacent positions
+ local positions = minetest.find_nodes_in_area(
+ {x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
+ {x = pos.x + 2, y = pos.y + 1, z = pos.z + 2},
+ {"air"}
+ )
+
+ local newPos=positions[math.random(#positions)]
+
+ local node_under = minetest.get_node({x = newPos.x, y = newPos.y - 1, z = newPos.z})
+ if node_under.name == "basenodes:dirt" or node_under.name == "basenodes:dirt_with_grass" then
+ if minetest.get_node(newPos).name == "air" then
+ print("spread potatoes")
+ minetest.set_node(newPos, {name = "main:potatoes"})
+ return true
+ end
+ end
+ return false
+end
+
+
+
+minetest.register_node("main:sumac", {
+ description = "Sumac",
+ drawtype = "plantlike",
+ tiles = {"sumac.png"},
+ inventory_image = "sumac.png",
+ wield_image = "sumac.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 3, flammable = 2, flora=1},
+ on_punch = function(pos, node, player, pointed_thing)
+ changePlayerHP(player,-2)
+ end,
+})
+
+minetest.register_node("main:sun_berry", {
+ description = "Sun Berry",
+ drawtype = "plantlike",
+ tiles = {"sun_berry.png"},
+ inventory_image = "sun_berry.png",
+ wield_image = "sun_berry.png",
+ paramtype = "light",
+ light_source=4,
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 3, flammable = 2, flora=1},
+})
+
+minetest.register_node("main:coffee", {
+ description = "Coffee",
+ drawtype = "plantlike",
+ tiles = {"coffee.png"},
+ inventory_image = "coffee.png",
+ wield_image = "coffee.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 3, flammable = 2, flora=1},
+ on_punch = function(pos, node, player, pointed_thing)
+ changePlayerEnergy(player,200)
+ end,
+})
+
+minetest.register_node("main:grib_weed", {
+ description = "Grib Weed",
+ drawtype = "plantlike",
+ tiles = {"grib_weed.png"},
+ inventory_image = "grib_weed.png",
+ wield_image = "grib_weed.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 3, flammable = 2, flora = 1},
+ on_timer = function(pos, elapsed)
+ grib_spread(pos)
+ return true -- Continue the cycle
+ end,
+ after_place_node = function(pos, placer, itemstack, pointed_thing)
+ --print("place grib")
+ start_node_timer(pos)
+ end,
+ on_construct = function(pos)
+ --minetest.log("action", "on_construct grib")
+ start_node_timer(pos)
+ end,
+})
+
+
+function grib_kill(pos)
+ -- Replaces grib weed with air, effectively "killing" it
+ minetest.set_node(pos, {name = "air"})
+end
+
+function grib_spread(pos)
+ -- Chance of spreading grib weed to adjacent positions
+ local positions = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
+ {"group:flora", "air"}
+ )
+ for _, p in ipairs(positions) do
+ if math.random(1, 1000) <= 20 then
+ local node_under = minetest.get_node({x = p.x, y = p.y - 1, z = p.z})
+ if node_under.name == "basenodes:dirt" or node_under.name == "basenodes:dirt_with_grass" then
+ if minetest.get_node(p).name == "air" or minetest.get_node(p).name:find("group:flora") then
+ --minetest.log("action", "spread_grib_weed")
+ minetest.set_node(p, {name = "main:grib_weed"})
+ end
+ end
+ end
+ end
+end
+
+
+minetest.register_node("main:corn", {
+ description = "Corn",
+ drawtype = "plantlike",
+ tiles = {"corn.png"},
+ inventory_image = "corn.png",
+ wield_image = "corn.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy = 3, flammable = 2, flora=1},
+ on_use = minetest.item_eat(3),
+})
diff --git a/games/globo/mods/main/player.lua b/games/globo/mods/main/player.lua
new file mode 100644
index 000000000..fda2479a6
--- /dev/null
+++ b/games/globo/mods/main/player.lua
@@ -0,0 +1,358 @@
+--[[
+Implements all changes to the players:
+ - needing certain nutrients.
+ - The hunger or thirst will increase till the player eats or drinks
+]]--
+
+player_definition = {
+ physical = true,
+ collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
+ visual = "mesh",
+ visual_size = {x=1, y=1},
+ mesh = "character.b3d",
+ textures = {"character.png"},
+ makes_footstep_sound = true,
+ view_range = 10,
+ walk_velocity = 2,
+ run_velocity = 5,
+}
+
+minetest.register_entity("main:player", player_definition)
+
+function changePlayerEnergy(player,amount)
+ local meta = player:get_meta()
+ local eCur = tonumber(meta:get_string("energy_cur"))
+ local eMax = tonumber(meta:get_string("energy_max"))
+ eCur = eCur + amount
+ if eCur < 0 then
+ eCur = 0
+ elseif eCur > eMax then
+ eCur = eMax
+ end
+ meta:set_string("energy_cur", eCur)
+end
+
+function changePlayerHP(player,amount)
+ local new_health = player:get_hp() + amount
+
+ if new_health < 0 then
+ new_health = 0
+ end
+
+ -- if new_health > player:get_properties().hp_max
+
+ player:set_hp(new_health)
+end
+
+function addNutrient(player,name,value)
+ local meta = player:get_meta()
+ local nut=tonumber( meta:get_string(name) )
+ print("Nut: " .. nut)
+ nut = nut + value
+ if nut < 0 then
+ nut = 0
+ elseif nut>1000 then
+ nut = 1000
+ end
+ meta:set_string(name, nut)
+end
+
+local function updateHUD(player)
+ -- Remove existing HUD elements if they exist
+ local meta = player:get_meta()
+ local hud_ids = meta:get("hud_ids")
+ if hud_ids then
+ hud_ids = minetest.deserialize(hud_ids)
+ if hud_ids.hunger_id then
+ player:hud_remove(hud_ids.hunger_id)
+ end
+
+ if hud_ids.thirst_id then
+ player:hud_remove(hud_ids.thirst_id)
+ end
+
+ if hud_ids.energy_id then
+ player:hud_remove(hud_ids.energy_id)
+ end
+
+ -- Sleeping overlay
+ if hud_ids.sleep_overlay_id then
+ player:hud_remove(hud_ids.sleep_overlay_id)
+ end
+ else
+ hud_ids = {}
+ end
+
+ local hunger_level = math.floor(tonumber(meta:get_string("hunger")))
+ local thirst_level = math.floor(tonumber(meta:get_string("thirst")))
+ local energy_cur = math.floor(tonumber(meta:get_string("energy_cur")))
+ local energy_max = math.floor(tonumber(meta:get_string("energy_max")))
+ local sleeping = meta:get_string("sleeping") ~= ""
+
+ -- Add new HUD elements
+ hud_ids.hunger_id = player:hud_add({
+ hud_elem_type = "text",
+ position = {x = 0.5, y = 0.8},
+ offset = {x = 0, y = 0},
+ text = "Hunger: " .. hunger_level,
+ alignment = {x = 0, y = 0},
+ scale = {x = 100, y = 100},
+ number = 0xFFFFFF,
+ })
+
+ hud_ids.thirst_id = player:hud_add({
+ hud_elem_type = "text",
+ position = {x = 0.5, y = 0.85},
+ offset = {x = 0, y = 0},
+ text = "Thirst: " .. thirst_level,
+ alignment = {x = 0, y = 0},
+ scale = {x = 100, y = 100},
+ number = 0xFFFFFF,
+ })
+
+ hud_ids.energy_id = player:hud_add({
+ hud_elem_type = "text",
+ text = "Energy: " .. energy_cur .. " / " .. energy_max,
+ number = 0xFFFFFF,
+ position = {x = 0.5, y = 0.9},
+ offset = {x = 0, y = 0},
+ alignment = {x = 0, y = 0},
+ scale = {x = 100, y = 100},
+ })
+
+ -- Add a dark overlay when the player is sleeping
+ if sleeping then
+ hud_ids.sleep_overlay_id = player:hud_add({
+ hud_elem_type = "image",
+ position = {x = 0, y = 0},
+ offset = {x = 0, y = 0},
+ text = "default_cloud.png^[colorize:#000000:220",
+ alignment = {x = 0, y = 0},
+ scale = {x = -100, y = -100},
+ })
+ end
+
+ -- Save HUD element IDs for later removal
+ player:get_meta():set_string("hud_ids", minetest.serialize(hud_ids))
+end
+
+
+
+
+minetest.register_globalstep(function(dtime)
+ for _, player in ipairs(minetest.get_connected_players()) do
+ if stepPlayerSleep(player,dtime) then
+ stepPlayerWalkRun(player)
+ stepPlayerEnergy(player,dtime)
+ end
+ stepPlayerHunger(player,dtime)
+ updateHUD(player)
+ end
+end)
+
+function stepPlayerHunger(player,dtime)
+ local health = player:get_hp()
+ if health > 0 then
+ local meta = player:get_meta()
+ local h=tonumber( meta:get_string("hunger") )
+ local t=tonumber(meta:get_string("thirst"))
+ local coe=1
+ if meta:get_string("sleeping") ~= "" then
+ coe=SLEEP_STARVE_COE
+ end
+ h = h-dtime*STARVE_1_MUL*coe
+ t= t-dtime*STARVE_2_MUL*coe
+ if h<200 then
+ wakeUp(player,"So Hungry")
+ if h<0 then
+ h=0
+ changePlayerHP(player,-dtime*PLAYER_STARVE_RATE)
+ end
+ end
+
+ if t<200 then
+ wakeUp(player,"So Thirsty")
+ if t<0 then
+ t=0
+ changePlayerHP(player,-dtime*PLAYER_DEHYDRATION_RATE)
+ end
+ end
+
+ meta:set_string("hunger",h)
+ meta:set_string("thirst",t)
+ end
+end
+
+function initializePlayerMeta(player)
+ local meta = player:get_meta()
+ if meta:get_string("energy_cur") == "" then
+ meta:set_string("energy_cur", 1000)
+ end
+ if meta:get_string("energy_max") == "" then
+ meta:set_string("energy_max", 1000)
+ end
+ if meta:get_string("hunger") == "" then
+ meta:set_string("hunger", 1000)
+ end
+ if meta:get_string("thirst") == "" then
+ meta:set_string("thirst", 1000)
+ end
+ if meta:get_string("temp") == "" then
+ meta:set_string("temp", START_TEMPERATURE)
+ end
+end
+
+
+minetest.register_on_joinplayer(function(player)
+ print("Player joining")
+
+ local inv = player:get_inventory()
+ inv:set_size("main", INVENTORY_SIZE)
+ --inv:add_item("main", "main:potatoes")
+
+ initializePlayerMeta(player)
+
+end)
+
+
+minetest.register_on_respawnplayer(function(player)
+ local meta = player:get_meta()
+ meta:set_string("energy_cur", 1000)
+ meta:set_string("energy_max", 1000)
+ meta:set_string("hunger", 1000)
+ meta:set_string("thirst", 1000)
+ meta:set_string("temp", START_TEMPERATURE)
+ meta:set_string("sleeping","")
+
+ return false
+end)
+
+
+function stepPlayerWalkRun(player)
+ local ctrl = player:get_player_control()
+ if ctrl.aux1 then -- aux1 is often mapped to the 'E' or 'Ctrl' key by default
+ player:set_physics_override({
+ speed = player_definition.run_velocity
+ })
+ else
+ player:set_physics_override({
+ speed = player_definition.walk_velocity
+ })
+ end
+end
+
+function wakeUp(player,msg)
+ local meta = player:get_meta()
+ if meta:get_string("sleeping") ~= "" then
+ print("Wake up: "..msg)
+ meta:set_string("sleeping","")
+ minetest.chat_send_player(player:get_player_name(), msg)
+ player:set_physics_override({speed = player_definition.walk_velocity})
+ end
+end
+
+-- Manage sleeping
+-- returns true if not sleeping
+function stepPlayerSleep(player,dtime)
+ local meta = player:get_meta()
+
+ if meta:get_string("sleeping") ~= "" then
+ player:set_physics_override({speed = 0}) -- Player cannot move while sleeping
+
+ local eMax = tonumber(meta:get_string("energy_max"))
+ local eCur = tonumber(meta:get_string("energy_cur"))
+
+ -- Increase energy and health while sleeping
+ eMax = math.min(eMax + (ENERGY_RECOVERY_RATE_SLEEP * dtime), 1000)
+ eCur = math.min(eCur + (ENERGY_RECOVERY_RATE_SLEEP * dtime), eMax)
+ meta:set_string("energy_cur", eCur)
+ meta:set_string("energy_max",eMax)
+ changePlayerHP(player,HEAL_RATE_SLEEP * dtime)
+
+ -- Wake up if fully rested
+ if eCur == 1000 then
+ wakeUp(player,"You wake up feeling rested.")
+ else
+ return false
+ end
+ else
+ local controls = player:get_player_control()
+ if controls.sneak then
+ print("player going to sleep")
+ meta:set_string("sleeping","1")
+ player:set_physics_override({speed = 0}) -- Player cannot move while sleeping
+ minetest.chat_send_player(player:get_player_name(), "You go to sleep.")
+ return false
+ end
+ end
+ return true
+end
+
+
+-- Function to handle when a player is hurt
+local function on_player_hpchange(player, hp_change)
+ local meta = player:get_meta()
+ if hp_change < 0 and meta:get_string("sleeping") ~= "" then
+ -- Player hurt while sleeping
+ wakeUp(player,"You were hurt and have woken up.")
+ end
+
+ return hp_change
+end
+
+-- Override Minetest's on_player_hpchange callback
+minetest.register_on_player_hpchange(on_player_hpchange)
+
+
+-- only called when awake
+function stepPlayerEnergy(player,dtime)
+ local player_meta = player:get_meta()
+ local eCur = tonumber(player_meta:get_string("energy_cur"))
+ local eMax = tonumber(player_meta:get_string("energy_max"))
+
+ local ctrl = player:get_player_control()
+ local energy_cost = 0
+
+ -- Calculate energy cost based on player's actions
+ if ctrl.up or ctrl.left or ctrl.right or ctrl.down then
+ energy_cost = ENERGY_WALK_COST * dtime
+ if ctrl.aux1 then -- Running
+ energy_cost = ENERGY_RUN_COST * dtime
+ end
+ end
+
+ if ctrl.jump then
+ energy_cost = ENERGY_JUMP_COST
+ end
+
+ -- Update current energy
+ eMax = eMax-TIRED_RATE*dtime
+ eCur = math.min(math.max(eCur - energy_cost, 0),eMax )
+
+ -- Check if the player can still walk or run
+ if eCur < 200 then
+ if eCur < 3 then
+ player:set_physics_override({speed = 0}) -- Player cannot move
+ else
+ player:set_physics_override({speed = player_definition.walk_velocity})
+ end
+ end
+
+ -- Recover energy when player is still
+ if energy_cost == 0 then
+ if eCur < eMax then
+ eCur = math.min(eCur + ENERGY_RECOVERY_RATE * dtime, eMax)
+ end
+ changePlayerHP(player,HEAL_RATE*dtime)
+ end
+
+ -- Set the energy values
+ player_meta:set_string("energy_cur", eCur)
+ player_meta:set_string("energy_max", eMax)
+
+end
+
+
+
+
+
diff --git a/games/globo/mods/main/textures/bones.png b/games/globo/mods/main/textures/bones.png
new file mode 100644
index 000000000..bc06c2865
Binary files /dev/null and b/games/globo/mods/main/textures/bones.png differ
diff --git a/games/globo/mods/main/textures/brambles.png b/games/globo/mods/main/textures/brambles.png
new file mode 100644
index 000000000..a8f5df226
Binary files /dev/null and b/games/globo/mods/main/textures/brambles.png differ
diff --git a/games/globo/mods/main/textures/coffee.png b/games/globo/mods/main/textures/coffee.png
new file mode 100644
index 000000000..ac6a2146b
Binary files /dev/null and b/games/globo/mods/main/textures/coffee.png differ
diff --git a/games/globo/mods/main/textures/corn.png b/games/globo/mods/main/textures/corn.png
new file mode 100644
index 000000000..bff840d3e
Binary files /dev/null and b/games/globo/mods/main/textures/corn.png differ
diff --git a/games/globo/mods/main/textures/corpse.png b/games/globo/mods/main/textures/corpse.png
new file mode 100644
index 000000000..e36cad4d8
Binary files /dev/null and b/games/globo/mods/main/textures/corpse.png differ
diff --git a/games/globo/mods/main/textures/default_apple.png b/games/globo/mods/main/textures/default_apple.png
new file mode 100644
index 000000000..9c115dae4
Binary files /dev/null and b/games/globo/mods/main/textures/default_apple.png differ
diff --git a/games/globo/mods/main/textures/default_cloud.png b/games/globo/mods/main/textures/default_cloud.png
new file mode 100644
index 000000000..faf0ec13d
Binary files /dev/null and b/games/globo/mods/main/textures/default_cloud.png differ
diff --git a/games/globo/mods/main/textures/default_snow.png b/games/globo/mods/main/textures/default_snow.png
new file mode 100644
index 000000000..c42e0eecb
Binary files /dev/null and b/games/globo/mods/main/textures/default_snow.png differ
diff --git a/games/globo/mods/main/textures/glow_stone.png b/games/globo/mods/main/textures/glow_stone.png
new file mode 100644
index 000000000..170d50be8
Binary files /dev/null and b/games/globo/mods/main/textures/glow_stone.png differ
diff --git a/games/globo/mods/main/textures/grib_weed.png b/games/globo/mods/main/textures/grib_weed.png
new file mode 100644
index 000000000..b95e532f7
Binary files /dev/null and b/games/globo/mods/main/textures/grib_weed.png differ
diff --git a/games/globo/mods/main/textures/potato.png b/games/globo/mods/main/textures/potato.png
new file mode 100644
index 000000000..70e3a7e03
Binary files /dev/null and b/games/globo/mods/main/textures/potato.png differ
diff --git a/games/globo/mods/main/textures/potato_plant.png b/games/globo/mods/main/textures/potato_plant.png
new file mode 100644
index 000000000..c3edf2896
Binary files /dev/null and b/games/globo/mods/main/textures/potato_plant.png differ
diff --git a/games/globo/mods/main/textures/pulse_blossom.png b/games/globo/mods/main/textures/pulse_blossom.png
new file mode 100644
index 000000000..6263dbe93
Binary files /dev/null and b/games/globo/mods/main/textures/pulse_blossom.png differ
diff --git a/games/globo/mods/main/textures/sumac.png b/games/globo/mods/main/textures/sumac.png
new file mode 100644
index 000000000..0f4759958
Binary files /dev/null and b/games/globo/mods/main/textures/sumac.png differ
diff --git a/games/globo/mods/main/textures/sun_berry.png b/games/globo/mods/main/textures/sun_berry.png
new file mode 100644
index 000000000..db5f8206e
Binary files /dev/null and b/games/globo/mods/main/textures/sun_berry.png differ
diff --git a/games/globo/mods/main/textures/thorns_0.png b/games/globo/mods/main/textures/thorns_0.png
new file mode 100644
index 000000000..2d9a7eed8
Binary files /dev/null and b/games/globo/mods/main/textures/thorns_0.png differ
diff --git a/games/globo/mods/main/textures/thorns_1.png b/games/globo/mods/main/textures/thorns_1.png
new file mode 100644
index 000000000..ecbd5f4cf
Binary files /dev/null and b/games/globo/mods/main/textures/thorns_1.png differ
diff --git a/games/globo/mods/main/textures/thorns_2.png b/games/globo/mods/main/textures/thorns_2.png
new file mode 100644
index 000000000..e452fe42b
Binary files /dev/null and b/games/globo/mods/main/textures/thorns_2.png differ
diff --git a/games/globo/mods/main/textures/thorns_3.png b/games/globo/mods/main/textures/thorns_3.png
new file mode 100644
index 000000000..0748e09c8
Binary files /dev/null and b/games/globo/mods/main/textures/thorns_3.png differ
diff --git a/games/globo/mods/mobkit/LICENSE b/games/globo/mods/mobkit/LICENSE
new file mode 100644
index 000000000..664fc8320
--- /dev/null
+++ b/games/globo/mods/mobkit/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 TheTermos
+
+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.
diff --git a/games/globo/mods/mobkit/README.md b/games/globo/mods/mobkit/README.md
new file mode 100644
index 000000000..26319f99f
--- /dev/null
+++ b/games/globo/mods/mobkit/README.md
@@ -0,0 +1,6 @@
+# mobkit
+Entity API for Minetest
+
+This library is meant to be shared between mods
+Please do not write to the mobkit namespace ('mobkit' global table),
+nor include own copies of mobkit in your mods and modpacks.
diff --git a/games/globo/mods/mobkit/behaviors2override.lua b/games/globo/mods/mobkit/behaviors2override.lua
new file mode 100644
index 000000000..1ddd0fbf3
--- /dev/null
+++ b/games/globo/mods/mobkit/behaviors2override.lua
@@ -0,0 +1,830 @@
+local abs = math.abs
+local pi = math.pi
+local floor = math.floor
+local ceil = math.ceil
+local random = math.random
+local sqrt = math.sqrt
+local max = math.max
+local min = math.min
+local tan = math.tan
+local pow = math.pow
+local dbg = minetest.chat_send_all
+
+local abr = tonumber(minetest.get_mapgen_setting('active_block_range')) or 3
+
+local neighbors ={
+ {x=1,z=0},
+ {x=1,z=1},
+ {x=0,z=1},
+ {x=-1,z=1},
+ {x=-1,z=0},
+ {x=-1,z=-1},
+ {x=0,z=-1},
+ {x=1,z=-1}
+ }
+
+function [yournamespace].dir2neighbor(dir)
+ dir.y=0
+ dir=vector.round(vector.normalize(dir))
+ for k,v in ipairs(neighbors) do
+ if v.x == dir.x and v.z == dir.z then return k end
+ end
+ return 1
+end
+
+function [yournamespace].neighbor_shift(neighbor,shift) -- int shift: minus is left, plus is right
+ return (8+neighbor+shift-1)%8+1
+end
+
+function [yournamespace].is_neighbor_node_reachable(self,neighbor) -- todo: take either number or pos
+ local offset = neighbors[neighbor]
+ local pos=mobkit.get_stand_pos(self)
+ local tpos = mobkit.get_node_pos(mobkit.pos_shift(pos,offset))
+ local recursteps = ceil(self.jump_height)+1
+ local height, liquidflag = mobkit.get_terrain_height(tpos,recursteps)
+
+ if height and abs(height-pos.y) <= self.jump_height then
+ tpos.y = height
+ height = height - pos.y
+
+ -- don't cut corners
+ if neighbor % 2 == 0 then -- diagonal neighbors are even
+ local n2 = neighbor-1 -- left neighbor never < 0
+ offset = neighbors[n2]
+ local t2 = mobkit.get_node_pos(mobkit.pos_shift(pos,offset))
+ local h2 = mobkit.get_terrain_height(t2,recursteps)
+ if h2 and h2 - pos.y > 0.02 then return end
+ n2 = (neighbor+1)%8 -- right neighbor
+ offset = neighbors[n2]
+ t2 = mobkit.get_node_pos(mobkit.pos_shift(pos,offset))
+ h2 = mobkit.get_terrain_height(t2,recursteps)
+ if h2 and h2 - pos.y > 0.02 then return end
+ end
+
+ -- check headroom
+ if tpos.y+self.height-pos.y > 1 then -- if head in next node above, else no point checking headroom
+ local snpos = mobkit.get_node_pos(pos)
+ local pos1 = {x=pos.x,y=snpos.y+1,z=pos.z} -- current pos plus node up
+ local pos2 = {x=tpos.x,y=tpos.y+self.height,z=tpos.z} -- target head pos
+
+ local nodes = mobkit.get_nodes_in_area(pos1,pos2,true)
+
+ for p,node in pairs(nodes) do
+ if snpos.x==p.x and snpos.z==p.z then
+ if node.name=='ignore' or node.walkable then return end
+ else
+ if node.name=='ignore' or
+ (node.walkable and mobkit.get_node_height(p)>tpos.y+0.001) then return end
+ end
+ end
+ end
+
+ return height, tpos, liquidflag
+ else
+ return
+ end
+end
+
+function [yournamespace].get_next_waypoint(self,tpos)
+ local pos = mobkit.get_stand_pos(self)
+ local dir=vector.direction(pos,tpos)
+ local neighbor = [yournamespace].dir2neighbor(dir)
+ local function update_pos_history(self,pos)
+ table.insert(self.pos_history,1,pos)
+ if #self.pos_history > 2 then table.remove(self.pos_history,#self.pos_history) end
+ end
+ local nogopos = self.pos_history[2]
+
+ local height, pos2, liquidflag = [yournamespace].is_neighbor_node_reachable(self,neighbor)
+ if height and not liquidflag
+ and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
+
+ local heightl = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,-1))
+ if heightl and abs(heightl-height)<0.001 then
+ local heightr = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,1))
+ if heightr and abs(heightr-height)<0.001 then
+ dir.y = 0
+ local dirn = vector.normalize(dir)
+ local npos = mobkit.get_node_pos(mobkit.pos_shift(pos,neighbors[neighbor]))
+ local factor = abs(dirn.x) > abs(dirn.z) and abs(npos.x-pos.x) or abs(npos.z-pos.z)
+ pos2=mobkit.pos_shift(pos,{x=dirn.x*factor,z=dirn.z*factor})
+ end
+ end
+ update_pos_history(self,pos2)
+ return height, pos2
+ else
+
+ for i=1,3 do
+ -- scan left
+ local height, pos2, liq = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,-i*self.path_dir))
+ if height and not liq
+ and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
+ update_pos_history(self,pos2)
+ return height,pos2
+ end
+ -- scan right
+ height, pos2, liq = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,i*self.path_dir))
+ if height and not liq
+ and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
+ update_pos_history(self,pos2)
+ return height,pos2
+ end
+ end
+ --scan rear
+ height, pos2, liquidflag = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,4))
+ if height and not liquidflag
+ and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
+ update_pos_history(self,pos2)
+ return height,pos2
+ end
+ end
+ -- stuck condition here
+ table.remove(self.pos_history,2)
+ self.path_dir = self.path_dir*-1 -- subtle change in pathfinding
+end
+
+function [yournamespace].get_next_waypoint_fast(self,tpos,nogopos)
+ local pos = mobkit.get_stand_pos(self)
+ local dir=vector.direction(pos,tpos)
+ local neighbor = [yournamespace].dir2neighbor(dir)
+ local height, pos2, liquidflag = [yournamespace].is_neighbor_node_reachable(self,neighbor)
+
+ if height and not liquidflag then
+ local fast = false
+ heightl = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,-1))
+ if heightl and abs(heightl-height)<0.001 then
+ heightr = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,1))
+ if heightr and abs(heightr-height)<0.001 then
+ fast = true
+ dir.y = 0
+ local dirn = vector.normalize(dir)
+ local npos = mobkit.get_node_pos(mobkit.pos_shift(pos,neighbors[neighbor]))
+ local factor = abs(dirn.x) > abs(dirn.z) and abs(npos.x-pos.x) or abs(npos.z-pos.z)
+ pos2=mobkit.pos_shift(pos,{x=dirn.x*factor,z=dirn.z*factor})
+ end
+ end
+ return height, pos2, fast
+ else
+
+ for i=1,4 do
+ -- scan left
+ height, pos2, liq = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,-i))
+ if height and not liq then return height,pos2 end
+ -- scan right
+ height, pos2, liq = [yournamespace].is_neighbor_node_reachable(self,[yournamespace].neighbor_shift(neighbor,i))
+ if height and not liq then return height,pos2 end
+ end
+ end
+end
+
+function [yournamespace].goto_next_waypoint(self,tpos)
+ local height, pos2 = [yournamespace].get_next_waypoint(self,tpos)
+
+ if not height then return false end
+
+ if height <= 0.01 then
+ local yaw = self.object:get_yaw()
+ local tyaw = minetest.dir_to_yaw(vector.direction(self.object:get_pos(),pos2))
+ if abs(tyaw-yaw) > 1 then
+ [yournamespace].lq_turn2pos(self,pos2)
+ end
+ [yournamespace].lq_dumbwalk(self,pos2)
+ else
+ [yournamespace].lq_turn2pos(self,pos2)
+ [yournamespace].lq_dumbjump(self,height)
+ end
+ return true
+end
+
+----------------------------
+-- BEHAVIORS
+----------------------------
+-- LOW LEVEL QUEUE FUNCTIONS
+----------------------------
+
+function [yournamespace].lq_turn2pos(self,tpos)
+ local func=function(self)
+ local pos = self.object:get_pos()
+ return mobkit.turn2yaw(self,
+ minetest.dir_to_yaw(vector.direction(pos,tpos)))
+ end
+ mobkit.queue_low(self,func)
+end
+
+function [yournamespace].lq_idle(self,duration,anim)
+ anim = anim or 'stand'
+ local init = true
+ local func=function(self)
+ if init then
+ mobkit.animate(self,anim)
+ init=false
+ end
+ duration = duration-self.dtime
+ if duration <= 0 then return true end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function [yournamespace].lq_dumbwalk(self,dest,speed_factor)
+ local timer = 3 -- failsafe
+ speed_factor = speed_factor or 1
+ local func=function(self)
+ mobkit.animate(self,'walk')
+ timer = timer - self.dtime
+ if timer < 0 then return true end
+
+ local pos = mobkit.get_stand_pos(self)
+ local y = self.object:get_velocity().y
+
+ if mobkit.is_there_yet2d(pos,minetest.yaw_to_dir(self.object:get_yaw()),dest) then
+-- if mobkit.isnear2d(pos,dest,0.25) then
+ if not self.isonground or abs(dest.y-pos.y) > 0.1 then -- prevent uncontrolled fall when velocity too high
+-- if abs(dest.y-pos.y) > 0.1 then -- isonground too slow for speeds > 4
+ self.object:set_velocity({x=0,y=y,z=0})
+ end
+ return true
+ end
+
+ if self.isonground then
+ local dir = vector.normalize(vector.direction({x=pos.x,y=0,z=pos.z},
+ {x=dest.x,y=0,z=dest.z}))
+ dir = vector.multiply(dir,self.max_speed*speed_factor)
+-- self.object:set_yaw(minetest.dir_to_yaw(dir))
+ mobkit.turn2yaw(self,minetest.dir_to_yaw(dir))
+ dir.y = y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+-- initial velocity for jump height h, v= a*sqrt(h*2/a) ,add 20%
+function [yournamespace].lq_dumbjump(self,height,anim)
+ anim = anim or 'stand'
+ local jump = true
+ local func=function(self)
+ local yaw = self.object:get_yaw()
+ if self.isonground then
+ if jump then
+ mobkit.animate(self,anim)
+ local dir = minetest.yaw_to_dir(yaw)
+ dir.y = -mobkit.gravity*sqrt((height+0.35)*2/-mobkit.gravity)
+ self.object:set_velocity(dir)
+ jump = false
+ else -- the eagle has landed
+ return true
+ end
+ else
+ local dir = minetest.yaw_to_dir(yaw)
+ local vel = self.object:get_velocity()
+ if self.lastvelocity.y < 0.9 then
+ dir = vector.multiply(dir,3)
+ end
+ dir.y = vel.y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function [yournamespace].lq_jumpout(self)
+ local phase = 1
+ local func=function(self)
+ local vel=self.object:get_velocity()
+ if phase == 1 then
+ vel.y=vel.y+5
+ self.object:set_velocity(vel)
+ phase = 2
+ else
+ if vel.y < 0 then return true end
+ local dir = minetest.yaw_to_dir(self.object:get_yaw())
+ dir.y=vel.y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function [yournamespace].lq_freejump(self)
+ local phase = 1
+ local func=function(self)
+ local vel=self.object:get_velocity()
+ if phase == 1 then
+ vel.y=vel.y+6
+ self.object:set_velocity(vel)
+ phase = 2
+ else
+ if vel.y <= 0.01 then return true end
+ local dir = minetest.yaw_to_dir(self.object:get_yaw())
+ dir.y=vel.y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function [yournamespace].lq_jumpattack(self,height,target)
+ local init=true
+ local timer=0.5
+ local tgtbox = target:get_properties().collisionbox
+ local func=function(self)
+ if not mobkit.is_alive(target) then return true end
+ if self.isonground then
+ if init then -- collision bug workaround
+ local vel = self.object:get_velocity()
+ local dir = minetest.yaw_to_dir(self.object:get_yaw())
+ dir=vector.multiply(dir,6)
+ dir.y = -mobkit.gravity*sqrt(height*2/-mobkit.gravity)
+ self.object:set_velocity(dir)
+ mobkit.make_sound(self,'charge')
+ init=false
+ else
+ [yournamespace].lq_idle(self,0.3)
+ return true
+ end
+ else
+ local tgtpos = target:get_pos()
+ local pos = self.object:get_pos()
+ -- calculate attack spot
+ local yaw = self.object:get_yaw()
+ local dir = minetest.yaw_to_dir(yaw)
+ local apos = mobkit.pos_translate2d(pos,yaw,self.attack.range)
+
+ if mobkit.is_pos_in_box(apos,tgtpos,tgtbox) then --bite
+ target:punch(self.object,1,self.attack)
+ -- bounce off
+ local vy = self.object:get_velocity().y
+ self.object:set_velocity({x=dir.x*-3,y=vy,z=dir.z*-3})
+ -- play attack sound if defined
+ mobkit.make_sound(self,'attack')
+ return true
+ end
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function [yournamespace].lq_fallover(self)
+ local zrot = 0
+ local init = true
+ local func=function(self)
+ if init then
+ local vel = self.object:get_velocity()
+ self.object:set_velocity(mobkit.pos_shift(vel,{y=1}))
+ mobkit.animate(self,'stand')
+ init = false
+ end
+ zrot=zrot+pi*0.05
+ local rot = self.object:get_rotation()
+ self.object:set_rotation({x=rot.x,y=rot.y,z=zrot})
+ if zrot >= pi*0.5 then return true end
+ end
+ mobkit.queue_low(self,func)
+end
+-----------------------------
+-- HIGH LEVEL QUEUE FUNCTIONS
+-----------------------------
+
+function [yournamespace].dumbstep(self,height,tpos,speed_factor,idle_duration)
+ if height <= 0.001 then
+ [yournamespace].lq_turn2pos(self,tpos)
+ [yournamespace].lq_dumbwalk(self,tpos,speed_factor)
+ else
+ [yournamespace].lq_turn2pos(self,tpos)
+ [yournamespace].lq_dumbjump(self,height)
+ end
+ idle_duration = idle_duration or 6
+ [yournamespace].lq_idle(self,random(ceil(idle_duration*0.5),idle_duration))
+end
+
+function [yournamespace].hq_roam(self,prty)
+ local func=function(self)
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local neighbor = random(8)
+
+ local height, tpos, liquidflag = [yournamespace].is_neighbor_node_reachable(self,neighbor)
+ if height and not liquidflag then [yournamespace].dumbstep(self,height,tpos,0.3) end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_follow0(self,tgtobj) -- probably delete this one
+ local func = function(self)
+ if not tgtobj then return true end
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ if vector.distance(pos,opos) > 3 then
+ local neighbor = [yournamespace].dir2neighbor(vector.direction(pos,opos))
+if not neighbor then return true end --temp debug
+ local height, tpos = [yournamespace].is_neighbor_node_reachable(self,neighbor)
+ if height then [yournamespace].dumbstep(self,height,tpos)
+ else
+ for i=1,4 do --scan left
+ height, tpos = [yournamespace].is_neighbor_node_reachable(self,(8+neighbor-i-1)%8+1)
+ if height then [yournamespace].dumbstep(self,height,tpos)
+ break
+ end --scan right
+ height, tpos = [yournamespace].is_neighbor_node_reachable(self,(neighbor+i-1)%8+1)
+ if height then [yournamespace].dumbstep(self,height,tpos)
+ break
+ end
+ end
+ end
+ else
+ [yournamespace].lq_idle(self,1)
+ end
+ end
+ end
+ mobkit.queue_high(self,func,0)
+end
+
+function [yournamespace].hq_follow(self,prty,tgtobj)
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ if vector.distance(pos,opos) > 3 then
+ [yournamespace].goto_next_waypoint(self,opos)
+ else
+ [yournamespace].lq_idle(self,1)
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_goto(self,prty,tpos)
+ local func = function(self)
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ if vector.distance(pos,tpos) > 3 then
+ [yournamespace].goto_next_waypoint(self,tpos)
+ else
+ return true
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_runfrom(self,prty,tgtobj)
+ local init=true
+ local timer=6
+ local func = function(self)
+
+ if not mobkit.is_alive(tgtobj) then return true end
+ if init then
+ timer = timer-self.dtime
+ if timer <=0 or vector.distance(self.object:get_pos(),tgtobj:get_pos()) < 8 then
+ mobkit.make_sound(self,'scared')
+ init=false
+ end
+ return
+ end
+
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ if vector.distance(pos,opos) < self.view_range*1.1 then
+ local tpos = {x=2*pos.x - opos.x,
+ y=opos.y,
+ z=2*pos.z - opos.z}
+ [yournamespace].goto_next_waypoint(self,tpos)
+ else
+ self.object:set_velocity({x=0,y=0,z=0})
+ return true
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_hunt(self,prty,tgtobj)
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ local dist = vector.distance(pos,opos)
+ if dist > self.view_range then
+ return true
+ elseif dist > 3 then
+ [yournamespace].goto_next_waypoint(self,opos)
+ else
+ [yournamespace].hq_attack(self,prty+1,tgtobj)
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_warn(self,prty,tgtobj)
+ local timer=0
+ local tgttime = 0
+ local init = true
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if init then
+ mobkit.animate(self,'stand')
+ init = false
+ end
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ local dist = vector.distance(pos,opos)
+
+ if dist > 11 then
+ return true
+ elseif dist < 4 or timer > 12 then -- too close man
+-- mobkit.clear_queue_high(self)
+ mobkit.remember(self,'hate',tgtobj:get_player_name())
+ [yournamespace].hq_hunt(self,prty+1,tgtobj) -- priority
+ else
+ timer = timer+self.dtime
+ if mobkit.is_queue_empty_low(self) then
+ [yournamespace].lq_turn2pos(self,opos)
+ end
+ -- make noise in random intervals
+ if timer > tgttime then
+ mobkit.make_sound(self,'warn')
+ -- if self.sounds and self.sounds.warn then
+ -- minetest.sound_play(self.sounds.warn, {object=self.object})
+ -- end
+ tgttime = timer + 1.1 + random()*1.5
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_die(self)
+ local timer = 5
+ local start = true
+ local func = function(self)
+ if start then
+ [yournamespace].lq_fallover(self)
+ self.logic = function(self) end -- brain dead as well
+ start=false
+ end
+ timer = timer-self.dtime
+ if timer < 0 then self.object:remove() end
+ end
+ mobkit.queue_high(self,func,100)
+end
+
+function [yournamespace].hq_attack(self,prty,tgtobj)
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if mobkit.is_queue_empty_low(self) then
+ local pos = mobkit.get_stand_pos(self)
+-- local tpos = tgtobj:get_pos()
+ local tpos = mobkit.get_stand_pos(tgtobj)
+ local dist = vector.distance(pos,tpos)
+ if dist > 3 then
+ return true
+ else
+ [yournamespace].lq_turn2pos(self,tpos)
+ local height = tgtobj:is_player() and 0.35 or tgtobj:get_luaentity().height*0.6
+ if tpos.y+height>pos.y then
+ [yournamespace].lq_jumpattack(self,tpos.y+height-pos.y,tgtobj)
+ else
+ [yournamespace].lq_dumbwalk(self,mobkit.pos_shift(tpos,{x=random()-0.5,z=random()-0.5}))
+ end
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_liquid_recovery(self,prty) -- scan for nearest land
+ local radius = 1
+ local yaw = 0
+ local func = function(self)
+ if not self.isinliquid then return true end
+ local pos=self.object:get_pos()
+ local vec = minetest.yaw_to_dir(yaw)
+ local pos2 = mobkit.pos_shift(pos,vector.multiply(vec,radius))
+ local height, liquidflag = mobkit.get_terrain_height(pos2)
+ if height and not liquidflag then
+ [yournamespace].hq_swimto(self,prty,pos2)
+ return true
+ end
+ yaw=yaw+pi*0.25
+ if yaw>2*pi then
+ yaw = 0
+ radius=radius+1
+ if radius > self.view_range then
+ self.hp = 0
+ return true
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_swimto(self,prty,tpos)
+ local box = self.object:get_properties().collisionbox
+ local cols = {}
+ local func = function(self)
+ if not self.isinliquid then
+ if self.isonground then return true end
+ return false
+ end
+
+ local pos = mobkit.get_stand_pos(self)
+ local y=self.object:get_velocity().y
+ local pos2d = {x=pos.x,y=tpos.y,z=pos.z}
+ local dir=vector.normalize(vector.direction(pos2d,tpos))
+ local yaw = minetest.dir_to_yaw(dir)
+
+ if mobkit.timer(self,1) then
+ cols = mobkit.get_box_displace_cols(pos,box,dir,1)
+ for _,p in ipairs(cols[1]) do
+ p.y=pos.y
+ local h,l = mobkit.get_terrain_height(p)
+ if h and h>pos.y and self.isinliquid then
+ [yournamespace].lq_freejump(self)
+ break
+ end
+ end
+ elseif mobkit.turn2yaw(self,yaw) then
+ dir.y = y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+---------------------
+-- AQUATIC
+---------------------
+
+-- MACROS
+local function aqua_radar_dumb(pos,yaw,range,reverse)
+ range = range or 4
+
+ local function okpos(p)
+ local node = mobkit.nodeatpos(p)
+ if node then
+ if node.drawtype == 'liquid' then
+ local nodeu = mobkit.nodeatpos(mobkit.pos_shift(p,{y=1}))
+ local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-1}))
+ if (nodeu and nodeu.drawtype == 'liquid') or (noded and noded.drawtype == 'liquid') then
+ return true
+ else
+ return false
+ end
+ else
+ local h,l = mobkit.get_terrain_height(p)
+ if h then
+ local node2 = mobkit.nodeatpos({x=p.x,y=h+1.99,z=p.z})
+ if node2 and node2.drawtype == 'liquid' then return true, h end
+ else
+ return false
+ end
+ end
+ else
+ return false
+ end
+ end
+
+ local fpos = mobkit.pos_translate2d(pos,yaw,range)
+ local ok,h = okpos(fpos)
+ if not ok then
+ local ffrom, fto, fstep
+ if reverse then
+ ffrom, fto, fstep = 3,1,-1
+ else
+ ffrom, fto, fstep = 1,3,1
+ end
+ for i=ffrom, fto, fstep do
+ local ok,h = okpos(mobkit.pos_translate2d(pos,yaw+i,range))
+ if ok then return yaw+i,h end
+ ok,h = okpos(mobkit.pos_translate2d(pos,yaw-i,range))
+ if ok then return yaw-i,h end
+ end
+ return yaw+pi,h
+ else
+ return yaw, h
+ end
+end
+
+function [yournamespace].is_in_deep(target)
+ if not target then return false end
+ local nodepos = mobkit.get_stand_pos(target)
+ local node1 = mobkit.nodeatpos(nodepos)
+ nodepos.y=nodepos.y+1
+ local node2 = mobkit.nodeatpos(nodepos)
+ nodepos.y=nodepos.y-2
+ local node3 = mobkit.nodeatpos(nodepos)
+ if node1 and node2 and node3 and node1.drawtype=='liquid' and (node2.drawtype=='liquid' or node3.drawtype=='liquid') then
+ return true
+ end
+end
+
+-- HQ behaviors
+
+function [yournamespace].hq_aqua_roam(self,prty,speed)
+ local tyaw = 0
+ local init = true
+ local prvscanpos = {x=0,y=0,z=0}
+ local center = self.object:get_pos()
+ local func = function(self)
+ if init then
+ mobkit.animate(self,'def')
+ init = false
+ end
+ local pos = mobkit.get_stand_pos(self)
+ local yaw = self.object:get_yaw()
+ local scanpos = mobkit.get_node_pos(mobkit.pos_translate2d(pos,yaw,speed))
+ if not vector.equals(prvscanpos,scanpos) then
+ prvscanpos=scanpos
+ local nyaw,height = aqua_radar_dumb(pos,yaw,speed,true)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+1
+ self.object:set_velocity(vel)
+ end
+ if yaw ~= nyaw then
+ tyaw=nyaw
+ [yournamespace].hq_aqua_turn(self,prty+1,tyaw,speed)
+ return
+ end
+ end
+ if mobkit.timer(self,1) then
+ if vector.distance(pos,center) > abr*16*0.5 then
+ tyaw = minetest.dir_to_yaw(vector.direction(pos,{x=center.x+random()*10-5,y=center.y,z=center.z+random()*10-5}))
+ else
+ if random(10)>=9 then tyaw=tyaw+random()*pi - pi*0.5 end
+ end
+ end
+
+ mobkit.turn2yaw(self,tyaw,3)
+-- local yaw = self.object:get_yaw()
+ mobkit.go_forward_horizontal(self,speed)
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_aqua_turn(self,prty,tyaw,speed)
+ local func = function(self)
+ local finished=mobkit.turn2yaw(self,tyaw)
+-- local yaw = self.object:get_yaw()
+ mobkit.go_forward_horizontal(self,speed)
+ if finished then return true end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function [yournamespace].hq_aqua_attack(self,prty,tgtobj,speed)
+ local tyaw = 0
+ local prvscanpos = {x=0,y=0,z=0}
+ local init = true
+ local tgtbox = tgtobj:get_properties().collisionbox
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if init then
+ mobkit.animate(self,'fast')
+ mobkit.make_sound(self,'attack')
+ init = false
+ end
+ local pos = mobkit.get_stand_pos(self)
+ local yaw = self.object:get_yaw()
+ local scanpos = mobkit.get_node_pos(mobkit.pos_translate2d(pos,yaw,speed))
+ if not vector.equals(prvscanpos,scanpos) then
+ prvscanpos=scanpos
+ local nyaw,height = aqua_radar_dumb(pos,yaw,speed*0.5)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+1
+ self.object:set_velocity(vel)
+ end
+ if yaw ~= nyaw then
+ tyaw=nyaw
+ [yournamespace].hq_aqua_turn(self,prty+1,tyaw,speed)
+ return
+ end
+ end
+
+ local tpos = tgtobj:get_pos()
+ local tyaw=minetest.dir_to_yaw(vector.direction(pos,tpos))
+ mobkit.turn2yaw(self,tyaw,3)
+ local yaw = self.object:get_yaw()
+ if mobkit.timer(self,1) then
+ if not [yournamespace].is_in_deep(tgtobj) then return true end
+ local vel = self.object:get_velocity()
+ if tpos.y>pos.y+0.5 then self.object:set_velocity({x=vel.x,y=vel.y+0.5,z=vel.z})
+ elseif tpos.y 0.02 then return end
+ n2 = (neighbor+1)%8 -- right neighbor
+ offset = neighbors[n2]
+ t2 = mobkit.get_node_pos(mobkit.pos_shift(pos,offset))
+ h2 = mobkit.get_terrain_height(t2,recursteps)
+ if h2 and h2 - pos.y > 0.02 then return end
+ end
+
+ -- check headroom
+ if tpos.y+self.height-pos.y > 1 then -- if head in next node above, else no point checking headroom
+ local snpos = mobkit.get_node_pos(pos)
+ local pos1 = {x=pos.x,y=snpos.y+1,z=pos.z} -- current pos plus node up
+ local pos2 = {x=tpos.x,y=tpos.y+self.height,z=tpos.z} -- target head pos
+
+ local nodes = mobkit.get_nodes_in_area(pos1,pos2,true)
+
+ for p,node in pairs(nodes) do
+ if snpos.x==p.x and snpos.z==p.z then
+ if node.name=='ignore' or node.walkable then return end
+ else
+ if node.name=='ignore' or
+ (node.walkable and mobkit.get_node_height(p)>tpos.y+0.001) then return end
+ end
+ end
+ end
+
+ return height, tpos, liquidflag
+ else
+ return
+ end
+end
+
+function mobkit.get_next_waypoint(self,tpos)
+ local pos = mobkit.get_stand_pos(self)
+ local dir=vector.direction(pos,tpos)
+ local neighbor = mobkit.dir2neighbor(dir)
+ local function update_pos_history(self,pos)
+ table.insert(self.pos_history,1,pos)
+ if #self.pos_history > 2 then table.remove(self.pos_history,#self.pos_history) end
+ end
+ local nogopos = self.pos_history[2]
+
+ local height, pos2, liquidflag = mobkit.is_neighbor_node_reachable(self,neighbor)
+ if height and not liquidflag
+ and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
+
+ local heightl, _, _ = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,-1))
+ if heightl and abs(heightl-height)<0.001 then
+ local heightr, _, _ = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,1))
+ if heightr and abs(heightr-height)<0.001 then
+ dir.y = 0
+ local dirn = vector.normalize(dir)
+ local npos = mobkit.get_node_pos(mobkit.pos_shift(pos,neighbors[neighbor]))
+ local factor = abs(dirn.x) > abs(dirn.z) and abs(npos.x-pos.x) or abs(npos.z-pos.z)
+ pos2=mobkit.pos_shift(pos,{x=dirn.x*factor,z=dirn.z*factor})
+ end
+ end
+ update_pos_history(self,pos2)
+ return height, pos2
+ else
+
+ for i=1,3 do
+ -- scan left
+ local height, pos2, liq = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,-i*self.path_dir))
+ if height and not liq
+ and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
+ update_pos_history(self,pos2)
+ return height,pos2
+ end
+ -- scan right
+ height, pos2, liq = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,i*self.path_dir))
+ if height and not liq
+ and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
+ update_pos_history(self,pos2)
+ return height,pos2
+ end
+ end
+ --scan rear
+ height, pos2, liquidflag = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,4))
+ if height and not liquidflag
+ and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
+ update_pos_history(self,pos2)
+ return height,pos2
+ end
+ end
+ -- stuck condition here
+ table.remove(self.pos_history,2)
+ self.path_dir = self.path_dir*-1 -- subtle change in pathfinding
+end
+
+function mobkit.get_next_waypoint_fast(self,tpos,nogopos)
+ local pos = mobkit.get_stand_pos(self)
+ local dir=vector.direction(pos,tpos)
+ local neighbor = mobkit.dir2neighbor(dir)
+ local height, pos2, liquidflag = mobkit.is_neighbor_node_reachable(self,neighbor)
+
+ if height and not liquidflag then
+ local fast = false
+ heightl, _, _ = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,-1))
+ if heightl and abs(heightl-height)<0.001 then
+ heightr, _, _ = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,1))
+ if heightr and abs(heightr-height)<0.001 then
+ fast = true
+ dir.y = 0
+ local dirn = vector.normalize(dir)
+ local npos = mobkit.get_node_pos(mobkit.pos_shift(pos,neighbors[neighbor]))
+ local factor = abs(dirn.x) > abs(dirn.z) and abs(npos.x-pos.x) or abs(npos.z-pos.z)
+ pos2=mobkit.pos_shift(pos,{x=dirn.x*factor,z=dirn.z*factor})
+ end
+ end
+ return height, pos2, fast
+ else
+
+ for i=1,4 do
+ -- scan left
+ height, pos2, liq = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,-i))
+ if height and not liq then return height,pos2 end
+ -- scan right
+ height, pos2, liq = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,i))
+ if height and not liq then return height,pos2 end
+ end
+ end
+end
+
+function mobkit.goto_next_waypoint(self,tpos)
+ local height, pos2 = mobkit.get_next_waypoint(self,tpos)
+
+ if not height or type(height) == "boolean" then return false end
+
+ if height <= 0.01 then
+ local yaw = self.object:get_yaw()
+ local tyaw = minetest.dir_to_yaw(vector.direction(self.object:get_pos(),pos2))
+ if abs(tyaw-yaw) > 1 then
+ mobkit.lq_turn2pos(self,pos2)
+ end
+ mobkit.lq_dumbwalk(self,pos2)
+ else
+ mobkit.lq_turn2pos(self,pos2)
+ mobkit.lq_dumbjump(self,height)
+ end
+ return true
+end
+
+----------------------------
+-- BEHAVIORS
+----------------------------
+-- LOW LEVEL QUEUE FUNCTIONS
+----------------------------
+
+function mobkit.lq_turn2pos(self,tpos)
+ local func=function(self)
+ local pos = self.object:get_pos()
+ return mobkit.turn2yaw(self,
+ minetest.dir_to_yaw(vector.direction(pos,tpos)))
+ end
+ mobkit.queue_low(self,func)
+end
+
+function mobkit.lq_idle(self,duration,anim)
+ anim = anim or 'stand'
+ local init = true
+ local func=function(self)
+ if init then
+ mobkit.animate(self,anim)
+ init=false
+ end
+ duration = duration-self.dtime
+ if duration <= 0 then return true end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function mobkit.lq_dumbwalk(self,dest,speed_factor)
+ local timer = 3 -- failsafe
+ speed_factor = speed_factor or 1
+ local func=function(self)
+ mobkit.animate(self,'walk')
+ timer = timer - self.dtime
+ if timer < 0 then return true end
+
+ local pos = mobkit.get_stand_pos(self)
+ local y = self.object:get_velocity().y
+
+ if mobkit.is_there_yet2d(pos,minetest.yaw_to_dir(self.object:get_yaw()),dest) then
+-- if mobkit.isnear2d(pos,dest,0.25) then
+ if not self.isonground or abs(dest.y-pos.y) > 0.1 then -- prevent uncontrolled fall when velocity too high
+-- if abs(dest.y-pos.y) > 0.1 then -- isonground too slow for speeds > 4
+ self.object:set_velocity({x=0,y=y,z=0})
+ end
+ return true
+ end
+
+ if self.isonground then
+ local dir = vector.normalize(vector.direction({x=pos.x,y=0,z=pos.z},
+ {x=dest.x,y=0,z=dest.z}))
+ dir = vector.multiply(dir,self.max_speed*speed_factor)
+-- self.object:set_yaw(minetest.dir_to_yaw(dir))
+ mobkit.turn2yaw(self,minetest.dir_to_yaw(dir))
+ dir.y = y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+-- initial velocity for jump height h, v= a*sqrt(h*2/a) ,add 20%
+function mobkit.lq_dumbjump(self,height,anim)
+ anim = anim or 'stand'
+ local jump = true
+ local func=function(self)
+ local yaw = self.object:get_yaw()
+ if self.isonground then
+ if jump then
+ mobkit.animate(self,anim)
+ local dir = minetest.yaw_to_dir(yaw)
+ dir.y = -mobkit.gravity*sqrt((height+0.35)*2/-mobkit.gravity)
+ self.object:set_velocity(dir)
+ jump = false
+ else -- the eagle has landed
+ return true
+ end
+ else
+ local dir = minetest.yaw_to_dir(yaw)
+ local vel = self.object:get_velocity()
+ if self.lastvelocity.y < 0.9 then
+ dir = vector.multiply(dir,3)
+ end
+ dir.y = vel.y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function mobkit.lq_jumpout(self)
+ local phase = 1
+ local func=function(self)
+ local vel=self.object:get_velocity()
+ if phase == 1 then
+ vel.y=vel.y+5
+ self.object:set_velocity(vel)
+ phase = 2
+ else
+ if vel.y < 0 then return true end
+ local dir = minetest.yaw_to_dir(self.object:get_yaw())
+ dir.y=vel.y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function mobkit.lq_freejump(self)
+ local phase = 1
+ local func=function(self)
+ local vel=self.object:get_velocity()
+ if phase == 1 then
+ vel.y=vel.y+6
+ self.object:set_velocity(vel)
+ phase = 2
+ else
+ if vel.y <= 0.01 then return true end
+ local dir = minetest.yaw_to_dir(self.object:get_yaw())
+ dir.y=vel.y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function mobkit.lq_jumpattack(self,height,target)
+ local init=true
+ local timer=0.5
+ local tgtbox = target:get_properties().collisionbox
+ local func=function(self)
+ if not mobkit.is_alive(target) then return true end
+ if self.isonground then
+ if init then -- collision bug workaround
+ local vel = self.object:get_velocity()
+ local dir = minetest.yaw_to_dir(self.object:get_yaw())
+ dir=vector.multiply(dir,6)
+ dir.y = -mobkit.gravity*sqrt(height*2/-mobkit.gravity)
+ self.object:set_velocity(dir)
+ mobkit.make_sound(self,'charge')
+ init=false
+ else
+ mobkit.lq_idle(self,0.3)
+ return true
+ end
+ else
+ local tgtpos = target:get_pos()
+ local pos = self.object:get_pos()
+ -- calculate attack spot
+ local yaw = self.object:get_yaw()
+ local dir = minetest.yaw_to_dir(yaw)
+ local apos = mobkit.pos_translate2d(pos,yaw,self.attack.range)
+
+ if mobkit.is_pos_in_box(apos,tgtpos,tgtbox) then --bite
+ target:punch(self.object,1,self.attack)
+ -- bounce off
+ local vy = self.object:get_velocity().y
+ self.object:set_velocity({x=dir.x*-3,y=vy,z=dir.z*-3})
+ -- play attack sound if defined
+ mobkit.make_sound(self,'attack')
+ return true
+ end
+ end
+ end
+ mobkit.queue_low(self,func)
+end
+
+function mobkit.lq_fallover(self)
+ local zrot = 0
+ local init = true
+ local func=function(self)
+ if init then
+ local vel = self.object:get_velocity()
+ self.object:set_velocity(mobkit.pos_shift(vel,{y=1}))
+ mobkit.animate(self,'stand')
+ init = false
+ end
+ zrot=zrot+pi*0.05
+ local rot = self.object:get_rotation()
+ self.object:set_rotation({x=rot.x,y=rot.y,z=zrot})
+ if zrot >= pi*0.5 then return true end
+ end
+ mobkit.queue_low(self,func)
+end
+-----------------------------
+-- HIGH LEVEL QUEUE FUNCTIONS
+-----------------------------
+
+function mobkit.dumbstep(self,height,tpos,speed_factor,idle_duration)
+ if height <= 0.001 then
+ mobkit.lq_turn2pos(self,tpos)
+ mobkit.lq_dumbwalk(self,tpos,speed_factor)
+ else
+ mobkit.lq_turn2pos(self,tpos)
+ mobkit.lq_dumbjump(self,height)
+ end
+ idle_duration = idle_duration or 6
+ mobkit.lq_idle(self,random(ceil(idle_duration*0.5),idle_duration))
+end
+
+function mobkit.hq_roam(self,prty)
+ local func=function(self)
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local neighbor = random(8)
+
+ local height, tpos, liquidflag = mobkit.is_neighbor_node_reachable(self,neighbor)
+ if height and not liquidflag then mobkit.dumbstep(self,height,tpos,0.3) end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_follow0(self,tgtobj) -- probably delete this one
+ local func = function(self)
+ if not tgtobj then return true end
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ if vector.distance(pos,opos) > 3 then
+ local neighbor = mobkit.dir2neighbor(vector.direction(pos,opos))
+if not neighbor then return true end --temp debug
+ local height, tpos = mobkit.is_neighbor_node_reachable(self,neighbor)
+ if height then mobkit.dumbstep(self,height,tpos)
+ else
+ for i=1,4 do --scan left
+ height, tpos, _ = mobkit.is_neighbor_node_reachable(self,(8+neighbor-i-1)%8+1)
+ if height then mobkit.dumbstep(self,height,tpos)
+ break
+ end --scan right
+ height, tpos, _ = mobkit.is_neighbor_node_reachable(self,(neighbor+i-1)%8+1)
+ if height then mobkit.dumbstep(self,height,tpos)
+ break
+ end
+ end
+ end
+ else
+ mobkit.lq_idle(self,1)
+ end
+ end
+ end
+ mobkit.queue_high(self,func,0)
+end
+
+function mobkit.hq_follow(self,prty,tgtobj)
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ if vector.distance(pos,opos) > 3 then
+ mobkit.goto_next_waypoint(self,opos)
+ else
+ mobkit.lq_idle(self,1)
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_goto(self,prty,tpos)
+ local func = function(self)
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ if vector.distance(pos,tpos) > 3 then
+ mobkit.goto_next_waypoint(self,tpos)
+ else
+ return true
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_runfrom(self,prty,tgtobj)
+ local init=true
+ local timer=6
+ local func = function(self)
+
+ if not mobkit.is_alive(tgtobj) then return true end
+ if init then
+ timer = timer-self.dtime
+ if timer <=0 or vector.distance(self.object:get_pos(),tgtobj:get_pos()) < 8 then
+ mobkit.make_sound(self,'scared')
+ init=false
+ end
+ return
+ end
+
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ if vector.distance(pos,opos) < self.view_range*1.1 then
+ local tpos = {x=2*pos.x - opos.x,
+ y=opos.y,
+ z=2*pos.z - opos.z}
+ mobkit.goto_next_waypoint(self,tpos)
+ else
+ self.object:set_velocity({x=0,y=0,z=0})
+ return true
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_hunt(self,prty,tgtobj)
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if mobkit.is_queue_empty_low(self) and self.isonground then
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ local dist = vector.distance(pos,opos)
+ if dist > self.view_range then
+ return true
+ elseif dist > 3 then
+ mobkit.goto_next_waypoint(self,opos)
+ else
+ mobkit.hq_attack(self,prty+1,tgtobj)
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_warn(self,prty,tgtobj)
+ local timer=0
+ local tgttime = 0
+ local init = true
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if init then
+ mobkit.animate(self,'stand')
+ init = false
+ end
+ local pos = mobkit.get_stand_pos(self)
+ local opos = tgtobj:get_pos()
+ local dist = vector.distance(pos,opos)
+
+ if dist > 11 then
+ return true
+ elseif dist < 4 or timer > 12 then -- too close man
+-- mobkit.clear_queue_high(self)
+ mobkit.remember(self,'hate',tgtobj:get_player_name())
+ mobkit.hq_hunt(self,prty+1,tgtobj) -- priority
+ else
+ timer = timer+self.dtime
+ if mobkit.is_queue_empty_low(self) then
+ mobkit.lq_turn2pos(self,opos)
+ end
+ -- make noise in random intervals
+ if timer > tgttime then
+ mobkit.make_sound(self,'warn')
+ -- if self.sounds and self.sounds.warn then
+ -- minetest.sound_play(self.sounds.warn, {object=self.object})
+ -- end
+ tgttime = timer + 1.1 + random()*1.5
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_die(self)
+ local timer = 5
+ local start = true
+ local func = function(self)
+ if start then
+ mobkit.lq_fallover(self)
+ self.logic = function(self) end -- brain dead as well
+ start=false
+ end
+ timer = timer-self.dtime
+ if timer < 0 then self.object:remove() end
+ end
+ mobkit.queue_high(self,func,100)
+end
+
+function mobkit.hq_attack(self,prty,tgtobj)
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if mobkit.is_queue_empty_low(self) then
+ local pos = mobkit.get_stand_pos(self)
+-- local tpos = tgtobj:get_pos()
+ local tpos = mobkit.get_stand_pos(tgtobj)
+ local dist = vector.distance(pos,tpos)
+ if dist > 3 then
+ return true
+ else
+ mobkit.lq_turn2pos(self,tpos)
+ local height = tgtobj:is_player() and 0.35 or tgtobj:get_luaentity().height*0.6
+ if tpos.y+height>pos.y then
+ mobkit.lq_jumpattack(self,tpos.y+height-pos.y,tgtobj)
+ else
+ mobkit.lq_dumbwalk(self,mobkit.pos_shift(tpos,{x=random()-0.5,z=random()-0.5}))
+ end
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_liquid_recovery(self,prty) -- scan for nearest land
+ local radius = 1
+ local yaw = 0
+ local func = function(self)
+ if not self.isinliquid then return true end
+ local pos=self.object:get_pos()
+ local vec = minetest.yaw_to_dir(yaw)
+ local pos2 = mobkit.pos_shift(pos,vector.multiply(vec,radius))
+ local height, liquidflag = mobkit.get_terrain_height(pos2)
+ if height and not liquidflag then
+ mobkit.hq_swimto(self,prty,pos2)
+ return true
+ end
+ yaw=yaw+pi*0.25
+ if yaw>2*pi then
+ yaw = 0
+ radius=radius+1
+ if radius > self.view_range then
+ self.hp = 0
+ return true
+ end
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_swimto(self,prty,tpos)
+ local box = self.object:get_properties().collisionbox
+ local cols = {}
+ local func = function(self)
+ if not self.isinliquid then
+ if self.isonground then return true end
+ return false
+ end
+
+ local pos = mobkit.get_stand_pos(self)
+ local y=self.object:get_velocity().y
+ local pos2d = {x=pos.x,y=tpos.y,z=pos.z}
+ local dir=vector.normalize(vector.direction(pos2d,tpos))
+ local yaw = minetest.dir_to_yaw(dir)
+
+ if mobkit.timer(self,1) then
+ cols = mobkit.get_box_displace_cols(pos,box,dir,1)
+ for _,p in ipairs(cols[1]) do
+ p.y=pos.y
+ local h,l = mobkit.get_terrain_height(p)
+ if h and h>pos.y and self.isinliquid then
+ mobkit.lq_freejump(self)
+ break
+ end
+ end
+ elseif mobkit.turn2yaw(self,yaw) then
+ dir.y = y
+ self.object:set_velocity(dir)
+ end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+---------------------
+-- AQUATIC
+---------------------
+
+-- MACROS
+local function aqua_radar_dumb(pos,yaw,range,reverse)
+ range = range or 4
+
+ local function okpos(p)
+ local node = mobkit.nodeatpos(p)
+ if node then
+ if node.drawtype == 'liquid' then
+ local nodeu = mobkit.nodeatpos(mobkit.pos_shift(p,{y=1}))
+ local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-1}))
+ if (nodeu and nodeu.drawtype == 'liquid') or (noded and noded.drawtype == 'liquid') then
+ return true
+ else
+ return false
+ end
+ else
+ local h,l = mobkit.get_terrain_height(p)
+ if h then
+ local node2 = mobkit.nodeatpos({x=p.x,y=h+1.99,z=p.z})
+ if node2 and node2.drawtype == 'liquid' then return true, h end
+ else
+ return false
+ end
+ end
+ else
+ return false
+ end
+ end
+
+ local fpos = mobkit.pos_translate2d(pos,yaw,range)
+ local ok,h = okpos(fpos)
+ if not ok then
+ local ffrom, fto, fstep
+ if reverse then
+ ffrom, fto, fstep = 3,1,-1
+ else
+ ffrom, fto, fstep = 1,3,1
+ end
+ for i=ffrom, fto, fstep do
+ local ok,h = okpos(mobkit.pos_translate2d(pos,yaw+i,range))
+ if ok then return yaw+i,h end
+ ok,h = okpos(mobkit.pos_translate2d(pos,yaw-i,range))
+ if ok then return yaw-i,h end
+ end
+ return yaw+pi,h
+ else
+ return yaw, h
+ end
+end
+
+function mobkit.is_in_deep(target)
+ if not target then return false end
+ local nodepos = mobkit.get_stand_pos(target)
+ local node1 = mobkit.nodeatpos(nodepos)
+ nodepos.y=nodepos.y+1
+ local node2 = mobkit.nodeatpos(nodepos)
+ nodepos.y=nodepos.y-2
+ local node3 = mobkit.nodeatpos(nodepos)
+ if node1 and node2 and node3 and node1.drawtype=='liquid' and (node2.drawtype=='liquid' or node3.drawtype=='liquid') then
+ return true
+ end
+end
+
+-- HQ behaviors
+
+function mobkit.hq_aqua_roam(self,prty,speed)
+ local tyaw = 0
+ local init = true
+ local prvscanpos = {x=0,y=0,z=0}
+ local center = self.object:get_pos()
+ local func = function(self)
+ if init then
+ mobkit.animate(self,'def')
+ init = false
+ end
+ local pos = mobkit.get_stand_pos(self)
+ local yaw = self.object:get_yaw()
+ local scanpos = mobkit.get_node_pos(mobkit.pos_translate2d(pos,yaw,speed))
+ if not vector.equals(prvscanpos,scanpos) then
+ prvscanpos=scanpos
+ local nyaw,height = aqua_radar_dumb(pos,yaw,speed,true)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+1
+ self.object:set_velocity(vel)
+ end
+ if yaw ~= nyaw then
+ tyaw=nyaw
+ mobkit.hq_aqua_turn(self,prty+1,tyaw,speed)
+ return
+ end
+ end
+ if mobkit.timer(self,1) then
+ if vector.distance(pos,center) > abr*16*0.5 then
+ tyaw = minetest.dir_to_yaw(vector.direction(pos,{x=center.x+random()*10-5,y=center.y,z=center.z+random()*10-5}))
+ else
+ if random(10)>=9 then tyaw=tyaw+random()*pi - pi*0.5 end
+ end
+ end
+
+ mobkit.turn2yaw(self,tyaw,3)
+-- local yaw = self.object:get_yaw()
+ mobkit.go_forward_horizontal(self,speed)
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_aqua_turn(self,prty,tyaw,speed)
+ local func = function(self)
+ local finished=mobkit.turn2yaw(self,tyaw)
+-- local yaw = self.object:get_yaw()
+ mobkit.go_forward_horizontal(self,speed)
+ if finished then return true end
+ end
+ mobkit.queue_high(self,func,prty)
+end
+
+function mobkit.hq_aqua_attack(self,prty,tgtobj,speed)
+ local tyaw = 0
+ local prvscanpos = {x=0,y=0,z=0}
+ local init = true
+ local tgtbox = tgtobj:get_properties().collisionbox
+ local func = function(self)
+ if not mobkit.is_alive(tgtobj) then return true end
+ if init then
+ mobkit.animate(self,'fast')
+ mobkit.make_sound(self,'attack')
+ init = false
+ end
+ local pos = mobkit.get_stand_pos(self)
+ local yaw = self.object:get_yaw()
+ local scanpos = mobkit.get_node_pos(mobkit.pos_translate2d(pos,yaw,speed))
+ if not vector.equals(prvscanpos,scanpos) then
+ prvscanpos=scanpos
+ local nyaw,height = aqua_radar_dumb(pos,yaw,speed*0.5)
+ if height and height > pos.y then
+ local vel = self.object:get_velocity()
+ vel.y = vel.y+1
+ self.object:set_velocity(vel)
+ end
+ if yaw ~= nyaw then
+ tyaw=nyaw
+ mobkit.hq_aqua_turn(self,prty+1,tyaw,speed)
+ return
+ end
+ end
+
+ local tpos = tgtobj:get_pos()
+ local tyaw=minetest.dir_to_yaw(vector.direction(pos,tpos))
+ mobkit.turn2yaw(self,tyaw,3)
+ local yaw = self.object:get_yaw()
+ if mobkit.timer(self,1) then
+ if not mobkit.is_in_deep(tgtobj) then return true end
+ local vel = self.object:get_velocity()
+ if tpos.y>pos.y+0.5 then self.object:set_velocity({x=vel.x,y=vel.y+0.5,z=vel.z})
+ elseif tpos.y bpos.x+box[1] and pos.x < bpos.x+box[4] and
+ pos.y > bpos.y+box[2] and pos.y < bpos.y+box[5] and
+ pos.z > bpos.z+box[3] and pos.z < bpos.z+box[6]
+end
+
+-- call this instead if you want feet position.
+--[[
+function mobkit.get_stand_pos(thing) -- thing can be luaentity or objectref.
+ if type(thing) == 'table' then
+ return mobkit.pos_shift(thing.object:get_pos(),{y=thing.collisionbox[2]+0.01})
+ elseif type(thing) == 'userdata' then
+ local colbox = thing:get_properties().collisionbox
+ return mobkit.pos_shift(thing:get_pos(),{y=colbox[2]+0.01})
+ end
+end --]]
+
+function mobkit.get_stand_pos(thing) -- thing can be luaentity or objectref.
+ local pos = {}
+ local colbox = {}
+ if type(thing) == 'table' then
+ pos = thing.object:get_pos()
+ colbox = thing.object:get_properties().collisionbox
+ elseif type(thing) == 'userdata' then
+ pos = thing:get_pos()
+ colbox = thing:get_properties().collisionbox
+ else
+ return false
+ end
+ return mobkit.pos_shift(pos,{y=colbox[2]+0.01}), pos
+end
+
+function mobkit.set_acceleration(thing,vec,limit)
+ limit = limit or 100
+ if type(thing) == 'table' then thing=thing.object end
+ vec.x=mobkit.minmax(vec.x,limit)
+ vec.y=mobkit.minmax(vec.y,limit)
+ vec.z=mobkit.minmax(vec.z,limit)
+
+ thing:set_acceleration(vec)
+end
+
+function mobkit.nodeatpos(pos)
+ local node = minetest.get_node_or_nil(pos)
+ if node then return minetest.registered_nodes[node.name] end
+end
+
+function mobkit.get_nodename_off(pos,vec)
+ return minetest.get_node(mobkit.pos_shift(pos,vec)).name
+end
+
+function mobkit.get_node_pos(pos)
+ return {
+ x=floor(pos.x+0.5),
+ y=floor(pos.y+0.5),
+ z=floor(pos.z+0.5),
+ }
+end
+
+function mobkit.get_nodes_in_area(pos1,pos2,full)
+ local npos1=mobkit.get_node_pos(pos1)
+ local npos2=mobkit.get_node_pos(pos2)
+ local result = {}
+ local cnt = 0 -- safety
+
+ local sx = (pos2.x 125 then
+ minetest.chat_send_all('get_nodes_in_area: area too big ')
+ return result
+ end
+
+ until y==npos2.y
+ until z==npos2.z
+ until x==npos2.x
+
+ return result
+end
+
+function mobkit.get_hitbox_bottom(self)
+ local y = self.collisionbox[2]
+ local pos = self.object:get_pos()
+ return {
+ {x=pos.x+self.collisionbox[1],y=pos.y+y,z=pos.z+self.collisionbox[3]},
+ {x=pos.x+self.collisionbox[1],y=pos.y+y,z=pos.z+self.collisionbox[6]},
+ {x=pos.x+self.collisionbox[4],y=pos.y+y,z=pos.z+self.collisionbox[3]},
+ {x=pos.x+self.collisionbox[4],y=pos.y+y,z=pos.z+self.collisionbox[6]},
+ }
+end
+
+function mobkit.get_node_height(pos)
+ local npos = mobkit.get_node_pos(pos)
+ local node = mobkit.nodeatpos(npos)
+ if node == nil then return nil end
+
+ if node.walkable then
+ if node.drawtype == 'nodebox' then
+ if node.node_box and node.node_box.type == 'fixed' then
+ if type(node.node_box.fixed[1]) == 'number' then
+ return npos.y + node.node_box.fixed[5] ,0, false
+ elseif type(node.node_box.fixed[1]) == 'table' then
+ return npos.y + node.node_box.fixed[1][5] ,0, false
+ else
+ return npos.y + 0.5,1, false -- todo handle table of boxes
+ end
+ elseif node.node_box and node.node_box.type == 'leveled' then
+ return minetest.get_node_level(pos)/64-0.5+mobkit.get_node_pos(pos).y, 0, false
+ else
+ return npos.y + 0.5,1, false -- the unforeseen
+ end
+ else
+ return npos.y+0.5,1, false -- full node
+ end
+ else
+ local liquidflag = false
+ if node.drawtype == 'liquid' then liquidflag = true end
+ return npos.y-0.5,-1,liquidflag
+ end
+end
+
+-- get_terrain_height
+-- steps(optional) number of recursion steps; default=3
+-- dir(optional) is 1=up, -1=down, 0=both; default=0
+-- liquidflag(forbidden) never provide this parameter.
+function mobkit.get_terrain_height(pos,steps,dir,liquidflag) --dir is 1=up, -1=down, 0=both
+ steps = steps or 3
+ dir = dir or 0
+
+ local h,f,l = mobkit.get_node_height(pos)
+ if h == nil then return nil end
+ if l then liquidflag = true end
+
+ if f==0 then
+ return h, liquidflag
+ end
+
+ if dir==0 or dir==f then
+ steps = steps - 1
+ if steps <=0 then return nil end
+ return mobkit.get_terrain_height(mobkit.pos_shift(pos,{y=f}),steps,f,liquidflag)
+ else
+ return h, liquidflag
+ end
+end
+
+function mobkit.get_spawn_pos_abr(dtime,intrvl,radius,chance,reduction)
+ dtime = min(dtime,0.1)
+ local plyrs = minetest.get_connected_players()
+ intrvl=1/intrvl
+
+ if random() 1 then
+ -- spawn in the front arc
+ yaw = minetest.dir_to_yaw(vel) + random()*0.35 - 0.75
+ else
+ -- random yaw
+ yaw = random()*pi*2 - pi
+ end
+ local pos = plyr:get_pos()
+ local dir = vector.multiply(minetest.yaw_to_dir(yaw),radius)
+ local pos2 = vector.add(pos,dir)
+ pos2.y=pos2.y-5
+ local height, liquidflag = mobkit.get_terrain_height(pos2,32)
+ if height then
+ local objs = minetest.get_objects_inside_radius(pos,radius*1.1)
+ for _,obj in ipairs(objs) do -- count mobs in abrange
+ if not obj:is_player() then
+ local lua = obj:get_luaentity()
+ if lua and lua.name ~= '__builtin:item' then
+ chance=chance + (1-chance)*reduction -- chance reduced for every mob in range
+ end
+ end
+ end
+ if chance < random() then
+ pos2.y = height
+ objs = minetest.get_objects_inside_radius(pos2,radius*0.95)
+ for _,obj in ipairs(objs) do -- do not spawn if another player around
+ if obj:is_player() then return end
+ end
+ return pos2, liquidflag
+ end
+ end
+ end
+end
+
+function mobkit.turn2yaw(self,tyaw,rate)
+ tyaw = tyaw or 0 --temp
+ rate = rate or 6
+ local yaw = self.object:get_yaw()
+ yaw = yaw+pi
+ tyaw=(tyaw+pi)%(pi*2)
+
+ local step=min(self.dtime*rate,abs(tyaw-yaw)%(pi*2))
+
+ local dir = abs(tyaw-yaw)>pi and -1 or 1
+ dir = tyaw>yaw and dir*1 or dir * -1
+
+ local nyaw = (yaw+step*dir)%(pi*2)
+ self.object:set_yaw(nyaw-pi)
+
+ if nyaw==tyaw then return true, nyaw-pi
+ else return false, nyaw-pi end
+end
+
+function mobkit.dir_to_rot(v,rot)
+ rot = rot or {x=0,y=0,z=0}
+ return {x = (v.x==0 and v.y==0 and v.z==0) and rot.x or math.atan2(v.y,vector.length({x=v.x,y=0,z=v.z})),
+ y = (v.x==0 and v.z==0) and rot.y or minetest.dir_to_yaw(v),
+ z=rot.z}
+end
+
+function mobkit.rot_to_dir(rot) -- keep rot within <-pi/2,pi/2>
+ local dir = minetest.yaw_to_dir(rot.y)
+ dir.y = dir.y+tan(rot.x)*vector.length(dir)
+ return vector.normalize(dir)
+end
+
+function mobkit.isnear2d(p1,p2,thresh)
+ if abs(p2.x-p1.x) < thresh and abs(p2.z-p1.z) < thresh then
+ return true
+ else
+ return false
+ end
+end
+
+-- object has reached the destination if dest is in the rear half plane.
+function mobkit.is_there_yet2d(pos,dir,dest) -- obj positon; facing vector; destination position
+
+ local c = -dir.x*pos.x-dir.z*pos.z -- the constant
+
+ if dir.z > 0 then
+ return dest.z <= (-dir.x*dest.x - c)/dir.z -- line equation
+ elseif dir.z < 0 then
+ return dest.z >= (-dir.x*dest.x - c)/dir.z
+ elseif dir.x > 0 then
+ return dest.x <= (-dir.z*dest.z - c)/dir.x
+ elseif dir.x < 0 then
+ return dest.x >= (-dir.z*dest.z - c)/dir.x
+ else
+ return false
+ end
+
+end
+
+function mobkit.isnear3d(p1,p2,thresh)
+ if abs(p2.x-p1.x) < thresh and abs(p2.z-p1.z) < thresh and abs(p2.y-p1.y) < thresh then
+ return true
+ else
+ return false
+ end
+end
+
+function mobkit.get_box_intersect_cols(pos,box)
+ local pmin = {x=floor(pos.x+box[1]+0.5),z=floor(pos.z+box[3]+0.5)}
+ local pmax = {x=floor(pos.x+box[4]+0.5),z=floor(pos.z+box[6]+0.5)}
+
+ result= {}
+ for x=pmin.x,pmax.x do
+ for z=pmin.z,pmax.z do
+ table.insert(result,{x=x,z=z})
+ end
+ end
+ return result
+end
+
+function mobkit.get_box_displace_cols(pos,box,vec,dist)
+
+ local result = {{}}
+ -- front facing corner pos and neighbors
+ local fpos = {pos.y}
+ local xpos={pos.y}
+ local zpos={pos.y}
+ local xoff=nil
+ local zoff=nil
+
+ if vec.x < 0 then
+ fpos.x = pos.x+box[1] -- frontmost corner's x
+ xoff = box[4]-box[1] -- edge offset along x
+ else
+ fpos.x = pos.x+box[4]
+ xoff = box[1]-box[4]
+ end
+
+ if vec.z < 0 then
+ fpos.z = pos.z+box[3] -- frontmost corner's z
+ zoff = box[6]-box[3] -- edge offset along z
+ else
+ fpos.z = pos.z+box[6]
+ zoff = box[3]-box[6]
+ end
+
+ -- displacement vector
+ if dist then vec = vector.multiply(vector.normalize(vec),dist) end
+
+ -- traverse x
+ local xsgn = sign(vec.x)
+ local zsgn = sign(zoff)
+ local index=0
+ for x = floor(fpos.x+0.5)+xsgn*0.5, fpos.x+vec.x, xsgn do
+ index=index+1
+ if index > 50 then return result end
+ result[index] = result[index] or {}
+ local zcomp = vec.x == 0 and 0 or fpos.z + (x-fpos.x)*vec.z/vec.x -- z component at the intersection of x and node edge
+ for z = floor(zcomp+0.5), floor(zcomp+zoff+0.5), zsgn do
+ table.insert(result[index],{x=x+xsgn*0.5,z=z})
+ end
+ end
+
+ -- traverse z
+ local zsgn = sign(vec.z)
+ local xsgn = sign(xoff)
+ index=0
+ for z = floor(fpos.z + 0.5)+zsgn*0.5, fpos.z+vec.z, zsgn do
+ index=index+1
+ if index > 50 then return result end
+ result[index] = result[index] or {}
+ local xcomp = vec.z == 0 and 0 or fpos.x + (z-fpos.z)*vec.x/vec.z
+ for x = floor(xcomp+0.5), floor(xcomp+xoff+0.5), xsgn do
+ table.insert(result[index],{x=x,z=z+zsgn*0.5})
+ end
+ end
+
+ return result
+end
+
+function mobkit.get_box_height(thing)
+ if type(thing) == 'table' then thing = thing.object end
+ local colbox = thing:get_properties().collisionbox
+ local height
+ if colbox then height = colbox[5]-colbox[2]
+ else height = 0.1 end
+
+ return height > 0 and height or 0.1
+end
+
+function mobkit.is_alive(thing) -- thing can be luaentity or objectref.
+-- if not thing then return false end
+ if not mobkit.exists(thing) then return false end
+ if type(thing) == 'table' then return thing.hp > 0 end
+ if thing:is_player() then return thing:get_hp() > 0
+ else
+ local lua = thing:get_luaentity()
+ local hp = lua and lua.hp or nil
+ return hp and hp > 0
+ end
+end
+
+function mobkit.exists(thing)
+ if not thing then return false end
+ if type(thing) == 'table' then thing=thing.object end
+ if type(thing) == 'userdata' then
+ if thing:is_player() then
+ if thing:get_look_horizontal() then return true end
+ else
+ if thing:get_yaw() then return true end
+ end
+ end
+end
+
+function mobkit.hurt(luaent,dmg)
+ if not luaent then return false end
+ if type(luaent) == 'table' then
+ luaent.hp = max((luaent.hp or 0) - dmg,0)
+ end
+end
+
+function mobkit.heal(luaent,dmg)
+ if not luaent then return false end
+ if type(luaent) == 'table' then
+ luaent.hp = min(luaent.max_hp,(luaent.hp or 0) + dmg)
+ end
+end
+
+function mobkit.animate(self,anim)
+ if self.animation and self.animation[anim] then
+ if self._anim == anim then return end
+ self._anim=anim
+
+ local aparms = {}
+ if #self.animation[anim] > 0 then
+ aparms = self.animation[anim][random(#self.animation[anim])]
+ else
+ aparms = self.animation[anim]
+ end
+
+ aparms.frame_blend = aparms.frame_blend or 0
+
+ self.object:set_animation(aparms.range,aparms.speed,aparms.frame_blend,aparms.loop)
+ else
+ self._anim = nil
+ end
+end
+
+function mobkit.make_sound(self, sound)
+ local spec = self.sounds and self.sounds[sound]
+ local param_table = {object=self.object}
+
+ if type(spec) == 'table' then
+ --pick random sound if it's a spec for random sounds
+ if #spec > 0 then spec = spec[random(#spec)] end
+
+ --returns value or a random value within the range [value[1], value[2])
+ local function in_range(value)
+ return type(value) == 'table' and value[1]+random()*(value[2]-value[1]) or value
+ end
+
+ --pick random values within a range if they're a table
+ param_table.gain = in_range(spec.gain)
+ param_table.fade = in_range(spec.fade)
+ param_table.pitch = in_range(spec.pitch)
+ return minetest.sound_play(spec.name, param_table)
+ end
+ return minetest.sound_play(spec, param_table)
+end
+
+function mobkit.go_forward_horizontal(self,speed) -- sets velocity in yaw direction, y component unaffected
+ local y = self.object:get_velocity().y
+ local yaw = self.object:get_yaw()
+ local vel = vector.multiply(minetest.yaw_to_dir(yaw),speed)
+ vel.y = y
+ self.object:set_velocity(vel)
+end
+
+function mobkit.drive_to_pos(self,tpos,speed,turn_rate,dist)
+ local pos=self.object:get_pos()
+ dist = dist or 0.2
+ if mobkit.isnear2d(pos,tpos,dist) then return true end
+ local tyaw = minetest.dir_to_yaw(vector.direction(pos,tpos))
+ mobkit.turn2yaw(self,tyaw,turn_rate)
+ mobkit.go_forward_horizontal(self,speed)
+ return false
+end
+
+function mobkit.timer(self,s) -- returns true approx every s seconds
+ local t1 = floor(self.time_total)
+ local t2 = floor(self.time_total+self.dtime)
+ if t2>t1 and t2%s==0 then return true end
+end
+
+-- Memory functions.
+-- Stuff in memory is serialized, never try to remember objectrefs.
+function mobkit.remember(self,key,val)
+ self.memory[key]=val
+ return val
+end
+
+function mobkit.forget(self,key)
+ self.memory[key] = nil
+end
+
+function mobkit.recall(self,key)
+ return self.memory[key]
+end
+
+-- Queue functions
+function mobkit.queue_high(self,func,priority)
+ local maxprty = mobkit.get_queue_priority(self)
+ if priority > maxprty then
+ mobkit.clear_queue_low(self)
+ end
+
+ for i,f in ipairs(self.hqueue) do
+ if priority > f.prty then
+ table.insert(self.hqueue,i,{func=func,prty=priority})
+ return
+ end
+ end
+ table.insert(self.hqueue,{func=func,prty=priority})
+end
+
+function mobkit.queue_low(self,func)
+ table.insert(self.lqueue,func)
+end
+
+function mobkit.is_queue_empty_low(self)
+ if #self.lqueue == 0 then return true
+ else return false end
+end
+
+function mobkit.clear_queue_high(self)
+ self.hqueue = {}
+end
+
+function mobkit.clear_queue_low(self)
+ self.lqueue = {}
+end
+
+function mobkit.get_queue_priority(self)
+ if #self.hqueue > 0 then
+ return self.hqueue[1].prty
+ else return 0 end
+end
+
+function mobkit.is_queue_empty_high(self)
+ if #self.hqueue == 0 then return true
+ else return false end
+end
+
+function mobkit.get_nearby_player(self) -- returns random player if nearby or nil
+ for _,obj in ipairs(self.nearby_objects) do
+ if obj:is_player() and mobkit.is_alive(obj) then return obj end
+ end
+ return
+end
+
+function mobkit.get_nearby_entity(self,name) -- returns random nearby entity of name or nil
+ for _,obj in ipairs(self.nearby_objects) do
+ if mobkit.is_alive(obj) and not obj:is_player() and obj:get_luaentity().name == name then return obj end
+ end
+ return
+end
+
+function mobkit.get_closest_entity(self,name) -- returns closest entity of name or nil
+ local cobj = nil
+ local dist = abr*64
+ local pos = self.object:get_pos()
+ for _,obj in ipairs(self.nearby_objects) do
+ local luaent = obj:get_luaentity()
+ if mobkit.is_alive(obj) and not obj:is_player() and luaent and luaent.name == name then
+ local opos = obj:get_pos()
+ local odist = abs(opos.x-pos.x) + abs(opos.z-pos.z)
+ if odist < dist then
+ dist=odist
+ cobj=obj
+ end
+ end
+ end
+ return cobj
+end
+
+local function execute_queues(self)
+ --Execute hqueue
+ if #self.hqueue > 0 then
+ local func = self.hqueue[1].func
+ if func(self) then
+ table.remove(self.hqueue,1)
+ self.lqueue = {}
+ end
+ end
+ -- Execute lqueue
+ if #self.lqueue > 0 then
+ local func = self.lqueue[1]
+ if func(self) then
+ table.remove(self.lqueue,1)
+ end
+ end
+end
+
+local function sensors()
+ local timer = 2
+ local pulse = 1
+ return function(self)
+ timer=timer-self.dtime
+ if timer < 0 then
+
+ pulse = pulse + 1 -- do full range every third scan
+ local range = self.view_range
+ if pulse > 2 then
+ pulse = 1
+ else
+ range = self.view_range*0.5
+ end
+
+ local pos = self.object:get_pos()
+--local tim = minetest.get_us_time()
+ self.nearby_objects = minetest.get_objects_inside_radius(pos, range)
+--minetest.chat_send_all(minetest.get_us_time()-tim)
+ for i,obj in ipairs(self.nearby_objects) do
+ if obj == self.object then
+ table.remove(self.nearby_objects,i)
+ break
+ end
+ end
+ timer=2
+ end
+ end
+end
+
+------------
+-- CALLBACKS
+------------
+
+function mobkit.default_brain(self)
+ if mobkit.is_queue_empty_high(self) then mobkit.hq_roam(self,0) end
+end
+
+function mobkit.physics(self)
+ local vel=self.object:get_velocity()
+ local vnew = vector.new(vel)
+ -- dumb friction
+ local colinfo = self.colinfo
+
+ if self.isonground and not self.isinliquid then
+ vnew = {x= vel.x> 0.2 and vel.x*mobkit.friction or 0,
+ y=vel.y,
+ z=vel.z > 0.2 and vel.z*mobkit.friction or 0}
+ end
+
+ -- bounciness
+ if self.springiness and self.springiness > 0 then
+
+ if colinfo and colinfo.collides then
+ for _,c in ipairs(colinfo.collisions) do
+ if c.old_velocity[c.axis] > 0.1 then
+ vnew[c.axis] = vnew[c.axis] * self.springiness * -1
+ end
+ end
+ elseif not colinfo then -- MT 5.2 and earlier
+ for _,k in ipairs({'y','z','x'}) do
+ if vel[k]==0 and abs(self.lastvelocity[k])> 0.1 then
+ vnew[k]=-self.lastvelocity[k]*self.springiness
+ end
+ end
+ end
+ end
+
+ self.object:set_velocity(vnew)
+
+ -- buoyancy
+ local surface = nil
+ local surfnodename = nil
+ local spos = mobkit.get_stand_pos(self)
+ spos.y = spos.y+0.01
+ -- get surface height
+ local snodepos = mobkit.get_node_pos(spos)
+ local surfnode = mobkit.nodeatpos(spos)
+ while surfnode and surfnode.drawtype == 'liquid' do
+ surfnodename = surfnode.name
+ surface = snodepos.y+0.5
+ if surface > spos.y+self.height then break end
+ snodepos.y = snodepos.y+1
+ surfnode = mobkit.nodeatpos(snodepos)
+ end
+ self.isinliquid = surfnodename
+ if surface then -- standing in liquid
+-- self.isinliquid = true
+ local submergence = min(surface-spos.y,self.height)/self.height
+-- local balance = self.buoyancy*self.height
+ local buoyacc = mobkit.gravity*(self.buoyancy-submergence)
+ mobkit.set_acceleration(self.object,
+ {x=-vel.x*self.water_drag,y=buoyacc-vel.y*abs(vel.y)*0.4,z=-vel.z*self.water_drag})
+ else
+-- self.isinliquid = false
+ self.object:set_acceleration({x=0,y=mobkit.gravity,z=0})
+ end
+end
+
+function mobkit.vitals(self)
+ -- vitals: fall damage
+ local vel = self.object:get_velocity()
+ local velocity_delta = abs(self.lastvelocity.y - vel.y)
+ if velocity_delta > mobkit.safe_velocity then
+ self.hp = self.hp - floor(self.max_hp * min(1, velocity_delta/mobkit.terminal_velocity))
+ end
+
+ -- vitals: oxygen
+ if self.lung_capacity then
+ local colbox = self.object:get_properties().collisionbox
+ local headnode = mobkit.nodeatpos(mobkit.pos_shift(self.object:get_pos(),{y=colbox[5]})) -- node at hitbox top
+ if headnode and headnode.drawtype == 'liquid' then
+ self.oxygen = self.oxygen - self.dtime
+ else
+ self.oxygen = self.lung_capacity
+ end
+
+ if self.oxygen <= 0 then self.hp=0 end -- drown
+ end
+end
+
+function mobkit.statfunc(self)
+ local tmptab={}
+ tmptab.memory = self.memory
+ tmptab.hp = self.hp
+ tmptab.texture_no = self.texture_no
+ return minetest.serialize(tmptab)
+end
+
+function mobkit.actfunc(self, staticdata, dtime_s)
+
+ self.logic = self.logic or self.brainfunc
+ self.physics = self.physics or mobkit.physics
+
+ self.lqueue = {}
+ self.hqueue = {}
+ self.nearby_objects = {}
+ self.nearby_players = {}
+ self.pos_history = {}
+ self.path_dir = 1
+ self.time_total = 0
+ self.water_drag = self.water_drag or 1
+
+ local sdata = minetest.deserialize(staticdata)
+ if sdata then
+ for k,v in pairs(sdata) do
+ self[k] = v
+ end
+ end
+
+ if self.textures==nil then
+ local prop_tex = self.object:get_properties().textures
+ if prop_tex then self.textures=prop_tex end
+ end
+
+ if not self.memory then -- this is the initial activation
+ self.memory = {}
+
+ -- texture variation
+ if #self.textures > 1 then self.texture_no = random(#self.textures) end
+ end
+
+ if self.timeout and ((self.timeout>0 and dtime_s > self.timeout and next(self.memory)==nil) or
+ (self.timeout<0 and dtime_s > abs(self.timeout))) then
+ self.object:remove()
+ end
+
+ -- apply texture
+ if self.textures and self.texture_no then
+ local props = {}
+ props.textures = {self.textures[self.texture_no]}
+ self.object:set_properties(props)
+ end
+
+--hp
+ self.max_hp = self.max_hp or 10
+ self.hp = self.hp or self.max_hp
+--armor
+ if type(self.armor_groups) ~= 'table' then
+ self.armor_groups={}
+ end
+ self.armor_groups.immortal = 1
+ self.object:set_armor_groups(self.armor_groups)
+
+ self.buoyancy = self.buoyancy or 0
+ self.oxygen = self.oxygen or self.lung_capacity
+ self.lastvelocity = {x=0,y=0,z=0}
+ self.sensefunc=sensors()
+end
+
+function mobkit.stepfunc(self,dtime,colinfo) -- not intended to be modified
+ self.dtime = min(dtime,0.2)
+ self.colinfo = colinfo
+ self.height = mobkit.get_box_height(self)
+
+-- physics comes first
+ local vel = self.object:get_velocity()
+
+ if colinfo then
+ self.isonground = colinfo.touching_ground
+ else
+ if self.lastvelocity.y==0 and vel.y==0 then
+ self.isonground = true
+ else
+ self.isonground = false
+ end
+ end
+
+ self:physics()
+
+ if self.logic then
+ if self.view_range then self:sensefunc() end
+ self:logic()
+ execute_queues(self)
+ end
+
+ self.lastvelocity = self.object:get_velocity()
+ self.time_total=self.time_total+self.dtime
+end
+
+-- load example behaviors
+dofile(minetest.get_modpath("mobkit") .. "/example_behaviors.lua")
+
+minetest.register_on_mods_loaded(function()
+ local mbkfuns = ''
+ for n,f in pairs(mobkit) do
+ if type(f) == 'function' then
+ mbkfuns = mbkfuns .. n .. string.split(minetest.serialize(f),'.lua')[2] or ''
+ end
+ end
+ local crc = minetest.sha1(mbkfuns)
+-- dbg(crc)
+-- if crc ~= 'a061770008fe9ecf8e1042a227dc3beabd10e481' then
+-- minetest.log("error","Mobkit namespace inconsistent, has been modified by other mods.")
+-- end
+end)
diff --git a/games/globo/mods/mobkit/mobkit_api.txt b/games/globo/mods/mobkit/mobkit_api.txt
new file mode 100644
index 000000000..1d2c8a088
--- /dev/null
+++ b/games/globo/mods/mobkit/mobkit_api.txt
@@ -0,0 +1,560 @@
+Contents
+
+1 Concepts
+ 1.1 Behavior functions
+ 1.1.1 Low level functions
+ 1.1.2 High level functions
+ 1.1.2.1 Priority
+ 1.1.3 Modifying built in behaviors
+ 1.2 Logic function
+ 1.3 Processing diagram
+ 1.4 Entity definition
+ 1.5 Exposed luaentity members
+
+2 Reference
+ 2.1 Utility functions
+ 2.2 Built in behaviors
+ 2.2.1 High level behaviors
+ 2.2.2 Low level behaviors
+ 2.3 Constants and member variables
+
+-----------
+1. Concepts
+-----------
+
+1.1 Behavior functions
+
+These are the most fundamental units of code, every action entities can perform is a separate function.
+There are two types of behaviors:
+- low level, these govern physical actions and interactions (think moves)
+- high level, these are logical structures governing low level behaviors in order to perform more complex tasks
+
+Behaviors run for considerable amount of time, this means the functions are being called repeatedly on consecutive engine steps.
+Therefore a need for preserving state between calls, this is why they are implemented as closures, see defining conventions for details.
+
+Behavior functions are active until they finish the job, are removed from the queue or superseded by a higher priority behavior.
+They signal finished state by returning true, therefore it's very important to carefully design the completion conditions
+
+For a behavior to begin executing it has to be put on a queue. There are two separate queues, one for low and one for high level behaviors.
+Queuing is covered by behavour defining conventions
+
+Mobkit comes with some example behavior functions, which are located in /example_behaviors.lua
+!!! In simplest scenarios there's no need to code behaviors, much can be achieved using only built-in stuff !!!
+!!! To start using the api it's enough to learn defining mobs and writing brain functions !!!
+
+
+1.1.1 Low level behavior functions
+
+These are physical actions and interactions: steps, jumps, turns etc. here you'll set velocity, yaw, kick off animations and sounds.
+
+Low level behavior definition:
+
+function mobkit.lq_bhv1(self,[optional additional persistent parameters]) -- enclosing function
+ ... -- optional definitions of additional persistent variables
+ local func=function(self) -- enclosed function, self is mandatory and the only allowed parameter
+ ... -- actual function definition, remember to return true eventually
+ end
+ mobkit.queue_low(self,func) -- this will queue the behavior at the time of lq_bhv1 call
+end
+
+
+1.1.2 High level behavior functions
+
+These are complex tasks like getting to a position, following other objects, hiding, patrolling an area etc.
+Their job is tracking changes in the environment and managing low level behavior queue accordingly.
+
+High level behavior definition:
+
+function mobkit.hq_bhv1(self,priority,[optional additional persistent parameters]) -- enclosing function
+ ... -- optional definitions of additional persistent variables
+ local func=function(self) -- enclosed function, self is mandatory and the only allowed parameter
+ ... -- actual function definition, remember to return true eventually
+ end
+ mobkit.queue_high(self,func,priority) -- this will queue the behavior at the time of hq_bhv1 call
+end
+
+
+1.1.2.1 Priority
+
+Unlike low level behaviors which are executed in FIFO order, high level behaviors support prioritization.
+This concept is essential for making sure the right behavior is active at the right time.
+Prioritization is what makes it possible to interrupt a task in order to perform a more important one
+
+The currently executing behavior is always the first in the queue.
+When a new behavior is placed onto the queue:
+If the queue is not empty a new behavior is inserted before the first behavior of lower priority if such exists, or last.
+If the new behavior supersedes the one currently executing, low level queue is purged immediately.
+
+Common idioms:
+
+hq_bhv1(self,prty):
+ ...
+ hq_bhv2(self,prty) -- bhv1 kicks off bhv2 with equal priority
+ return true -- and ends,
+ -- bhv2 becomes active on the next engine step.
+
+hq_bhv1(self,prty):
+ ...
+ hq_bhv2(self,prty+1) -- bhv1 kicks off bhv2 with higher priority
+ -- bhv2 takes over and when it ends, bhv1 resumes.
+
+
+Particular prioritization scheme is to be designed by the user according to specific mod requirements.
+
+1.1.3 Modifying built in behaviors
+
+Do not modify example_behaviors.lua directly, because functions defined there are meant to be shared between mods.
+Instead, copy the contents of /behaviors2override.lua into your mod/game, changing every occurence of the string '[yournamespace]' to the name of a lua table representing your namespace of choice.
+
+1.2 Logic function
+------------------
+Every mob must have one.
+Its job is managing high level behavior queue in response to events which are not intercepted by callbacks.
+Contrary to what the name suggests, these functions needn't necessarily be too complex thanks to their limited responsibilities.
+
+Typical flow might look like this:
+
+if mobkit.timer(self,1) then -- returns true approx every second
+ local prty = mobkit.get_queue_priority(self)
+
+ if prty < 20
+ if ... then
+ hq_do_important_stuff(self,20)
+ return
+ end
+ end
+
+ if prty < 10 then
+ if ... then
+ hq_do_something_else(self,10)
+ return
+ elseif ... then
+ hq_do_this_instead(self,10)
+ return
+ end
+ end
+
+ if mobkit.is_queue_empty_high(self) then
+ hq_fool_around(self,0)
+ end
+end
+
+
+1.3 Processing diagram
+----------------------
+
+ ---------------------------------------
+| PHYSICS |
+| |
+| ----------------------- |
+| | Logic Function | |
+| ----------------------- |
+| | |
+| -----|----------------- |
+| | V HL Queue| |
+| | 1| 2| 3|... | |
+| ----------------------- |
+| | |
+| -----|----------------- |
+| | V LL Queue| |
+| | 1| 2| 3|... | |
+| ----------------------- |
+| |
+ ---------------------------------------
+
+ Order of execution during an engine step:
+ First comes physics: gravity, buoyancy, friction etc., then the logic function is called.
+ After that, the first behavior on the high level queue, if exists,
+ and the last, the first low level behavior if present.
+
+1.4 Entity definition
+---------------------
+
+minetest.register_entity("mod:name",{
+
+ -- required minetest api props
+
+ initial_properties = {
+ physical = true,
+ collide_with_objects = true,
+ collisionbox = {...},
+ visual = "mesh",
+ mesh = "...",
+ textures = {...},
+ },
+
+
+ -- required mobkit props
+
+ timeout = [num], -- entities are removed after this many seconds inactive
+ -- 0 is never
+ -- mobs having memory entries are not affected
+
+ buoyancy = [num], -- (0,1) - portion of collisionbox submerged
+ -- = 1 - controlled buoyancy (fish, submarine)
+ -- > 1 - drowns
+ -- < 0 - MC like water trampolining
+
+ lung_capacity = [num], -- seconds
+ max_hp = [num],
+ on_step = mobkit.stepfunc,
+ on_activate = mobkit.actfunc,
+ get_staticdata = mobkit.statfunc,
+ logic = [function user defined], -- older 'brainfunc' name works as well.
+
+ -- optional mobkit props
+ -- or used by built in behaviors
+ physics = [function user defined] -- optional, overrides built in physics
+ animation = {
+ [name]={range={x=[num],y=[num]},speed=[num],loop=[bool]}, -- single
+
+ [name]={ -- variant, animations are chosen randomly.
+ {range={x=[num],y=[num]},speed=[num],loop=[bool]},
+ {range={x=[num],y=[num]},speed=[num],loop=[bool]},
+ ...
+ }
+ ...
+ }
+ sounds = {
+ [name] = [string filename], --single, simple,
+
+ [name] = { --single, more powerful. All fields but 'name' are optional
+ name = [string filename],
+ gain=[num or range], --range is a table of the format {left_bound, right_bound}
+ fade=[num or range],
+ pitch=[num or range],
+ },
+
+ [name] = { --variant, sound is chosen randomly
+ {
+ name = [string filename],
+ gain=[num or range],
+ fade=[num or range],
+ pitch=[num or range],
+ },
+ {
+ name = [string filename],
+ gain=[num or range],
+ fade=[num or range],
+ pitch=[num or range],
+ },
+ ...
+ },
+ ...
+ },
+ max_speed = [num], -- m/s
+ jump_height = [num], -- nodes/meters
+ view_range = [num], -- nodes/meters
+ attack={range=[num], -- range is distance between attacker's collision box center
+ damage_groups={fleshy=[num]}}, -- and the tip of the murder weapon in nodes/meters
+ armor_groups = {fleshy=[num]}
+})
+
+1.5 Exposed luaentity members
+
+Some frequently used entity fields to be accessed directly for convenience
+
+ self.dtime -- max(dtime as passed to on_step,0.5) - limit of 0.05 to prevent jerkines on long steps.
+ self.hp -- hitpoints
+ self.isonground -- true if in collision with negative Y
+ self.isinliquid -- true if the node at foot level is drawtype=='liquid'
+
+------------
+2. Reference
+------------
+
+2.1 Utility Functions
+
+function mobkit.minmax(v,m)
+ -- v,n: numbers
+ -- returns v trimmed to <-m,m> range
+
+function mobkit.get_terrain_height(pos,steps)
+ -- recursively search for walkable surface at pos.
+ -- steps (optional) is how far from pos it gives up, expressed in nodes, default 3
+ -- Returns:
+ -- surface height at pos, or nil if not found
+ -- liquid flag: true if found surface is covered with liquid
+
+function mobkit.turn2yaw(self,tyaw,rate)
+ -- gradually turns towards yaw
+ -- self: luaentity
+ -- tyaw: target yaw in radians
+ -- rate: turn rate in rads/s
+ --returns: true if facing tyaw; current yaw
+
+function mobkit.timer(self,s)
+ -- returns true approx every s seconds
+ -- used to reduce execution of code that needn't necessarily be done on every engine step
+
+function mobkit.pos_shift(pos,vec)
+ -- convenience function
+ -- returns pos shifted by vec
+ -- vec needn't have all three components given, absent components are assumed zero.
+ -- e.g pos_shift(pos,{y=1}) is valid
+
+function mobkit.pos_translate2d(pos,yaw,dist)
+ -- returns pos translated in the yaw direction by dist
+
+function mobkit.get_stand_pos(thing)
+ -- returns object pos projected onto the bottom collisionbox face
+ -- thing can be luaentity or objectref.
+
+function mobkit.nodeatpos(pos)
+ -- convenience function
+ -- returns nodedef or nil if it's an ignore node
+
+function mobkit.get_node_pos(pos)
+ -- returns center of the node that pos is inside
+
+function mobkit.get_nodes_in_area(pos1,pos2,[full])
+ -- in basic mode returns a table of unique nodes within area indexed by node
+ -- in full=true mode returns a table of nodes indexed by pos
+ -- works for up to 125 nodes.
+
+function mobkit.isnear2d(p1,p2,thresh)
+ -- returns true if pos p2 is within a square with center at pos p1 and radius thresh
+ -- y components are ignored
+
+function mobkit.is_there_yet2d(pos,dir,dest) -- obj positon; facing vector; destination position
+ -- returns true if a position dest is behind position pos according to facing vector dir
+ -- (checks if dest is in the rear half plane as defined by pos and dir)
+ -- y components are ignored
+
+function mobkit.isnear3d(p1,p2,thresh)
+ -- returns true if pos p2 is within a cube with center at pos p1 and radius thresh
+
+function mobkit.get_box_intersect_cols(pos,box)
+ -- returns an array of {x=,z=} columns that the box intersects with.
+
+function mobkit.get_box_displace_cols(pos,box,vec,dist)
+ -- returns an array of {x=,z=} columns that the box would pass by if moved by horizontal vector vec
+ -- if dist provided, vec gets normalized.
+
+function mobkit.dir_to_rot(v,rot)
+ -- converts a 3d vector v to rotation like in set_rotation() object method
+ -- rot (optional) is current object rotation
+
+function mobkit.rot_to_dir(rot)
+ -- converts minetest rotation vector (pitch,yaw,roll) to direction unit vector
+
+function mobkit.is_alive(thing)
+ -- non essential, checks if thing exists in the world and is alive
+ -- makes an assumption that luaentities are considered dead when their hp < 100
+ -- thing can be luaentity or objectref.
+ -- used for stored luaentities and objectrefs
+
+function mobkit.exists(thing)
+ -- checks if thing exists in the world
+ -- thing can be luaentity or objectref.
+ -- used for stored luaentities and objectrefs
+
+function mobkit.hurt(luaent,dmg)
+ -- decrease luaent.hp by dmg
+
+function mobkit.heal(luaent,dmg)
+ -- increase luaent.hp by dmg
+
+function mobkit.get_spawn_pos_abr(dtime,intrvl,radius,chance,reduction)
+ -- returns a potential spawn position at random intervals
+ -- intrvl: avg spawn attempt interval for every player
+ -- radius: spawn distance in nodes, active_block_range*16 is recommended
+ -- chance: (0,1) chance to spawn a mob if there are no other objects in area
+ -- reduction: (0,1) spawn chance is reduced by this factor for every object in range.
+ --usage:
+ minetest.register_globalstep(function(dtime)
+ local spawnpos = mobkit.get_spawn_pos_abr(...)
+ if spawnpos then
+ ... -- mod/game specific logic
+ end
+ end)
+
+function mobkit.animate(self,anim)
+ -- makes an entity play an animation of name anim, or does nothing if not defined
+ -- anim is string, see entity definition
+ -- does nothing if the same animation is already running
+
+function mobkit.make_sound(self,sound)
+ -- sound is string, see entity definition
+ -- makes an entity play sound, or does nothing if not defined
+ --returns sound handle
+
+function mobkit.go_forward_horizontal(self,speed)
+ -- sets an entity's horizontal velocity in yaw direction. Vertical velocity unaffected.
+
+function mobkit.drive_to_pos(self,tpos,speed,turn_rate,dist)
+ -- moves in facing direction while gradually turning towards tpos, returns true if in dist distance from tpos
+ -- tpos: target position
+ -- speed: in m/s
+ -- turn_rate: in rad/s
+ -- dist: in m.
+
+-- Memory functions.
+
+This represents mob long term memory
+Warning: Stuff in memory is serialized, never try to remember objectrefs or tables referencing them
+or the engine will crash.
+
+function mobkit.remember(self,key,val)
+ -- premanently store a key, value pair
+function mobkit.forget(self,key)
+ -- clears a memory entry
+function mobkit.recall(self,key)
+ -- returns val associated with key
+
+-- Queue functions
+
+function mobkit.queue_high(self,func,priority)
+ -- only for use in behavior definitions, see 1.1.2
+
+function mobkit.queue_low(self,func)
+ -- only for use in behavior definitions, see 1.1.1
+
+
+function mobkit.clear_queue_high(self)
+function mobkit.clear_queue_low(self)
+
+function mobkit.is_queue_empty_high(self)
+function mobkit.is_queue_empty_low(self)
+
+function mobkit.get_queue_priority(self)
+ -- returns the priority of currently running behavior
+ -- this is also the highest of all queued behaviors
+
+
+-- Use these inside logic functions --
+
+function mobkit.vitals(self)
+ -- default drowning and fall damage, call it before hp check
+function mobkit.get_nearby_player(self)
+ -- returns random player if nearby or nil
+function mobkit.get_nearby_entity(self,name)
+ -- returns random nearby entity of name or nil
+function mobkit.get_closest_entity(self,name)
+ -- returns closest entity of name or nil
+
+
+-- Misc
+
+Neighbors structure represents a node's horizontal neighbors
+Not essential, used by some built in behaviors
+Custom behaviors may not need it.
+
+Neighbor #1 is offset {x=1,z=0}, subsequent numbers go clockwise
+
+function mobkit.dir2neighbor(dir)
+ -- converts a 3d vector to neighbor number, y component ignored
+
+function mobkit.neighbor_shift(neighbor,shift)
+ -- get another neighbor number relative to the given, shift: plus is clockwise, minus the opposite
+ -- 1,1 = 2; 1,-2 = 7
+
+
+2.2 Built in behaviors
+
+function mobkit.goto_next_waypoint(self,tpos)
+ -- this functions groups common operations making mobs move in a specific direction
+ -- not a behavior itself, but is used by some built in HL behaviors
+ -- which use node by node movement algorithm
+
+2.2.1 High Level Behaviors --
+
+function mobkit.hq_roam(self,prty)
+ -- slow random roaming
+ -- never returns
+
+function mobkit.hq_follow(self,prty,tgtobj)
+ -- follow the tgtobj
+ -- returns if tgtobj becomes inactive
+
+function mobkit.hq_goto(self,prty,tpos)
+ -- go to tpos position
+ -- returns on arrival
+
+function mobkit.hq_runfrom(self,prty,tgtobj)
+ -- run away from tgtobj object
+ -- returns when tgtobj far enough
+
+function mobkit.hq_hunt(self,prty,tgtobj)
+ -- follow tgtobj and when close enough, kick off hq_attack
+ -- returns when tgtobj too far
+
+function mobkit.hq_warn(self,prty,tgtobj)
+ -- when a tgtobj close by, turn towards them and make the 'warn' sound
+ -- kick off hq_hunt if tgtobj too close or timer expired
+ -- returns when tgtobj moves away
+
+function mobkit.hq_die(self)
+ -- default death, rotate and remove() after set time
+
+function mobkit.hq_attack(self,prty,tgtobj)
+ -- default attack, turns towards tgtobj and leaps
+ -- returns when tgtobj out of range
+
+function mobkit.hq_liquid_recovery(self,prty)
+ -- use when submerged in liquid, scan for nearest land
+ -- if land is found within view_range, kick off hq_swimto
+ -- otherwise die
+
+function mobkit.hq_swimto(self,prty,tpos)
+ -- swim towards the position tpos, jump if necessary
+ -- returns if standing firmly on dry land
+
+ Aquatic behaviors:
+
+ Macros:
+function aqua_radar_dumb(pos,yaw,range,reverse)
+ -- assumes a mob will avoid shallows
+ -- checks if a pos in front of a moving entity swimmable
+ -- otherwise returns new position
+
+function mobkit.is_in_deep(target)
+ -- checks if an object is in water at least 2 nodes deep
+
+ Hq Behaviors:
+function mobkit.hq_aqua_roam(self,prty,speed)
+function mobkit.hq_aqua_attack(self,prty,tgtobj,speed)
+function mobkit.hq_aqua_turn(self,prty,tyaw,speed)
+ -- used by both previous bhv
+
+2.2.2 Low Level Behaviors --
+
+function mobkit.lq_turn2pos(self,tpos)
+ -- gradually turn towards tpos position
+ -- returns when facing tpos
+
+function mobkit.lq_idle(self,duration)
+ -- do nothing for duration seconds
+ -- set 'stand' animation
+
+function mobkit.lq_dumbwalk(self,dest,speed_factor)
+ -- simply move towards dest
+ -- set 'walk' animation
+
+function mobkit.lq_dumbjump(self,height)
+ -- if standing on the ground, jump in the facing direction
+ -- height is relative to feet level
+ -- set 'stand' animation
+
+function mobkit.lq_freejump(self)
+ -- unconditional jump in the facing direction
+ -- useful e.g for getting out of water
+ -- returns when the apex has been reached
+
+function mobkit.lq_jumpattack(self,height,target)
+ -- jump towards the target, punch if a hit
+ -- returns after punch or on the ground
+
+function mobkit.lq_fallover(self)
+ -- gradually rotates Z = 0 to pi/2
+
+
+2.3 Constants and member variables --
+
+mobkit.gravity = -9.8
+mobkit.friction = 0.4 -- inert entities will slow down when in contact with the ground
+ -- the smaller the number, the greater the effect
+
+self.dtime -- for convenience, dtime as passed to currently executing on_step()
+self.isonground -- true if y velocity is 0 for at least two succesive steps
+self.isinliquid -- true if feet submerged in liquid type=source
diff --git a/games/globo/mods/mobkit/mod.conf b/games/globo/mods/mobkit/mod.conf
new file mode 100644
index 000000000..d1b9d401b
--- /dev/null
+++ b/games/globo/mods/mobkit/mod.conf
@@ -0,0 +1,2 @@
+name = mobkit
+description = Entity API
diff --git a/games/globo/mods/nodes_nature/LICENSE.txt b/games/globo/mods/nodes_nature/LICENSE.txt
new file mode 100644
index 000000000..4596486dc
--- /dev/null
+++ b/games/globo/mods/nodes_nature/LICENSE.txt
@@ -0,0 +1,655 @@
+License of source code
+----------------------
+Copyright (C) 2019 Dokimi
+
+----------------------
+
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ 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.
+
+
+ Copyright (C)
+
+ 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 .
diff --git a/games/globo/mods/nodes_nature/README.txt b/games/globo/mods/nodes_nature/README.txt
new file mode 100644
index 000000000..ba30a806a
--- /dev/null
+++ b/games/globo/mods/nodes_nature/README.txt
@@ -0,0 +1,86 @@
+Exile mod: Nodes Nature
+=============================
+Naturally occurring nodes, and associated phenomena e.g. water movements.
+
+
+Authors of source code
+----------------------
+Dokimi (GPLv3)
+
+dripping_water adapted for Exile from drippingwater by kddekadenz CC0
+
+
+Authors of media (sounds)
+------------------------
+dripping_water 1-3 by kddekadenz CC0
+
+
+mud footstep sounds (http://www.freesound.org/people/dobroide/sounds/16771) copyright (C) 2006 by dobroide, [CC by 3.0]
+
+From Minetest Game Default:
+ Mito551 (sounds) (CC BY-SA 3.0):
+ default_dig_choppy.ogg
+ default_dig_cracky.ogg
+ default_dig_crumbly.1.ogg
+ default_dig_crumbly.2.ogg
+ default_dig_dig_immediate.ogg
+ default_dig_oddly_breakable_by_hand.ogg
+ default_dug_node.1.ogg
+ default_dug_node.2.ogg
+ default_grass_footstep.1.ogg
+ default_grass_footstep.2.ogg
+ default_grass_footstep.3.ogg
+ default_gravel_footstep.1.ogg
+ default_gravel_footstep.2.ogg
+ default_gravel_footstep.3.ogg
+ default_gravel_footstep.4.ogg
+ default_grass_footstep.1.ogg
+ default_place_node.1.ogg
+ default_place_node.2.ogg
+ default_place_node.3.ogg
+ default_place_node_hard.1.ogg
+ default_place_node_hard.2.ogg
+ default_hard_footstep.1.ogg
+ default_hard_footstep.2.ogg
+ default_hard_footstep.3.ogg
+ default_sand_footstep.1.ogg
+ default_sand_footstep.2.ogg
+ default_wood_footstep.1.ogg
+ default_wood_footstep.2.ogg
+ default_dirt_footstep.1.ogg
+ default_dirt_footstep.2.ogg
+ default_glass_footstep.ogg
+
+ AGFX (CC BY 3.0):
+ https://www.freesound.org/people/AGFX/packs/1253/
+ default_water_footstep.1.ogg
+ default_water_footstep.2.ogg
+ default_water_footstep.3.ogg
+ (default_water_footstep.4.ogg is silent)
+
+ blukotek (CC0 1.0):
+ https://www.freesound.org/people/blukotek/sounds/251660/
+ default_dig_snappy.ogg
+
+ Ryding (CC0 1.0):
+ http://freesound.org/people/Ryding/sounds/94337/
+ default_snow_footstep.*.ogg
+
+
+
+
+Authors of media (textures, models)
+------------------------
+Dokimi (CC BY-SA 3.0)
+Jan Wielkiewicz (CC BY-SA 3.0)
+ cobble models (modified boulder by Dokimi)
+ volcanic ash (modified sand, basalt textures by Dokimi)
+
+From Minetest Game Default:
+ Gambit (CC BY-SA 3.0):
+ default_snow.png
+ default_snowball.png
+
+From rubberduck on opengameart (https://opengameart.org/users/rubberduck) CC0:
+ nodes_nature_place_glass.ogg (glass_02.ogg from 100 CC0 SFX pack)
+ nodes_nature_remove_glass.ogg (glass_05.ogg from 100 CC0 SFX pack)
diff --git a/games/globo/mods/nodes_nature/data_plant.lua b/games/globo/mods/nodes_nature/data_plant.lua
new file mode 100644
index 000000000..8d372c132
--- /dev/null
+++ b/games/globo/mods/nodes_nature/data_plant.lua
@@ -0,0 +1,82 @@
+-- Internationalization
+local S = nodes_nature.S
+
+--how long it takes seeds to mature (number of ticks down i.e. timer X bg = time)
+--18000 per season?
+plant_base_growth = 500
+plant_base_timer = 40
+
+
+plantlist = {
+ {"moss", S("Moss"),{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, 1, "snappy", "nodebox", nil, S("Moss Spores"), "nodes_nature_spores.png", plant_base_growth *3, 1, "green"},
+ {"gitiri", "Gitiri", nil, 1.2, "woody_plant", nil, 2, nil, nil, plant_base_growth * 2, 1, "green"},
+ {"sari", "Sari", nil, 1, "fibrous_plant", nil, 2, nil, nil, plant_base_growth *0.5, 1, "yellow"},
+ {"tanai", "Tanai", nil, 1, "fibrous_plant", nil, 4, nil, nil, plant_base_growth*1.5, 1, "crimson"},
+ {"bronach", "Bronach", nil, 1.5, "woody_plant", nil, 3, nil, nil, plant_base_growth * 2, 1, "crimson"},
+ {"thoka", "Thoka", nil, 1, "fibrous_plant", nil, 4, nil, nil, plant_base_growth * 2, 1},
+ {"alaf", "Alaf", nil, 1, "fibrous_plant", nil, 4, nil, nil, plant_base_growth * 2, 1, "yellow"},
+ {"damo", "Damo", nil, 1, "fibrous_plant", nil, 4, nil, nil, plant_base_growth, 1, "green"},
+ {"vansano", "Vansano", nil, 1, "herbaceous_plant", nil, 2, nil, nil, plant_base_growth * 1.2, 1, "green"},
+ {"anperla", "Anperla", nil, 1, "herbaceous_plant", nil, 3, S('Anperla Tuber'), 'nodes_nature_tuber.png', plant_base_growth * 2, 1, "green"},
+ {"tashvish", "Tashvish", nil, 1, "fibrous_plant", nil, 4, nil, nil, plant_base_growth*1.5},
+
+ --artifact
+ {"reshedaar", "Reshedaar", {-0.25, -0.5, -0.25, 0.25, -0.125, 0.25}, 1, "fibrous_plant", "nodebox", nil, S("Reshedaar Spores"), "nodes_nature_spores.png", plant_base_growth *3, 1, "indigo"},
+ {"mahal", "Mahal", {-0.25, -0.5, -0.25, 0.25, -0.125, 0.25}, 1, "woody_plant", "nodebox", nil, S("Mahal Spores"), "nodes_nature_spores.png", plant_base_growth *3, 1},
+--Consumables
+ --drugs
+ {"tikusati", "Tikusati", nil, 1, "herbaceous_plant", nil, 2, nil, nil, plant_base_growth, nil, "yellow"},
+ --toxic
+ {"nebiyi", "Nebiyi", nil, 1, "mushroom", nil, 1, nil, nil, plant_base_growth, 1, "indigo"},
+ {"marbhan", "Marbhan", nil, 1, "mushroom", nil, 2, nil, nil, plant_base_growth*2, 1, "red"},
+ --medicine
+ {"hakimi", "Hakimi", nil, 1, "herbaceous_plant", nil, 0, nil, nil, plant_base_growth * 2, 1, "blue"},
+ {"merki", "Merki", nil, 1, "mushroom", nil, 0, nil, nil, plant_base_growth * 2, 1, "blue"},
+ --food and water
+ {"wiha", "Wiha", nil, 1, "herbaceous_plant", nil, 4, nil, nil, plant_base_growth * 2, 1, "red"},
+ {"zufani", "Zufani", nil, 1, "mushroom", nil, 2, nil, nil, plant_base_growth * 2, 1, "yellow"},
+ {"galanta", "Galanta", nil, 1, "herbaceous_plant", nil, 4, nil, nil, plant_base_growth *0.8, 1, "green"},
+ {"momo", "Momo", nil, 1, "herbaceous_plant", nil, 2, nil, nil, plant_base_growth *2, 1, "red"},
+ --artifact
+ {"lambakap", "Lambakap", {-0.25, -0.5, -0.25, 0.25, -0.125, 0.25}, 1, "mushroom", "nodebox", 0, S("Lambakap Spores"), "nodes_nature_spores.png", plant_base_growth *3, 1, "red"},
+
+}
+
+--Underwater Rooted plants
+searooted_list = {
+ {"kelp",
+ S("Kelp"),
+ {-2/16, 0.5, -2/16, 2/16, 3.5, 2/16},
+ "seaweed", "nodes_nature:gravel_wet_salty",
+ "nodes_nature_gravel.png^nodes_nature_mud.png",
+ nodes_nature.node_sound_gravel_defaults({ dig = {name = "default_dig_snappy", gain = 0.2}, dug = {name = "default_grass_footstep", gain = 0.25},}),
+ 4,6, true},
+ {"seagrass",
+ S("Seagrass"),
+ {-0.4, -0.5, -0.4, 0.4, -0.2, 0.4},
+ "seaweed", "nodes_nature:sand_wet_salty",
+ "nodes_nature_sand.png^nodes_nature_mud.png",
+ nodes_nature.node_sound_dirt_defaults({ dig = {name = "default_dig_snappy", gain = 0.2}, dug = {name = "default_grass_footstep", gain = 0.25},}),
+ 1,1, false},
+ {"sea_lettuce",
+ S("Sea Lettuce"),
+ {-0.4, -0.5, -0.4, 0.4, -0.2, 0.4},
+ "seaweed", "nodes_nature:silt_wet_salty",
+ "nodes_nature_silt.png^nodes_nature_mud.png",
+ nodes_nature.node_sound_dirt_defaults({ dig = {name = "default_dig_snappy", gain = 0.2}, dug = {name = "default_grass_footstep", gain = 0.25},}),
+ 1,1, false}
+
+}
+
+
+tree_base_tree_growth = 31000
+tree_base_leaf_growth = 21000
+tree_base_fruit_growth = 19000
+
+
+tree_list = {
+ {"maraka", S("Maraka Tree"), "maraka_nut", S("Maraka Nut"), 1, {-0.2, 0.2, -0.2, 0.2, 0.5, 0.2},1, 1, "black"},
+ {"tangkal", S("Tangkal Tree"), "tangkal_fruit", S("Tangkal Fruit"), 1, {-0.1, 0.1, -0.1, 0.1, 0.5, 0.1},2, 1, "crimson"},
+ {"sasaran", S("Sasaran Tree"), "sasaran_cone", S("Sasaran Cone"), 1, {-0.1, -0.5, -0.1, 0.1, -0.1, 0.1},2, 1, "yellow"},
+ {"kagum", S("Kagum Tree"), "kagum_pod", S("Kagum Pod"), 1, {-0.1, -0.1, -0.1, 0.1, 0.5, 0.1},2, 1},
+}
diff --git a/games/globo/mods/nodes_nature/data_rock.lua b/games/globo/mods/nodes_nature/data_rock.lua
new file mode 100644
index 000000000..87cfbb741
--- /dev/null
+++ b/games/globo/mods/nodes_nature/data_rock.lua
@@ -0,0 +1,52 @@
+-- Internationalization
+local S = nodes_nature.S
+
+--sedimentary rocks can be deconstructed into sediment, but not reformed
+--sedimentary rocks are of the weakly consolidated soft variety
+
+stone_list = {
+ {"sandstone", S("Sandstone"),3, "sediment", "nodes_nature:sand",},
+ {"siltstone", S("Siltstone"), 3, "sediment", "nodes_nature:silt",},
+ {"claystone", S("Claystone"), 3, "sediment", "nodes_nature:clay",},
+ {"conglomerate", S("Conglomerate"), 3, "sediment", "nodes_nature:gravel",},
+}
+rock_list = {
+ {"limestone", S("Limestone"), 3},
+ {"ironstone", S("Ironstone"), 3},
+ {"granite", S("Granite"), 1},
+ {"basalt", S("Basalt"), 2},
+ {"gneiss", S("Gneiss"), 1},
+ {"jade", S("Jade"), 1},
+
+}
+
+sed_list = {
+ {"sand", S("Sand"), 3, "sand"},
+ {"silt", S("Silt"), 3, "silt" },
+ {"clay", S("Clay"), 2, "clay"},
+ {"gravel", S("Gravel"), 2, "gravel"},
+ {"loam", S("Loam"), 3, "loam"},
+
+
+}
+
+
+soil_list = {
+ {"grassland_soil", S("Grassland Soil"), 2, "clay", "clay"},
+ {"marshland_soil", S("Marshland Soil"), 3, "silt", "silt"},
+ {"duneland_soil", S("Duneland Soil"), 3, "sand", "sand"},
+ {"highland_soil", S("Highland Soil"), 2, "gravel", "gravel"},
+ {"woodland_soil", S("Woodland Soil"), 3, "loam", "loam"},
+ {"grassland_barren_soil", S("Barren Grassland Soil"), 3, "gravel", "gravel"},
+ {"woodland_dry_soil", S("Dry Woodland Soil"), 3, "silt", "silt"},
+
+}
+
+
+agri_soil_list = {
+ {"clay_agricultural_soil", S("Clay Agricultural Soil"), 2, "nodes_nature:clay", "clay"},
+ {"silt_agricultural_soil", S("Silty Agricultural Soil"), 3, "nodes_nature:silt", "silt"},
+ {"sand_agricultural_soil", S("Sandy Agricultural Soil"), 3, "nodes_nature:sand", "sand"},
+ {"gravel_agricultural_soil", S("Stony Agricultural Soil"), 3, "nodes_nature:gravel", "gravel"},
+ {"loam_agricultural_soil", S("Loamy Agricultural Soil"), 3, "nodes_nature:loam", "loam"},
+}
diff --git a/games/globo/mods/nodes_nature/dripping_water.lua b/games/globo/mods/nodes_nature/dripping_water.lua
new file mode 100644
index 000000000..bcda7769a
--- /dev/null
+++ b/games/globo/mods/nodes_nature/dripping_water.lua
@@ -0,0 +1,96 @@
+-------------------------------------------------------------------------
+--Dripping Water
+--underground drinkable water drops
+-------------------------------------------------------------------------
+local random = math.random
+
+--Drop entities
+minetest.register_entity("nodes_nature:drop_water", {
+ hp_max = 2,
+ physical = true,
+ collide_with_objects = false,
+ collisionbox = {-0.05,-0.05,-0.05,0.05,0.05,0.05},
+ visual = "cube",
+ visual_size = {x=0.05, y=0.1},
+ textures = {"nodes_nature_freshwater.png","nodes_nature_freshwater.png","nodes_nature_freshwater.png","nodes_nature_freshwater.png", "nodes_nature_freshwater.png","nodes_nature_freshwater.png"},
+ spritediv = {x=1, y=1},
+ initial_sprite_basepos = {x=0, y=0},
+
+ on_activate = function(self, staticdata)
+ self.object:set_sprite({x=0,y=0}, 1, 1, true)
+ self.object:set_armor_groups({immortal=1})
+ end,
+
+ on_step = function(self, dtime)
+ local k = math.random(1,444)
+ local ownpos = self.object:get_pos()
+
+ if k==1 then
+ self.object:set_acceleration({x=0, y=-5, z=0})
+ end
+
+ if minetest.get_node({x=ownpos.x, y=ownpos.y+0.5, z=ownpos.z}).name == "air" then
+ self.object:set_acceleration({x=0, y=-5, z=0})
+ end
+
+ if minetest.get_node({x=ownpos.x, y=ownpos.y -0.1, z=ownpos.z}).name ~= "air" then
+ self.object:remove()
+ minetest.sound_play({name="nodes_nature_water_drip"}, {pos = ownpos, gain = math.random(0.5,1), max_hear_distance = 12})
+ end
+ end,
+
+ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
+ --drink
+ local meta = puncher:get_meta()
+ if not meta then return end --mobs can punch, but can't drink
+ local pos = puncher:get_pos()
+ local thirst = meta:get_int("thirst")
+ --only drink if thirsty
+ if thirst < 100 then
+
+ local water = math.random(1,10)
+ thirst = thirst + water
+ if thirst > 100 then
+ thirst = 100
+ end
+
+ meta:set_int("thirst", thirst)
+ minetest.sound_play("nodes_nature_slurp", {pos = pos, max_hear_distance = 3, gain = 0.1})
+ self.object:remove()
+
+ --food poisoning
+ if random() < 0.005 then
+ HEALTH.add_new_effect(clicker, {"Food Poisoning", 1})
+ end
+
+ --parasites
+ if random() < 0.001 then
+ HEALTH.add_new_effect(clicker, {"Intestinal Parasites"})
+ end
+
+ end
+ end,
+})
+
+
+--Create drop
+minetest.register_abm({
+ nodenames = {"group:stone", "group:soft_stone"},
+ --neighbors = {"group:water"},
+ interval = 27,
+ chance = 120,
+ action = function(pos)
+
+ if pos.y < 200
+ and pos.y > -1000 then
+ local nb = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
+ if nb == 'air' then
+ local nb2 = minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name
+ if nb2 == 'air' then
+ local i = math.random(-35,35) / 100
+ minetest.add_entity({x=pos.x + i, y=pos.y-0.501, z=pos.z + i}, "nodes_nature:drop_water")
+ end
+ end
+ end
+ end,
+})
diff --git a/games/globo/mods/nodes_nature/flora_spread.lua b/games/globo/mods/nodes_nature/flora_spread.lua
new file mode 100644
index 000000000..a45956348
--- /dev/null
+++ b/games/globo/mods/nodes_nature/flora_spread.lua
@@ -0,0 +1,332 @@
+-------------------------------------------------------------
+--SPREAD PLANTS
+--grow "flora" on sediment in light,
+--grow mushrooms on sediment in darker
+-- cane growth
+--spreading surfaces
+
+nsl = naturalslopeslib
+
+----------------------------------------------------------------
+-- Flora
+--
+
+
+local function flora_spread(pos, node)
+ pos.y = pos.y - 1
+ local under = minetest.get_node(pos)
+ pos.y = pos.y + 1
+
+
+ if minetest.get_item_group(under.name, "sediment") == 0 then
+ return
+ end
+
+ --extreme temps will kill, semi-extreme stop growth
+ local temp = climate.get_point_temp(pos)
+ if temp < -30 or temp > 60 then
+ minetest.remove_node(pos)
+ elseif temp < 0 or temp > 40 then
+ return
+ end
+
+ --cannot grow indoors
+ local light = minimal.get_daylight({x=pos.x, y=pos.y + 1, z=pos.z}, 0.5)
+ if not light or light < 13 then
+ return
+ end
+
+ local pos0 = vector.subtract(pos, 4)
+ local pos1 = vector.add(pos, 4)
+ -- Testing shows that a threshold of 3 results in an appropriate maximum
+ -- density of approximately 7 flora per 9x9 area.
+ if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 3 then
+ return
+ end
+
+ local soils = minetest.find_nodes_in_area_under_air(
+ pos0, pos1, "group:sediment")
+ local num_soils = #soils
+ if num_soils >= 1 then
+ for si = 1, math.min(3, num_soils) do
+ local soil = soils[math.random(num_soils)]
+ local soil_name = minetest.get_node(soil).name
+ local soil_above = {x = soil.x, y = soil.y + 1, z = soil.z}
+ light = minimal.get_daylight(soil_above)
+ if light and light >= 13 and soil_name == under.name then
+ local plant = node.name
+ local seedling_nodedef = minetest.registered_nodes[plant.."_seed"]
+ if not seedling_nodedef then
+ --use adult plant
+ minetest.set_node(soil_above, {name = plant, param2= node.param2})
+ else
+ --use seedling
+ minetest.set_node(soil_above, {name = plant.."_seed"})
+ end
+ end
+ end
+ end
+end
+
+local function undersea_flora_spread(pos, node)
+ local nodedef = minetest.registered_nodes[node.name]
+ local substrate = nodedef.node_dig_prediction
+ local pos0 = vector.subtract(pos, 4)
+ local pos1 = vector.add(pos, 4)
+ -- Testing shows that a threshold of 3 results in an appropriate maximum
+ -- density of approximately 7 flora per 9x9 area.
+ if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 3 then
+ return
+ end
+ pos0 = vector.subtract(pos, {x=4,y=2,z=4})
+ pos1 = vector.add(pos, {x=4,y=2,z=4})
+ --find a random saltwater node
+ local tgts = minetest.find_nodes_in_area(pos0, pos1,
+ "nodes_nature:salt_water_source")
+ if #tgts == 0 then return end
+ local tgt = tgts[math.random(1,#tgts)]
+ -- seek down until we hit the seabed
+ local down = vector.new(0, -1, 0)
+ local under = vector.add(tgt, down)
+ local uname = minetest.get_node(under).name
+ while uname == "nodes_nature:salt_water_source" do
+ tgt = under
+ under = vector.add(tgt, down)
+ uname = minetest.get_node(under).name
+ end
+ if uname ~= substrate then -- it's not the right soil for this plant
+ return
+ end
+ minetest.place_node(tgt, { name = node.name })
+end
+
+---------------
+
+minetest.register_abm({
+ label = "Flora spread",
+ nodenames = {"group:flora"},
+ interval = 260,
+ chance = 60,
+ max_y = 800,
+ min_y = -15,
+ action = function(pos, node)
+ if minetest.get_item_group(node.name, "flora_sea") == 0 then
+ flora_spread(pos, node)
+ else
+ undersea_flora_spread(pos, node)
+ end
+ end,
+})
+
+
+------------------------------------------------------------
+-- Mushrooms
+--
+
+
+-- Mushroom spread
+local function mushroom_spread(pos, node)
+ --don't do for young
+ if minetest.get_item_group(node.name, "seedling") >= 1 then
+ return
+ end
+
+ pos.y = pos.y - 1
+ local under = minetest.get_node(pos)
+ pos.y = pos.y + 1
+
+
+ if minetest.get_item_group(under.name, "sediment") == 0 then
+ return
+ end
+
+ --extreme temps will kill, semi-extreme stop growth
+ local temp = climate.get_point_temp(pos)
+ if temp < -30 or temp > 60 then
+ minetest.remove_node(pos)
+ elseif temp < 0 or temp > 40 then
+ return
+ end
+
+ local positions = minetest.find_nodes_in_area_under_air(
+ {x = pos.x - 1, y = pos.y - 2, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
+ {"group:sediment"})
+
+ if #positions == 0 then
+ return
+ end
+
+ local pos2 = positions[math.random(#positions)]
+ pos2.y = pos2.y + 1
+ if minimal.get_daylight(pos, 0.5) <= 14 and
+ minimal.get_daylight(pos2, 0.5) <= 14 then
+ local plant = node.name
+ local seedling_nodedef = minetest.registered_nodes[plant.."_seed"]
+ if not seedling_nodedef then
+ --use adult plant
+ local nodedef = minetest.registered_nodes[plant]
+ minetest.set_node(pos2, {name = plant, param2= nodedef.place_param2})
+ else
+ --use seedling
+ minetest.set_node(pos2, {name = plant.."_seed"})
+ end
+ end
+end
+
+----------------------
+minetest.register_abm({
+ label = "Mushroom spread",
+ nodenames = {"group:mushroom"},
+ interval = 280,
+ chance = 80,
+ catch_up = true,
+ action = function(...)
+ mushroom_spread(...)
+ end,
+})
+
+
+
+
+---------------------------------
+local function grow_cane(pos, node)
+ pos.y = pos.y - 1
+ local under = minetest.get_node(pos)
+ pos.y = pos.y + 1
+
+ if minetest.get_item_group(under.name, "wet_sediment") ~= 1 then
+ return
+ end
+
+ ---extreme stop growth
+ local temp = climate.get_point_temp(pos)
+ if temp < 10 or temp > 40 then
+ return
+ end
+
+ local plant_name = node.name
+
+ local height = 0
+ while node.name == plant_name and height < 5 do
+ height = height + 1
+ pos.y = pos.y + 1
+ node = minetest.get_node(pos)
+ end
+
+ if height == 5 or node.name ~= "air" then
+ return
+ end
+
+ if minimal.get_daylight(pos) < 13 then
+ return
+ end
+ local nodedef = minetest.registered_nodes[plant_name]
+ minetest.set_node(pos, {name = plant_name, param2= nodedef.place_param2})
+ return true
+end
+
+
+minetest.register_abm({
+ label = "Grow cane",
+ nodenames = {"group:cane_plant"},
+ neighbors = {"group:sediment"},
+ interval = 220,
+ chance = 3,
+ catch_up = true,
+ action = function(...)
+ grow_cane(...)
+ end
+})
+
+
+
+-------------------------------------------------------------
+-- Spreading Surfaces
+--
+
+minetest.register_abm({
+ label = "Surface spread",
+ nodenames = {"group:bare_sediment"},
+ neighbors = {"group:spreading"},
+ interval = 161,
+ min_y = 5,
+ chance = 15,
+ catch_up = false,
+ action = function(pos, node)
+
+ -- Don't spread at night
+ local tod = minetest.get_timeofday()
+ if tod < 0.2 or tod > 0.8 then return end
+
+ local pos_above = {x = pos.x, y = pos.y + 1, z = pos.z}
+ local above_name = minetest.get_node(pos_above).name
+ if ( above_name ~= "air" or minimal.get_daylight(
+ pos_above, 0.5) < 13 ) then
+ return -- This node is in darkness, covered
+ end
+
+ -- Get dry drop so we know what type of base sediment we are
+ local nodedef = minetest.registered_nodes[node.name]
+ local drop = nodedef.drop:gsub("%_wet","")
+ if not nodedef or not drop then
+ return
+ end
+
+ -- Look for correct grass type nearby
+ local positions = minetest.find_nodes_in_area_under_air(
+ {x = pos.x - 1, y = pos.y - 2, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y + 2, z = pos.z + 1},
+ {"group:spreading"})
+
+ if #positions == 0 then
+ return
+ end
+
+ local sourcepos = positions[math.random(#positions)]
+ -- Check against drop
+ local source = minetest.get_node(sourcepos)
+ local sname = nsl.get_regular_node_name(source.name)
+ or source.name -- Ignore natural slopes variations
+ sname = sname:gsub("%_wet","") -- ..and compare dry vs dry!
+
+ local sdef = minetest.registered_nodes[sname]
+ if ( not sdef.drop ) or sdef.drop ~= drop then
+ return -- Wrong grass/dirt type, can't spread here
+ end
+
+ local id = nodedef.groups.natural_slope
+ if id then -- We're a slope, preserve that
+ sname = nsl.get_all_slopes(sname)[id]
+ end
+ if minetest.get_item_group(node.name, "wet_sediment") == 1 then
+ -- Preserve wetness too, sname is always the dry node
+ sname = sname.."_wet"
+ end
+ minetest.set_node(pos, {name = sname, param2 = node.param2})
+ end
+
+})
+
+minetest.register_abm({
+ label = "Remove buried and covered grass",
+ nodenames = {"group:spreading"},
+ interval = 211,
+ chance = 1,
+ catch_up = false,
+ min_y = -30,
+ max_y = 500,
+ action = function(pos, node)
+ local pos_above = {x = pos.x, y = pos.y + 1, z = pos.z}
+ local soil_nodedef = minetest.registered_nodes[node.name]
+ local light_above = minimal.get_daylight(pos_above, 0.5)
+ local toname = soil_nodedef.drop
+ if not light_above or light_above < 10 then
+ local id = soil_nodedef.groups.natural_slope
+ if id then -- We're a slope, preserve that
+ toname = nsl.get_all_slopes(toname)[id]
+ end
+ minetest.set_node(pos, {name = toname, param2 = node.param2})
+ end
+ end
+})
diff --git a/games/globo/mods/nodes_nature/init.lua b/games/globo/mods/nodes_nature/init.lua
new file mode 100644
index 000000000..348e89923
--- /dev/null
+++ b/games/globo/mods/nodes_nature/init.lua
@@ -0,0 +1,32 @@
+nodes_nature = {}
+
+-- Internationalization
+nodes_nature.S = minetest.get_translator("nodes_nature")
+
+-- Load files
+local path = minetest.get_modpath("nodes_nature")
+
+
+--crafting spots
+crafting.register_type("mixing_spot")
+crafting.register_type("threshing_spot")
+crafting.register_type("hammering_block")
+crafting.register_type("chopping_block")
+crafting.register_type("masonry_bench")
+
+--------------------------------
+
+dofile(path.."/sounds.lua")
+dofile(path.."/data_plant.lua")
+dofile(path.."/data_rock.lua")
+
+dofile(path.."/sediment.lua")
+dofile(path.."/rock.lua")
+dofile(path.."/ore.lua")
+dofile(path.."/life.lua")
+dofile(path.."/trees.lua")
+dofile(path.."/liquids.lua")
+
+dofile(path.."/flora_spread.lua")
+dofile(path.."/dripping_water.lua")
+dofile(path.."/moisture_spread.lua")
diff --git a/games/globo/mods/nodes_nature/life.lua b/games/globo/mods/nodes_nature/life.lua
new file mode 100644
index 000000000..cab2cda54
--- /dev/null
+++ b/games/globo/mods/nodes_nature/life.lua
@@ -0,0 +1,1117 @@
+---------------------------------------------------------
+--LIFE
+--living things e.g. plants
+
+--[[param2
+Currently the following meshes are choosable:
+ * 0 = a "x" shaped plant (ordinary plant)
+ * 1 = a "+" shaped plant (just rotated 45 degrees)
+ * 2 = a "*" shaped plant with 3 faces instead of 2
+ * 3 = a "#" shaped plant with 4 faces instead of 2
+ * 4 = a "#" shaped plant with 4 faces that lean
+]]
+
+-- Internationalization
+local S = nodes_nature.S
+
+---------------------------------------
+local random = math.random
+local floor = math.floor
+local c_alpha = minimal.compat_alpha
+
+plant_base_growth = plant_base_growth
+plant_base_timer = plant_base_timer
+crop_rewind = crop_rewind
+exile_add_food_hooks = exile_add_food_hooks
+creative = creative
+wielded_light = wielded_light
+
+---------------------------
+-- Dig upwards
+--
+
+local function dig_up(pos, node, digger)
+ local lnode = wielded_light.get_unlit_node(node)
+ local np = {x = pos.x, y = pos.y + 1, z = pos.z}
+ local unode = wielded_light.get_unlit_node(minetest.get_node(np))
+ local count = 0
+ while lnode.name == unode.name do
+ count = count + 1
+ minetest.set_node(np, {name = "air"})
+ np.y = np.y + 1
+ unode = wielded_light.get_unlit_node(minetest.get_node(np))
+ end
+ if count > 0 then
+ local inv = digger:get_inventory()
+ local leftover = inv:add_item('main',
+ lnode.name.." "..tostring(count))
+ if leftover then minetest.add_item(pos, leftover) end
+ end
+end
+
+
+------------------------------
+-- Seeds/seedling soil timers
+--if the soil quality changes under the seed it will slow/speed the timer
+local function seed_soil_response(pos)
+
+ local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
+ local node_under = minetest.get_node(pos_under).name
+
+ local sediment = minetest.get_item_group(node_under, "sediment")
+ if sediment == 0 then
+ return false
+ end
+
+ local wetness = minetest.get_item_group(node_under, "wet_sediment")
+ local ag_soil = minetest.get_item_group(node_under, "agricultural_soil")
+ local dep_ag_soil = minetest.get_item_group(node_under, "depleted_agricultural_soil")
+
+ local timer_min = plant_base_timer
+
+
+ --apply bonus or penalty by by soil type and wetness
+ if wetness == 1 then
+ --moisture is good
+ timer_min = timer_min * 0.75
+ elseif wetness == 2 then
+ --salt water is very bad
+ timer_min = timer_min * 1000
+ end
+
+ if sediment == 1 then
+ --loam is best
+ timer_min = timer_min * .80
+ elseif sediment == 3 then
+ --silt is nearly as good as loam
+ timer_min = timer_min * .90
+ elseif sediment == 2 then
+ --clay is poor, needs to be broken up; i.e. into ag_soil
+ timer_min = timer_min * 1.50
+ elseif sediment == 4 or sediment == 5 then
+ --sand and gravel are terrible
+ timer_min = timer_min * 1.80
+ end
+
+ if ag_soil == 1 then
+ --cultivation boom
+ timer_min = timer_min * 0.60
+ elseif dep_ag_soil == 1 then
+ --lesser cultivation boom
+ timer_min = timer_min * 0.80
+ end
+
+ local timer_max = timer_min * 1.1
+ return timer_min, timer_max
+end
+
+
+-- Seeds growth
+local function grow_seed(pos, seed_name, plant_name, place_p2, timer_avg, elapsed)
+
+ local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
+ local node_under = minetest.get_node(pos_under)
+ local mushroom = false
+
+ --if not on sediment abort
+ if minetest.get_item_group(node_under.name, "sediment") == 0 then
+ return
+ end
+
+ --cannot grow indoors (unless a mushroom)
+ if minetest.get_item_group(plant_name, "mushroom") == 0 then
+ local light = minimal.get_daylight({x=pos.x, y=pos.y + 1, z=pos.z}, 0.5)
+ if not light or light < 13 then
+ return
+ end
+ else mushroom = true
+ end
+
+ --extreme temps will kill
+ local temp = climate.get_point_temp(pos)
+ if temp < -30 or temp > 60 then
+ minetest.remove_node(pos)
+ return true -- this plant's done
+ end
+
+ --
+ local meta = minetest.get_meta(pos)
+ local growth = meta:get_int("growth")
+ --happens if they fall, no meta is set
+ if growth == 0 then
+ growth = plant_base_growth
+ end
+
+ --We've been away, let's catch up on missing growth
+ if elapsed and elapsed > timer_avg then
+ if pos.y < -15 and temp >= 0 or temp <= 40 then
+ if mushroom then
+ --This is an underground shroom, assume steady temp
+ growth = growth - ( elapsed / timer_avg )
+ else
+ -- underground plant, but we've got light so give it 50%
+ growth = growth - ( elapsed / timer_avg / 2)
+ end
+ else
+ local change = crop_rewind(elapsed, timer_avg, mushroom)
+ if change == -1 then
+ --Exteme heat or cold killed the plant
+ minetest.remove_node(pos)
+ return true
+ end
+ growth = growth - change
+ end
+ end
+
+ --after first cycle turn seeds into seedlings
+ if seed_name ~= nil then
+ if minetest.get_item_group(seed_name, "seed") == 1 then
+ minetest.set_node(pos, {name = plant_name.."_seedling", param2= place_p2})
+ meta:set_int("growth", growth)
+ --return
+ end
+ end
+
+ --semi-extreme temps stop growth
+ if temp < 0 or temp > 40 then
+ return
+ end
+ -- new plant, or grow
+ if growth <= 1 then
+ minetest.set_node(pos, {name = plant_name, param2= place_p2})
+ return true
+ else
+ --still growing
+ --chance to deplete soil
+ if minetest.get_item_group(node_under.name, "agricultural_soil") >= 1 then
+ if math.random()<0.0001 then
+ local deplete_name = node_under.name.."_depleted"
+ minetest.swap_node(pos_under, {name = deplete_name})
+ end
+ end
+ --grow faster in rain
+ if climate.get_rain(pos) then
+ growth = growth - 4
+ if growth < 1 then
+ growth = 1
+ end
+ meta:set_int("growth", growth)
+ else
+ growth = growth - 1
+ if growth < 1 then
+ growth = 1
+ end
+ meta:set_int("growth", growth)
+ end
+ end
+end
+
+---------------------------
+-- Save/restore seedling timers on dig/place
+--
+local on_dig_seedling = function(pos,node, digger)
+ if not digger then return false end
+
+ if minetest.is_protected(pos, digger:get_player_name()) then
+ return false
+ end
+ local meta = minetest.get_meta(pos)
+ local growth = meta:get_int("growth")
+ if not growth then growth = plant_base_growth end
+
+ local new_stack = ItemStack(node.name)
+ local stack_meta = new_stack:get_meta()
+ stack_meta:set_int("growth", growth)
+
+ minetest.remove_node(pos)
+ local player_inv = digger:get_inventory()
+ if player_inv:room_for_item("main", new_stack) then
+ player_inv:add_item("main", new_stack)
+ else
+ minetest.add_item(pos, new_stack)
+ end
+end
+local after_place_seedling = function(pos, placer, itemstack, pointed_thing)
+ local meta = minetest.get_meta(pos)
+ local stack_meta = itemstack:get_meta()
+ local growth = stack_meta:get_int("growth")
+ if growth == 0 then -- new seeds have no meta
+ growth = meta:get_int("growth") -- but it's set on the node already
+ end
+ if not growth then growth = plant_base_growth end
+ meta:set_int("growth", growth)
+end
+
+---------------------------
+-- Prevent placing seed anywhere but sediment
+--
+local on_place_seedling = function(itemstack, placer, pointed_thing)
+ local ground = minetest.get_node(pointed_thing.under)
+ local above = minetest.get_node(pointed_thing.above)
+ if minetest.get_item_group(ground.name,"sediment") == 0
+ or above.name ~= "air" then
+ local udef = minetest.registered_nodes[ground.name]
+ if udef and udef.on_rightclick and
+ not (placer and placer:is_player() and
+ placer:get_player_control().sneak) then
+ return udef.on_rightclick(pointed_thing.under, ground,
+ placer, itemstack,
+ pointed_thing) or itemstack
+ else
+ return itemstack
+ end
+ end
+
+ return minetest.item_place_node(itemstack,placer,pointed_thing)
+end
+
+-------------------------------------------------------------
+--
+--All regular plants
+--
+
+
+plantlist = plantlist
+for i in ipairs(plantlist) do
+ local plantname = plantlist[i][1]
+ local plantdesc = plantlist[i][2]
+ local selbox = plantlist[i][3]
+ local vscale = plantlist[i][4]
+ local type = plantlist[i][5]
+ local draw = plantlist[i][6]
+ local p2 = plantlist[i][7] --param2
+ local seed_desc = plantlist[i][8]
+ local seed_image = plantlist[i][9]
+ local growth = plantlist[i][10] --for seeds
+ local dyecandidate = plantlist[i][11]
+ local dominantcolor = plantlist[i][12]
+
+ if selbox == nil then
+ selbox = {-0.4, -0.5, -0.4, 0.4, -0.2, 0.4}
+ end
+
+ local s = nodes_nature.node_sound_leaves_defaults()
+
+ local g
+ local gs = {snappy = 3, herbaceous_plant = 1, attached_node = 1,
+ flammable = 2, seedling = 1, temp_pass = 1} --seedlings
+ local g_seed = {snappy = 3, dig_immediate = 2, flammable = 2,
+ attached_node = 1, seed = 1, temp_pass = 1}
+
+ if type == "crumbly" then --moss, dirt mat-like things
+ g = {crumbly = 3, herbaceous_plant = 1, falling_node = 1,
+ attached_node = 1, flammable = 5, flora = 1, temp_pass = 1}
+ elseif type == "woody_plant" then
+ g = {choppy = 3, woody_plant = 1, attached_node = 1,
+ flammable = 2, flora = 1, temp_pass = 1}
+ s = nodes_nature.node_sound_wood_defaults()
+ elseif type == "herbaceous_plant" then
+ g = {snappy = 3, herbaceous_plant = 1, attached_node = 1,
+ flammable = 3, flora = 1, temp_pass = 1}
+ elseif type == "fibrous_plant" then
+ g = {snappy = 3, fibrous_plant = 1, attached_node = 1,
+ flammable = 1, flora = 1, temp_pass = 1}
+ elseif type == "mushroom" then
+ g = {snappy = 3, attached_node = 1, flammable = 3,
+ mushroom = 1, temp_pass = 1}
+ gs = {snappy = 3, attached_node = 1, flammable = 3,
+ mushroom = 1, seedling = 1, temp_pass = 1}
+ g_seed = {snappy = 3, attached_node = 1, flammable = 3,
+ mushroom = 1, seed = 1, temp_pass = 1}
+ else
+ g = {snappy = 3, attached_node = 1, flammable = 2,
+ flora = 1, temp_pass = 1}
+ end
+
+ if dyecandidate then
+ g.ncrafting_dye_candidate = dyecandidate
+ else
+ g.ncrafting_dye_candidate = 1
+ end
+
+ --singlenode bushes etc
+ if draw == "nodebox" then
+ minetest.register_node("nodes_nature:"..plantname, {
+ description = plantdesc,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ selbox,
+ },
+ },
+ tiles = {"nodes_nature_"..plantname..".png"},
+ stack_max = minimal.stack_max_medium,
+ paramtype = "light",
+ paramtype2 = "facedir",
+ floodable = true,
+ sunlight_propagates = false,
+ is_ground_content = false,
+ walkable = false,
+ buildable_to = true,
+ groups = g,
+ sounds = s,
+ _ncrafting_dye_dcolor = dominantcolor
+ })
+
+ --seedling
+ minetest.register_node("nodes_nature:"..plantname.."_seedling", {
+ description = S("Young @1", plantdesc),
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.2, -0.5, -0.2, 0.2, -0.3, 0.2},
+ },
+ },
+ tiles = {"nodes_nature_"..plantname..".png"},
+ stack_max = minimal.stack_max_medium,
+ paramtype = "light",
+ paramtype2 = "facedir",
+ floodable = true,
+ sunlight_propagates = true,
+ is_ground_content = false,
+ walkable = false,
+ buildable_to = true,
+ groups = gs,
+ sounds = s,
+ on_construct = function(pos)
+ --set initial timer, growth rate depends on soil
+ local timer_min, timer_max = seed_soil_response(pos)
+ if timer_min then
+ minetest.get_node_timer(pos):start(math.random(timer_min, timer_max))
+ else
+ minetest.get_node_timer(pos):start(plant_base_timer)
+ end
+ end,
+
+ on_timer = function(pos,elapsed)
+ local timer_min, timer_max = seed_soil_response(pos)
+ if not timer_min then
+ if minetest.get_node(pos).name ~= "ignore" then
+ return false -- not on soil anymore? Stop timer
+ else
+ return true -- it's unloaded, skip the timer
+ end
+ end
+ local timer_avg = timer_min + timer_max / 2
+ elapsed = elapsed - timer_max
+ if grow_seed(pos, nil, "nodes_nature:"..plantname, nil, timer_avg, elapsed) then
+ return false -- done
+ else
+ minetest.get_node_timer(pos):start(math.random(timer_min, timer_max))
+ end
+ end,
+ after_place_node = function(pos, placer, itemstack, pointed_thing)
+ after_place_seedling(pos, placer, itemstack, pointed_thing)
+ end,
+ on_dig = function(pos, node, digger)
+ on_dig_seedling(pos, node, digger)
+ end,
+ })
+
+
+ else
+ minetest.register_node("nodes_nature:"..plantname, {
+ description = plantdesc,
+ drawtype = draw or "plantlike",
+ waving = 1,
+ visual_scale = vscale,
+ tiles = {"nodes_nature_"..plantname..".png"},
+ stack_max = minimal.stack_max_medium,
+ inventory_image = "nodes_nature_"..plantname..".png",
+ wield_image = "nodes_nature_"..plantname..".png",
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = p2 or 1,
+ floodable = true,
+ sunlight_propagates = true,
+ walkable = false,
+ buildable_to = true,
+ groups = g,
+ sounds = s,
+ _ncrafting_dye_dcolor = dominantcolor,
+ selection_box = {
+ type = "fixed",
+ fixed = selbox,
+ },
+ })
+
+ --seedling
+ minetest.register_node("nodes_nature:"..plantname.."_seedling", {
+ description = S("Young @1", plantdesc),
+ drawtype = draw or "plantlike",
+ waving = 1,
+ visual_scale = vscale,
+ tiles = {"nodes_nature_"..plantname.."_seedling.png"},
+ inventory_image = "nodes_nature_"..plantname.."_seedling.png",
+ wield_image = "nodes_nature_"..plantname.."_seedling.png",
+ stack_max = minimal.stack_max_medium,
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = p2 or 1,
+ floodable = true,
+ sunlight_propagates = true,
+ walkable = false,
+ buildable_to = true,
+ groups = gs,
+ sounds = s,
+ selection_box = {
+ type = "fixed",
+ fixed = {
+ {-0.2, -0.5, -0.2, 0.2, -0.3, 0.2},
+ },
+ },
+ on_construct = function(pos)
+ --set initial timer, growth rate depends on soil
+ local timer_min, timer_max = seed_soil_response(pos)
+ if timer_min then
+ minetest.get_node_timer(pos):start(math.random(timer_min, timer_max))
+ else
+ minetest.get_node_timer(pos):start(plant_base_timer)
+ end
+ end,
+
+ on_timer = function(pos,elapsed)
+ local timer_min, timer_max = seed_soil_response(pos)
+ if not timer_min then
+ if minetest.get_node(pos).name ~= "ignore" then
+ return false -- not on soil anymore? Stop timer
+ else
+ return true -- it's unloaded, skip the timer
+ end
+ end
+ local timer_avg = timer_min + timer_max / 2
+ elapsed = elapsed - timer_max
+ if grow_seed(pos, nil, "nodes_nature:"..plantname, p2, timer_avg, elapsed) then
+ return
+ else
+ minetest.get_node_timer(pos):start(math.random(timer_min, timer_max))
+ end
+ end,
+ after_place_node = function(pos, placer, itemstack, pointed_thing)
+ after_place_seedling(pos, placer, itemstack, pointed_thing)
+ end,
+ on_dig = function(pos, node, digger)
+ on_dig_seedling(pos, node, digger)
+ end,
+ })
+ end
+
+ minetest.register_craft({
+ type = "fuel",
+ recipe = "nodes_nature:"..plantname,
+ burntime = 1,
+ })
+
+
+ --seeds and spores
+
+ if not seed_image then
+ if type == "mushroom" then
+ seed_image = "nodes_nature_spores.png"
+ else
+ seed_image = "nodes_nature_seeds.png"
+ end
+ end
+
+ if not seed_desc then
+ if type == "mushroom" then
+ seed_desc = S("@1 Spores", plantdesc)
+ else
+ seed_desc = S("@1 Seeds", plantdesc)
+ end
+ end
+
+ minetest.register_node("nodes_nature:"..plantname.."_seed", {
+ description = seed_desc,
+ drawtype = "nodebox",
+ tiles = {seed_image},
+ inventory_image = seed_image,
+ node_box = {
+ type = "fixed",
+ fixed = {-0.3, -0.5, -0.3, 0.3, -0.48, 0.3},
+ },
+ stack_max = minimal.stack_max_light,
+ use_texture_alpha = c_alpha.clip,
+ paramtype = "light",
+ floodable = true,
+ sunlight_propagates = true,
+ is_ground_content = false,
+ walkable = false,
+ buildable_to = true,
+ groups = g_seed,
+ sounds = nodes_nature.node_sound_defaults(),
+ on_construct = function(pos)
+ --duration of growth, per species
+ local meta = minetest.get_meta(pos)
+ meta:set_int("growth", growth)
+ --set initial timer, growth rate depends on soil
+ local timer_min, timer_max = seed_soil_response(pos)
+ if timer_min then
+ minetest.get_node_timer(pos):start(math.random(timer_min, timer_max))
+ else
+ minetest.get_node_timer(pos):start(plant_base_timer)
+ end
+ end,
+
+ on_timer = function(pos,elapsed)
+ local timer_min, timer_max = seed_soil_response(pos)
+ if not timer_min then
+ if minetest.get_node(pos).name ~= "ignore" then
+ return false -- not on soil anymore? Stop timer
+ else
+ return true -- it's unloaded, skip the timer
+ end
+ end
+ local timer_avg = timer_min + timer_max / 2
+ elapsed = elapsed - timer_max
+ if grow_seed(pos, "nodes_nature:"..plantname.."_seed", "nodes_nature:"..plantname,
+ p2, timer_avg, elapsed) then
+ return
+ else
+ minetest.get_node_timer(pos):start(math.random(timer_min, timer_max))
+ end
+ end,
+ after_place_node = function(pos, placer, itemstack, pointed_thing)
+ after_place_seedling(pos, placer, itemstack, pointed_thing)
+ end,
+ on_dig = function(pos, node, digger)
+ on_dig_seedling(pos, node, digger)
+ end,
+ on_place = function(itemstack, placer, pointed_thing)
+ return on_place_seedling(itemstack, placer, pointed_thing)
+ end,
+ })
+
+
+ --extract seeds
+ crafting.register_recipe({
+ type = "threshing_spot",
+ output = "nodes_nature:"..plantname.."_seed 6",
+ items = {"nodes_nature:"..plantname},
+ level = 1,
+ always_known = true,
+ })
+
+ exile_add_food_hooks("nodes_nature:"..plantname.."_seed")
+ exile_add_food_hooks("nodes_nature:"..plantname)
+
+
+end
+
+-----------------------------------------
+---CANES
+
+minetest.register_node("nodes_nature:gemedi", {
+ description = "Gemedi",
+ drawtype = "plantlike",
+ tiles = {"nodes_nature_gemedi.png"},
+ inventory_image = "nodes_nature_gemedi.png",
+ wield_image = "nodes_nature_gemedi.png",
+ stack_max = minimal.stack_max_medium,
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = 2,
+ sunlight_propagates = true,
+ walkable = false,
+ --floodable = true,
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
+ },
+ groups = {snappy = 3, fibrous_plant = 1, flammable = 1, flora = 1,
+ cane_plant = 1, temp_pass = 1, ncrafting_dye_candidate = 1},
+ sounds = nodes_nature.node_sound_leaves_defaults(),
+ _ncrafting_dye_dcolor = "yellow",
+
+ after_dig_node = function(pos, node, metadata, digger)
+ dig_up(pos, node, digger)
+ end,
+})
+
+minetest.register_node("nodes_nature:cana", {
+ description = S("Cana"),
+ drawtype = "plantlike",
+ tiles = {"nodes_nature_cana.png"},
+ inventory_image = "nodes_nature_cana.png",
+ wield_image = "nodes_nature_cana.png",
+ stack_max = minimal.stack_max_medium,
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = 2,
+ sunlight_propagates = true,
+ walkable = false,
+ --floodable = true,
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
+ },
+ groups = {snappy = 3, fibrous_plant = 1, flammable = 1, flora = 1, cane_plant = 1, temp_pass = 1},
+ sounds = nodes_nature.node_sound_leaves_defaults(),
+
+ after_dig_node = function(pos, node, metadata, digger)
+ dig_up(pos, node, digger)
+ end,
+})
+
+minetest.register_node("nodes_nature:tiken", {
+ description = "Tiken",
+ drawtype = "plantlike",
+ tiles = {"nodes_nature_tiken.png"},
+ inventory_image = "nodes_nature_tiken.png",
+ wield_image = "nodes_nature_tiken.png",
+ stack_max = minimal.stack_max_medium,
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = 2,
+ sunlight_propagates = true,
+ walkable = false,
+ damage_per_second = 1,
+ climbable = true,
+ --floodable = true,
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
+ },
+ groups = {choppy = 3, woody_plant = 1, flammable = 1, flora = 1,
+ cane_plant = 1, temp_pass = 1, ncrafting_dye_candidate = 1},
+ sounds = nodes_nature.node_sound_wood_defaults(),
+
+ after_dig_node = function(pos, node, metadata, digger)
+ dig_up(pos, node, digger)
+ end,
+})
+
+
+----------------------------------------------------------------------
+--SEA LIFE
+
+local function rooted_place(itemstack, placer, pointed_thing, node_name, substrate_name, height_min, height_max)
+ -- Call on_rightclick if the pointed node defines it
+ if pointed_thing.type == "node" and placer and
+ not placer:get_player_control().sneak then
+ local node_ptu = minetest.get_node(pointed_thing.under)
+ local def_ptu = minetest.registered_nodes[node_ptu.name]
+ if def_ptu and def_ptu.on_rightclick then
+ return def_ptu.on_rightclick(pointed_thing.under, node_ptu, placer,
+ itemstack, pointed_thing)
+ end
+ end
+
+ local pos = pointed_thing.under
+ if minetest.get_node(pos).name ~= substrate_name then
+ return itemstack
+ end
+
+ local height = math.random(height_min, height_max)
+ local pos_top = {x = pos.x, y = pos.y + height, z = pos.z}
+ local node_top = minetest.get_node(pos_top)
+ local def_top = minetest.registered_nodes[node_top.name]
+ local player_name = ""
+ if placer then
+ player_name = placer:get_player_name()
+ end
+
+ if def_top and def_top.liquidtype == "source" and
+ minetest.get_item_group(node_top.name, "water") > 0 then
+ if not minetest.is_protected(pos, player_name) and
+ not minetest.is_protected(pos_top, player_name) then
+ minetest.swap_node(pos, {name = node_name,
+ param2 = height * 16})
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(player_name)) then
+ itemstack:take_item()
+ end
+ else
+ minetest.chat_send_player(player_name, "Node is protected")
+ minetest.record_protection_violation(pos, player_name)
+ end
+ end
+
+ return itemstack
+end
+
+
+
+--Underwater Rooted plants
+
+searooted_list = searooted_list
+for i in ipairs(searooted_list) do
+ local name = searooted_list[i][1]
+ local desc = searooted_list[i][2]
+ local selbox = searooted_list[i][3]
+ local type = searooted_list[i][4]
+ local substrate = searooted_list[i][5]
+ local substrate_tile = searooted_list[i][6]
+ local sound_table = searooted_list[i][7]
+ local height_min = searooted_list[i][8]
+ local height_max = searooted_list[i][9]
+ local pillar = searooted_list[i][10]
+ local dyecandidate = searooted_list[i][11]
+ local dominantcolor = searooted_list[i][12] or "green"
+
+ local g = {snappy = 3, flora = 1, flora_sea = 1}
+ --use seaweed as fertilizer
+ if type == "seaweed" then
+ g.fertilizer = 1
+ end
+
+ if dyecandidate then
+ g.ncrafting_dye_candidate = dyecandidate
+ else
+ g.ncrafting_dye_candidate = 1
+ end
+
+ if pillar then
+ minetest.register_node("nodes_nature:"..name, {
+ description = desc,
+ drawtype = "plantlike_rooted",
+ waving = 1,
+ tiles = {substrate_tile},
+ special_tiles = {{name = "nodes_nature_"..name..".png", tileable_vertical = true}},
+ inventory_image = "nodes_nature_"..name..".png",
+ paramtype = "light",
+ paramtype2 = "leveled",
+ groups = g,
+ selection_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
+ selbox,
+ },
+ },
+ stack_max = minimal.stack_max_medium,
+ node_dig_prediction = substrate,
+ node_placement_prediction = "",
+ sounds = sound_table,
+ _ncrafting_dye_dcolor = dominantcolor,
+
+ on_place = function(itemstack, placer, pointed_thing)
+ return rooted_place(itemstack, placer, pointed_thing, "nodes_nature:"..name, substrate, height_min, height_max)
+ end,
+
+ after_destruct = function(pos, oldnode)
+ minetest.swap_node(pos, {name = substrate})
+ end
+ })
+
+ else
+ minetest.register_node("nodes_nature:"..name, {
+ description = desc,
+ drawtype = "plantlike_rooted",
+ waving = 1,
+ tiles = {substrate_tile},
+ special_tiles = {{name = "nodes_nature_"..name..".png", tileable_vertical = true}},
+ inventory_image = "nodes_nature_"..name..".png",
+ paramtype = "light",
+ groups = g,
+ selection_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
+ selbox,
+ },
+ },
+ stack_max = minimal.stack_max_medium,
+ node_dig_prediction = substrate,
+ node_placement_prediction = "",
+ sounds = sound_table,
+ _ncrafting_dye_dcolor = dominantcolor,
+
+ on_place = function(itemstack, placer, pointed_thing)
+ return rooted_place(itemstack, placer, pointed_thing, "nodes_nature:"..name, substrate, height_min, height_max)
+ end,
+
+ after_destruct = function(pos, oldnode)
+ minetest.swap_node(pos, {name = substrate})
+ end,
+ })
+ end
+ exile_add_food_hooks("nodes_nature:"..name)
+
+end
+
+--exile_experimental plants, need Exile v4 biomes to spawn?
+minetest.register_node("nodes_nature:chalin", {
+ description = "Chalin",
+ drawtype = "plantlike",
+ tiles = {"nodes_nature_chalin.png"},
+ inventory_image = "nodes_nature_chalin.png",
+ wield_image = "nodes_nature_chalin.png",
+ stack_max = minimal.stack_max_medium,
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = 2,
+ sunlight_propagates = true,
+ walkable = false,
+ climbable = true,
+ --floodable = true,
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
+ },
+ groups = {choppy = 3, woody_plant = 1, flammable = 1,
+ flora = 1, cane_plant = 1, temp_pass = 1,
+ ncrafting_dye_candidate = 1},
+ sounds = nodes_nature.node_sound_wood_defaults(),
+
+ on_place = function(itemstack, placer, pointed_thing)
+ local under = pointed_thing.under
+ local node = minetest.get_node(under)
+ local udef = minetest.registered_nodes[node.name]
+
+ if node.name == "nodes_nature:chalin" then
+ return
+ end
+ -- Run any on_rightclick function of pointed node
+ if udef and udef.on_rightclick and
+ not (placer and placer:is_player() and
+ placer:get_player_control().sneak) then
+ return udef.on_rightclick(under, node, placer,
+ itemstack, pointed_thing) or itemstack
+ end
+
+ local face = vector.direction(pointed_thing.above,
+ pointed_thing.under)
+ if face.y == -1 then
+ minetest.item_place_node(itemstack, placer,
+ pointed_thing)
+ return itemstack
+ else
+ return itemstack
+ end
+ end,
+ after_dig_node = function(pos, node, metadata, digger)
+ dig_up(pos, node, digger)
+ end,
+})
+
+--a bit experimental, doesn't reproduce
+minetest.register_node("nodes_nature:glow_worm", {
+ description = S("Glow Worm"),
+ drawtype = "plantlike",
+ waving = 1,
+ visual_scale = 1,
+ light_source = 2,
+ tiles = {"nodes_nature_glow_worm.png"},
+ stack_max = minimal.stack_max_medium,
+ inventory_image = "nodes_nature_glow_worm.png",
+ wield_image = "nodes_nature_glow_worm.png",
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = 3,
+ floodable = true,
+ sunlight_propagates = true,
+ walkable = false,
+ buildable_to = true,
+ groups = {snappy = 3, flammable = 5, temp_pass = 1, bioluminescent = 1},
+ sounds = nodes_nature.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.3, 0.5, -0.3, 0.3, 0.35, 0.3},
+ floodable = true,
+ sunlight_propagates = true,
+ walkable = false,
+ buildable_to = true,
+ groups = {snappy = 3, flammable = 5, temp_pass = 1, bioluminescent = 1},
+ sounds = nodes_nature.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.3, 0.5, -0.3, 0.3, 0.35, 0.3},
+ },
+ },
+})
+
+
+----------------------------------------------
+--Extra effects
+
+--glowing mushroom
+minetest.override_item("nodes_nature:merki",{
+ light_source = 2,
+ groups = {snappy = 3, attached_node = 1, flammable = 3, mushroom = 1, temp_pass = 1, bioluminescent= 1}
+})
+
+
+-- tuber
+minetest.override_item("nodes_nature:anperla_seed",{
+ tiles = {'nodes_nature_silt.png'},
+ node_box = {
+ type = "fixed",
+ fixed = {-0.15, -0.5, -0.15, 0.15, -0.35, 0.15},
+ },
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.15, -0.5, -0.15, 0.15, -0.35, 0.15},
+ },
+ stack_max = minimal.stack_max_medium,
+ walkable = true,
+})
+
+--marbhan has a Neurotoxin
+minetest.override_item("nodes_nature:marbhan",{
+ on_use = function(itemstack, user, pointed_thing)
+ --Similar to hemlock, which tastes musty or like mouse urine
+ minetest.chat_send_player(user:get_player_name(),
+ "This plant has a foul musty flavor.")
+ --food poisoning
+ if random() < 0.001 then
+ HEALTH.add_new_effect(user, {"Food Poisoning", 1})
+ end
+
+ --toxin
+ if random() < 0.75 then
+ HEALTH.add_new_effect(user, {"Neurotoxicity", floor(random(1,4))})
+ end
+
+ --hp_change, thirst_change, hunger_change, energy_change, temp_change, replace_with_item
+ return HEALTH.use_item(itemstack, user, 0, 0, 1, -10, 0)
+ end,
+})
+
+
+--nebiyi has a Hepatotoxin
+minetest.override_item("nodes_nature:nebiyi",{
+ on_use = function(itemstack, user, pointed_thing)
+ --Flowers look a bit like oleander; it causes intense stomach pain
+ minetest.chat_send_player(user:get_player_name(),
+ "Your stomach hurts terribly.")
+ --food poisoning
+ if random() < 0.001 then
+ HEALTH.add_new_effect(user, {"Food Poisoning", 1})
+ end
+
+ --toxin
+ if random() < 0.75 then
+ HEALTH.add_new_effect(user, {"Hepatotoxicity", floor(random(1,4))})
+ end
+
+ --hp_change, thirst_change, hunger_change, energy_change, temp_change, replace_with_item
+ return HEALTH.use_item(itemstack, user, 0, 0, 1, -10, 0)
+ end,
+})
+
+
+--hakimi is antibacterial, antifungal
+minetest.override_item("nodes_nature:hakimi",{
+ on_use = function(itemstack, user, pointed_thing)
+
+ --only cure mild
+ if random()<0.75 then
+ HEALTH.remove_new_effect(user, {"Food Poisoning", 1})
+ HEALTH.remove_new_effect(user, {"Fungal Infection", 1})
+ HEALTH.remove_new_effect(user, {"Dust Fever", 1})
+ end
+
+ --hp_change, thirst_change, hunger_change, energy_change, temp_change, replace_with_item
+ return HEALTH.use_item(itemstack, user, 1, 0, 0, -10, 0)
+ end,
+})
+
+--merki is anti-parasitic
+minetest.override_item("nodes_nature:merki",{
+ on_use = function(itemstack, user, pointed_thing)
+
+ if random()<0.15 then
+ HEALTH.remove_new_effect(user, {"Intestinal Parasites"})
+ end
+
+
+ --hp_change, thirst_change, hunger_change, energy_change, temp_change, replace_with_item
+ return HEALTH.use_item(itemstack, user, 1, 0, 0, -10, 0)
+ end,
+})
+
+
+
+
+--------------------------------------
+--lambakap. is also a mushroom.
+--slow growing food and water source, main crop for longterm underground living.
+minetest.override_item("nodes_nature:lambakap",{
+ light_source = 2,
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.125, -0.5, -0.125, 0.125, -0.375, 0.125},
+ {-0.1875, -0.375, -0.1875, 0.1875, -0.1875, 0.1875},
+ {-0.1875, -0.1875, -0.1875, -0.0625, 0, 0.1875},
+ {0.0625, -0.1875, -0.1875, 0.1875, 0, 0.1875},
+ {-0.0625, -0.1875, -0.1875, 0.0625, 0, -0.0625},
+ {-0.0625, -0.1875, 0.0625, 0.0625, 0, 0.1875},
+ }
+ },
+ groups = {snappy = 3, mushroom = 1, falling_node = 1,
+ attached_node = 1, flammable = 6, flora = 1,
+ temp_pass = 1, bioluminescent = 1}
+})
+
+--reshedaar. is also a mushroom.
+--slow growing fibre mushroom, main fibre crop for longterm underground living.
+--(can't be bioluminescent or conflicts with recipe)
+minetest.override_item("nodes_nature:reshedaar",{
+ --light_source = 2,
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.125, -0.5, -0.125, 0.125, -0.25, 0.125}, -- NodeBox1
+ {-0.0625, -0.5, -0.1875, 0.0625, -0.0625, -0.125}, -- NodeBox2
+ {-0.0625, -0.5, 0.125, 0.0625, -0.0625, 0.1875}, -- NodeBox3
+ {-0.1875, -0.5, -0.0625, -0.125, -0.0625, 0.0625}, -- NodeBox4
+ {0.125, -0.5, -0.0625, 0.1875, -0.0625, 0.0625}, -- NodeBox5
+ {-0.125, -0.25, -0.125, -0.0625, 0.4375, -0.0625}, -- NodeBox9
+ {-0.125, -0.25, 0.0625, -0.0625, 0.3125, 0.125}, -- NodeBox10
+ {0.0625, -0.25, -0.125, 0.125, 0.3125, -0.0625}, -- NodeBox11
+ {0.0625, -0.25, 0.0625, 0.125, 0.4375, 0.125}, -- NodeBox12
+ }
+ },
+ groups = {snappy = 3, mushroom = 1, fibrous_plant = 1,
+ falling_node = 1, attached_node = 1,
+ flammable = 2, flora = 1, temp_pass = 1}
+})
+
+--Mahal. is also a mushroom.
+--slow growing woody mushroom, main stick crop for longterm underground living.
+minetest.override_item("nodes_nature:mahal",{
+ light_source = 2,
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.125, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1
+ {-0.0625, -0.3125, -0.0625, 0.0625, 0.3125, 0.0625}, -- NodeBox2
+ {-0.125, 0.375, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
+ {-0.1875, 0.3125, -0.1875, 0.1875, 0.375, 0.1875}, -- NodeBox4
+ }
+ },
+ groups = {snappy = 3, mushroom = 1, woody_plant = 1,
+ falling_node = 1, attached_node = 1, flammable = 2,
+ flora = 1, temp_pass = 1, bioluminescent = 1}
+})
+
+--------------------------------
+--Bulk recipes
+
+--page spacing
+for i = 1,3,1 do
+crafting.register_recipe({
+ type = "threshing_spot",
+ output = "",
+ items = {},
+ level = 1,
+ always_known = true,
+})
+end
+
+
+--bulk recipes x4 use 4 -> 24 here because anperla tuber has medium bulk = 24
+for i in ipairs(plantlist) do
+ local plantname = plantlist[i][1]
+ crafting.register_recipe({
+ type = "threshing_spot",
+ output = "nodes_nature:"..plantname.."_seed 24",
+ items = {"nodes_nature:"..plantname.." 4"},
+ level = 1,
+ always_known = true,
+ })
+end
diff --git a/games/globo/mods/nodes_nature/liquids.lua b/games/globo/mods/nodes_nature/liquids.lua
new file mode 100644
index 000000000..8ad0f3a3d
--- /dev/null
+++ b/games/globo/mods/nodes_nature/liquids.lua
@@ -0,0 +1,529 @@
+---------------------------------------------------------
+--LIQUIDS
+--
+
+-- Internationalization
+local S = nodes_nature.S
+
+local ran = math.random
+
+local c_alpha = minimal.compat_alpha
+
+--Water
+local list = {
+ {"salt_water", S("Salt Water"), 2, 230, 140, true},
+ {"freshwater", S("Freshwater"), 1, 180, 100, false},
+
+}
+
+
+for i in ipairs(list) do
+ local name = list[i][1]
+ local desc = list[i][2]
+ local water_g = list[i][3]
+ local alpha = c_alpha.blend -- list[i][4]
+ local post_alpha = list[i][5]
+ local renew = list[i][6]
+
+
+
+
+
+ minetest.register_node("nodes_nature:"..name.."_source", {
+ description = S("@1 Source", desc),
+ drawtype = "liquid",
+ tiles = {
+ {
+ name = "nodes_nature_"..name.."_source_animated.png",
+ backface_culling = false,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 2.0,
+ },
+ },
+ {
+ name = "nodes_nature_"..name.."_source_animated.png",
+ backface_culling = true,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 2.0,
+ },
+ },
+ },
+ use_texture_alpha = alpha,
+ paramtype = "light",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drop = "",
+ drowning = 1,
+ liquidtype = "source",
+ liquid_alternative_flowing = "nodes_nature:"..name.."_flowing",
+ liquid_alternative_source = "nodes_nature:"..name.."_source",
+ liquid_viscosity = 1,
+ liquid_range = 2,
+ liquid_renewable = renew,
+ post_effect_color = {a = post_alpha, r = 30, g = 60, b = 90},
+ groups = {water = water_g, cools_lava = 1, puts_out_fire = 1, falling_node = 1, float = 1},
+ sounds = nodes_nature.node_sound_water_defaults(),
+ })
+
+
+ minetest.register_node("nodes_nature:"..name.."_flowing", {
+ description = S("@1 Flowing", desc),
+ drawtype = "flowingliquid",
+ tiles = {"nodes_nature_"..name..".png"},
+ special_tiles = {
+ {
+ name = "nodes_nature_"..name.."_flowing_animated.png",
+ backface_culling = false,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 0.8,
+ },
+ },
+ {
+ name = "nodes_nature_"..name.."_flowing_animated.png",
+ backface_culling = true,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 0.8,
+ },
+ },
+ },
+ use_texture_alpha = alpha,
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ liquid_move_physics = false,
+ move_resistance = 0,
+ drop = "",
+ drowning = 1,
+ liquidtype = "flowing",
+ liquid_range = 2,
+ liquid_alternative_flowing = "nodes_nature:"..name.."_flowing",
+ liquid_alternative_source = "nodes_nature:"..name.."_source",
+ liquid_viscosity = 1,
+ liquid_renewable = renew,
+ post_effect_color = {a = post_alpha, r = 30, g = 60, b = 90},
+ groups = {water = water_g, not_in_creative_inventory = 1, puts_out_fire = 1, cools_lava = 1},
+ sounds = nodes_nature.node_sound_water_defaults(),
+ })
+
+end
+
+
+
+-----------------------------
+--Drink Liquids with weild hand
+
+--make freshwater drinkable on click
+minetest.override_item("nodes_nature:freshwater_source",{
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ if (type(clicker) ~= "nil") then
+ local meta = clicker:get_meta()
+ local thirst = meta:get_int("thirst")
+ --only drink if thirsty
+ if thirst < 100 then
+
+ local water = 100
+ thirst = thirst + water
+ if thirst > 100 then
+ thirst = 100
+ end
+
+ meta:set_int("thirst", thirst)
+ --remove so don't get infinity water supply
+ minetest.set_node(pos, {name = "air"})
+ minetest.sound_play("nodes_nature_slurp", {pos = pos, max_hear_distance = 3, gain = 0.25})
+
+ --food poisoning
+ local c = 0.005
+ --parasites
+ local c2 = 0.005
+
+ --disease chance worse if water in a bad place (e.g. a muddy hole)
+ local bad = minetest.find_node_near(pos, 1, {"group:sediment"})
+ if bad then
+ c = 0.15
+ c2 = 0.15
+ end
+
+ --food poisoning
+ if ran() < c then
+ HEALTH.add_new_effect(clicker, {"Food Poisoning", 1})
+ end
+
+ --parasites
+ if ran() < c2 then
+ HEALTH.add_new_effect(clicker, {"Intestinal Parasites"})
+ end
+ end
+ end
+ end
+})
+
+minetest.override_item("nodes_nature:salt_water_source",{
+ color = "#90ff95",
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ if (type(clicker) ~= "nil") then
+ minetest.chat_send_player(clicker:get_player_name(),
+ "Salt water is not safe to drink.")
+ end
+ end
+})
+
+minetest.override_item("nodes_nature:salt_water_flowing",{
+ color = "#99ff95",
+})
+
+----------------------------------------------------------
+--SNOW AND ICE (yes I know this isn't a liquid...in this state)
+
+--Snow
+
+minetest.register_node("nodes_nature:snow", {
+ description = S("Snow"),
+ tiles = {"nodes_nature_snow.png"},
+ stack_max = minimal.stack_max_bulky *2,
+ paramtype = "light",
+ buildable_to = true,
+ floodable = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+ },
+ temp_effect = -2,
+ temp_effect_max = 0,
+ groups = {crumbly = 3, falling_node = 1, temp_effect = 1, temp_pass = 1,
+ puts_out_fire = 1, fall_damage_add_percent = -25,
+ edible = 1},
+ sounds = nodes_nature.node_sound_snow_defaults(),
+ on_rightclick = function (pos,node,clicker,itemstack,pointed_thing)
+ return minimal.slabs_combine(pos,node,itemstack,'nodes_nature:snow_block')
+ end,
+})
+
+minetest.register_node("nodes_nature:snow_block", {
+ description = S("Snow Block"),
+ tiles = {"nodes_nature_snow.png"},
+ stack_max = minimal.stack_max_bulky,
+ temp_effect = -4,
+ temp_effect_max = 0,
+ groups = {crumbly = 3, falling_node = 1, temp_effect = 1,
+ puts_out_fire = 1, cools_lava = 1, fall_damage_add_percent = -50,
+ edible = 1,
+ },
+ sounds = nodes_nature.node_sound_snow_defaults(),
+})
+
+
+crafting.register_recipe({
+ type = "mixing_spot",
+ output = "nodes_nature:snow_block",
+ items = {"nodes_nature:snow 2"},
+ level = 1,
+ always_known = true,
+})
+
+crafting.register_recipe({
+ type = "mixing_spot",
+ output = "nodes_nature:snow 2",
+ items = {"nodes_nature:snow_block"},
+ level = 1,
+ always_known = true,
+})
+
+crafting.register_recipe({
+ type = "mixing_spot",
+ output = "nodes_nature:snow_block 2",
+ items = {"nodes_nature:ice"},
+ level = 1,
+ always_known = true,
+})
+
+crafting.register_recipe({
+ type = "mixing_spot",
+ output = "nodes_nature:ice",
+ items = {"nodes_nature:snow_block 2"},
+ level = 1,
+ always_known = true,
+})
+
+--ice
+minetest.register_node("nodes_nature:ice", {
+ description = S("Ice"),
+ tiles = {"nodes_nature_ice.png"},
+ stack_max = minimal.stack_max_bulky,
+ paramtype = "light",
+ use_texture_alpha = c_alpha.blend,
+ temp_effect = -4,
+ temp_effect_max = 0,
+ groups = {cracky = 3, crumbly = 1, cools_lava = 1, puts_out_fire = 1, slippery = 3, temp_effect = 1},
+ sounds = nodes_nature.node_sound_snow_defaults(),
+})
+
+
+--sea ice
+--for thawing, so it turns back into salt water
+minetest.register_node("nodes_nature:sea_ice", {
+ description = S("Sea Ice"),
+ tiles = {"nodes_nature_ice.png"},
+ paramtype = "light",
+ drop = "nodes_nature:ice",
+ use_texture_alpha = c_alpha.blend,
+ temp_effect = -4,
+ temp_effect_max = 0,
+ groups = {cracky = 3, crumbly = 1, cools_lava = 1, puts_out_fire = 1, slippery = 3, temp_effect = 1},
+ sounds = nodes_nature.node_sound_snow_defaults(),
+})
+
+
+--------------------------------------------------------------------
+--LAVA
+local lava_light = 12
+local lava_temp_effect = 60
+local lava_heater = 1100
+
+minetest.register_node("nodes_nature:lava_source", {
+ description = S("Lava Source"),
+ drawtype = "liquid",
+ tiles = {
+ {
+ name = "nodes_nature_lava_source_animated.png",
+ backface_culling = false,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 3.0,
+ },
+ },
+ {
+ name = "nodes_nature_lava_source_animated.png",
+ backface_culling = true,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 3.0,
+ },
+ },
+ },
+ paramtype = "light",
+ light_source = lava_light,
+ temp_effect = lava_temp_effect,
+ temp_effect_max = lava_heater,
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drop = "",
+ drowning = 1,
+ liquidtype = "source",
+ liquid_alternative_flowing = "nodes_nature:lava_flowing",
+ liquid_alternative_source = "nodes_nature:lava_source",
+ liquid_viscosity = 7,
+ liquid_renewable = false,
+ damage_per_second = 4 * 2,
+ post_effect_color = {a = 191, r = 255, g = 64, b = 0},
+ groups = {igniter = 1, temp_effect = 1, temp_pass = 1},
+})
+
+minetest.register_node("nodes_nature:lava_flowing", {
+ description = S("Flowing Lava"),
+ drawtype = "flowingliquid",
+ tiles = {"nodes_nature_lava.png"},
+ special_tiles = {
+ {
+ name = "nodes_nature_lava_flowing_animated.png",
+ backface_culling = false,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 3.3,
+ },
+ },
+ {
+ name = "nodes_nature_lava_flowing_animated.png",
+ backface_culling = true,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 3.3,
+ },
+ },
+ },
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ light_source = lava_light,
+ temp_effect = lava_temp_effect,
+ temp_effect_max = lava_heater,
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ drop = "",
+ drowning = 1,
+ liquidtype = "flowing",
+ liquid_alternative_flowing = "nodes_nature:lava_flowing",
+ liquid_alternative_source = "nodes_nature:lava_source",
+ liquid_viscosity = 7,
+ liquid_renewable = false,
+ damage_per_second = 4 * 2,
+ post_effect_color = {a = 191, r = 255, g = 64, b = 0},
+ groups = {igniter = 1, not_in_creative_inventory = 1, temp_effect = 1, temp_pass = 1},
+})
+
+
+--
+-- Lavacooling, moving
+--
+
+--cool when next to a cooling node
+local cool_lava = function(pos, node)
+ minetest.set_node(pos, {name = "nodes_nature:basalt"})
+ minetest.sound_play("nodes_nature_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
+end
+
+minetest.register_abm({
+ label = "Lava cooling",
+ nodenames = {"nodes_nature:lava_source", "nodes_nature:lava_flowing"},
+ neighbors = {"group:cools_lava"},
+ interval = 10,
+ chance = 3,
+ catch_up = false,
+ action = function(...)
+ cool_lava(...)
+ end,
+})
+
+-----
+-----
+
+--plumes
+local erupt = function(pos, aname)
+ local height = 0
+ --erupt
+ while (aname == "air" or aname == "climate:air_temp") and height < 7 do
+ if ran()<0.8 then
+ height = height + 1
+ pos.y = pos.y + 1
+ minetest.set_node(pos, {name = "nodes_nature:lava_flowing"})
+ minetest.sound_play("nodes_nature_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
+ local posa = {x = pos.x, y = pos.y+1, z = pos.z}
+ aname = minetest.get_node(posa).name
+ else
+ break
+ end
+ end
+
+end
+
+
+--cools when exposed to air, melts solids, adds plumes
+local lava_melt = function(pos, node)
+ --add hot air
+ climate.air_temp_source(pos, lava_temp_effect, lava_heater, 0.5, 15)
+
+ --lava works it's way up through rocks and more, melting them as it goes
+ --being on top of a magma chamber is now very dangerous
+ local posa = {x = pos.x, y = pos.y+1, z = pos.z}
+ local nodename = node.name
+
+ --air above, cool or plume source
+ if nodename == "nodes_nature:lava_source" then
+
+ local aname = minetest.get_node(posa).name
+
+ --space vs solid above
+ if aname == "air" or aname == "climate:air_temp" then
+ local c = ran()
+ --cool vs erupt
+ if c<0.5 then
+ minetest.set_node(pos, {name = "nodes_nature:basalt"})
+ minetest.sound_play("nodes_nature_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
+ return
+ elseif c<0.75 then
+ erupt(pos, aname)
+ --spread instability
+ local spos = minetest.find_node_near(pos, 3, 'nodes_nature:lava_source')
+ if spos then
+ local pa = {x = pos.x, y = pos.y+1, z = pos.z}
+ local an = minetest.get_node(pa).name
+ if an == 'air' or an == 'climate:air_temp' then
+ minetest.after(5, function()
+ erupt(spos, an)
+ end)
+ end
+ end
+
+ else
+ --no change
+ return
+ end
+ elseif minetest.get_item_group(aname, "cracky") > 0 or minetest.get_item_group(aname, "crumbly") > 0 then
+ --check it has "force" nearby
+ local gpos = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y, z = pos.z + 1},
+ {"nodes_nature:lava_source"})
+ if #gpos < 9 then
+ return
+ end
+ --melt above
+ minetest.set_node(posa, {name = "nodes_nature:lava_source"})
+ minetest.sound_play("nodes_nature_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
+ end
+ end
+
+
+ --flowing only has air anywhere (so sides solidify)
+ if nodename == "nodes_nature:lava_flowing" and minetest.find_node_near(pos, 1, {"air", "climate:air_temp"}) then
+ local pos_under = {x = pos.x, y = pos.y-1, z = pos.z}
+ local under_name = minetest.get_node(pos_under).name
+ local nodedef = minetest.registered_nodes[under_name]
+ local walkable = nodedef.walkable
+ if not nodedef or not walkable then
+ return
+ end
+ minetest.set_node(pos, {name = "nodes_nature:basalt"})
+ minetest.sound_play("nodes_nature_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
+ return
+ end
+
+end
+
+
+
+
+minetest.register_abm({
+ label = "Lava melt",
+ nodenames = {"nodes_nature:lava_source", "nodes_nature:lava_flowing"},
+ neighbors = {"group:stone", "group:soft_stone", 'air', 'climate:air_temp'},
+ interval = 26,
+ chance = 13,
+ catch_up = false,
+ action = function(...)
+ lava_melt(...)
+ end,
+})
diff --git a/games/globo/mods/nodes_nature/locale/nodes_nature.es.tr b/games/globo/mods/nodes_nature/locale/nodes_nature.es.tr
new file mode 100644
index 000000000..5fc22359f
--- /dev/null
+++ b/games/globo/mods/nodes_nature/locale/nodes_nature.es.tr
@@ -0,0 +1,84 @@
+# textdomain: nodes_nature
+
+# data_plant.lua
+Moss=Musgo
+Moss Spores=Esporas de Musgo
+Anperla Tuber=Tuberculo de Anperla
+Reshedaar Spores=Esporas de Reshedaar
+Mahal Spores=Esporas de Mahal
+Lambakap Spores=Esporas de Lambakap
+Kelp=Algas
+Seagrass=Hierba Marina
+Sea Lettuce=Lechuga de Mar
+Maraka Nut=Nueces de Maraka
+Tangkal Fruit=Fruta de Tangkal
+Sasaran Cone=Estróbilo de Sasaran
+Kagum Pod=Vaina de kagum
+Maraka Tree=Árbol Maraka
+Tangkal Tree=Árbol Tangkal
+Sasaran Tree=Árbol Sasaran
+Kagum Tree=Árbol Kagum
+
+# data_rock.lua
+Sandstone=Arenisca
+Siltstone=Limolita
+Claystone=Argilita
+Conglomerate=Conglomerado
+Limestone=Caliza
+Ironstone=Mineral de Hierro
+Granite=Granito
+Basalt=Basalto
+Gneiss=Gneis
+Jade=Jade
+Sand=Arena
+Silt=Limo
+Clay=Arcilla
+Gravel=Grava
+Loam=Suelo Margo
+Grassland Soil=Suelo de Pastizal
+Marshland Soil=Suelo de Pantanal
+Duneland Soil=Suelo Arenoso
+Highland Soil=Suelo de Paramo
+Woodland Soil=Suelo de Bosque
+Barren Grassland Soil=Suela de Pastizal Arido
+Dry Woodland Soil=Suelo de Bosque Seco
+Clay Agricultural Soil=Terreno Agricola Arcilloso
+Silty Agricultural Soil=Terreno Agricola Limoso
+Sandy Agricultural Soil=Terreno Agricola Arenoso
+Stony Agricultural Soil=Terreno Agricola Rocoso
+Loamy Agricultural Soil=Terreno Agricola Margo
+
+# life.lua
+Young @1=Brote de @1
+@1 Spores=Esporas de @1
+@1 Seeds=Semillas de @1
+Cana=Caña
+Glow Worm=Larvas Luminosas
+
+# liquids.lua
+Salt Water=Agua Salada
+Freshwater=Agua Fresca
+@1 Source=Fuente de @1
+@1 Flowing=Corriente de @1
+Snow=Nieve
+Snow Block=Bloque de nieve
+Ice=Hielo
+Sea Ice=Hielo Marino
+Lava Source=Fuente de Lava
+Lava Flowing=Corriente de Lava
+
+# rocks.lua
+@1 Boulder=Roca de @1
+@1 Brick=Ladrillo de @1
+@1 Block=Bloque de @1
+
+# sediment.lua
+Wet @1=@1 Humedecido
+Salty Wet @1=@1 Salado Humedecido
+Depleted @1=@1 Agotado
+Wet Depleted @1=@1 Humedecido Agotado
+
+# trees.lua
+Tree Marker=Marcador de Arbol
+@1 Log=Tronco de @1
+@1 Leaves=Ramas de @1
diff --git a/games/globo/mods/nodes_nature/locale/nodes_nature.fr.tr b/games/globo/mods/nodes_nature/locale/nodes_nature.fr.tr
new file mode 100644
index 000000000..e8ec14882
--- /dev/null
+++ b/games/globo/mods/nodes_nature/locale/nodes_nature.fr.tr
@@ -0,0 +1,79 @@
+# textdomain: nodes_nature
+
+# data_plant.lua
+Moss=Mousse
+Moss Spores=Spores de mousse
+Anperla Tuber=Tubercule d'anperla
+Reshedaar Spores=Spores de reshedaar
+Mahal Spores=Spores de mahal
+Lambakap Spores=Spores de lambakap
+Kelp=Varech
+Seagrass=Herbier marin
+Sea Lettuce=Laitue de mer
+Maraka Nut=Noix de maraka
+Tangkal Fruit=Fruit de tangkal
+Sasaran Cone=Pomme de Sasaran
+Kagum Pod=Cosse de kagum
+
+# data_rock.lua
+Sandstone=Grès
+Siltstone=Grès fin
+Claystone=Pierre argileuse
+Conglomerate=Conglomérat
+Limestone=Calcaire
+Ironstone=Pierre ferugineuse
+Granite=Granit
+Basalt=Basalte
+Gneiss=Gneiss
+Jade=Jade
+Sand=Sable
+Silt=Vase
+Clay=Argile
+Gravel=Gravier
+Loam=Terreau
+Grassland Soil=Sol de prairie
+Marshland Soil=Sol de marécage
+Duneland Soil=Sol de dune
+Highland Soil=Sol de montagne
+Woodland Soil=Sol de bois
+Barren Grassland Soil=Sol de prairie aride
+Dry Woodland Soil=Sol de bois aride
+Clay Agricultural Soil=Terre agricole argileuse
+Silty Agricultural Soil=Terre agricole vaseuse
+Sandy Agricultural Soil=Terre agricole sableuse
+Stony Agricultural Soil=Terre agricole caillouteuse
+Loamy Agricultural Soil=Terreau agricole
+
+# life.lua
+Young @1=Jeune pousse de @1
+@1 Spores=Spores de @1
+@1 Seeds=Graines de @1
+Cana=Canne à sucre
+Glow Worm=Ver luisant
+
+# liquids.lua
+Salt Water=Eau salée
+Freshwater=Eau fraiche
+@1 Source=@1 courrante
+@1 Flowing=@1 courrante
+Snow=Neige
+Snow Block=Bloc de neige
+Ice=Glace
+Sea Ice=Glace de l'océan
+Lava Source=Source de lave
+Lava Flowing=Lave courrante
+
+# rocks.lua
+@1 Boulder=Rocher de @1
+@1 Brick=Brique de @1
+@1 Block=Bloc de @1
+
+# sediment.lua
+Wet @1=@1 humide
+Salty Wet @1=@1 humide (salé-e)
+Depleted @1=@1 épuisé-e
+Wet Depleted @1=@1 humide épuisé-e
+
+# trees.lua
+Tree Marker=Marqueur d'arbre
+@1 Log=Tronc de @1
diff --git a/games/globo/mods/nodes_nature/locale/nodes_nature.ru.tr b/games/globo/mods/nodes_nature/locale/nodes_nature.ru.tr
new file mode 100644
index 000000000..dd8a07a4b
--- /dev/null
+++ b/games/globo/mods/nodes_nature/locale/nodes_nature.ru.tr
@@ -0,0 +1,84 @@
+# textdomain: nodes_nature
+
+# data_plant.lua
+Moss=Мох
+Moss Spores=Споры мха
+Anperla Tuber=Клубень анперла
+Reshedaar Spores=Споры решедара
+Mahal Spores=Споры махала
+Lambakap Spores=Споры ламбакапа
+Kelp=Келп
+Seagrass=Морская трава
+Sea Lettuce=Морской салат
+Maraka Nut=Орех марака
+Tangkal Fruit=Фрукт тангкала
+Sasaran Cone=Шишка сасаранская
+Kagum Pod=Стручок кагума
+Maraka Tree=Дерево марака
+Tangkal Tree=Дерево тангкал
+Sasaran Tree=Дерево сасаран
+Kagum Tree=Дерево кагум
+
+# data_rock.lua
+Sandstone=Песчаник
+Siltstone=Алевролит
+Claystone=Глинистый камень
+Conglomerate=Конгломерат
+Limestone=Известняк
+Ironstone=Железистый камень
+Granite=Гранит
+Basalt=Базальт
+Gneiss=Гнейс
+Jade=Нефрит
+Sand=Песок
+Silt=Ил
+Clay=Глина
+Gravel=Гравий
+Loam=Суглинок
+Grassland Soil=Почва пастбищная
+Marshland Soil=Почва болотная
+Duneland Soil=Почва дюн
+Highland Soil=Почва горная
+Woodland Soil=Почва лесная
+Barren Grassland Soil=Почва бесплодных пастбищ
+Dry Woodland Soil=Почва сухая лесная
+Clay Agricultural Soil=Почва глинистая сельскохозяйственная
+Silty Agricultural Soil=Почва шелковистая сельскохозяйственная
+Sandy Agricultural Soil=Почва песчаная сельскохозяйственная
+Stony Agricultural Soil=Почва каменистая сельскохозяйственная
+Loamy Agricultural Soil=Почва суглинистая сельскохозяйственная
+
+# life.lua
+Young @1=Молодой(ая) @1
+@1 Spores=Споры @1
+@1 Seeds=Семена @1
+Cana=Кана
+Glow Worm=Светящийся червь
+
+# liquids.lua
+Salt Water=Соленая вода
+Freshwater=Пресная вода
+@1 Source=Источник @1
+@1 Flowing=Течение @1
+Snow=Снег
+Snow Block=Снежный блок
+Ice=Лёд
+Sea Ice=Морской лед
+Lava Source=Источник лавы
+Lava Flowing=Течение лавы
+
+# rocks.lua
+@1 Boulder=Валун @1
+@1 Brick=Кирпич @1
+@1 Block=Блок @1
+
+# sediment.lua
+Wet @1=Влажный @1
+Salty Wet @1=Солёный влажный @1
+Depleted @1=Истощенный @1
+Wet Depleted @1=Истощенный влажный @1
+
+# trees.lua
+Tree Marker=Маркер дерева
+@1 Log=Бревно @1
+@1 Leaves=Листья @1
diff --git a/games/globo/mods/nodes_nature/locale/template.txt b/games/globo/mods/nodes_nature/locale/template.txt
new file mode 100644
index 000000000..539f00fa7
--- /dev/null
+++ b/games/globo/mods/nodes_nature/locale/template.txt
@@ -0,0 +1,84 @@
+# textdomain: nodes_nature
+
+# data_plant.lua
+Moss=
+Moss Spores=
+Anperla Tuber=
+Reshedaar Spores=
+Mahal Spores=
+Lambakap Spores=
+Kelp=
+Seagrass=
+Sea Lettuce=
+Maraka Nut=
+Tangkal Fruit=
+Sasaran Cone=
+Kagum Pod=
+Maraka Tree=
+Tangkal Tree=
+Sasaran Tree=
+Kagum Tree=
+
+# data_rock.lua
+Sandstone=
+Siltstone=
+Claystone=
+Conglomerate=
+Limestone=
+Ironstone=
+Granite=
+Basalt=
+Gneiss=
+Jade=
+Sand=
+Silt=
+Clay=
+Gravel=
+Loam=
+Grassland Soil=
+Marshland Soil=
+Duneland Soil=
+Highland Soil=
+Woodland Soil=
+Barren Grassland Soil=
+Dry Woodland Soil=
+Clay Agricultural Soil=
+Silty Agricultural Soil=
+Sandy Agricultural Soil=
+Stony Agricultural Soil=
+Loamy Agricultural Soil=
+
+# life.lua
+Young @1=
+@1 Spores=
+@1 Seeds=
+Cana=
+Glow Worm=
+
+# liquids.lua
+Salt Water=
+Freshwater=
+@1 Source=
+@1 Flowing=
+Snow=
+Snow Block=
+Ice=
+Sea Ice=
+Lava Source=
+Lava Flowing=
+
+# rocks.lua
+@1 Boulder=
+@1 Brick=
+@1 Block=
+
+# sediment.lua
+Wet @1=
+Salty Wet @1=
+Depleted @1=
+Wet Depleted @1=
+
+# trees.lua
+Tree Marker=
+@1 Log=
+@1 Leaves
diff --git a/games/globo/mods/nodes_nature/mod.conf b/games/globo/mods/nodes_nature/mod.conf
new file mode 100644
index 000000000..ca1143e34
--- /dev/null
+++ b/games/globo/mods/nodes_nature/mod.conf
@@ -0,0 +1,4 @@
+name = nodes_nature
+description = Nodes used by mapgen, naturally occurring in the world, and their low level crafts (e.g. blocks, bricks).
+depends = minimal, stairs, crafting, climate, naturalslopeslib, health, wielded_light
+author = Dokimi
diff --git a/games/globo/mods/nodes_nature/models/nodes_nature_boulder.mtl b/games/globo/mods/nodes_nature/models/nodes_nature_boulder.mtl
new file mode 100644
index 000000000..a3fbcc358
--- /dev/null
+++ b/games/globo/mods/nodes_nature/models/nodes_nature_boulder.mtl
@@ -0,0 +1,11 @@
+# Blender MTL File: 'None'
+# Material Count: 1
+
+newmtl None
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
diff --git a/games/globo/mods/nodes_nature/models/nodes_nature_boulder.obj b/games/globo/mods/nodes_nature/models/nodes_nature_boulder.obj
new file mode 100644
index 000000000..0121583e1
--- /dev/null
+++ b/games/globo/mods/nodes_nature/models/nodes_nature_boulder.obj
@@ -0,0 +1,279 @@
+# Blender v2.73 (sub 0) OBJ File: ''
+# www.blender.org
+mtllib nodes_nature_boulder.mtl
+o Icosphere.001_Icosphere.002
+v -0.500018 -0.518751 0.344213
+v -0.223932 -0.508544 0.471127
+v -0.461759 -0.113955 0.432411
+v -0.565033 -0.547144 -0.178093
+v -0.535991 -0.541613 0.079739
+v -0.645663 -0.122101 -0.082434
+v -0.580098 -0.129282 0.228331
+v -0.618138 -0.195134 -0.326723
+v -0.277478 0.195766 0.475485
+v -0.023665 0.237858 0.495836
+v -0.365359 0.429005 0.402736
+v -0.600918 0.315530 0.070736
+v -0.479498 0.197901 0.394278
+v -0.480094 0.442427 0.093739
+v -0.411308 0.193842 -0.486488
+v -0.593089 0.333005 -0.171522
+v -0.270091 0.448662 -0.336754
+v -0.462611 -0.503117 -0.423684
+v -0.434775 -0.608933 -0.064407
+v -0.213531 -0.608291 -0.283720
+v -0.353492 -0.594516 0.213715
+v -0.053661 -0.609140 0.276273
+v -0.030874 -0.476087 0.441107
+v -0.339516 -0.246985 -0.510969
+v -0.140590 -0.075129 0.527672
+v 0.106533 0.430330 0.384959
+v -0.073530 0.443258 -0.006612
+v -0.216830 0.429156 0.154125
+v -0.037545 0.444396 -0.349752
+v 0.161368 -0.486338 0.388926
+v 0.263974 -0.218983 0.469968
+v -0.077072 -0.470734 -0.547314
+v -0.167055 0.426542 0.380673
+v -0.162794 -0.137663 -0.545869
+v 0.190960 -0.456305 -0.523478
+v 0.204972 -0.610619 -0.325774
+v 0.266416 0.195224 0.458084
+v 0.120358 -0.093605 -0.557349
+v 0.545955 -0.449821 -0.145478
+v 0.454728 -0.486338 -0.328393
+v 0.558986 -0.091078 -0.266376
+v 0.400156 -0.456304 0.385705
+v 0.510543 -0.542606 0.091956
+v 0.488662 -0.104428 0.314466
+v 0.363733 -0.113416 -0.526623
+v 0.594587 -0.094608 -0.026391
+v -0.085888 0.140816 -0.481119
+v 0.418933 0.305748 -0.377704
+v 0.201378 0.180969 -0.521839
+v 0.235863 0.443569 -0.277812
+v 0.561216 0.199595 0.079897
+v 0.470370 0.378657 -0.141744
+v 0.410487 0.428500 0.018419
+v 0.454936 0.258854 0.339456
+v 0.392085 -0.590314 -0.114053
+v -0.045445 -0.607120 -0.330789
+v 0.200058 -0.608869 0.272540
+v 0.071370 -0.186741 0.495097
+v 0.144014 0.451538 0.006477
+v -0.013551 -0.605707 -0.028665
+vt 0.999784 0.777888
+vt 0.781916 0.751069
+vt 0.930695 0.535842
+vt 0.718554 0.493678
+vt 0.498343 0.500066
+vt 0.612704 0.301958
+vt 0.278288 0.491767
+vt 0.136170 0.301428
+vt 0.385039 0.315647
+vt 0.861174 0.302958
+vt 0.817615 0.924676
+vt 0.662334 0.996212
+vt 0.719667 0.785775
+vt 0.955856 0.540882
+vt 0.919844 0.749017
+vt 0.810792 0.580191
+vt 0.698724 0.249779
+vt 0.882029 0.358101
+vt 0.648319 0.423681
+vt 0.738504 0.311189
+vt 0.859769 0.100574
+vt 0.955856 0.301223
+vt 0.603011 0.109855
+vt 0.889116 0.979094
+vt 0.625593 0.954685
+vt 0.572947 0.723101
+vt 0.629662 0.708272
+vt 0.361849 0.694965
+vt 0.626863 0.523494
+vt 0.877334 0.514944
+vt 0.753445 0.687054
+vt 0.678897 0.522004
+vt 0.804007 0.322784
+vt 0.508145 0.125975
+vt 0.614686 0.322544
+vt 0.274631 0.088482
+vt 0.046907 0.080882
+vt 0.724191 0.150589
+vt 0.955856 0.101994
+vt 0.459738 0.810380
+vt 0.524431 0.596612
+vt 0.614955 0.619521
+vt 0.385224 0.455707
+vt 0.518113 0.743431
+vt 0.397247 0.481913
+vt 0.473092 0.333636
+vt 0.593136 0.806842
+vt 0.542133 0.566645
+vt 0.245991 0.361941
+vt 0.291514 0.126530
+vt 0.515385 0.289890
+vt 0.348981 0.560141
+vt 0.480373 0.537386
+vt 0.705144 0.472239
+vt 0.601667 0.722403
+vt 0.283471 0.700220
+vt 0.061144 0.812481
+vt 0.120014 0.502516
+vt 0.080353 0.535703
+vt 0.356859 0.719702
+vt 0.417004 0.243099
+vt 0.001005 0.468262
+vt 0.186797 0.314823
+vt 0.187216 0.555587
+vt 0.094383 0.931756
+vt 0.003057 0.709324
+vt 0.238065 0.772821
+vt 0.569632 0.999536
+vt 0.323797 1.000000
+vt 0.482075 0.313011
+vt 0.735871 0.182001
+vt 0.032983 0.251846
+vt 0.574313 0.080491
+vt 0.318361 0.961238
+vt 0.229901 0.178033
+vt 0.256609 0.467686
+vt 0.464307 0.768933
+vt 0.865183 0.712997
+vt 0.725052 0.926500
+vt 0.093408 0.705147
+vt 0.230523 0.921209
+vt 0.968797 0.984796
+vt 0.210756 0.792236
+vt 0.477482 0.962103
+vt 0.256493 0.223509
+vt 0.000000 0.255402
+vt 0.543998 0.500902
+vt 0.362414 0.637562
+vt 0.469769 0.648982
+vt 0.379376 0.894841
+vt 0.246514 0.544201
+vt 0.117965 0.884444
+vt 0.047032 0.632888
+vt 0.079441 0.605161
+vt 0.000000 0.325670
+vt 0.241712 0.163133
+vt 0.470206 0.343559
+usemtl None
+s off
+f 1/1 2/2 3/3
+f 4/4 5/5 6/6
+f 1/7 3/8 7/9
+f 4/4 6/6 8/10
+f 9/11 10/12 11/13
+f 12/14 13/15 14/16
+f 15/17 16/18 17/19
+f 18/20 19/21 4/22
+f 18/20 20/23 19/21
+f 2/2 1/1 21/24
+f 21/24 22/25 2/2
+f 22/25 23/26 2/2
+f 19/27 5/5 4/4
+f 19/27 21/28 5/5
+f 21/28 1/7 5/5
+f 24/29 8/30 15/31
+f 24/29 18/20 8/30
+f 18/20 4/22 8/30
+f 3/3 25/32 9/33
+f 3/3 2/2 25/32
+f 2/2 23/26 25/32
+f 6/6 7/9 12/34
+f 6/6 5/5 7/9
+f 5/5 1/7 7/9
+f 25/32 10/35 9/33
+f 7/9 13/36 12/34
+f 7/9 3/8 13/36
+f 3/8 9/37 13/36
+f 8/10 16/38 15/39
+f 8/10 6/6 16/38
+f 6/6 12/34 16/38
+f 26/40 27/41 28/42
+f 27/41 29/43 17/19
+f 23/26 30/44 31/45
+f 32/46 18/20 24/29
+f 11/13 10/12 33/47
+f 24/29 15/31 34/48
+f 14/16 11/13 28/42
+f 14/16 13/15 11/13
+f 13/15 9/11 11/13
+f 17/19 14/16 28/42
+f 17/19 16/18 14/16
+f 16/18 12/14 14/16
+f 35/49 36/50 32/46
+f 37/51 10/35 31/45
+f 35/49 32/46 38/52
+f 39/53 40/54 41/55
+f 42/56 43/57 44/58
+f 23/26 22/25 30/44
+f 35/49 38/52 45/59
+f 39/53 41/55 46/60
+f 42/56 44/58 31/45
+f 15/17 17/19 47/61
+f 48/62 49/63 50/64
+f 51/65 52/66 53/67
+f 37/68 54/69 26/40
+f 55/70 40/54 39/53
+f 55/70 36/71 40/54
+f 36/50 35/49 40/72
+f 18/20 32/46 20/23
+f 32/46 36/50 56/73
+f 57/74 43/57 42/56
+f 57/75 55/70 43/76
+f 55/70 39/53 43/76
+f 34/48 32/46 24/29
+f 32/46 56/73 20/23
+f 57/74 42/56 30/44
+f 38/52 34/48 47/77
+f 38/52 32/46 34/48
+f 41/55 45/78 48/79
+f 41/55 40/54 45/78
+f 40/72 35/49 45/59
+f 44/80 46/60 51/81
+f 44/80 43/76 46/60
+f 43/76 39/53 46/60
+f 22/25 57/74 30/44
+f 30/44 42/56 31/45
+f 45/78 49/82 48/79
+f 45/59 38/52 49/83
+f 38/52 47/77 49/83
+f 46/60 52/84 51/81
+f 46/60 41/55 52/84
+f 41/55 48/79 52/84
+f 31/45 54/85 37/51
+f 31/45 44/58 54/85
+f 44/58 51/86 54/85
+f 25/32 23/26 58/87
+f 10/35 25/32 58/87
+f 15/31 47/77 34/48
+f 50/64 29/43 59/88
+f 50/64 49/63 29/43
+f 49/63 47/61 29/43
+f 53/67 50/64 59/88
+f 53/67 52/66 50/64
+f 52/66 48/62 50/64
+f 26/40 53/67 59/88
+f 26/40 54/69 53/67
+f 54/69 51/65 53/67
+f 27/41 26/40 59/88
+f 10/12 37/68 26/40
+f 11/13 33/47 28/42
+f 29/43 27/41 59/88
+f 28/42 27/41 17/19
+f 47/61 17/19 29/43
+f 22/89 21/90 60/91
+f 21/90 19/92 60/91
+f 19/92 20/93 60/91
+f 20/93 56/94 60/91
+f 56/94 36/95 60/91
+f 36/95 55/96 60/91
+f 55/96 57/97 60/91
+f 57/97 22/89 60/91
+f 10/12 26/40 33/47
+f 33/47 26/40 28/42
+f 23/26 31/45 58/87
+f 31/45 10/35 58/87
diff --git a/games/globo/mods/nodes_nature/models/nodes_nature_cobble1.mtl b/games/globo/mods/nodes_nature/models/nodes_nature_cobble1.mtl
new file mode 100644
index 000000000..e6e93d7e1
--- /dev/null
+++ b/games/globo/mods/nodes_nature/models/nodes_nature_cobble1.mtl
@@ -0,0 +1,12 @@
+# Blender MTL File: 'rock.blend'
+# Material Count: 1
+
+newmtl None.001
+Ns 96.078443
+Ka 1.000000 1.000000 1.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
diff --git a/games/globo/mods/nodes_nature/models/nodes_nature_cobble1.obj b/games/globo/mods/nodes_nature/models/nodes_nature_cobble1.obj
new file mode 100644
index 000000000..2322eafdd
--- /dev/null
+++ b/games/globo/mods/nodes_nature/models/nodes_nature_cobble1.obj
@@ -0,0 +1,395 @@
+# Blender v3.0.1 OBJ File: 'rock.blend'
+# www.blender.org
+mtllib rock.mtl
+o Icosphere.001_Icosphere.001
+v -0.273259 -0.587868 0.138111
+v -0.122378 -0.584509 0.189034
+v -0.252350 -0.454643 0.173500
+v -0.308790 -0.597213 -0.071458
+v -0.292918 -0.595393 0.031994
+v -0.352854 -0.457324 -0.033076
+v -0.317022 -0.459687 0.091615
+v -0.337811 -0.481360 -0.131094
+v -0.151641 -0.352708 0.190782
+v -0.012933 -0.338855 0.198948
+v -0.199668 -0.275945 0.161593
+v -0.328401 -0.313292 0.028382
+v -0.262045 -0.352006 0.158199
+v -0.262370 -0.271528 0.037612
+v -0.224779 -0.353341 -0.195197
+v -0.324122 -0.307541 -0.068821
+v -0.147604 -0.269476 -0.135118
+v -0.252816 -0.582723 -0.169998
+v -0.237604 -0.617549 -0.025843
+v -0.116694 -0.617337 -0.113839
+v -0.193183 -0.612804 0.085750
+v -0.029326 -0.617617 0.110851
+v -0.016873 -0.573827 0.176989
+v -0.185545 -0.498425 -0.205020
+v -0.076832 -0.441865 0.211722
+v 0.058220 -0.275509 0.154460
+v -0.040184 -0.271254 -0.002653
+v -0.118497 -0.275896 0.061841
+v -0.020518 -0.270880 -0.140334
+v 0.088187 -0.577201 0.156052
+v 0.144261 -0.489209 0.188569
+v -0.042120 -0.572065 -0.219603
+v -0.091295 -0.276756 0.152740
+v -0.088967 -0.462446 -0.219023
+v 0.104359 -0.567316 -0.210039
+v 0.112017 -0.618104 -0.130713
+v 0.145596 -0.352887 0.183801
+v 0.065775 -0.447945 -0.223629
+v 0.298363 -0.565182 -0.058371
+v 0.248508 -0.577201 -0.131764
+v 0.305485 -0.447114 -0.106880
+v 0.218685 -0.567316 0.154759
+v 0.279011 -0.595719 0.036896
+v 0.267053 -0.451507 0.126176
+v 0.198779 -0.454465 -0.211301
+v 0.324941 -0.448275 -0.010589
+v -0.046938 -0.370793 -0.193043
+v 0.228946 -0.316511 -0.151549
+v 0.110053 -0.357578 -0.209381
+v 0.128899 -0.271152 -0.111469
+v 0.306704 -0.351448 0.032058
+v 0.257056 -0.292516 -0.056873
+v 0.224330 -0.276111 0.007390
+v 0.248622 -0.331945 0.136203
+v 0.214274 -0.611421 -0.045762
+v -0.024836 -0.616952 -0.132725
+v 0.109331 -0.617528 0.109353
+v 0.039004 -0.478598 0.198652
+v 0.078703 -0.268529 0.002599
+v -0.007406 -0.616487 -0.011501
+vt 0.999784 0.777888
+vt 0.781916 0.751069
+vt 0.930695 0.535842
+vt 0.718554 0.493678
+vt 0.498343 0.500066
+vt 0.612704 0.301958
+vt 0.278288 0.491767
+vt 0.136170 0.301428
+vt 0.385039 0.315647
+vt 0.861174 0.302958
+vt 0.817615 0.924676
+vt 0.662334 0.996212
+vt 0.719667 0.785775
+vt 0.955856 0.540882
+vt 0.919844 0.749017
+vt 0.810792 0.580191
+vt 0.698724 0.249779
+vt 0.882029 0.358101
+vt 0.648319 0.423681
+vt 0.738504 0.311189
+vt 0.859769 0.100574
+vt 0.955856 0.301223
+vt 0.603011 0.109855
+vt 0.889116 0.979094
+vt 0.625593 0.954685
+vt 0.572947 0.723101
+vt 0.629662 0.708272
+vt 0.361849 0.694965
+vt 0.626863 0.523494
+vt 0.877334 0.514944
+vt 0.753445 0.687054
+vt 0.678897 0.522004
+vt 0.804007 0.322784
+vt 0.508145 0.125975
+vt 0.614686 0.322544
+vt 0.274631 0.088482
+vt 0.046907 0.080882
+vt 0.724191 0.150589
+vt 0.955856 0.101994
+vt 0.459738 0.810380
+vt 0.524431 0.596612
+vt 0.614955 0.619521
+vt 0.385224 0.455707
+vt 0.518113 0.743431
+vt 0.397247 0.481913
+vt 0.473092 0.333636
+vt 0.593136 0.806842
+vt 0.542133 0.566645
+vt 0.245991 0.361941
+vt 0.291514 0.126530
+vt 0.515385 0.289890
+vt 0.348981 0.560141
+vt 0.480373 0.537386
+vt 0.705144 0.472239
+vt 0.601667 0.722403
+vt 0.283471 0.700220
+vt 0.061144 0.812481
+vt 0.120014 0.502516
+vt 0.080353 0.535703
+vt 0.356859 0.719702
+vt 0.417004 0.243099
+vt 0.001005 0.468262
+vt 0.186797 0.314823
+vt 0.187216 0.555587
+vt 0.094383 0.931756
+vt 0.003057 0.709324
+vt 0.238065 0.772821
+vt 0.569632 0.999536
+vt 0.323797 1.000000
+vt 0.482075 0.313011
+vt 0.735871 0.182001
+vt 0.032983 0.251846
+vt 0.574313 0.080491
+vt 0.318361 0.961238
+vt 0.229901 0.178033
+vt 0.256609 0.467686
+vt 0.464307 0.768933
+vt 0.865183 0.712997
+vt 0.725052 0.926500
+vt 0.093408 0.705147
+vt 0.230523 0.921209
+vt 0.968797 0.984796
+vt 0.210756 0.792236
+vt 0.477482 0.962103
+vt 0.256493 0.223509
+vt 0.000000 0.255402
+vt 0.543998 0.500902
+vt 0.362414 0.637562
+vt 0.469769 0.648982
+vt 0.379376 0.894841
+vt 0.246514 0.544201
+vt 0.117965 0.884444
+vt 0.047032 0.632888
+vt 0.079441 0.605161
+vt 0.000000 0.325670
+vt 0.241712 0.163133
+vt 0.470206 0.343559
+vn -0.3095 -0.1985 0.9300
+vn -0.9308 -0.3340 0.1487
+vn -0.7828 -0.0421 0.6208
+vn -0.9568 -0.2799 -0.0782
+vn -0.0864 0.3064 0.9480
+vn -0.5166 0.7115 0.4763
+vn -0.3701 0.7415 -0.5597
+vn -0.1356 -0.9662 -0.2191
+vn -0.1558 -0.9638 -0.2164
+vn -0.0862 -0.9442 0.3178
+vn -0.0755 -0.9473 0.3113
+vn 0.1450 -0.8373 0.5271
+vn -0.3121 -0.9478 0.0646
+vn -0.2415 -0.9607 0.1370
+vn -0.2286 -0.9672 0.1109
+vn -0.4413 -0.0587 -0.8954
+vn -0.4387 -0.0231 -0.8983
+vn -0.7510 -0.4411 -0.4914
+vn -0.2159 0.0479 0.9752
+vn -0.2057 -0.0893 0.9745
+vn 0.1308 -0.1963 0.9718
+vn -0.9599 0.0449 0.2767
+vn -0.9244 -0.2786 0.2604
+vn -0.9478 -0.2534 0.1936
+vn -0.0747 0.1682 0.9829
+vn -0.8636 0.1418 0.4837
+vn -0.7852 0.0181 0.6190
+vn -0.2805 0.1156 0.9529
+vn -0.6988 0.2894 -0.6542
+vn -0.9725 0.1426 -0.1842
+vn -0.9830 0.1808 -0.0326
+vn -0.0244 0.9988 0.0423
+vn 0.0112 0.9999 0.0043
+vn 0.1629 -0.4317 0.8872
+vn -0.2124 -0.2255 -0.9508
+vn 0.0668 0.6485 0.7583
+vn -0.1528 0.0256 -0.9879
+vn 0.0266 0.9994 0.0222
+vn -0.7218 0.5748 0.3855
+vn -0.2771 0.1852 0.9428
+vn 0.0255 0.9993 0.0288
+vn -0.2671 0.9492 -0.1662
+vn -0.5370 0.8432 0.0263
+vn 0.0626 -0.8378 -0.5424
+vn 0.0980 0.0338 0.9946
+vn 0.0678 -0.0912 -0.9935
+vn 0.8180 -0.2601 -0.5131
+vn 0.8422 -0.2316 0.4869
+vn 0.0806 -0.8380 0.5397
+vn 0.0879 -0.0846 -0.9925
+vn 0.9702 -0.1398 -0.1977
+vn 0.4440 0.0355 0.8953
+vn 0.0633 0.5420 -0.8380
+vn 0.0687 0.7414 -0.6676
+vn 0.6458 0.7511 0.1372
+vn 0.2448 0.5730 0.7821
+vn 0.4558 -0.8744 -0.1665
+vn 0.2755 -0.9258 -0.2587
+vn 0.2378 -0.8074 -0.5399
+vn -0.0544 -0.9035 -0.4251
+vn -0.0007 -0.8885 -0.4589
+vn 0.2658 -0.8974 0.3523
+vn 0.1549 -0.9857 0.0660
+vn 0.4515 -0.8723 -0.1879
+vn -0.1256 -0.0484 -0.9909
+vn -0.0874 -0.8920 -0.4435
+vn 0.0628 -0.7411 0.6684
+vn -0.0561 0.2960 -0.9535
+vn -0.0291 -0.0071 -0.9996
+vn 0.6850 0.1582 -0.7111
+vn 0.6951 -0.1709 -0.6983
+vn 0.4249 -0.3648 -0.8285
+vn 0.9209 0.0018 0.3898
+vn 0.9103 -0.1607 0.3815
+vn 0.9585 -0.2630 0.1104
+vn 0.0076 -0.7551 0.6555
+vn 0.0370 -0.3671 0.9295
+vn 0.3249 0.3152 -0.8917
+vn 0.0970 0.1085 -0.9894
+vn -0.1187 0.2112 -0.9702
+vn 0.9033 0.3036 -0.3031
+vn 0.9201 0.3470 -0.1817
+vn 0.8554 0.3814 -0.3506
+vn 0.4146 0.0278 0.9096
+vn 0.4541 -0.0047 0.8909
+vn 0.8769 0.0957 0.4711
+vn 0.0333 -0.2402 0.9701
+vn 0.1260 0.0447 0.9910
+vn 0.0369 0.2568 -0.9658
+vn 0.0058 0.9998 -0.0204
+vn 0.1308 0.7307 -0.6701
+vn -0.1309 0.4894 -0.8621
+vn 0.0520 0.9986 -0.0001
+vn 0.2187 0.9664 -0.1353
+vn 0.2848 0.9057 -0.3141
+vn 0.0502 0.9974 0.0526
+vn 0.2972 0.8952 0.3320
+vn 0.6255 0.7520 0.2080
+vn -0.0248 0.9988 0.0426
+vn 0.1252 0.4722 0.8726
+vn 0.0081 0.9999 0.0071
+vn -0.0229 0.9997 -0.0006
+vn -0.0289 0.9989 0.0368
+vn -0.0309 0.4728 -0.8806
+vn -0.0272 -0.9995 -0.0141
+vn 0.0020 -0.9991 0.0417
+vn 0.0044 -1.0000 0.0036
+vn 0.0048 -1.0000 0.0031
+vn -0.0085 -1.0000 0.0051
+vn 0.0295 -0.9986 0.0431
+vn 0.0187 -0.9995 -0.0267
+vn 0.0005 -1.0000 -0.0091
+vn -0.0142 0.5853 0.8107
+vn -0.0085 0.9999 0.0120
+vn 0.0663 -0.2582 0.9638
+vn 0.0988 0.0346 0.9945
+usemtl None.001
+s off
+f 1/1/1 2/2/1 3/3/1
+f 4/4/2 5/5/2 6/6/2
+f 1/7/3 3/8/3 7/9/3
+f 4/4/4 6/6/4 8/10/4
+f 9/11/5 10/12/5 11/13/5
+f 12/14/6 13/15/6 14/16/6
+f 15/17/7 16/18/7 17/19/7
+f 18/20/8 19/21/8 4/22/8
+f 18/20/9 20/23/9 19/21/9
+f 2/2/10 1/1/10 21/24/10
+f 21/24/11 22/25/11 2/2/11
+f 22/25/12 23/26/12 2/2/12
+f 19/27/13 5/5/13 4/4/13
+f 19/27/14 21/28/14 5/5/14
+f 21/28/15 1/7/15 5/5/15
+f 24/29/16 8/30/16 15/31/16
+f 24/29/17 18/20/17 8/30/17
+f 18/20/18 4/22/18 8/30/18
+f 3/3/19 25/32/19 9/33/19
+f 3/3/20 2/2/20 25/32/20
+f 2/2/21 23/26/21 25/32/21
+f 6/6/22 7/9/22 12/34/22
+f 6/6/23 5/5/23 7/9/23
+f 5/5/24 1/7/24 7/9/24
+f 25/32/25 10/35/25 9/33/25
+f 7/9/26 13/36/26 12/34/26
+f 7/9/27 3/8/27 13/36/27
+f 3/8/28 9/37/28 13/36/28
+f 8/10/29 16/38/29 15/39/29
+f 8/10/30 6/6/30 16/38/30
+f 6/6/31 12/34/31 16/38/31
+f 26/40/32 27/41/32 28/42/32
+f 27/41/33 29/43/33 17/19/33
+f 23/26/34 30/44/34 31/45/34
+f 32/46/35 18/20/35 24/29/35
+f 11/13/36 10/12/36 33/47/36
+f 24/29/37 15/31/37 34/48/37
+f 14/16/38 11/13/38 28/42/38
+f 14/16/39 13/15/39 11/13/39
+f 13/15/40 9/11/40 11/13/40
+f 17/19/41 14/16/41 28/42/41
+f 17/19/42 16/18/42 14/16/42
+f 16/18/43 12/14/43 14/16/43
+f 35/49/44 36/50/44 32/46/44
+f 37/51/45 10/35/45 31/45/45
+f 35/49/46 32/46/46 38/52/46
+f 39/53/47 40/54/47 41/55/47
+f 42/56/48 43/57/48 44/58/48
+f 23/26/49 22/25/49 30/44/49
+f 35/49/50 38/52/50 45/59/50
+f 39/53/51 41/55/51 46/60/51
+f 42/56/52 44/58/52 31/45/52
+f 15/17/53 17/19/53 47/61/53
+f 48/62/54 49/63/54 50/64/54
+f 51/65/55 52/66/55 53/67/55
+f 37/68/56 54/69/56 26/40/56
+f 55/70/57 40/54/57 39/53/57
+f 55/70/58 36/71/58 40/54/58
+f 36/50/59 35/49/59 40/72/59
+f 18/20/60 32/46/60 20/23/60
+f 32/46/61 36/50/61 56/73/61
+f 57/74/62 43/57/62 42/56/62
+f 57/75/63 55/70/63 43/76/63
+f 55/70/64 39/53/64 43/76/64
+f 34/48/65 32/46/65 24/29/65
+f 32/46/66 56/73/66 20/23/66
+f 57/74/67 42/56/67 30/44/67
+f 38/52/68 34/48/68 47/77/68
+f 38/52/69 32/46/69 34/48/69
+f 41/55/70 45/78/70 48/79/70
+f 41/55/71 40/54/71 45/78/71
+f 40/72/72 35/49/72 45/59/72
+f 44/80/73 46/60/73 51/81/73
+f 44/80/74 43/76/74 46/60/74
+f 43/76/75 39/53/75 46/60/75
+f 22/25/76 57/74/76 30/44/76
+f 30/44/77 42/56/77 31/45/77
+f 45/78/78 49/82/78 48/79/78
+f 45/59/79 38/52/79 49/83/79
+f 38/52/80 47/77/80 49/83/80
+f 46/60/81 52/84/81 51/81/81
+f 46/60/82 41/55/82 52/84/82
+f 41/55/83 48/79/83 52/84/83
+f 31/45/84 54/85/84 37/51/84
+f 31/45/85 44/58/85 54/85/85
+f 44/58/86 51/86/86 54/85/86
+f 25/32/87 23/26/87 58/87/87
+f 10/35/88 25/32/88 58/87/88
+f 15/31/89 47/77/89 34/48/89
+f 50/64/90 29/43/90 59/88/90
+f 50/64/91 49/63/91 29/43/91
+f 49/63/92 47/61/92 29/43/92
+f 53/67/93 50/64/93 59/88/93
+f 53/67/94 52/66/94 50/64/94
+f 52/66/95 48/62/95 50/64/95
+f 26/40/96 53/67/96 59/88/96
+f 26/40/97 54/69/97 53/67/97
+f 54/69/98 51/65/98 53/67/98
+f 27/41/99 26/40/99 59/88/99
+f 10/12/100 37/68/100 26/40/100
+f 11/13/101 33/47/101 28/42/101
+f 29/43/102 27/41/102 59/88/102
+f 28/42/103 27/41/103 17/19/103
+f 47/61/104 17/19/104 29/43/104
+f 22/89/105 21/90/105 60/91/105
+f 21/90/106 19/92/106 60/91/106
+f 19/92/107 20/93/107 60/91/107
+f 20/93/108 56/94/108 60/91/108
+f 56/94/109 36/95/109 60/91/109
+f 36/95/110 55/96/110 60/91/110
+f 55/96/111 57/97/111 60/91/111
+f 57/97/112 22/89/112 60/91/112
+f 10/12/113 26/40/113 33/47/113
+f 33/47/114 26/40/114 28/42/114
+f 23/26/115 31/45/115 58/87/115
+f 31/45/116 10/35/116 58/87/116
diff --git a/games/globo/mods/nodes_nature/models/nodes_nature_cobble2.mtl b/games/globo/mods/nodes_nature/models/nodes_nature_cobble2.mtl
new file mode 100644
index 000000000..79fc91254
--- /dev/null
+++ b/games/globo/mods/nodes_nature/models/nodes_nature_cobble2.mtl
@@ -0,0 +1,12 @@
+# Blender MTL File: 'nodes_nature_cobble2.blend'
+# Material Count: 1
+
+newmtl None.001
+Ns 96.078443
+Ka 1.000000 1.000000 1.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
diff --git a/games/globo/mods/nodes_nature/models/nodes_nature_cobble2.obj b/games/globo/mods/nodes_nature/models/nodes_nature_cobble2.obj
new file mode 100644
index 000000000..3113c52eb
--- /dev/null
+++ b/games/globo/mods/nodes_nature/models/nodes_nature_cobble2.obj
@@ -0,0 +1,395 @@
+# Blender v3.0.1 OBJ File: 'nodes_nature_cobble2.blend'
+# www.blender.org
+mtllib nodes_nature_cobble2.mtl
+o Icosphere.001_Icosphere.001
+v -0.262106 -0.587868 0.206094
+v -0.117384 -0.584509 0.282082
+v -0.242051 -0.454643 0.258901
+v -0.296186 -0.597213 -0.106631
+v -0.280963 -0.595393 0.047743
+v -0.338452 -0.457324 -0.049356
+v -0.304083 -0.459687 0.136711
+v -0.324024 -0.481360 -0.195622
+v -0.145452 -0.352708 0.284692
+v -0.012405 -0.338855 0.296877
+v -0.191519 -0.275945 0.241134
+v -0.314997 -0.313292 0.042352
+v -0.251350 -0.352006 0.236070
+v -0.251662 -0.271528 0.056125
+v -0.215605 -0.353341 -0.291280
+v -0.310893 -0.307540 -0.102697
+v -0.141580 -0.269476 -0.201628
+v -0.242498 -0.582723 -0.253676
+v -0.227906 -0.617549 -0.038563
+v -0.111931 -0.617337 -0.169874
+v -0.185298 -0.612804 0.127960
+v -0.028129 -0.617617 0.165416
+v -0.016184 -0.573827 0.264108
+v -0.177972 -0.498425 -0.305937
+v -0.073696 -0.441865 0.315938
+v 0.055844 -0.275509 0.230490
+v -0.038544 -0.271254 -0.003959
+v -0.113661 -0.275896 0.092281
+v -0.019681 -0.270880 -0.209410
+v 0.084588 -0.577201 0.232865
+v 0.138373 -0.489209 0.281388
+v -0.040401 -0.572065 -0.327698
+v -0.087569 -0.276756 0.227924
+v -0.085336 -0.462446 -0.326833
+v 0.100100 -0.567316 -0.313427
+v 0.107445 -0.618104 -0.195054
+v 0.139653 -0.352887 0.274273
+v 0.063091 -0.447945 -0.333707
+v 0.286186 -0.565182 -0.087103
+v 0.238365 -0.577201 -0.196622
+v 0.293017 -0.447114 -0.159490
+v 0.209759 -0.567316 0.230937
+v 0.267623 -0.595719 0.055058
+v 0.256153 -0.451507 0.188283
+v 0.190666 -0.454465 -0.315310
+v 0.311678 -0.448275 -0.015801
+v -0.045022 -0.370793 -0.288065
+v 0.219602 -0.316511 -0.226146
+v 0.105561 -0.357578 -0.312446
+v 0.123638 -0.271152 -0.166337
+v 0.294186 -0.351448 0.047837
+v 0.246565 -0.292516 -0.084868
+v 0.215174 -0.276111 0.011028
+v 0.238474 -0.331945 0.203246
+v 0.205528 -0.611421 -0.068288
+v -0.023822 -0.616952 -0.198056
+v 0.104869 -0.617528 0.163180
+v 0.037412 -0.478598 0.296434
+v 0.075491 -0.268529 0.003878
+v -0.007103 -0.616487 -0.017163
+vt 0.999784 0.777888
+vt 0.781916 0.751069
+vt 0.930695 0.535842
+vt 0.718554 0.493678
+vt 0.498343 0.500066
+vt 0.612704 0.301958
+vt 0.278288 0.491767
+vt 0.136170 0.301428
+vt 0.385039 0.315647
+vt 0.861174 0.302958
+vt 0.817615 0.924676
+vt 0.662334 0.996212
+vt 0.719667 0.785775
+vt 0.955856 0.540882
+vt 0.919844 0.749017
+vt 0.810792 0.580191
+vt 0.698724 0.249779
+vt 0.882029 0.358101
+vt 0.648319 0.423681
+vt 0.738504 0.311189
+vt 0.859769 0.100574
+vt 0.955856 0.301223
+vt 0.603011 0.109855
+vt 0.889116 0.979094
+vt 0.625593 0.954685
+vt 0.572947 0.723101
+vt 0.629662 0.708272
+vt 0.361849 0.694965
+vt 0.626863 0.523494
+vt 0.877334 0.514944
+vt 0.753445 0.687054
+vt 0.678897 0.522004
+vt 0.804007 0.322784
+vt 0.508145 0.125975
+vt 0.614686 0.322544
+vt 0.274631 0.088482
+vt 0.046907 0.080882
+vt 0.724191 0.150589
+vt 0.955856 0.101994
+vt 0.459738 0.810380
+vt 0.524431 0.596612
+vt 0.614955 0.619521
+vt 0.385224 0.455707
+vt 0.518113 0.743431
+vt 0.397247 0.481913
+vt 0.473092 0.333636
+vt 0.593136 0.806842
+vt 0.542133 0.566645
+vt 0.245991 0.361941
+vt 0.291514 0.126530
+vt 0.515385 0.289890
+vt 0.348981 0.560141
+vt 0.480373 0.537386
+vt 0.705144 0.472239
+vt 0.601667 0.722403
+vt 0.283471 0.700220
+vt 0.061144 0.812481
+vt 0.120014 0.502516
+vt 0.080353 0.535703
+vt 0.356859 0.719702
+vt 0.417004 0.243099
+vt 0.001005 0.468262
+vt 0.186797 0.314823
+vt 0.187216 0.555587
+vt 0.094383 0.931756
+vt 0.003057 0.709324
+vt 0.238065 0.772821
+vt 0.569632 0.999536
+vt 0.323797 1.000000
+vt 0.482075 0.313011
+vt 0.735871 0.182001
+vt 0.032983 0.251846
+vt 0.574313 0.080491
+vt 0.318361 0.961238
+vt 0.229901 0.178033
+vt 0.256609 0.467686
+vt 0.464307 0.768933
+vt 0.865183 0.712997
+vt 0.725052 0.926500
+vt 0.093408 0.705147
+vt 0.230523 0.921209
+vt 0.968797 0.984796
+vt 0.210756 0.792236
+vt 0.477482 0.962103
+vt 0.256493 0.223509
+vt 0.000000 0.255402
+vt 0.543998 0.500902
+vt 0.362414 0.637562
+vt 0.469769 0.648982
+vt 0.379376 0.894841
+vt 0.246514 0.544201
+vt 0.117965 0.884444
+vt 0.047032 0.632888
+vt 0.079441 0.605161
+vt 0.000000 0.325670
+vt 0.241712 0.163133
+vt 0.470206 0.343559
+vn -0.4424 -0.2721 0.8545
+vn -0.9411 -0.3239 0.0966
+vn -0.8900 -0.0459 0.4537
+vn -0.9616 -0.2698 -0.0505
+vn -0.1267 0.4309 0.8934
+vn -0.5683 0.7508 0.3368
+vn -0.4212 0.8093 -0.4094
+vn -0.1432 -0.9785 -0.1487
+vn -0.1644 -0.9754 -0.1468
+vn -0.0925 -0.9713 0.2191
+vn -0.0809 -0.9734 0.2143
+vn 0.1640 -0.9089 0.3834
+vn -0.3244 -0.9449 0.0431
+vn -0.2525 -0.9632 0.0921
+vn -0.2386 -0.9683 0.0744
+vn -0.6066 -0.0774 -0.7912
+vn -0.6047 -0.0305 -0.7959
+vn -0.8180 -0.4609 -0.3441
+vn -0.3248 0.0692 0.9432
+vn -0.3094 -0.1289 0.9422
+vn 0.1966 -0.2830 0.9387
+vn -0.9823 0.0441 0.1820
+vn -0.9465 -0.2736 0.1713
+vn -0.9609 -0.2464 0.1261
+vn -0.1138 0.2458 0.9626
+vn -0.9307 0.1466 0.3351
+vn -0.8918 0.0197 0.4519
+vn -0.4108 0.1623 0.8971
+vn -0.8111 0.3222 -0.4881
+vn -0.9831 0.1383 -0.1197
+vn -0.9846 0.1737 -0.0210
+vn -0.0254 0.9993 0.0284
+vn 0.0117 0.9999 0.0029
+vn 0.2253 -0.5725 0.7884
+vn -0.3114 -0.3170 -0.8958
+vn 0.0842 0.7843 0.6146
+vn -0.2337 0.0375 -0.9716
+vn 0.0277 0.9995 0.0148
+vn -0.7667 0.5856 0.2632
+vn -0.4018 0.2575 0.8788
+vn 0.0266 0.9995 0.0193
+vn -0.2797 0.9535 -0.1119
+vn -0.5530 0.8330 0.0174
+vn 0.0713 -0.9150 -0.3970
+vn 0.1514 0.0501 0.9872
+vn 0.1046 -0.1350 -0.9853
+vn 0.8924 -0.2722 -0.3598
+vn 0.9100 -0.2400 0.3381
+vn 0.0917 -0.9143 0.3946
+vn 0.1353 -0.1250 -0.9829
+vn 0.9824 -0.1357 -0.1287
+vn 0.6102 0.0468 0.7909
+vn 0.0843 0.6920 -0.7170
+vn 0.0824 0.8533 -0.5149
+vn 0.6648 0.7415 0.0908
+vn 0.3123 0.7010 0.6411
+vn 0.4746 -0.8731 -0.1114
+vn 0.2916 -0.9402 -0.1761
+vn 0.2698 -0.8787 -0.3938
+vn -0.0597 -0.9520 -0.3002
+vn -0.0008 -0.9450 -0.3271
+vn 0.2861 -0.9267 0.2438
+vn 0.1615 -0.9859 0.0442
+vn 0.4711 -0.8730 -0.1260
+vn -0.1930 -0.0714 -0.9786
+vn -0.0965 -0.9443 -0.3146
+vn 0.0753 -0.8534 0.5158
+vn -0.0828 0.4189 -0.9042
+vn -0.0452 -0.0107 -0.9989
+vn 0.8180 0.1812 -0.5459
+vn 0.8241 -0.1943 -0.5321
+vn 0.5548 -0.4568 -0.6954
+vn 0.9649 0.0018 0.2626
+vn 0.9529 -0.1614 0.2567
+vn 0.9646 -0.2539 0.0714
+vn 0.0090 -0.8643 0.5028
+vn 0.0533 -0.5070 0.8603
+vn 0.4482 0.4171 -0.7907
+vn 0.1489 0.1596 -0.9759
+vn -0.1782 0.3039 -0.9359
+vn 0.9323 0.3006 -0.2011
+vn 0.9337 0.3378 -0.1185
+vn 0.8936 0.3821 -0.2354
+vn 0.5780 0.0371 0.8152
+vn 0.6213 -0.0062 0.7835
+vn 0.9406 0.0984 0.3248
+vn 0.0500 -0.3462 0.9368
+vn 0.1936 0.0659 0.9789
+vn 0.0552 0.3683 -0.9281
+vn 0.0060 0.9999 -0.0137
+vn 0.1570 0.8414 -0.5171
+vn -0.1774 0.6361 -0.7509
+vn 0.0542 0.9985 -0.0001
+vn 0.2287 0.9692 -0.0909
+vn 0.3042 0.9279 -0.2156
+vn 0.0524 0.9980 0.0353
+vn 0.3184 0.9200 0.2286
+vn 0.6488 0.7482 0.1387
+vn -0.0258 0.9993 0.0285
+vn 0.1711 0.6190 0.7665
+vn 0.0084 1.0000 0.0047
+vn -0.0239 0.9997 -0.0004
+vn -0.0301 0.9992 0.0247
+vn -0.0426 0.6246 -0.7797
+vn -0.0284 -0.9996 -0.0095
+vn 0.0021 -0.9996 0.0279
+vn 0.0046 -1.0000 0.0024
+vn 0.0050 -1.0000 0.0021
+vn -0.0088 -1.0000 0.0034
+vn 0.0307 -0.9991 0.0289
+vn 0.0195 -0.9996 -0.0179
+vn 0.0006 -1.0000 -0.0061
+vn -0.0185 0.7328 0.6802
+vn -0.0088 0.9999 0.0080
+vn 0.0989 -0.3693 0.9240
+vn 0.1525 0.0512 0.9870
+usemtl None.001
+s off
+f 1/1/1 2/2/1 3/3/1
+f 4/4/2 5/5/2 6/6/2
+f 1/7/3 3/8/3 7/9/3
+f 4/4/4 6/6/4 8/10/4
+f 9/11/5 10/12/5 11/13/5
+f 12/14/6 13/15/6 14/16/6
+f 15/17/7 16/18/7 17/19/7
+f 18/20/8 19/21/8 4/22/8
+f 18/20/9 20/23/9 19/21/9
+f 2/2/10 1/1/10 21/24/10
+f 21/24/11 22/25/11 2/2/11
+f 22/25/12 23/26/12 2/2/12
+f 19/27/13 5/5/13 4/4/13
+f 19/27/14 21/28/14 5/5/14
+f 21/28/15 1/7/15 5/5/15
+f 24/29/16 8/30/16 15/31/16
+f 24/29/17 18/20/17 8/30/17
+f 18/20/18 4/22/18 8/30/18
+f 3/3/19 25/32/19 9/33/19
+f 3/3/20 2/2/20 25/32/20
+f 2/2/21 23/26/21 25/32/21
+f 6/6/22 7/9/22 12/34/22
+f 6/6/23 5/5/23 7/9/23
+f 5/5/24 1/7/24 7/9/24
+f 25/32/25 10/35/25 9/33/25
+f 7/9/26 13/36/26 12/34/26
+f 7/9/27 3/8/27 13/36/27
+f 3/8/28 9/37/28 13/36/28
+f 8/10/29 16/38/29 15/39/29
+f 8/10/30 6/6/30 16/38/30
+f 6/6/31 12/34/31 16/38/31
+f 26/40/32 27/41/32 28/42/32
+f 27/41/33 29/43/33 17/19/33
+f 23/26/34 30/44/34 31/45/34
+f 32/46/35 18/20/35 24/29/35
+f 11/13/36 10/12/36 33/47/36
+f 24/29/37 15/31/37 34/48/37
+f 14/16/38 11/13/38 28/42/38
+f 14/16/39 13/15/39 11/13/39
+f 13/15/40 9/11/40 11/13/40
+f 17/19/41 14/16/41 28/42/41
+f 17/19/42 16/18/42 14/16/42
+f 16/18/43 12/14/43 14/16/43
+f 35/49/44 36/50/44 32/46/44
+f 37/51/45 10/35/45 31/45/45
+f 35/49/46 32/46/46 38/52/46
+f 39/53/47 40/54/47 41/55/47
+f 42/56/48 43/57/48 44/58/48
+f 23/26/49 22/25/49 30/44/49
+f 35/49/50 38/52/50 45/59/50
+f 39/53/51 41/55/51 46/60/51
+f 42/56/52 44/58/52 31/45/52
+f 15/17/53 17/19/53 47/61/53
+f 48/62/54 49/63/54 50/64/54
+f 51/65/55 52/66/55 53/67/55
+f 37/68/56 54/69/56 26/40/56
+f 55/70/57 40/54/57 39/53/57
+f 55/70/58 36/71/58 40/54/58
+f 36/50/59 35/49/59 40/72/59
+f 18/20/60 32/46/60 20/23/60
+f 32/46/61 36/50/61 56/73/61
+f 57/74/62 43/57/62 42/56/62
+f 57/75/63 55/70/63 43/76/63
+f 55/70/64 39/53/64 43/76/64
+f 34/48/65 32/46/65 24/29/65
+f 32/46/66 56/73/66 20/23/66
+f 57/74/67 42/56/67 30/44/67
+f 38/52/68 34/48/68 47/77/68
+f 38/52/69 32/46/69 34/48/69
+f 41/55/70 45/78/70 48/79/70
+f 41/55/71 40/54/71 45/78/71
+f 40/72/72 35/49/72 45/59/72
+f 44/80/73 46/60/73 51/81/73
+f 44/80/74 43/76/74 46/60/74
+f 43/76/75 39/53/75 46/60/75
+f 22/25/76 57/74/76 30/44/76
+f 30/44/77 42/56/77 31/45/77
+f 45/78/78 49/82/78 48/79/78
+f 45/59/79 38/52/79 49/83/79
+f 38/52/80 47/77/80 49/83/80
+f 46/60/81 52/84/81 51/81/81
+f 46/60/82 41/55/82 52/84/82
+f 41/55/83 48/79/83 52/84/83
+f 31/45/84 54/85/84 37/51/84
+f 31/45/85 44/58/85 54/85/85
+f 44/58/86 51/86/86 54/85/86
+f 25/32/87 23/26/87 58/87/87
+f 10/35/88 25/32/88 58/87/88
+f 15/31/89 47/77/89 34/48/89
+f 50/64/90 29/43/90 59/88/90
+f 50/64/91 49/63/91 29/43/91
+f 49/63/92 47/61/92 29/43/92
+f 53/67/93 50/64/93 59/88/93
+f 53/67/94 52/66/94 50/64/94
+f 52/66/95 48/62/95 50/64/95
+f 26/40/96 53/67/96 59/88/96
+f 26/40/97 54/69/97 53/67/97
+f 54/69/98 51/65/98 53/67/98
+f 27/41/99 26/40/99 59/88/99
+f 10/12/100 37/68/100 26/40/100
+f 11/13/101 33/47/101 28/42/101
+f 29/43/102 27/41/102 59/88/102
+f 28/42/103 27/41/103 17/19/103
+f 47/61/104 17/19/104 29/43/104
+f 22/89/105 21/90/105 60/91/105
+f 21/90/106 19/92/106 60/91/106
+f 19/92/107 20/93/107 60/91/107
+f 20/93/108 56/94/108 60/91/108
+f 56/94/109 36/95/109 60/91/109
+f 36/95/110 55/96/110 60/91/110
+f 55/96/111 57/97/111 60/91/111
+f 57/97/112 22/89/112 60/91/112
+f 10/12/113 26/40/113 33/47/113
+f 33/47/114 26/40/114 28/42/114
+f 23/26/115 31/45/115 58/87/115
+f 31/45/116 10/35/116 58/87/116
diff --git a/games/globo/mods/nodes_nature/models/nodes_nature_cobble3.mtl b/games/globo/mods/nodes_nature/models/nodes_nature_cobble3.mtl
new file mode 100644
index 000000000..cd3235604
--- /dev/null
+++ b/games/globo/mods/nodes_nature/models/nodes_nature_cobble3.mtl
@@ -0,0 +1,12 @@
+# Blender MTL File: 'nodes_nature_cobble.blend'
+# Material Count: 1
+
+newmtl None.001
+Ns 96.078443
+Ka 1.000000 1.000000 1.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
diff --git a/games/globo/mods/nodes_nature/models/nodes_nature_cobble3.obj b/games/globo/mods/nodes_nature/models/nodes_nature_cobble3.obj
new file mode 100644
index 000000000..5b2170531
--- /dev/null
+++ b/games/globo/mods/nodes_nature/models/nodes_nature_cobble3.obj
@@ -0,0 +1,395 @@
+# Blender v3.0.1 OBJ File: 'nodes_nature_cobble.blend'
+# www.blender.org
+mtllib nodes_nature_cobble3.mtl
+o Icosphere.001_Icosphere.001
+v -0.180823 -0.634491 -0.031326
+v -0.080981 -0.669554 0.005755
+v -0.166987 -0.569878 0.090439
+v -0.204335 -0.487145 -0.180643
+v -0.193832 -0.561780 -0.108982
+v -0.233493 -0.420199 -0.051957
+v -0.209783 -0.513253 0.031074
+v -0.223539 -0.364652 -0.136217
+v -0.100345 -0.513259 0.176946
+v -0.008558 -0.509830 0.192657
+v -0.132126 -0.439668 0.213401
+v -0.217312 -0.367359 0.095455
+v -0.173402 -0.488885 0.155312
+v -0.173618 -0.345737 0.132359
+v -0.148743 -0.230612 -0.085906
+v -0.214481 -0.292161 0.033595
+v -0.097674 -0.217662 0.016443
+v -0.167295 -0.405026 -0.237004
+v -0.157229 -0.534424 -0.164549
+v -0.077220 -0.469743 -0.224214
+v -0.127834 -0.613041 -0.085208
+v -0.019406 -0.634721 -0.071675
+v -0.011165 -0.653458 0.005401
+v -0.122780 -0.322035 -0.198988
+v -0.050842 -0.589224 0.125794
+v 0.038526 -0.434140 0.208872
+v -0.026591 -0.316021 0.105188
+v -0.078413 -0.366476 0.145627
+v -0.013578 -0.214791 0.011868
+v 0.058356 -0.640397 -0.011306
+v 0.095462 -0.604428 0.075332
+v -0.027872 -0.361400 -0.262909
+v -0.060413 -0.433727 0.206789
+v -0.058872 -0.287306 -0.182120
+v 0.069057 -0.365186 -0.252924
+v 0.074125 -0.457889 -0.236246
+v 0.096345 -0.508260 0.172069
+v 0.043525 -0.274071 -0.174616
+v 0.197435 -0.474969 -0.148256
+v 0.164445 -0.429313 -0.206962
+v 0.202148 -0.359129 -0.094641
+v 0.144710 -0.632729 -0.004935
+v 0.184629 -0.565597 -0.105890
+v 0.176716 -0.533040 0.060567
+v 0.131538 -0.287545 -0.171018
+v 0.215022 -0.430539 -0.030034
+v -0.031060 -0.244055 -0.097241
+v 0.151500 -0.237586 -0.029223
+v 0.072825 -0.223089 -0.098655
+v 0.085296 -0.236146 0.031290
+v 0.202954 -0.395993 0.069970
+v 0.170101 -0.290709 0.052736
+v 0.148446 -0.326689 0.108453
+v 0.164520 -0.459115 0.155071
+v 0.141791 -0.515649 -0.173596
+v -0.016434 -0.455630 -0.236770
+v 0.072348 -0.633562 -0.072628
+v 0.025810 -0.604610 0.089968
+v 0.052080 -0.318020 0.110757
+v -0.004900 -0.544220 -0.154021
+vt 0.999784 0.777888
+vt 0.781916 0.751069
+vt 0.930695 0.535842
+vt 0.718554 0.493678
+vt 0.498343 0.500066
+vt 0.612704 0.301958
+vt 0.278288 0.491767
+vt 0.136170 0.301428
+vt 0.385039 0.315647
+vt 0.861174 0.302958
+vt 0.817615 0.924676
+vt 0.662334 0.996212
+vt 0.719667 0.785775
+vt 0.955856 0.540882
+vt 0.919844 0.749017
+vt 0.810792 0.580191
+vt 0.698724 0.249779
+vt 0.882029 0.358101
+vt 0.648319 0.423681
+vt 0.738504 0.311189
+vt 0.859769 0.100574
+vt 0.955856 0.301223
+vt 0.603011 0.109855
+vt 0.889116 0.979094
+vt 0.625593 0.954685
+vt 0.572947 0.723101
+vt 0.629662 0.708272
+vt 0.361849 0.694965
+vt 0.626863 0.523494
+vt 0.877334 0.514944
+vt 0.753445 0.687054
+vt 0.678897 0.522004
+vt 0.804007 0.322784
+vt 0.508145 0.125975
+vt 0.614686 0.322544
+vt 0.274631 0.088482
+vt 0.046907 0.080882
+vt 0.724191 0.150589
+vt 0.955856 0.101994
+vt 0.459738 0.810380
+vt 0.524431 0.596612
+vt 0.614955 0.619521
+vt 0.385224 0.455707
+vt 0.518113 0.743431
+vt 0.397247 0.481913
+vt 0.473092 0.333636
+vt 0.593136 0.806842
+vt 0.542133 0.566645
+vt 0.245991 0.361941
+vt 0.291514 0.126530
+vt 0.515385 0.289890
+vt 0.348981 0.560141
+vt 0.480373 0.537386
+vt 0.705144 0.472239
+vt 0.601667 0.722403
+vt 0.283471 0.700220
+vt 0.061144 0.812481
+vt 0.120014 0.502516
+vt 0.080353 0.535703
+vt 0.356859 0.719702
+vt 0.417004 0.243099
+vt 0.001005 0.468262
+vt 0.186797 0.314823
+vt 0.187216 0.555587
+vt 0.094383 0.931756
+vt 0.003057 0.709324
+vt 0.238065 0.772821
+vt 0.569632 0.999536
+vt 0.323797 1.000000
+vt 0.482075 0.313011
+vt 0.735871 0.182001
+vt 0.032983 0.251846
+vt 0.574313 0.080491
+vt 0.318361 0.961238
+vt 0.229901 0.178033
+vt 0.256609 0.467686
+vt 0.464307 0.768933
+vt 0.865183 0.712997
+vt 0.725052 0.926500
+vt 0.093408 0.705147
+vt 0.230523 0.921209
+vt 0.968797 0.984796
+vt 0.210756 0.792236
+vt 0.477482 0.962103
+vt 0.256493 0.223509
+vt 0.000000 0.255402
+vt 0.543998 0.500902
+vt 0.362414 0.637562
+vt 0.469769 0.648982
+vt 0.379376 0.894841
+vt 0.246514 0.544201
+vt 0.117965 0.884444
+vt 0.047032 0.632888
+vt 0.079441 0.605161
+vt 0.000000 0.325670
+vt 0.241712 0.163133
+vt 0.470206 0.343559
+vn -0.4413 -0.7709 0.4592
+vn -0.9678 -0.2312 -0.0990
+vn -0.8850 -0.3620 0.2927
+vn -0.9804 -0.0901 -0.1752
+vn -0.1300 -0.4846 0.8650
+vn -0.6738 0.1160 0.7298
+vn -0.5158 0.8434 0.1506
+vn -0.2026 -0.4904 -0.8476
+vn -0.2319 -0.4889 -0.8409
+vn -0.1297 -0.8708 -0.4742
+vn -0.1137 -0.8691 -0.4814
+vn 0.2162 -0.9432 -0.2524
+vn -0.4447 -0.6521 -0.6140
+vn -0.3521 -0.7268 -0.5897
+vn -0.3345 -0.7152 -0.6137
+vn -0.5965 0.5517 -0.5830
+vn -0.5937 0.5759 -0.5620
+vn -0.8643 0.0461 -0.5008
+vn -0.3169 -0.6631 0.6781
+vn -0.3028 -0.7552 0.5814
+vn 0.1956 -0.8370 0.5110
+vn -0.9818 -0.1167 0.1496
+vn -0.9647 -0.2626 -0.0189
+vn -0.9761 -0.2141 -0.0370
+vn -0.1124 -0.6044 0.7887
+vn -0.9328 -0.1847 0.3094
+vn -0.8865 -0.3300 0.3243
+vn -0.4040 -0.5912 0.6981
+vn -0.8279 0.5304 -0.1823
+vn -0.9877 0.1559 -0.0139
+vn -0.9924 0.0981 0.0738
+vn -0.0368 0.6477 0.7610
+vn 0.0170 0.6765 0.7362
+vn 0.2421 -0.9284 0.2817
+vn -0.3121 0.5289 -0.7892
+vn 0.1006 -0.1149 0.9883
+vn -0.2275 0.7311 -0.6433
+vn 0.0402 0.6628 0.7477
+vn -0.8444 0.0836 0.5292
+vn -0.3995 -0.5396 0.7411
+vn 0.0385 0.6579 0.7521
+vn -0.3864 0.7343 0.5582
+vn -0.6933 0.4732 0.5435
+vn 0.0943 -0.1713 -0.9807
+vn 0.1472 -0.7021 0.6967
+vn 0.1022 0.6647 -0.7401
+vn 0.9066 0.1463 -0.3957
+vn 0.9208 -0.3722 0.1166
+vn 0.1214 -0.9615 -0.2467
+vn 0.1321 0.6671 -0.7331
+vn 0.9866 0.0336 -0.1594
+vn 0.5994 -0.5650 0.5670
+vn 0.0955 0.9805 -0.1717
+vn 0.1035 0.9906 0.0896
+vn 0.7876 0.3309 0.5198
+vn 0.3565 -0.1773 0.9173
+vn 0.6120 -0.4196 -0.6703
+vn 0.3974 -0.4197 -0.8161
+vn 0.3470 -0.1477 -0.9262
+vn -0.0820 -0.3019 -0.9498
+vn -0.0011 -0.2674 -0.9636
+vn 0.3846 -0.8315 -0.4009
+vn 0.2305 -0.7077 -0.6679
+vn 0.6074 -0.4052 -0.6833
+vn -0.1879 0.6869 -0.7021
+vn -0.1315 -0.2798 -0.9510
+vn 0.0946 -0.9915 -0.0889
+vn -0.0846 0.8987 -0.4302
+vn -0.0439 0.7278 -0.6844
+vn 0.8178 0.4970 -0.2902
+vn 0.8252 0.3111 -0.4714
+vn 0.5785 0.3241 -0.7485
+vn 0.9629 -0.1970 0.1843
+vn 0.9576 -0.2708 0.0985
+vn 0.9812 -0.1760 -0.0798
+vn 0.0114 -0.9941 -0.1082
+vn 0.0559 -0.9304 0.3623
+vn 0.4607 0.8148 -0.3519
+vn 0.1457 0.7945 -0.5895
+vn -0.1778 0.8475 -0.5002
+vn 0.9540 0.2996 0.0116
+vn 0.9625 0.2556 0.0907
+vn 0.9282 0.3708 0.0297
+vn 0.5671 -0.5867 0.5781
+vn 0.6102 -0.5838 0.5355
+vn 0.9401 -0.1990 0.2770
+vn 0.0503 -0.8742 0.4830
+vn 0.1885 -0.6894 0.6994
+vn 0.0557 0.8821 -0.4677
+vn 0.0087 0.6946 0.7193
+vn 0.1955 0.9775 0.0795
+vn -0.1957 0.9546 -0.2247
+vn 0.0784 0.6778 0.7311
+vn 0.3208 0.7340 0.5986
+vn 0.4096 0.8052 0.4289
+vn 0.0757 0.6384 0.7660
+vn 0.4256 0.3460 0.8361
+vn 0.7712 0.2926 0.5653
+vn -0.0374 0.6475 0.7611
+vn 0.1873 -0.3158 0.9302
+vn 0.0122 0.6746 0.7381
+vn -0.0346 0.6798 0.7326
+vn -0.0436 0.6517 0.7572
+vn -0.0467 0.9667 -0.2518
+vn -0.0411 -0.6688 -0.7423
+vn 0.0030 -0.7098 -0.7044
+vn 0.0066 -0.6824 -0.7309
+vn 0.0073 -0.6821 -0.7312
+vn -0.0128 -0.6834 -0.7299
+vn 0.0445 -0.7101 -0.7027
+vn 0.0283 -0.6597 -0.7510
+vn 0.0008 -0.6731 -0.7396
+vn -0.0215 -0.1966 0.9802
+vn -0.0128 0.6709 0.7414
+vn 0.0999 -0.8799 0.4646
+vn 0.1483 -0.7015 0.6971
+usemtl None.001
+s off
+f 1/1/1 2/2/1 3/3/1
+f 4/4/2 5/5/2 6/6/2
+f 1/7/3 3/8/3 7/9/3
+f 4/4/4 6/6/4 8/10/4
+f 9/11/5 10/12/5 11/13/5
+f 12/14/6 13/15/6 14/16/6
+f 15/17/7 16/18/7 17/19/7
+f 18/20/8 19/21/8 4/22/8
+f 18/20/9 20/23/9 19/21/9
+f 2/2/10 1/1/10 21/24/10
+f 21/24/11 22/25/11 2/2/11
+f 22/25/12 23/26/12 2/2/12
+f 19/27/13 5/5/13 4/4/13
+f 19/27/14 21/28/14 5/5/14
+f 21/28/15 1/7/15 5/5/15
+f 24/29/16 8/30/16 15/31/16
+f 24/29/17 18/20/17 8/30/17
+f 18/20/18 4/22/18 8/30/18
+f 3/3/19 25/32/19 9/33/19
+f 3/3/20 2/2/20 25/32/20
+f 2/2/21 23/26/21 25/32/21
+f 6/6/22 7/9/22 12/34/22
+f 6/6/23 5/5/23 7/9/23
+f 5/5/24 1/7/24 7/9/24
+f 25/32/25 10/35/25 9/33/25
+f 7/9/26 13/36/26 12/34/26
+f 7/9/27 3/8/27 13/36/27
+f 3/8/28 9/37/28 13/36/28
+f 8/10/29 16/38/29 15/39/29
+f 8/10/30 6/6/30 16/38/30
+f 6/6/31 12/34/31 16/38/31
+f 26/40/32 27/41/32 28/42/32
+f 27/41/33 29/43/33 17/19/33
+f 23/26/34 30/44/34 31/45/34
+f 32/46/35 18/20/35 24/29/35
+f 11/13/36 10/12/36 33/47/36
+f 24/29/37 15/31/37 34/48/37
+f 14/16/38 11/13/38 28/42/38
+f 14/16/39 13/15/39 11/13/39
+f 13/15/40 9/11/40 11/13/40
+f 17/19/41 14/16/41 28/42/41
+f 17/19/42 16/18/42 14/16/42
+f 16/18/43 12/14/43 14/16/43
+f 35/49/44 36/50/44 32/46/44
+f 37/51/45 10/35/45 31/45/45
+f 35/49/46 32/46/46 38/52/46
+f 39/53/47 40/54/47 41/55/47
+f 42/56/48 43/57/48 44/58/48
+f 23/26/49 22/25/49 30/44/49
+f 35/49/50 38/52/50 45/59/50
+f 39/53/51 41/55/51 46/60/51
+f 42/56/52 44/58/52 31/45/52
+f 15/17/53 17/19/53 47/61/53
+f 48/62/54 49/63/54 50/64/54
+f 51/65/55 52/66/55 53/67/55
+f 37/68/56 54/69/56 26/40/56
+f 55/70/57 40/54/57 39/53/57
+f 55/70/58 36/71/58 40/54/58
+f 36/50/59 35/49/59 40/72/59
+f 18/20/60 32/46/60 20/23/60
+f 32/46/61 36/50/61 56/73/61
+f 57/74/62 43/57/62 42/56/62
+f 57/75/63 55/70/63 43/76/63
+f 55/70/64 39/53/64 43/76/64
+f 34/48/65 32/46/65 24/29/65
+f 32/46/66 56/73/66 20/23/66
+f 57/74/67 42/56/67 30/44/67
+f 38/52/68 34/48/68 47/77/68
+f 38/52/69 32/46/69 34/48/69
+f 41/55/70 45/78/70 48/79/70
+f 41/55/71 40/54/71 45/78/71
+f 40/72/72 35/49/72 45/59/72
+f 44/80/73 46/60/73 51/81/73
+f 44/80/74 43/76/74 46/60/74
+f 43/76/75 39/53/75 46/60/75
+f 22/25/76 57/74/76 30/44/76
+f 30/44/77 42/56/77 31/45/77
+f 45/78/78 49/82/78 48/79/78
+f 45/59/79 38/52/79 49/83/79
+f 38/52/80 47/77/80 49/83/80
+f 46/60/81 52/84/81 51/81/81
+f 46/60/82 41/55/82 52/84/82
+f 41/55/83 48/79/83 52/84/83
+f 31/45/84 54/85/84 37/51/84
+f 31/45/85 44/58/85 54/85/85
+f 44/58/86 51/86/86 54/85/86
+f 25/32/87 23/26/87 58/87/87
+f 10/35/88 25/32/88 58/87/88
+f 15/31/89 47/77/89 34/48/89
+f 50/64/90 29/43/90 59/88/90
+f 50/64/91 49/63/91 29/43/91
+f 49/63/92 47/61/92 29/43/92
+f 53/67/93 50/64/93 59/88/93
+f 53/67/94 52/66/94 50/64/94
+f 52/66/95 48/62/95 50/64/95
+f 26/40/96 53/67/96 59/88/96
+f 26/40/97 54/69/97 53/67/97
+f 54/69/98 51/65/98 53/67/98
+f 27/41/99 26/40/99 59/88/99
+f 10/12/100 37/68/100 26/40/100
+f 11/13/101 33/47/101 28/42/101
+f 29/43/102 27/41/102 59/88/102
+f 28/42/103 27/41/103 17/19/103
+f 47/61/104 17/19/104 29/43/104
+f 22/89/105 21/90/105 60/91/105
+f 21/90/106 19/92/106 60/91/106
+f 19/92/107 20/93/107 60/91/107
+f 20/93/108 56/94/108 60/91/108
+f 56/94/109 36/95/109 60/91/109
+f 36/95/110 55/96/110 60/91/110
+f 55/96/111 57/97/111 60/91/111
+f 57/97/112 22/89/112 60/91/112
+f 10/12/113 26/40/113 33/47/113
+f 33/47/114 26/40/114 28/42/114
+f 23/26/115 31/45/115 58/87/115
+f 31/45/116 10/35/116 58/87/116
diff --git a/games/globo/mods/nodes_nature/moisture_spread.lua b/games/globo/mods/nodes_nature/moisture_spread.lua
new file mode 100644
index 000000000..9a168e84d
--- /dev/null
+++ b/games/globo/mods/nodes_nature/moisture_spread.lua
@@ -0,0 +1,530 @@
+-------------------------------------------------------------
+--MOISTURE SPREAD
+--move wettness through sediment
+--other water effects
+
+
+----------------------------------------------------------------
+--freeze water
+local function water_freeze(pos, node)
+ local n_name = node.name
+
+ if climate.can_freeze(pos) then
+
+ local water_type = minetest.get_item_group(n_name, "water")
+ if water_type == 1 then
+ minetest.set_node(pos, {name = "nodes_nature:ice"})
+ elseif water_type == 2 then
+ minetest.set_node(pos, {name = "nodes_nature:sea_ice"})
+ end
+
+ end
+end
+
+----------------------------------------------------------------
+--evaporate water
+local function water_evap(pos, node)
+
+ --evaporation
+ if climate.can_evaporate(pos) then
+ --lose it's own water to the atmosphere
+ minetest.remove_node(pos)
+ return
+ end
+
+end
+
+--------------------------
+--move sources down, otherwise erosion leaves them stranded
+local function fall_water(pos,node)
+
+ local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
+ local under_name = minetest.get_node(pos_under).name
+
+ if under_name == "nodes_nature:freshwater_flowing" or under_name == "nodes_nature:salt_water_flowing" then
+ minetest.remove_node(pos)
+ minetest.set_node(pos_under, {name = node.name})
+ return pos
+ end
+
+ --Fresh water should not float on top of the ocean
+ if ( under_name == "nodes_nature:salt_water_source" and
+ node.name == "nodes_nature:freshwater_source" ) then
+ minetest.remove_node(pos)
+ return nil
+ end
+ return pos
+end
+
+local function water_handler(pos, node)
+ pos = fall_water(pos, node)
+ if pos == nil then
+ return -- the water is not there anymore
+ end
+ if climate.active_temp < 2 then
+ water_freeze(pos, node)
+ else
+ water_evap(pos, node)
+ end
+end
+
+--
+minetest.register_abm({
+ label = "Water Source Handling",
+ nodenames = {"nodes_nature:freshwater_source", "nodes_nature:salt_water_source"},
+ interval = 120,
+ chance = 10,
+ action = function(...)
+ water_handler(...)
+ end
+})
+
+
+----------------------------------------------------------------
+--Thaw snow and ice
+
+local function thaw_frozen(pos, node)
+ --position gets overwritten by climate function otherwise,
+ --not clear why
+ local p = pos
+ if climate.can_thaw(p) then
+
+ local name = node.name
+ if name == "nodes_nature:snow_block" then
+ minetest.set_node(p, {name = "nodes_nature:freshwater_source"})
+ elseif name == "nodes_nature:snow" then
+ minetest.remove_node(p)
+ elseif name == "nodes_nature:ice" then
+ local under = minetest.get_node({x = p.x, y = p.y-1, z =p.z})
+ if under.name == "nodes_nature:salt_water_source" then
+ minetest.remove_node(p)
+ else
+ minetest.set_node(p, {name = "nodes_nature:freshwater_source"})
+ end
+ elseif name == "nodes_nature:sea_ice" then
+ minetest.set_node(p, {name = "nodes_nature:salt_water_source"})
+ return
+ end
+ minetest.check_for_falling(p)
+ return
+ end
+end
+
+
+minetest.register_abm({
+ label = "Thaw Ice and snow",
+ nodenames = {"nodes_nature:ice", "nodes_nature:snow_block", "nodes_nature:snow", "nodes_nature:sea_ice"},
+ interval = 103,
+ chance = 5,
+ action = function(...)
+ thaw_frozen(...)
+ end
+})
+
+
+
+------------------------------------------------------------------
+--
+local function snow_accumulate(pos, node)
+ if pos.y < -15 then
+ return
+ end
+
+ --
+ local posu = {x = pos.x, y = pos.y - 1, z = pos.z}
+ local under_name = minetest.get_node(posu).name
+
+ if under_name == "air" then
+ return
+ end
+
+ --is snowing
+ if not climate.get_snow(pos) then
+ return
+ end
+
+ local nodedef = minetest.registered_nodes[under_name]
+ if not nodedef then
+ return
+ end
+
+ --walkable under i.e. not on water etc
+ local walk = nodedef.walkable
+ if not walk then
+ return
+ end
+
+ --pile up snow
+ if under_name == "nodes_nature:snow" then
+ minetest.swap_node(posu, {name = "nodes_nature:snow_block"})
+ return
+ end
+
+ --not on stairs, meshes etc
+ local draw = nodedef.drawtype
+ if draw ~= 'normal' then
+ return
+ end
+
+ --thin snow
+ minetest.set_node(pos, {name = "nodes_nature:snow"})
+
+end
+
+
+--
+minetest.register_abm({
+ label = "snow accumulate",
+ nodenames = {"air", "nodes_nature:snow"},
+ neighbors = {"group:crumbly","group:cracky", "group:snappy"},
+ interval = 72,
+ chance = 770,
+ min_y = -15,
+ action = function(...)
+ snow_accumulate(...)
+ end
+})
+
+
+
+
+
+--puddle detect
+--check for sides that can hold water
+--intended to be call for an air node with solid below
+--i.e. somewhere to put a puddle
+local function puddle_detect(pos)
+ local sides = {
+ {x = pos.x + 1, y = pos.y, z = pos.z},
+ {x = pos.x - 1, y = pos.y, z = pos.z},
+ {x = pos.x, y = pos.y, z = pos.z + 1},
+ {x = pos.x, y = pos.y, z = pos.z - 1}
+ }
+ local puddle = true
+ for i, v in ipairs(sides) do
+ local s_name = minetest.get_node(v).name
+ if minetest.get_item_group(s_name, "wet_sediment") == 0
+ and minetest.get_item_group(s_name, "soft_stone") == 0
+ and minetest.get_item_group(s_name, "masonry") == 0
+ and minetest.get_item_group(s_name, "stone") == 0 then
+ puddle = false
+ break
+ end
+ end
+ if puddle then
+ return true
+ else
+ return false
+ end
+end
+
+----------------------------------------------------------------
+-- Wet nodes: move water down into dry sediment
+--drain if exposed side or under
+--evaporate at surface in hot sun
+
+local function moisture_spread(pos, node)
+
+
+ local nodename = node.name
+
+ --dry version
+ local nodedef = minetest.registered_nodes[nodename]
+ local dry_name = nodedef._dry_name
+ if not nodedef or not dry_name then
+ return
+ end
+
+ --evaporation
+ if climate.can_evaporate(pos) then
+ --lose it's own water to the atmosphere
+ minetest.swap_node(pos, {name = dry_name})
+ return
+ end
+
+ --1= fresh or 2 = salty
+ local water_type = minetest.get_item_group(nodename, "wet_sediment")
+
+
+ --move through the soil, with a bias downwards
+ local pos_sed = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y, z = pos.z + 1},
+ {"group:sediment"})
+
+ if #pos_sed > 0 then
+ --select a random one
+ local pos2 = pos_sed[math.random(#pos_sed)]
+ --is it dry?
+ local name2 = minetest.get_node(pos2).name
+ if minetest.get_item_group(name2, "wet_sediment") == 0 then
+ --lose it's own water, and move it
+ minetest.swap_node(pos, {name = dry_name})
+ --set wet version of what draining into
+ local nodedef2 = minetest.registered_nodes[name2]
+ if not nodedef2 then
+ return
+ end
+ if water_type == 1 then
+ minetest.swap_node(pos2, {name = nodedef2._wet_name})
+ else
+ --can it absorb salt or is it "destroyed" e.g. surface, ag
+ local salt = nodedef2._wet_salty_name
+ if not salt then
+ --set it to it's salted parent material
+ minetest.swap_node(pos2, {name = nodedef2.drop})
+ else
+ minetest.swap_node(pos2, {name = nodedef2._wet_salty_name})
+ end
+ end
+ return
+ end
+ end
+
+ --leach out
+ --move out of the soil, only downwards
+ local pos_air = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y - 1, z = pos.z + 1},
+ {"air"})
+
+ if #pos_air > 0 then
+ --select a random one
+ local pos2 = pos_air[math.random(#pos_air)]
+ --lose it's own water, and move it
+ minetest.swap_node(pos, {name = dry_name})
+ --source or flowing?
+ if puddle_detect(pos2) then
+ if water_type == 1 then
+ minetest.set_node(pos2, {name = "nodes_nature:freshwater_source"})
+ else
+ minetest.set_node(pos2, {name = "nodes_nature:salt_water_source"})
+ end
+ else
+ if water_type == 1 then
+ minetest.set_node(pos2, {name = "nodes_nature:freshwater_flowing"})
+ else
+ minetest.set_node(pos2, {name = "nodes_nature:salt_water_flowing"})
+ end
+ end
+ return
+ end
+
+
+
+
+end
+
+--
+--
+minetest.register_abm({
+ label = "Moisture Spread",
+ nodenames = {"group:wet_sediment"},
+ --neighbors = {"group:sediment"},
+ interval = 121,
+ chance = 15,
+ action = function(...)
+ moisture_spread(...)
+ end
+})
+
+
+----------------------------------------------------------------
+-- Water soaks into sediment
+local function water_soak(pos, node)
+
+ local nodename = node.name
+
+ --move into the soil, with a bais downwards
+ local pos_sed = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y, z = pos.z + 1},
+ {"group:sediment"})
+
+ if #pos_sed > 0 then
+ --select a random one
+ local pos2 = pos_sed[math.random(#pos_sed)]
+ --is it dry?
+ local name2 = minetest.get_node(pos2).name
+ if minetest.get_item_group(name2, "wet_sediment") == 0 then
+ --
+ if nodename == "nodes_nature:freshwater_source" then
+ --non-renew
+ minetest.swap_node(pos, {name = "air"})
+ --set wet version of what draining into
+ local nodedef2 = minetest.registered_nodes[name2]
+ if not nodedef2 then
+ return
+ end
+ minetest.swap_node(pos2, {name = nodedef2._wet_name})
+ return
+ else
+ --set salty wet version of what draining into
+ local nodedef2 = minetest.registered_nodes[name2]
+ if not nodedef2 then
+ return
+ end
+ minetest.swap_node(pos2, {name = nodedef2._wet_salty_name})
+ return
+ end
+ end
+ end
+
+end
+
+--
+--
+minetest.register_abm({
+ label = "Water Soak",
+ nodenames = {"nodes_nature:freshwater_source", "nodes_nature:salt_water_source"},
+ neighbors = {"group:sediment"},
+ interval = 147,
+ chance = 100,
+ action = function(...)
+ water_soak(...)
+ end
+})
+
+
+
+----------------------------------------------------------------
+-- flowing Water erode
+--will rearrange sediments until out of the path of flow..
+--and cannot shift them anywhere else
+--eventually getting a stable "river" bed shape if it can
+local function water_erode(pos, node)
+ --take the sediment under it and move it to the side
+ local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
+ local under_name = minetest.get_node(pos_under).name
+ if minetest.get_item_group(under_name, "sediment") > 0 then
+
+ --move it to another part of water, so long as it is grounded
+ local pos_flow = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y - 1, z = pos.z + 1},
+ {"nodes_nature:freshwater_flowing", "nodes_nature:salt_water_flowing" })
+
+ if #pos_flow > 0 then
+ --select a random one
+ local pos2 = pos_flow[math.random(#pos_flow)]
+ --check under
+ local pos_uf = {x = pos2.x, y = pos2.y - 1, z = pos2.z}
+ local uf_name = minetest.get_node(pos_uf).name
+
+ local nodedefu = minetest.registered_nodes[uf_name]
+ if not nodedefu then
+ return
+ end
+
+ if nodedefu.walkable then
+
+ --shift the sediment and put the water in its place
+ minetest.remove_node(pos)
+ minetest.set_node(pos_under, {name = node.name})
+ --set dropped
+ local nodedef = minetest.registered_nodes[under_name]
+ if not nodedef then
+ return
+ end
+ minetest.set_node(pos2, {name = nodedef.drop})
+ end
+ end
+
+ elseif minetest.get_item_group(under_name, "water") > 0 or under_name == "air" then
+ --it is a water fall
+ --take sediment from beside and move under to fill gap
+ --move it to another part of water, so long as it is grounded
+ local pos_flow = 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},
+ {"group:sediment"})
+
+ if #pos_flow > 0 then
+ --select a random one
+ local pos2 = pos_flow[math.random(#pos_flow)]
+
+ --check under is solid
+ local pos_uf = {x = pos_under.x, y = pos_under.y - 1, z = pos_under.z}
+ local uf_name = minetest.get_node(pos_uf).name
+
+ local nodedefu = minetest.registered_nodes[uf_name]
+ if not nodedefu then
+ return
+ end
+
+ if nodedefu.walkable then
+ --take it and drop it underneath
+ --set dropped
+ local side_name = minetest.get_node(pos2).name
+ local nodedef = minetest.registered_nodes[side_name]
+ if not nodedef then
+ return
+ end
+ minetest.remove_node(pos2)
+ minetest.set_node(pos_under, {name = nodedef.drop})
+ end
+ end
+
+ end
+end
+
+
+--
+--
+minetest.register_abm({
+ label = "Water Erode",
+ nodenames = {"nodes_nature:freshwater_flowing", "nodes_nature:salt_water_flowing"},
+ neighbors = {"group:sediment"},
+ interval = 120,
+ chance = 30,
+ action = function(...)
+ water_erode(...)
+ end
+})
+
+
+------------------------------------------------------------------
+--soak water into soil, catch water in puddles
+local function rain_soak(pos, node)
+ if pos.y < -15 then
+ return
+ end
+ local name = node.name
+
+
+ if climate.get_rain(pos) then
+ --dry sediment absorbs water, wet and solids can trap puddles
+ if minetest.get_item_group(name, "sediment") >0
+ and minetest.get_item_group(name, "wet_sediment") == 0
+ then
+ --set wet version of what draining into
+ local nodedef = minetest.registered_nodes[name]
+ if not nodedef then
+ return
+ end
+ minetest.swap_node(pos, {name = nodedef._wet_name})
+ return
+ elseif math.random()<0.3 then
+ local posa = {x = pos.x, y = pos.y + 1, z = pos.z}
+ if puddle_detect(posa) then
+ minetest.set_node(posa, {name = "nodes_nature:freshwater_source"})
+ end
+ end
+
+ end
+end
+
+
+--
+minetest.register_abm({
+ label = "Rain Soak",
+ --calling for stone is for puddles only, but means calling all stone
+ --nodenames = {"group:sediment", "group:stone", "group:soft_stone"},
+ nodenames = {"group:sediment"},
+ interval = 92,
+ chance = 180,
+ min_y = -15,
+ action = function(...)
+ rain_soak(...)
+ end
+})
diff --git a/games/globo/mods/nodes_nature/ore.lua b/games/globo/mods/nodes_nature/ore.lua
new file mode 100644
index 000000000..a0bdf47db
--- /dev/null
+++ b/games/globo/mods/nodes_nature/ore.lua
@@ -0,0 +1 @@
+--most ores are just another rock, and can be done under rocks
diff --git a/games/globo/mods/nodes_nature/rock.lua b/games/globo/mods/nodes_nature/rock.lua
new file mode 100644
index 000000000..dbb1e80fd
--- /dev/null
+++ b/games/globo/mods/nodes_nature/rock.lua
@@ -0,0 +1,301 @@
+---------------------------------------------------------
+--STONE
+
+-- Internationalization
+local S = nodes_nature.S
+
+-- Load tables from data_rock.lua
+stone_list = stone_list
+rock_list = rock_list
+
+function cobble_on_place(itemstack, placer, pointed_thing, name)
+ local pt_pos = minetest.get_pointed_thing_position(pointed_thing)
+ local pt_node=minetest.get_node(pt_pos)
+ if pt_node and minetest.registered_nodes[pt_node.name].on_rightclick then
+ return minetest.registered_nodes[pt_node.name].on_rightclick(pt_pos,pt_node,placer,itemstack,pointed_thing)
+ end
+ local cobble_nr = math.random(1,3)
+ local param2 = math.random(0,3)
+ local place_item = ItemStack("nodes_nature:"..name.."_cobble"..cobble_nr)
+ if not (minimal.player_in_creative(placer)) then
+ itemstack:take_item(1)
+ end
+ minetest.item_place_node(place_item, placer, pointed_thing, param2)
+ return itemstack
+end
+
+
+
+for i in ipairs(stone_list) do
+ local name = stone_list[i][1]
+ local desc = stone_list[i][2]
+ local hardness = stone_list[i][3]
+ local type = stone_list[i][4]
+ local sediment = stone_list[i][5]
+
+
+
+
+ g = {cracky = hardness, crumbly = 1, soft_stone = 1}
+ dropped = { max_items = 1,
+ items = {
+ { tools = { "artifacts:antiquorium_chisel" },
+ items = { "nodes_nature:"..name.."_block" } },
+ { items = { sediment } }
+ }
+ }
+ s = nodes_nature.node_sound_gravel_defaults({footstep = {name = "nodes_nature_hard_footstep", gain = 0.25},})
+
+ --register raw
+ minetest.register_node("nodes_nature:"..name, {
+ description = desc,
+ tiles = {"nodes_nature_"..name..".png"},
+ stack_max = minimal.stack_max_bulky,
+ groups = g,
+ drop = dropped,
+ sounds = s,
+ })
+
+ --blocks and bricks
+ --drystone construction. (see tech for the mortared version)
+ --Bricks are more portable.
+ minetest.register_node("nodes_nature:"..name.."_brick", {
+ description = S("@1 Brick", desc),
+ tiles = {"nodes_nature_"..name.."_brick.png"},
+ paramtype2 = "facedir",
+ stack_max = minimal.stack_max_bulky *3,
+ groups = {cracky = hardness, falling_node = 1, oddly_breakable_by_hand = 1, masonry = 1},
+ sounds = nodes_nature.node_sound_stone_defaults(),
+ })
+
+ --block is cut from stone with a chisel, can be masonry'd to brick
+ minetest.register_node("nodes_nature:"..name.."_block", {
+ description = S("@1 Block", desc),
+ tiles = {"nodes_nature_"..name.."_block.png"},
+ stack_max = minimal.stack_max_bulky *2,
+ groups = {cracky = hardness, falling_node = 1, oddly_breakable_by_hand = 1, masonry = 1},
+ sounds = nodes_nature.node_sound_stone_defaults(),
+ })
+
+ --brick
+ stairs.register_stair_and_slab(
+ name.."_brick",
+ "nodes_nature:"..name.."_brick",
+ "masonry_bench",
+ "true",
+ {cracky = hardness, falling_node = 1, oddly_breakable_by_hand = 1},
+ {"nodes_nature_"..name.."_brick.png" },
+ desc.." Brick Stair",
+ desc.." Brick Slab",
+ minimal.stack_max_bulky * 6,
+ nodes_nature.node_sound_stone_defaults()
+ )
+
+ crafting.register_recipe({
+ type = "masonry_bench",
+ output = "nodes_nature:"..name.."_brick",
+ items = {"nodes_nature:"..name.."_block"},
+ level = 1,
+ always_known = true,
+ })
+end
+
+
+for i in ipairs(rock_list) do
+ local name = rock_list[i][1]
+ local desc = rock_list[i][2]
+ local hardness = rock_list[i][3]
+
+
+
+ --harder rocks drop boulders
+ local g = {cracky = hardness, stone = 1}
+ local dropped = "nodes_nature:"..name.."_boulder"
+ local s = nodes_nature.node_sound_stone_defaults()
+
+
+
+
+ --register raw
+ minetest.register_node("nodes_nature:"..name, {
+ description = desc,
+ tiles = {"nodes_nature_"..name..".png"},
+ stack_max = minimal.stack_max_bulky,
+ groups = g,
+ drop = dropped,
+ sounds = s,
+ })
+
+
+
+ --boulder
+ minetest.register_node("nodes_nature:"..name.."_boulder",{
+ description = S("@1 Boulder", desc),
+ drawtype = "mesh",
+ mesh = "nodes_nature_boulder.obj",
+ tiles = {"nodes_nature_"..name..".png"},
+ stack_max = minimal.stack_max_bulky,
+ paramtype = "light",
+ paramtype2 = "facedir",
+ groups = {cracky = hardness, falling_node = 1, oddly_breakable_by_hand = 1, boulder = 1},
+ selection_box = {
+ type = "fixed",
+ fixed = {-7/16, -8/16, -7/16, 7/16, 7/16, 7/16},
+ },
+ collision_box = {
+ type = "fixed",
+ fixed = {-7/16, -8/16, -7/16, 7/16, 7/16, 7/16},
+ },
+ sounds = nodes_nature.node_sound_stone_defaults(),
+ })
+
+
+ --blocks and bricks
+ --drystone construction. (see tech for the mortared version)
+ --Bricks are more portable.
+ minetest.register_node("nodes_nature:"..name.."_brick", {
+ description = S("@1 Brick", desc),
+ tiles = {"nodes_nature_"..name.."_brick.png"},
+ paramtype2 = "facedir",
+ stack_max = minimal.stack_max_bulky *3,
+ groups = {cracky = hardness, falling_node = 1, oddly_breakable_by_hand = 1, masonry = 1},
+ sounds = nodes_nature.node_sound_stone_defaults(),
+ })
+
+ --block is a shaped boulder, so has similar properties
+ minetest.register_node("nodes_nature:"..name.."_block", {
+ description = S("@1 Block", desc),
+ tiles = {"nodes_nature_"..name.."_block.png"},
+ --drawtype = "nodebox",
+ --paramtype = "light",
+ --[[...fancy block
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
+ {-0.375, -0.5, 0.375, 0.375, 0.5, 0.5},
+ {-0.375, -0.5, -0.5, 0.375, 0.5, -0.375},
+ {0.375, -0.5, -0.375, 0.5, 0.5, 0.375},
+ {-0.5, -0.5, -0.375, -0.375, 0.5, 0.375},
+ {-0.5, -0.375, -0.5, -0.375, 0.375, -0.375},
+ {0.375, -0.375, -0.5, 0.5, 0.375, -0.375},
+ {0.375, -0.375, 0.375, 0.5, 0.375, 0.5},
+ {-0.5, -0.375, 0.375, -0.375, 0.375, 0.5},
+ }
+ },]]
+ stack_max = minimal.stack_max_bulky *2,
+ groups = {cracky = hardness, falling_node = 1, oddly_breakable_by_hand = 1, masonry = 1},
+ sounds = nodes_nature.node_sound_stone_defaults(),
+ })
+
+ --hammer out blocks etc from boulder
+ crafting.register_recipe({
+ type = "hammering_block",
+ output = "nodes_nature:"..name.."_block",
+ items = {"nodes_nature:"..name.."_boulder"},
+ level = 1,
+ always_known = true,
+ })
+
+ crafting.register_recipe({
+ type = "hammering_block",
+ output = "nodes_nature:"..name.."_cobble2 8",
+ items = {"nodes_nature:"..name.."_boulder"},
+ level = 1,
+ always_known = true,
+ })
+
+ crafting.register_recipe({
+ type = "masonry_bench",
+ output = "nodes_nature:"..name.."_block",
+ items = {"nodes_nature:"..name.."_boulder"},
+ level = 1,
+ always_known = true,
+ })
+
+ crafting.register_recipe({
+ type = "masonry_bench",
+ output = "nodes_nature:"..name.."_brick",
+ items = {"nodes_nature:"..name.."_boulder"},
+ level = 1,
+ always_known = true,
+ })
+
+ --recycle block (e.g. so can get iron ore)
+ crafting.register_recipe({
+ type = "mixing_spot",
+ output = "nodes_nature:"..name.."_boulder",
+ items = {"nodes_nature:"..name.."_block"},
+ level = 1,
+ always_known = true,
+ })
+
+ --stairs and slabs
+
+ --brick
+ stairs.register_stair_and_slab(
+ name.."_brick",
+ "nodes_nature:"..name.."_brick",
+ "masonry_bench",
+ "true",
+ {cracky = hardness, falling_node = 1, oddly_breakable_by_hand = 1},
+ {"nodes_nature_"..name.."_brick.png" },
+ desc.." Brick Stair",
+ desc.." Brick Slab",
+ minimal.stack_max_bulky * 6,
+ nodes_nature.node_sound_stone_defaults()
+ )
+
+ --block
+ stairs.register_stair_and_slab(
+ name.."_block",
+ "nodes_nature:"..name.."_block",
+ "masonry_bench",
+ "false",
+ {cracky = hardness, falling_node = 1, oddly_breakable_by_hand = 1},
+ {"nodes_nature_"..name.."_block.png" },
+ desc.." Block Stair",
+ desc.." Block Slab",
+ minimal.stack_max_bulky * 4,
+ nodes_nature.node_sound_stone_defaults()
+ )
+
+ local cobble_groups = {cracky = hardness,
+ falling_node = 1,
+ oddly_breakable_by_hand = 3,
+ temp_pass = 1, temp_flow = 1
+ }
+ cobble_groups[name.."_cobble"] = 1
+
+ -- cobbles
+ for cobble_nr = 1, 3 do
+ minetest.register_node(
+ "nodes_nature:"..name.."_cobble"..cobble_nr,{
+ description = S("@1 Cobble", desc),
+ drawtype = "mesh",
+ mesh = "nodes_nature_cobble"..cobble_nr..".obj",
+ tiles = {"nodes_nature_"..name..".png"},
+ stack_max = minimal.stack_max_bulky * 8,
+ paramtype = "light",
+ paramtype2 = "facedir",
+ groups = cobble_groups,
+ drop = "nodes_nature:"..name.."_cobble1",
+ on_place = function(itemstack, placer, pointed_thing)
+ return cobble_on_place(itemstack, placer, pointed_thing, name)
+ end,
+ selection_box = {
+ type = "fixed",
+ fixed = {-5/16, -8/16, -5/16, 5/16, -4/16, 5/16},
+ },
+ collision_box = {
+ type = "fixed",
+ fixed = {-5/16, -8/16, -5/16, 5/16, -4/16, 5/16},
+ },
+ sounds = nodes_nature.node_sound_stone_defaults(),
+ })
+ end
+
+end
+
+------------------------------------------------------------------
+--Special features
diff --git a/games/globo/mods/nodes_nature/sediment.lua b/games/globo/mods/nodes_nature/sediment.lua
new file mode 100644
index 000000000..ca90e7b08
--- /dev/null
+++ b/games/globo/mods/nodes_nature/sediment.lua
@@ -0,0 +1,571 @@
+---------------------------------------------------------
+--SEDIMENT
+--
+----------------------------------------------------------
+
+-- Internationalization
+local S = nodes_nature.S
+
+-- Useful objects for node definitions
+sediment = {}
+sediment.hardness = {
+ soft = 3,
+ medium = 2,
+ hard = 1,
+}
+local hardness = sediment.hardness
+
+local textures = {
+ wet = "nodes_nature_mud.png",
+ salty = "nodes_nature_mud_salt.png",
+ agri_top = "nodes_nature_ag_top.png",
+ agri_side = "nodes_nature_ag_side.png",
+ agri_top_depleted = "nodes_nature_ag_dep_top.png",
+ agri_side_depleted = "nodes_nature_ag_dep_side.png",
+}
+
+sediment.sounds = {
+ dirt = nodes_nature.node_sound_dirt_defaults(),
+ dirt_wet = nodes_nature.node_sound_dirt_defaults({
+ footstep = {name = "nodes_nature_mud", gain = 0.4},
+ dug = {name = "nodes_nature_mud", gain = 0.4}}),
+
+ sand = nodes_nature.node_sound_sand_defaults(),
+ sand_wet = nodes_nature.node_sound_sand_defaults({
+ footstep = {name = "nodes_nature_mud", gain = 0.4},
+ dug = {name = "nodes_nature_mud", gain = 0.4}}),
+
+ gravel = nodes_nature.node_sound_gravel_defaults(),
+ gravel_wet = nodes_nature.node_sound_gravel_defaults({
+ footstep = {name = "nodes_nature_mud", gain = 0.4},
+ dug = {name = "nodes_nature_mud", gain = 0.4}}),
+}
+local sounds = sediment.sounds
+
+-- Utility functions
+-----------------------------------
+
+local function merge_tables (t1, t2)
+ local new_table = {}
+ --copy table
+ for key, value in pairs(t1) do
+ new_table[key] = value
+ end
+ --merge tables
+ for key, value in pairs(t2) do
+ new_table[key] = value
+ end
+ return new_table
+end
+
+-- Soil erosion and fertilizers
+-----------------------------------
+
+--soil degrades from farming
+local function erode_deplete_ag_soil(pos, depleted_name)
+ local c = math.random()
+ --rain makes this more likely (erosive, washes nutrient out)
+ local adjust = 1
+ if climate.get_rain(pos) then
+ adjust = 2
+ end
+
+ if c < (0.05 * adjust) then -- 90-95% chance nothing happens
+ return true
+ end
+ --4-8% chance of rain/water erosion
+ if c > (0.01 * adjust) then
+ --erode if exposed, and near water or raining
+ local positions = 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},
+ {"group:water", "air"})
+
+ if #positions >= 1 then
+ local name = minetest.get_node(pos).name
+ local new = name:gsub("%_depleted","")
+ new = new:gsub("%_agricultural_soil","")
+ --would prefer stairs:slab, but sand/etc lacks wet
+ new = new:gsub("%nature:","%nature:slope_pike_")
+ minetest.swap_node(pos, {name = new})
+ return false
+ end
+
+ elseif minetest.get_node({x=pos.x, y=(pos.y+1), z=pos.z}) == 'air' then
+ -- ^ don't deplete a planted node; already handled in life.lua
+ -- and a 1-2% chance to be depleted via neglect
+ minetest.swap_node(pos, {name = depleted_name})
+ return false
+ end
+end
+
+--For using fertilizer on punch
+local function fertilize_ag_soil(pos, puncher, restored_name)
+ --hit it with fertilizer to restore
+ local itemstack = puncher:get_wielded_item()
+ local ist_name = itemstack:get_name()
+
+ if minetest.get_item_group(ist_name, "fertilizer") >= 1 then
+ minetest.swap_node(pos, {name = restored_name})
+ local inv = puncher:get_inventory()
+ inv:remove_item("main", ist_name)
+ end
+end
+
+-- Sediments
+-----------------------------------
+
+function sediment.new(args)
+ local groups =
+ {falling_node = 1, crumbly = args.hardness, sediment = args.fertility}
+ local mod_name = args.mod_name or "nodes_nature" -- allows making artificial soils
+ local node_name = mod_name..":"..args.name
+ local texture_name = args.texture_name or mod_name.."_"..args.name..".png"
+ local sed = {
+ name = args.name,
+ description = args.description,
+ hardness = args.hardness,
+ fertility = args.fertility,
+ texture_name = texture_name,
+ dry_node_name = node_name,
+ wet_node_name = node_name.."_wet",
+ wet_salty_node_name = node_name.."_wet_salty",
+ ag_soil = node_name.."_agricultural_soil",
+ ag_soil_wet = node_name.."_agricultural_soil_wet",
+ sound = args.sound,
+ sound_wet = args.sound_wet,
+ groups = groups,
+ groups_wet =
+ merge_tables(groups, {wet_sediment = 1, puts_out_fire = 1}),
+ groups_wet_salty =
+ merge_tables(groups, {wet_sediment = 2, puts_out_fire = 1}),
+ mod_name = mod_name,
+
+ }
+ return sed
+end
+
+local function get_dry_node_props(sed)
+ local props = {
+ description = sed.description,
+ tiles = {sed.texture_name},
+ stack_max = minimal.stack_max_bulky,
+ groups = table.copy(sed.groups),
+ drop = sed.dry_node_name,
+ sounds = sed.sound,
+ _wet_name = sed.wet_node_name,
+ _wet_salty_name = sed.wet_salty_node_name,
+ }
+ props.groups.bare_sediment = 1
+ return props
+end
+
+function sediment.register_dry(sed)
+ local props = get_dry_node_props(sed)
+ minetest.register_node(sed.dry_node_name, props)
+end
+
+local function get_wet_node_props(sed)
+ local props = {
+ description = S("Wet @1", sed.description),
+ tiles = {sed.texture_name.."^"..textures.wet},
+ stack_max = minimal.stack_max_bulky,
+ groups = table.copy(sed.groups_wet),
+ drop = sed.wet_node_name,
+ sounds = sed.sound_wet,
+ _dry_name = sed.dry_node_name,
+ }
+ props.groups.bare_sediment = 1
+ return props
+end
+
+function sediment.register_wet(sed)
+ local props = get_wet_node_props(sed)
+ minetest.register_node(sed.wet_node_name, props)
+end
+
+local function get_wet_salty_node_props(sed)
+ local props = {
+ description = S("Salty Wet @1", sed.description),
+ tiles = {sed.texture_name.."^"..textures.wet.."^"..textures.salty},
+ stack_max = minimal.stack_max_bulky,
+ groups = sed.groups_wet_salty,
+ drop = sed.wet_salty_node_name,
+ sounds = sed.sound_wet,
+ _dry_name = sed.dry_node_name,
+ }
+ return props
+end
+
+function sediment.register_wet_salty(sed)
+ local props = get_wet_salty_node_props(sed)
+ minetest.register_node(sed.wet_salty_node_name, props)
+end
+
+function sediment.register_stair_and_slab(sed)
+ stairs.register_stair_and_slab(
+ sed.name,
+ sed.dry_node_name,
+ "mixing_spot",
+ "true",
+ {falling_node = 1, crumbly = sed.hardness},
+ {sed.texture_name},
+ sed.description.." Stair",
+ sed.description.." Slab",
+ minimal.stack_max_bulky * 2,
+ sed.sound
+ )
+end
+
+function sediment.do_slopes(sed)
+ local doslopes = minetest.settings:get_bool('exile_enableslopes')
+ local slopechance = minetest.settings:get('exile_slopechance') or 20
+ if doslopes then
+ naturalslopeslib.register_slope(sed.dry_node_name, {}, slopechance)
+ naturalslopeslib.register_slope(sed.wet_node_name, {}, slopechance)
+ naturalslopeslib.register_slope(sed.wet_salty_node_name, {}, slopechance)
+ end
+end
+
+-- Soils
+-----------------------------------
+soil = {}
+
+function soil.new(args)
+ local mod_name = args.mod_name or "nodes_nature"
+ local node_name = mod_name..":"..args.name
+ local soil = {
+ name = args.name,
+ description = args.description,
+ sediment = args.sediment,
+ dry_node_name = node_name,
+ wet_node_name = node_name.."_wet",
+
+ texture_name = mod_name.."_"..args.name..".png",
+ texture_side_name = mod_name.."_"..args.name.."_side.png",
+ }
+ return soil
+end
+
+function soil.register_dry(soil)
+ local sed = soil.sediment
+ local additional_properties = {
+ description = soil.description,
+ groups = merge_tables(sed.groups, {spreading = 1}),
+ tiles = {soil.texture_name, sed.texture_name,
+ {name = sed.texture_name.."^"..soil.texture_side_name}},
+ _ag_soil = sed.ag_soil,
+ _wet_name = soil.wet_node_name,
+ }
+ local sed_props = get_dry_node_props(sed)
+ local soil_props = merge_tables(sed_props, additional_properties)
+ minetest.register_node(soil.dry_node_name, soil_props)
+end
+
+function soil.register_wet(soil)
+ local sed = soil.sediment
+ local additional_properties = {
+ description = S("Wet @1", soil.description),
+ groups = merge_tables(sed.groups, {wet_sediment = 1, puts_out_fire = 1,
+ spreading = 1}),
+ tiles = {soil.texture_name.."^"..textures.wet, sed.texture_name.."^"..textures.wet,
+ {name = sed.texture_name.."^"..soil.texture_side_name.."^"..textures.wet}},
+ _ag_soil = sed.ag_soil_wet,
+ _dry_name = sed.dry_node_name,
+ }
+ local sed_props = get_wet_node_props(sed)
+ local soil_props = merge_tables(sed_props, additional_properties)
+ minetest.register_node(soil.wet_node_name, soil_props)
+end
+
+function soil.do_slopes(soil)
+ local doslopes = minetest.settings:get_bool('exile_enableslopes')
+ local slopechance = minetest.settings:get('exile_slopechance') or 20
+ if doslopes then
+ naturalslopeslib.register_slope(soil.dry_node_name, {}, slopechance)
+ naturalslopeslib.register_slope(soil.wet_node_name, {}, slopechance)
+ end
+end
+
+-- Agricultural soils
+-----------------------------------
+agricultural_soil = {}
+
+function agricultural_soil.new(args)
+ local sed = args.sediment
+ local name = args.name
+ local mod_name = args.mod_name or sed.mod_name or "nodes_nature"
+ local node_name = mod_name..":"..name
+ local ag_soil = {
+ name = name,
+ description = args.description,
+ sediment = sed,
+ texture_name = textures.agri_top,
+ texture_side_name = textures.agri_side,
+ texture_depleted_name = textures.agri_top_depleted,
+ texture_depleted_side_name = textures.agri_side_depleted,
+ dry_node_name = node_name,
+ wet_node_name = node_name.."_wet",
+ depleted_node_name = node_name.."_depleted",
+ wet_depleted_node_name = node_name.."_wet_depleted",
+ }
+ return ag_soil
+end
+
+function agricultural_soil.register_dry(ag_soil)
+ local sed = ag_soil.sediment
+ local props = {
+ description = ag_soil.description,
+ tiles = {
+ {name = sed.texture_name.."^"..ag_soil.texture_name},
+ sed.texture_name,
+ {name = sed.texture_name.."^"..ag_soil.texture_side_name}},
+ stack_max = minimal.stack_max_bulky,
+ groups = merge_tables(sed.groups, {agricultural_soil = 1}),
+ sounds = sed.sound,
+ drop = sed.dry_node_name,
+ _wet_name = ag_soil.wet_node_name,
+ _wet_salty_name = sed.wet_salty_node_name,
+ on_construct = function(pos)
+ --speed of erosion, degrade to depleted
+ minetest.get_node_timer(pos):start(math.random(90, 300))
+ end,
+ on_timer = function(pos,elapsed)
+ return erode_deplete_ag_soil(pos, ag_soil.depleted_node_name)
+ end,
+ }
+ minetest.register_node(ag_soil.dry_node_name, props)
+end
+
+function agricultural_soil.register_wet(ag_soil)
+ local sed = ag_soil.sediment
+ local props = {
+ description = S("Wet @1", ag_soil.description),
+ tiles = {
+ {name = sed.texture_name.."^"..ag_soil.texture_name.."^"..textures.wet},
+ sed.texture_name.."^"..textures.wet,
+ {name = sed.texture_name.."^"..ag_soil.texture_side_name.."^"..textures.wet}},
+ stack_max = minimal.stack_max_bulky,
+ groups = merge_tables(sed.groups_wet, {agricultural_soil = 1}),
+ sounds = sed.sound_wet,
+ drop = sed.wet_node_name,
+ _dry_name = ag_soil.dry_node_name,
+ on_construct = function(pos)
+ --speed of erosion, degrade to depleted
+ minetest.get_node_timer(pos):start(math.random(90, 300))
+ end,
+ on_timer = function(pos, elapsed)
+ return erode_deplete_ag_soil(pos, ag_soil.depleted_node_name)
+ end,
+ }
+ minetest.register_node(ag_soil.wet_node_name, props)
+end
+
+function agricultural_soil.register_depleted(ag_soil)
+ local sed = ag_soil.sediment
+ local props = {
+ description = S("Depleted @1", ag_soil.description),
+ tiles = {
+ {name = sed.texture_name.."^"..ag_soil.texture_depleted_name},
+ sed.texture_name,
+ {name = sed.texture_name.."^"..ag_soil.texture_depleted_side_name}},
+ stack_max = minimal.stack_max_bulky,
+ groups = merge_tables(sed.groups, {depleted_agricultural_soil = 1}),
+ sounds = sed.sound,
+ drop = sed.dry_node_name,
+ _wet_name = ag_soil.wet_depleted_node_name,
+ _wet_salty_name = sed.wet_salty_node_name,
+ on_punch = function(pos, node, puncher, pointed_thing)
+ fertilize_ag_soil(pos, puncher, ag_soil.dry_node_name)
+ end,
+ on_construct = function(pos)
+ --speed of erosion, reversion to natural/depleted
+ minetest.get_node_timer(pos):start(math.random(60, 300))
+ end,
+ on_timer = function(pos,elapsed)
+ return erode_deplete_ag_soil(pos, sed.dry_node_name)
+ end,
+ }
+ minetest.register_node(ag_soil.depleted_node_name, props)
+end
+
+function agricultural_soil.register_wet_depleted(ag_soil)
+ local sed = ag_soil.sediment
+ local props = {
+ description = S("Wet Depleted @1", ag_soil.description),
+ tiles = {
+ {name = sed.texture_name.."^"..ag_soil.texture_depleted_name.."^"..textures.wet},
+ sed.texture_name.."^"..textures.wet,
+ {name = sed.texture_name.."^"..ag_soil.texture_depleted_side_name.."^"..textures.wet}},
+ stack_max = minimal.stack_max_bulky,
+ groups = merge_tables(sed.groups_wet, {depleted_agricultural_soil = 1}),
+ sounds = sed.sound_wet,
+ drop = sed.wet_node_name,
+ _dry_name = ag_soil.dry_node_name,
+ on_punch = function(pos, node, puncher, pointed_thing)
+ fertilize_ag_soil(pos, puncher, ag_soil.wet_node_name)
+ end,
+ on_construct = function(pos)
+ --speed of erosion, reversion to natural/depleted
+ minetest.get_node_timer(pos):start(math.random(60, 300))
+ end,
+ on_timer = function(pos,elapsed)
+ return erode_deplete_ag_soil(pos, sed.wet_node_name)
+ end,
+ }
+ minetest.register_node(ag_soil.wet_depleted_node_name, props)
+end
+
+function agricultural_soil.register_recipe(agri_soil)
+ crafting.register_recipe({
+ type = "mixing_spot",
+ output = agri_soil.dry_node_name,
+ items = {agri_soil.sediment.dry_node_name.." 1","group:fertilizer 1"},
+ level = 1,
+ always_known = true,
+ })
+end
+
+function agricultural_soil.register_recipe_wet(agri_soil)
+ crafting.register_recipe({
+ type = "mixing_spot",
+ output = agri_soil.wet_node_name,
+ items = {agri_soil.sediment.wet_node_name.." 1","group:fertilizer 1"},
+ level = 1,
+ always_known = true,
+ })
+end
+
+-- Functions for making sets: sediment + soil + agricultural soil
+---------------------------------------------------
+
+-- Registers sediments, their slabs, wet, salty, slopes etc. and crafting recipes
+function sediment.register_sed_variants(sed)
+ sediment.register_dry(sed)
+ sediment.register_wet(sed)
+ sediment.register_wet_salty(sed)
+ sediment.register_stair_and_slab(sed)
+ sediment.do_slopes(sed)
+end
+
+-- Registers agricultural soils and their variants
+-- (dry, wet, depleted) and recipes to craft them
+function sediment.register_agri_soil_variants(sed)
+ local agri =
+ agricultural_soil.new({name = sed.name.."_agricultural_soil",
+ description = S("@1 Agricultural Soil", sed.description),
+ sediment = sed})
+ agricultural_soil.register_dry(agri)
+ agricultural_soil.register_wet(agri)
+ agricultural_soil.register_depleted(agri)
+ agricultural_soil.register_wet_depleted(agri)
+ agricultural_soil.register_recipe(agri)
+ agricultural_soil.register_recipe_wet(agri)
+end
+
+-- Registers soils with "grasses" and their variants including slopes
+function sediment.register_soil_variants(soil_list)
+ for _, s in ipairs(soil_list) do
+ soil.register_dry(s)
+ soil.register_wet(s)
+ soil.do_slopes(s)
+ end
+end
+
+-- Registers sediments, their variants (slabs, wet, salty, etc.) and agricultural soils
+-- including crafting recipes
+function sediment.register_all_sed_and_agri_variants(sed_list)
+ for _, sed in pairs(sed_list) do
+ sediment.register_sed_variants(sed)
+ sediment.register_agri_soil_variants(sed)
+ end
+end
+
+---------------------------------------------
+-- Nodes and recipes are defined here
+---------------------------------------------
+
+-- list of sediments to be used for mapgen
+local sediment_list = {
+ sand = sediment.new({name = "sand",
+ description = S("Sand"), hardness = hardness.soft,
+ fertility = 4, sound = sounds.sand,
+ sound_wet = sounds.sand_wet}),
+ silt = sediment.new({name = "silt",
+ description = S("Silt"), hardness = hardness.soft,
+ fertility = 3, sound = sounds.dirt,
+ sound_wet = sounds.dirt_wet}),
+ clay = sediment.new({name = "clay",
+ description = S("Clay"), hardness = hardness.medium,
+ fertility = 2, sound = sounds.dirt,
+ sound_wet = sounds.dirt_wet}),
+ gravel = sediment.new({name = "gravel",
+ description = S("Gravel"), hardness = hardness.soft,
+ fertility = 5, sound = sounds.gravel,
+ sound_wet = sounds.gravel_wet}),
+ loam = sediment.new({name = "loam",
+ description = S("Loam"), hardness = hardness.soft,
+ fertility = 1, sound = sounds.dirt,
+ sound_wet = sounds.dirt_wet}),
+ volcanic_ash = sediment.new({name = "volcanic_ash",
+ description = S("Volcanic ash"),
+ hardness = hardness.soft,
+ fertility = 1, sound = sounds.sand,
+ sound_wet = sounds.sand_wet}),
+}
+
+local soil_list = {
+ --Forest & Woodland
+ soil.new({name = "woodland_soil",
+ description = S("Woodland Soil"),
+ sediment = sediment_list.silt}),
+
+ --Wetlands
+ soil.new({name = "marshland_soil",
+ description = S("Marshland Soil"),
+ sediment = sediment_list.silt}),
+
+ --Shrubland & Grassland
+ soil.new({name = "grassland_soil", description = S("Grassland Soil"),
+ sediment = sediment_list.clay}),
+
+ --Barrenland & Duneland
+ soil.new({name = "duneland_soil",
+ description = S("Duneland Soil"),
+ sediment = sediment_list.sand}),
+
+ -- Highland
+ soil.new({name = "highland_soil",
+ description = S("Highland Soil"),
+ sediment = sediment_list.gravel}),
+
+ --Legacy
+ soil.new({name = "grassland_barren_soil",
+ description = S("Barren Grassland Soil"),
+ sediment = sediment_list.gravel}),
+ soil.new({name = "woodland_dry_soil",
+ description = S("Dry Woodland Soil"),
+ sediment = sediment_list.silt}),
+}
+
+-- Recipes for loam
+crafting.register_recipe({
+ type = "mixing_spot",
+ output = "nodes_nature:loam 3",
+ items = {"nodes_nature:clay 1","nodes_nature:silt 1","nodes_nature:sand 1"},
+ level = 1,
+ always_known = true,
+})
+
+crafting.register_recipe({
+ type = "mixing_spot",
+ output = "nodes_nature:loam_wet 3",
+ items = {"nodes_nature:clay_wet 1","nodes_nature:silt_wet 1","nodes_nature:sand_wet 1"},
+ level = 1,
+ always_known = true,
+})
+
+-- Actually registers (almost) all soils in the game
+-- see red_ochre above
+sediment.register_all_sed_and_agri_variants(sediment_list)
+sediment.register_soil_variants(soil_list)
diff --git a/games/globo/mods/nodes_nature/sounds.lua b/games/globo/mods/nodes_nature/sounds.lua
new file mode 100644
index 000000000..9de3c0cc1
--- /dev/null
+++ b/games/globo/mods/nodes_nature/sounds.lua
@@ -0,0 +1,158 @@
+
+--
+-- Sounds
+--
+function nodes_nature.node_sound_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "", gain = 1.0}
+ table.dug = table.dug or
+ {name = "nodes_nature_dug_node", gain = 0.25}
+ table.place = table.place or
+ {name = "nodes_nature_place_node_hard", gain = 1.0}
+ return table
+end
+
+
+function nodes_nature.node_sound_stone_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_hard_footstep", gain = 0.3}
+ table.dig = table.dig or
+ {name = "nodes_nature_dig_cracky", gain = 1.0}
+ table.dug = table.dug or
+ {name = "nodes_nature_hard_footstep", gain = 1.0}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+function nodes_nature.node_sound_dirt_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_dirt_footstep", gain = 0.4}
+ table.dig = table.dig or
+ {name = "nodes_nature_dig_crumbly", gain = 1.0}
+ table.dug = table.dug or
+ {name = "nodes_nature_dirt_footstep", gain = 1.0}
+ table.place = table.place or
+ {name = "nodes_nature_place_node", gain = 1.0}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+function nodes_nature.node_sound_sand_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_sand_footstep", gain = 0.12}
+ table.dig = table.dig or
+ {name = "nodes_nature_dig_crumbly", gain = 1.0}
+ table.dug = table.dug or
+ {name = "nodes_nature_sand_footstep", gain = 0.24}
+ table.place = table.place or
+ {name = "nodes_nature_place_node", gain = 1.0}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+function nodes_nature.node_sound_gravel_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_gravel_footstep", gain = 0.4}
+ table.dig = table.dig or
+ {name = "nodes_nature_dig_crumbly", gain = 1.0}
+ table.dug = table.dug or
+ {name = "nodes_nature_gravel_footstep", gain = 1.0}
+ table.place = table.place or
+ {name = "nodes_nature_place_node", gain = 1.0}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+
+
+function nodes_nature.node_sound_water_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_water_footstep", gain = 0.2}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+
+function nodes_nature.node_sound_leaves_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_grass_footstep", gain = 0.45}
+ table.dig = table.dig or
+ {name = "nodes_nature_dig_snappy", gain = 1.0}
+ table.dug = table.dug or
+ {name = "nodes_nature_grass_footstep", gain = 0.7}
+ table.place = table.place or
+ {name = "nodes_nature_place_node", gain = 1.0}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+
+function nodes_nature.node_sound_wood_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_wood_footstep", gain = 0.3}
+ table.dig = table.dig or
+ {name = "nodes_nature_dig_choppy", gain = 1.0}
+ table.dug = table.dug or
+ {name = "nodes_nature_wood_footstep", gain = 1.0}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+
+
+function nodes_nature.node_sound_snow_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_snow_footstep", gain = 0.2}
+ table.dig = table.dig or
+ {name = "nodes_nature_snow_footstep", gain = 0.3}
+ table.dug = table.dug or
+ {name = "nodes_nature_snow_footstep", gain = 0.3}
+ table.place = table.place or
+ {name = "nodes_nature_place_node", gain = 1.0}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+
+function nodes_nature.node_sound_glass_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "nodes_nature_glass_footstep", gain = 0.3}
+ table.dig = table.dig or
+ {name = "nodes_nature_glass_footstep", gain = 0.5}
+ table.place = table.place or
+ {name = "nodes_nature_place_glass", gain = 0.3}
+ table.dug = table.dug or
+ {name = "nodes_nature_remove_glass", gain = 0.3}
+ nodes_nature.node_sound_defaults(table)
+ return table
+end
+
+
+
+--[[
+
+
+function default.node_sound_metal_defaults(table)
+ table = table or {}
+ table.footstep = table.footstep or
+ {name = "default_metal_footstep", gain = 0.4}
+ table.dig = table.dig or
+ {name = "default_dig_metal", gain = 0.5}
+ table.dug = table.dug or
+ {name = "default_dug_metal", gain = 0.5}
+ table.place = table.place or
+ {name = "default_place_node_metal", gain = 0.5}
+ default.node_sound_defaults(table)
+ return table
+end
+]]
diff --git a/games/globo/mods/nodes_nature/sounds/default_break_glass.1.ogg b/games/globo/mods/nodes_nature/sounds/default_break_glass.1.ogg
new file mode 100644
index 000000000..b1ccc5fab
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/default_break_glass.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.1.ogg
new file mode 100644
index 000000000..42506ddff
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.2.ogg
new file mode 100644
index 000000000..2747ab81c
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.3.ogg
new file mode 100644
index 000000000..8baeac32e
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_cool_lava.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_choppy.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_choppy.ogg
new file mode 100644
index 000000000..e2ecd8416
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_choppy.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_cracky.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_cracky.ogg
new file mode 100644
index 000000000..da1167916
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_cracky.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_crumbly.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_crumbly.ogg
new file mode 100644
index 000000000..a0b2a1f9f
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_crumbly.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_snappy.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_snappy.ogg
new file mode 100644
index 000000000..3686fcddb
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_dig_snappy.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_dirt_footstep.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_dirt_footstep.1.ogg
new file mode 100644
index 000000000..201aa3b2d
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_dirt_footstep.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_dirt_footstep.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_dirt_footstep.2.ogg
new file mode 100644
index 000000000..2667dbc21
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_dirt_footstep.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_dug_node.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_dug_node.1.ogg
new file mode 100644
index 000000000..c04975d42
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_dug_node.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_dug_node.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_dug_node.2.ogg
new file mode 100644
index 000000000..9f209268f
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_dug_node.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_glass_footstep.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_glass_footstep.ogg
new file mode 100644
index 000000000..191287a33
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_glass_footstep.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.1.ogg
new file mode 100644
index 000000000..22d1ad6b8
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.2.ogg
new file mode 100644
index 000000000..4ccd8a0f3
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.3.ogg
new file mode 100644
index 000000000..20db84eda
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_grass_footstep.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.1.ogg
new file mode 100644
index 000000000..8d260ce01
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.2.ogg
new file mode 100644
index 000000000..2aba2c652
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.3.ogg
new file mode 100644
index 000000000..1bcd8a117
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.4.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.4.ogg
new file mode 100644
index 000000000..696c9ffd2
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_gravel_footstep.4.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.1.ogg
new file mode 100644
index 000000000..1748bc56a
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.2.ogg
new file mode 100644
index 000000000..fe39fd784
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.3.ogg
new file mode 100644
index 000000000..5030e0607
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_hard_footstep.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.1.ogg
new file mode 100644
index 000000000..5c2f93acc
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.2.ogg
new file mode 100644
index 000000000..ca9d6e955
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.3.ogg
new file mode 100644
index 000000000..b50b14edf
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.4.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.4.ogg
new file mode 100644
index 000000000..b57dfd925
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.4.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.5.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.5.ogg
new file mode 100644
index 000000000..c100def7b
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.5.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.6.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.6.ogg
new file mode 100644
index 000000000..5aa4c13ad
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_mud.6.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_place_glass.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_glass.ogg
new file mode 100644
index 000000000..cf0341c0e
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_glass.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.1.ogg
new file mode 100644
index 000000000..46b9756de
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.2.ogg
new file mode 100644
index 000000000..d34c01a43
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.3.ogg
new file mode 100644
index 000000000..fc2936506
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node_hard.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node_hard.1.ogg
new file mode 100644
index 000000000..9f97facad
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node_hard.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node_hard.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node_hard.2.ogg
new file mode 100644
index 000000000..1d3b3de2c
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_place_node_hard.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_remove_glass.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_remove_glass.ogg
new file mode 100644
index 000000000..444a51d51
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_remove_glass.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_sand_footstep.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_sand_footstep.1.ogg
new file mode 100644
index 000000000..65b68c7e6
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_sand_footstep.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_sand_footstep.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_sand_footstep.2.ogg
new file mode 100644
index 000000000..57f35f30a
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_sand_footstep.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_slurp.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_slurp.ogg
new file mode 100644
index 000000000..e481f4923
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_slurp.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.1.ogg
new file mode 100644
index 000000000..97cc8252e
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.2.ogg
new file mode 100644
index 000000000..97a6baa48
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.3.ogg
new file mode 100644
index 000000000..bde1f21d4
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.4.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.4.ogg
new file mode 100644
index 000000000..8ca6a590d
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.4.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.5.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.5.ogg
new file mode 100644
index 000000000..220d60c93
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_snow_footstep.5.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.1.ogg
new file mode 100644
index 000000000..8f07658f2
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.2.ogg
new file mode 100644
index 000000000..fa399d191
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.3.ogg
new file mode 100644
index 000000000..c80037898
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_drip.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.1.ogg
new file mode 100644
index 000000000..63b9744ce
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.2.ogg
new file mode 100644
index 000000000..8d79c1f4b
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.3.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.3.ogg
new file mode 100644
index 000000000..f8891506d
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.3.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.4.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.4.ogg
new file mode 100644
index 000000000..6f1eab824
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_water_footstep.4.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_wood_footstep.1.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_wood_footstep.1.ogg
new file mode 100644
index 000000000..34f63a17c
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_wood_footstep.1.ogg differ
diff --git a/games/globo/mods/nodes_nature/sounds/nodes_nature_wood_footstep.2.ogg b/games/globo/mods/nodes_nature/sounds/nodes_nature_wood_footstep.2.ogg
new file mode 100644
index 000000000..124fc297c
Binary files /dev/null and b/games/globo/mods/nodes_nature/sounds/nodes_nature_wood_footstep.2.ogg differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_ag_dep_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_ag_dep_side.png
new file mode 100644
index 000000000..f86ab9ce6
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_ag_dep_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_ag_dep_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_ag_dep_top.png
new file mode 100644
index 000000000..50207f543
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_ag_dep_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_ag_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_ag_side.png
new file mode 100644
index 000000000..5bd6d6ffa
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_ag_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_ag_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_ag_top.png
new file mode 100644
index 000000000..b4c84bbf2
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_ag_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_alaf.png b/games/globo/mods/nodes_nature/textures/nodes_nature_alaf.png
new file mode 100644
index 000000000..ad39fdfd4
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_alaf.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_alaf_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_alaf_seedling.png
new file mode 100644
index 000000000..1b1ded745
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_alaf_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_anperla.png b/games/globo/mods/nodes_nature/textures/nodes_nature_anperla.png
new file mode 100644
index 000000000..62e56576e
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_anperla.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_anperla_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_anperla_seedling.png
new file mode 100644
index 000000000..7f5b94e24
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_anperla_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_basalt.png b/games/globo/mods/nodes_nature/textures/nodes_nature_basalt.png
new file mode 100644
index 000000000..8fed766b2
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_basalt.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_basalt_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_basalt_block.png
new file mode 100644
index 000000000..08e99415c
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_basalt_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_basalt_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_basalt_brick.png
new file mode 100644
index 000000000..a5d69e0e4
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_basalt_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_bronach.png b/games/globo/mods/nodes_nature/textures/nodes_nature_bronach.png
new file mode 100644
index 000000000..0963c5ef0
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_bronach.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_bronach_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_bronach_seedling.png
new file mode 100644
index 000000000..bdbc877c9
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_bronach_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_cana.png b/games/globo/mods/nodes_nature/textures/nodes_nature_cana.png
new file mode 100644
index 000000000..093c358c3
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_cana.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_chalin.png b/games/globo/mods/nodes_nature/textures/nodes_nature_chalin.png
new file mode 100644
index 000000000..c5bab388a
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_chalin.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_clay.png b/games/globo/mods/nodes_nature/textures/nodes_nature_clay.png
new file mode 100644
index 000000000..2ff954c5f
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_clay.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_claystone.png b/games/globo/mods/nodes_nature/textures/nodes_nature_claystone.png
new file mode 100644
index 000000000..8299709fa
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_claystone.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_claystone_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_claystone_block.png
new file mode 100644
index 000000000..2d0211123
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_claystone_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_claystone_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_claystone_brick.png
new file mode 100644
index 000000000..1ef080d2b
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_claystone_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate.png b/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate.png
new file mode 100644
index 000000000..9ccf8915a
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate_block.png
new file mode 100644
index 000000000..8c9da2540
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate_brick.png
new file mode 100644
index 000000000..8cf86bfc8
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_conglomerate_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_damo.png b/games/globo/mods/nodes_nature/textures/nodes_nature_damo.png
new file mode 100644
index 000000000..8e3f07d19
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_damo.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_damo_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_damo_seedling.png
new file mode 100644
index 000000000..bde5924af
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_damo_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_duneland_soil.png b/games/globo/mods/nodes_nature/textures/nodes_nature_duneland_soil.png
new file mode 100644
index 000000000..6c32bae74
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_duneland_soil.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_duneland_soil_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_duneland_soil_side.png
new file mode 100644
index 000000000..6fa5991b1
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_duneland_soil_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater.png b/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater.png
new file mode 100644
index 000000000..f99ccdbe2
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater_flowing_animated.png b/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater_flowing_animated.png
new file mode 100644
index 000000000..e47ddde92
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater_flowing_animated.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater_source_animated.png b/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater_source_animated.png
new file mode 100644
index 000000000..294c91ea0
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_freshwater_source_animated.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_galanta.png b/games/globo/mods/nodes_nature/textures/nodes_nature_galanta.png
new file mode 100644
index 000000000..66b9f346c
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_galanta.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_galanta_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_galanta_seedling.png
new file mode 100644
index 000000000..8bfb1642e
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_galanta_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_gemedi.png b/games/globo/mods/nodes_nature/textures/nodes_nature_gemedi.png
new file mode 100644
index 000000000..eea218463
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_gemedi.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_gitiri.png b/games/globo/mods/nodes_nature/textures/nodes_nature_gitiri.png
new file mode 100644
index 000000000..4b29b80d6
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_gitiri.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_gitiri_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_gitiri_seedling.png
new file mode 100644
index 000000000..489c82fc0
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_gitiri_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_glow_worm.png b/games/globo/mods/nodes_nature/textures/nodes_nature_glow_worm.png
new file mode 100644
index 000000000..d60284297
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_glow_worm.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss.png b/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss.png
new file mode 100644
index 000000000..ebe548d7b
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss_block.png
new file mode 100644
index 000000000..e4f655362
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss_brick.png
new file mode 100644
index 000000000..9f5163af6
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_gneiss_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_granite.png b/games/globo/mods/nodes_nature/textures/nodes_nature_granite.png
new file mode 100644
index 000000000..6c385c6aa
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_granite.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_granite_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_granite_block.png
new file mode 100644
index 000000000..8b62ba612
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_granite_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_granite_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_granite_brick.png
new file mode 100644
index 000000000..8cd8ebb6f
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_granite_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_barren_soil.png b/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_barren_soil.png
new file mode 100644
index 000000000..6711119db
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_barren_soil.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_barren_soil_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_barren_soil_side.png
new file mode 100644
index 000000000..7f3f2c989
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_barren_soil_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_soil.png b/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_soil.png
new file mode 100644
index 000000000..96ef0fb00
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_soil.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_soil_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_soil_side.png
new file mode 100644
index 000000000..ab5ff3994
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_grassland_soil_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_gravel.png b/games/globo/mods/nodes_nature/textures/nodes_nature_gravel.png
new file mode 100644
index 000000000..911ceddd2
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_gravel.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_hakimi.png b/games/globo/mods/nodes_nature/textures/nodes_nature_hakimi.png
new file mode 100644
index 000000000..c929bf1ba
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_hakimi.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_hakimi_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_hakimi_seedling.png
new file mode 100644
index 000000000..02ded5aae
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_hakimi_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_highland_soil.png b/games/globo/mods/nodes_nature/textures/nodes_nature_highland_soil.png
new file mode 100644
index 000000000..b4c99aa25
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_highland_soil.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_highland_soil_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_highland_soil_side.png
new file mode 100644
index 000000000..27c846343
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_highland_soil_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_ice.png b/games/globo/mods/nodes_nature/textures/nodes_nature_ice.png
new file mode 100644
index 000000000..45a4b3fa9
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_ice.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone.png b/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone.png
new file mode 100644
index 000000000..1dc7a2a24
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone_block.png
new file mode 100644
index 000000000..bb6ec42b9
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone_brick.png
new file mode 100644
index 000000000..0f6a2e1c2
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_ironstone_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_jade.png b/games/globo/mods/nodes_nature/textures/nodes_nature_jade.png
new file mode 100644
index 000000000..f05684a8e
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_jade.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_jade_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_jade_block.png
new file mode 100644
index 000000000..9a3edc605
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_jade_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_jade_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_jade_brick.png
new file mode 100644
index 000000000..a8807ac70
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_jade_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_leaves.png b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_leaves.png
new file mode 100644
index 000000000..4556e63c3
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_leaves.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_log.png b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_log.png
new file mode 100644
index 000000000..599a65221
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_log.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_log_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_log_top.png
new file mode 100644
index 000000000..a4463de71
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_log_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_pod.png b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_pod.png
new file mode 100644
index 000000000..bdd28b5e3
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_pod.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_tree.png b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_tree.png
new file mode 100644
index 000000000..1549bd5aa
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_tree.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_tree_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_tree_top.png
new file mode 100644
index 000000000..f841ec9ff
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_kagum_tree_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_kelp.png b/games/globo/mods/nodes_nature/textures/nodes_nature_kelp.png
new file mode 100644
index 000000000..70b743d59
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_kelp.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_lambakap.png b/games/globo/mods/nodes_nature/textures/nodes_nature_lambakap.png
new file mode 100644
index 000000000..8a46594f2
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_lambakap.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_lava.png b/games/globo/mods/nodes_nature/textures/nodes_nature_lava.png
new file mode 100644
index 000000000..7f41e9b00
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_lava.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_lava_flowing_animated.png b/games/globo/mods/nodes_nature/textures/nodes_nature_lava_flowing_animated.png
new file mode 100644
index 000000000..2ec074634
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_lava_flowing_animated.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_lava_source_animated.png b/games/globo/mods/nodes_nature/textures/nodes_nature_lava_source_animated.png
new file mode 100644
index 000000000..32267a6bf
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_lava_source_animated.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_limestone.png b/games/globo/mods/nodes_nature/textures/nodes_nature_limestone.png
new file mode 100644
index 000000000..8cb4ae862
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_limestone.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_limestone_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_limestone_block.png
new file mode 100644
index 000000000..8a93835b1
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_limestone_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_limestone_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_limestone_brick.png
new file mode 100644
index 000000000..de936a6a6
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_limestone_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_loam.png b/games/globo/mods/nodes_nature/textures/nodes_nature_loam.png
new file mode 100644
index 000000000..12358ea04
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_loam.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_mahal.png b/games/globo/mods/nodes_nature/textures/nodes_nature_mahal.png
new file mode 100644
index 000000000..05a9314d1
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_mahal.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_leaves.png b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_leaves.png
new file mode 100644
index 000000000..24d0e6d2a
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_leaves.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_log.png b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_log.png
new file mode 100644
index 000000000..279aca738
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_log.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_log_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_log_top.png
new file mode 100644
index 000000000..7ea203551
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_log_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_nut.png b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_nut.png
new file mode 100644
index 000000000..ce350969d
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_nut.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_tree.png b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_tree.png
new file mode 100644
index 000000000..93d762706
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_tree.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_tree_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_tree_top.png
new file mode 100644
index 000000000..c7f73703b
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_maraka_tree_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_marbhan.png b/games/globo/mods/nodes_nature/textures/nodes_nature_marbhan.png
new file mode 100644
index 000000000..52d474ca3
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_marbhan.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_marbhan_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_marbhan_seedling.png
new file mode 100644
index 000000000..2ac40576b
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_marbhan_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_marshland_soil.png b/games/globo/mods/nodes_nature/textures/nodes_nature_marshland_soil.png
new file mode 100644
index 000000000..451ce4045
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_marshland_soil.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_marshland_soil_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_marshland_soil_side.png
new file mode 100644
index 000000000..46ec45f8a
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_marshland_soil_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_merki.png b/games/globo/mods/nodes_nature/textures/nodes_nature_merki.png
new file mode 100644
index 000000000..05332d118
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_merki.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_merki_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_merki_seedling.png
new file mode 100644
index 000000000..c6c6bf9f3
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_merki_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_momo.png b/games/globo/mods/nodes_nature/textures/nodes_nature_momo.png
new file mode 100644
index 000000000..614615be3
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_momo.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_momo_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_momo_seedling.png
new file mode 100644
index 000000000..db64ded42
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_momo_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_moss.png b/games/globo/mods/nodes_nature/textures/nodes_nature_moss.png
new file mode 100644
index 000000000..8be526fe6
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_moss.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_mud.png b/games/globo/mods/nodes_nature/textures/nodes_nature_mud.png
new file mode 100644
index 000000000..f5e34c638
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_mud.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_mud_salt.png b/games/globo/mods/nodes_nature/textures/nodes_nature_mud_salt.png
new file mode 100644
index 000000000..88e79513f
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_mud_salt.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_nebiyi.png b/games/globo/mods/nodes_nature/textures/nodes_nature_nebiyi.png
new file mode 100644
index 000000000..05f8d4aa5
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_nebiyi.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_nebiyi_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_nebiyi_seedling.png
new file mode 100644
index 000000000..e386fd696
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_nebiyi_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_reshedaar.png b/games/globo/mods/nodes_nature/textures/nodes_nature_reshedaar.png
new file mode 100644
index 000000000..7a3c6d499
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_reshedaar.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water.png b/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water.png
new file mode 100644
index 000000000..645b7dcf2
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water_flowing_animated.png b/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water_flowing_animated.png
new file mode 100644
index 000000000..3e87c5882
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water_flowing_animated.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water_source_animated.png b/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water_source_animated.png
new file mode 100644
index 000000000..babbffbee
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_salt_water_source_animated.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sand.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sand.png
new file mode 100644
index 000000000..eaa002bca
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sand.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone.png
new file mode 100644
index 000000000..a4abd14be
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone_block.png
new file mode 100644
index 000000000..1f20f3dd7
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone_brick.png
new file mode 100644
index 000000000..c29038d43
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sandstone_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sari.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sari.png
new file mode 100644
index 000000000..6ff693897
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sari.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sari_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sari_seedling.png
new file mode 100644
index 000000000..39da9bd17
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sari_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_cone.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_cone.png
new file mode 100644
index 000000000..b42be432c
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_cone.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_leaves.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_leaves.png
new file mode 100644
index 000000000..bd20fc1a3
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_leaves.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_log.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_log.png
new file mode 100644
index 000000000..ffc55c754
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_log.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_log_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_log_top.png
new file mode 100644
index 000000000..d0778de88
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_log_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_tree.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_tree.png
new file mode 100644
index 000000000..0a13c7f47
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_tree.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_tree_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_tree_top.png
new file mode 100644
index 000000000..1ebcf0fa8
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sasaran_tree_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_sea_lettuce.png b/games/globo/mods/nodes_nature/textures/nodes_nature_sea_lettuce.png
new file mode 100644
index 000000000..009d6c294
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_sea_lettuce.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_seagrass.png b/games/globo/mods/nodes_nature/textures/nodes_nature_seagrass.png
new file mode 100644
index 000000000..c34b54969
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_seagrass.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_seeds.png b/games/globo/mods/nodes_nature/textures/nodes_nature_seeds.png
new file mode 100644
index 000000000..bd2202d4c
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_seeds.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_silt.png b/games/globo/mods/nodes_nature/textures/nodes_nature_silt.png
new file mode 100644
index 000000000..d57d39346
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_silt.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone.png b/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone.png
new file mode 100644
index 000000000..26da5c3f2
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone_block.png b/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone_block.png
new file mode 100644
index 000000000..a0f23729f
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone_block.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone_brick.png b/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone_brick.png
new file mode 100644
index 000000000..250522af9
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_siltstone_brick.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_snow.png b/games/globo/mods/nodes_nature/textures/nodes_nature_snow.png
new file mode 100644
index 000000000..fcbef0e58
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_snow.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_snowball.png b/games/globo/mods/nodes_nature/textures/nodes_nature_snowball.png
new file mode 100644
index 000000000..3a4dc1f66
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_snowball.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_spores.png b/games/globo/mods/nodes_nature/textures/nodes_nature_spores.png
new file mode 100644
index 000000000..c82972c9a
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_spores.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tanai.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tanai.png
new file mode 100644
index 000000000..6854f3416
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tanai.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tanai_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tanai_seedling.png
new file mode 100644
index 000000000..df25d64fe
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tanai_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_fruit.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_fruit.png
new file mode 100644
index 000000000..f4d25169e
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_fruit.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_leaves.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_leaves.png
new file mode 100644
index 000000000..97293c190
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_leaves.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_log.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_log.png
new file mode 100644
index 000000000..09c31ca81
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_log.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_log_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_log_top.png
new file mode 100644
index 000000000..6c63ec295
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_log_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_tree.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_tree.png
new file mode 100644
index 000000000..60f883e87
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_tree.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_tree_top.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_tree_top.png
new file mode 100644
index 000000000..010c8f08a
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tangkal_tree_top.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tashvish.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tashvish.png
new file mode 100644
index 000000000..179cdfcd1
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tashvish.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tashvish_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tashvish_seedling.png
new file mode 100644
index 000000000..eda4524fb
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tashvish_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_thoka.png b/games/globo/mods/nodes_nature/textures/nodes_nature_thoka.png
new file mode 100644
index 000000000..cd269c8fb
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_thoka.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_thoka_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_thoka_seedling.png
new file mode 100644
index 000000000..ac4ebc996
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_thoka_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tiken.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tiken.png
new file mode 100644
index 000000000..ea8b8f05f
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tiken.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tikusati.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tikusati.png
new file mode 100644
index 000000000..6619283b9
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tikusati.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tikusati_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tikusati_seedling.png
new file mode 100644
index 000000000..837ad116e
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tikusati_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_tuber.png b/games/globo/mods/nodes_nature/textures/nodes_nature_tuber.png
new file mode 100644
index 000000000..f483277af
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_tuber.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_vansano.png b/games/globo/mods/nodes_nature/textures/nodes_nature_vansano.png
new file mode 100644
index 000000000..16d21068a
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_vansano.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_vansano_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_vansano_seedling.png
new file mode 100644
index 000000000..36144ce7c
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_vansano_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_volcanic_ash.png b/games/globo/mods/nodes_nature/textures/nodes_nature_volcanic_ash.png
new file mode 100644
index 000000000..a59f6e119
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_volcanic_ash.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_wiha.png b/games/globo/mods/nodes_nature/textures/nodes_nature_wiha.png
new file mode 100644
index 000000000..366e35181
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_wiha.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_wiha_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_wiha_seedling.png
new file mode 100644
index 000000000..3eb5b2cec
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_wiha_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_dry_soil.png b/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_dry_soil.png
new file mode 100644
index 000000000..c419c61d5
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_dry_soil.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_dry_soil_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_dry_soil_side.png
new file mode 100644
index 000000000..871693fb4
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_dry_soil_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_soil.png b/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_soil.png
new file mode 100644
index 000000000..fb6460668
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_soil.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_soil_side.png b/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_soil_side.png
new file mode 100644
index 000000000..0b97b1ec4
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_woodland_soil_side.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_zufani.png b/games/globo/mods/nodes_nature/textures/nodes_nature_zufani.png
new file mode 100644
index 000000000..53ce11c16
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_zufani.png differ
diff --git a/games/globo/mods/nodes_nature/textures/nodes_nature_zufani_seedling.png b/games/globo/mods/nodes_nature/textures/nodes_nature_zufani_seedling.png
new file mode 100644
index 000000000..83d80133f
Binary files /dev/null and b/games/globo/mods/nodes_nature/textures/nodes_nature_zufani_seedling.png differ
diff --git a/games/globo/mods/nodes_nature/trees.lua b/games/globo/mods/nodes_nature/trees.lua
new file mode 100644
index 000000000..9feb2c4d4
--- /dev/null
+++ b/games/globo/mods/nodes_nature/trees.lua
@@ -0,0 +1,352 @@
+---------------------------------------------------------
+--TREES
+--
+
+--[[param2
+Currently the following meshes are choosable:
+ * 0 = a "x" shaped plant (ordinary plant)
+ * 1 = a "+" shaped plant (just rotated 45 degrees)
+ * 2 = a "*" shaped plant with 3 faces instead of 2
+ * 3 = a "#" shaped plant with 4 faces instead of 2
+ * 4 = a "#" shaped plant with 4 faces that lean
+]]
+
+-- Internationalization
+local S = nodes_nature.S
+
+local random = math.random
+---------------------------------------------------------
+--
+-- Leafdecay
+--
+
+
+-- Leafdecay
+local function leafdecay_after_destruct(pos, oldnode, def)
+ for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius),
+ vector.add(pos, def.radius), def.leaves)) do
+ local node = minetest.get_node(v)
+ local timer = minetest.get_node_timer(v)
+ if node.param2 == 0 and not timer:is_started() then
+ timer:start(math.random(20, 120) / 10)
+ end
+ end
+end
+
+local function leafdecay_on_timer(pos, def)
+ if minetest.find_node_near(pos, def.radius, def.trunks) then
+ return false
+ end
+
+ local node = minetest.get_node(pos)
+ local drops = minetest.get_node_drops(node.name)
+ for _, item in ipairs(drops) do
+ local is_leaf
+ for _, v in pairs(def.leaves) do
+ if v == item then
+ is_leaf = true
+ end
+ end
+ if minetest.get_item_group(item, "leafdecay_drop") ~= 0 or
+ not is_leaf then
+ minetest.add_item({
+ x = pos.x - 0.5 + math.random(),
+ y = pos.y - 0.5 + math.random(),
+ z = pos.z - 0.5 + math.random(),
+ }, item)
+ end
+ end
+
+ minetest.remove_node(pos)
+ minetest.check_for_falling(pos)
+end
+
+local function register_leafdecay(def)
+ assert(def.leaves)
+ assert(def.trunks)
+ assert(def.radius)
+ for _, v in pairs(def.trunks) do
+ minetest.override_item(v, {
+ after_destruct = function(pos, oldnode)
+ leafdecay_after_destruct(pos, oldnode, def)
+ end,
+ })
+ end
+ for _, v in pairs(def.leaves) do
+ minetest.override_item(v, {
+ on_timer = function(pos)
+ leafdecay_on_timer(pos, def)
+ end,
+ })
+ end
+end
+
+---------------------------------------------------------
+--
+--Mark
+--used to regrow fruit, leaves, trunks on trees
+
+minetest.register_node("nodes_nature:tree_mark", {
+ description = S("Tree Marker"),
+ drawtype = "airlike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ drop = "",
+ groups = {not_in_creative_inventory = 1},
+ on_timer = function(pos, elapsed)
+ local meta = minetest.get_meta(pos)
+ local saved_name = meta:get_string("saved_name")
+ local saved_param2 = meta:get_string("saved_param2")
+ local leaf_name = meta:get_string("leaf_name")
+ local tree_name = meta:get_string("tree_name")
+
+ local positions = minetest.find_nodes_in_area(
+ {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
+ {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
+ {leaf_name, tree_name })
+
+ if #positions == 0 then
+ minetest.remove_node(pos)
+ elseif climate.get_rain(pos, 15) or
+ climate.time_since_rain(elapsed) > 0 then
+ --needs rain for growth
+ minetest.set_node(pos, {name = saved_name, param2 = saved_param2})
+ else
+ --no rain, so wait
+ return true
+ end
+ end
+})
+
+
+---------------------------------------------------------
+
+tree_list = tree_list -- declare globals from data_plant.lua
+tree_base_tree_growth = tree_base_tree_growth
+tree_base_leaf_growth = tree_base_leaf_growth
+tree_base_fruit_growth = tree_base_fruit_growth
+
+for i in ipairs(tree_list) do
+ local treename = tree_list[i][1]
+ local treedesc = tree_list[i][2]
+ local fruitname = tree_list[i][3]
+ local fruitdesc = tree_list[i][4]
+ local p2_fruit = tree_list[i][5]
+ local selbox_fruit = tree_list[i][6]
+ local hardness = tree_list[i][7]
+ local dyecandidate = tree_list[i][8]
+ local dominantcolor = tree_list[i][9] or "none"
+ local flamesusceptibility = hardness * -2
+
+ if not selbox_fruit then
+ selbox_fruit = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16}
+ end
+
+
+
+ --trunk
+ minetest.register_node("nodes_nature:"..treename.."_tree", {
+ description = treedesc,
+ tiles = {
+ "nodes_nature_"..treename.."_tree_top.png",
+ "nodes_nature_"..treename.."_tree_top.png",
+ "nodes_nature_"..treename.."_tree.png"
+ },
+ stack_max = minimal.stack_max_bulky,
+ drop = "nodes_nature:"..treename.."_log",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ groups = {tree = 1, choppy = hardness,
+ flammable = 10 - flamesusceptibility },
+ sounds = nodes_nature.node_sound_wood_defaults(),
+ on_place = minetest.rotate_node,
+ after_place_node = function(pos, placer, itemstack)
+ minetest.set_node(pos, {name = "nodes_nature:"..treename.."_tree", param3 = 1})
+ end,
+ after_dig_node = function(pos, oldnode, oldmetadata, digger)
+ if oldnode.param3 ~= 1 then
+ minetest.set_node(pos, {name = "nodes_nature:tree_mark"})
+ local meta = minetest.get_meta(pos)
+ meta:set_string("saved_name", "nodes_nature:"..treename.."_tree")
+ meta:set_string("saved_param2", 0)
+ meta:set_string("leaf_name", "nodes_nature:"..treename.."_leaves")
+ meta:set_string("tree_name", "nodes_nature:"..treename.."_tree")
+ minetest.get_node_timer(pos):start(math.random(tree_base_tree_growth/2, tree_base_tree_growth))
+ end
+ end,
+ })
+
+ --dropped log
+ minetest.register_node("nodes_nature:"..treename.."_log", {
+ description = S("@1 Log", treedesc),
+ tiles = {
+ "nodes_nature_"..treename.."_log_top.png",
+ "nodes_nature_"..treename.."_log_top.png",
+ "nodes_nature_"..treename.."_log.png"
+ },
+ stack_max = minimal.stack_max_bulky,
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.4375, -0.5, -0.4375, 0.4375, 0.5, 0.4375},
+ {-0.375, -0.5, 0.4375, 0.375, 0.5, 0.5},
+ {-0.375, -0.5, -0.5, 0.375, 0.5, -0.4375},
+ {0.4375, -0.5, -0.375, 0.5, 0.5, 0.375},
+ {-0.5, -0.5, -0.375, -0.4375, 0.5, 0.375},
+ }
+ },
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ groups = {log = 1, choppy = hardness,
+ flammable = 10 - flamesusceptibility},
+ sounds = nodes_nature.node_sound_wood_defaults(),
+ on_place = minetest.rotate_node,
+ })
+
+ --stairs and slabs
+ stairs.register_stair_and_slab(
+ treename.."_log",
+ "nodes_nature:"..treename.."_log",
+ "chopping_block",
+ "false",
+ {choppy = hardness, flammable = 8 - flamesusceptibility,
+ woodslab = 1},
+ {
+ "nodes_nature_"..treename.."_log_top.png",
+ "nodes_nature_"..treename.."_log_top.png",
+ "nodes_nature_"..treename.."_log.png"
+ },
+ treedesc.." Log Stair",
+ treedesc.." Log Slab",
+ minimal.stack_max_bulky * 2,
+ nodes_nature.node_sound_wood_defaults()
+ )
+
+
+
+
+ --leaves
+ minetest.register_node("nodes_nature:"..treename.."_leaves", {
+ description = S("@1 Leaves", treedesc),
+ drawtype = "plantlike",
+ visual_scale = 1,
+ tiles ={"nodes_nature_"..treename.."_leaves.png" },
+ stack_max = minimal.stack_max_bulky * 3,
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = 4,
+ walkable = false,
+ climbable = true,
+ groups = {choppy = 3, flammable = 2, woody_plant = 1, leafdecay = 1, leafdecay_drop = 1},
+ sounds = nodes_nature.node_sound_leaves_defaults(),
+ after_place_node = function(pos, placer, itemstack)
+ minetest.set_node(pos, {name = "nodes_nature:"..treename.."_leaves", param2 = 0})
+ end,
+ after_dig_node = function(pos, oldnode, oldmetadata, digger)
+ if oldnode.param2 ~= 0 then
+ minetest.set_node(pos, {name = "nodes_nature:tree_mark"})
+ local meta = minetest.get_meta(pos)
+ meta:set_string("saved_name", "nodes_nature:"..treename.."_leaves")
+ meta:set_string("saved_param2", oldnode.param2)
+ meta:set_string("leaf_name", "nodes_nature:"..treename.."_leaves")
+ meta:set_string("tree_name", "nodes_nature:"..treename.."_tree")
+ minetest.get_node_timer(pos):start(math.random(tree_base_leaf_growth/2, tree_base_leaf_growth))
+ end
+ end,
+ })
+
+ --fruit
+ if fruitname then
+ minetest.register_node("nodes_nature:"..fruitname, {
+ description = fruitdesc,
+ drawtype = "plantlike",
+ tiles = { "nodes_nature_"..fruitname..".png" },
+ inventory_image = "nodes_nature_"..fruitname..".png",
+ wield_image = "nodes_nature_"..fruitname..".png",
+ stack_max = minimal.stack_max_medium,
+ visual_scale = 1,
+ paramtype = "light",
+ paramtype2 = "meshoptions",
+ place_param2 = p2_fruit or 2,
+ sunlight_propagates = true,
+ walkable = false,
+ selection_box = {
+ type = "fixed",
+ fixed = selbox_fruit
+ },
+ groups = {dig_immediate=3, flammable=2, leafdecay = 3, leafdecay_drop = 1, ncrafting_dye_candidate = dyecandidate },
+ sounds = nodes_nature.node_sound_defaults(),
+ _ncrafting_dye_dcolor = dominantcolor,
+ after_place_node = function(pos, placer, itemstack)
+ minetest.set_node(pos, {name = "nodes_nature:"..fruitname, param2 = 0})
+ end,
+ after_dig_node = function(pos, oldnode, oldmetadata, digger)
+ if oldnode.param2 ~= 0 then
+ minetest.set_node(pos, {name = "nodes_nature:tree_mark"})
+ local meta = minetest.get_meta(pos)
+ meta:set_string("saved_name", "nodes_nature:"..fruitname)
+ meta:set_string("saved_param2", p2_fruit)
+ meta:set_string("leaf_name", "nodes_nature:"..treename.."_leaves")
+ meta:set_string("tree_name", "nodes_nature:"..treename.."_tree")
+ minetest.get_node_timer(pos):start(math.random(tree_base_fruit_growth/2, tree_base_fruit_growth))
+ end
+ end,
+ })
+ exile_add_food_hooks("nodes_nature:"..fruitname)
+ register_leafdecay({
+ trunks = {"nodes_nature:"..treename.."_tree"},
+ leaves = {"nodes_nature:"..treename.."_leaves", "nodes_nature:"..fruitname},
+ radius = 3,
+ })
+ else
+ register_leafdecay({
+ trunks = {"nodes_nature:"..treename.."_tree"},
+ leaves = {"nodes_nature:"..treename.."_leaves"},
+ radius = 3,
+ })
+
+ end
+
+
+end
+
+
+-------------------------------------------------
+--Special properties
+
+--maraka thorns
+minetest.override_item("nodes_nature:maraka_leaves",{damage_per_second = 1})
+
+--tangkal fruit is good food, but bulky
+minetest.override_item("nodes_nature:tangkal_fruit",{stack_max = minimal.stack_max_medium/2})
+
+--exile_experimental trees
+minetest.override_item("nodes_nature:sasaran_cone",{
+ on_use = function(itemstack, user, pointed_thing)
+
+ --food poisoning
+ if random() < 0.08 then
+ HEALTH.add_new_effect(user, {"Food Poisoning", 1})
+ end
+
+ --hp_change, thirst_change, hunger_change, energy_change, temp_change, replace_with_item
+ return HEALTH.use_item(itemstack, user, 0, 0, 1, 0, 0)
+
+ end,
+})
+
+
+local kagum_groups = table.copy(minetest.registered_nodes["nodes_nature:kagum_pod"].groups)
+kagum_groups.bioluminescent = 1
+
+minetest.override_item("nodes_nature:kagum_pod",{
+ light_source = 2,
+ groups = kagum_groups,
+})
diff --git a/games/globo/mods/notools/init.lua b/games/globo/mods/notools/init.lua
new file mode 100644
index 000000000..44e92f35d
--- /dev/null
+++ b/games/globo/mods/notools/init.lua
@@ -0,0 +1,65 @@
+
+
+
+minetest.register_item(":", {
+ type = "none",
+ wield_image = "wieldhand.png",
+ wield_scale = {x = 1, y = 1, z = 2.5},
+ tool_capabilities = {
+ full_punch_interval = 0.9,
+ max_drop_level = 0,
+ },
+--[[
+ on_use = function(itemstack, player, pointed_thing)
+ if pointed_thing.type == "node" then
+ local pos = pointed_thing.under
+ local node = minetest.get_node(pos)
+
+ if node.name == "basenodes:apple" then
+ addNutrient(player,"hunger",100)
+ if math.random(0,99) < APPLE_CHANCE_DIE then
+ local pos = pointed_thing.under
+ minetest.remove_node(pos)
+ end
+ elseif node.name == "basenodes:snowblock" then
+ addNutrient(user,"thirst",100)
+ if math.random(0,99) < SNOW_CHANCE_DIE then
+ local pos = pointed_thing.under
+ minetest.remove_node(pos)
+ end
+ elseif node.name == "basenodes:pine_tree" and
+ itemstack:get_name() == "notools:rock" then
+ minetest.remove_node(pos)
+ minetest.add_item(pos, 'basenodes:pine_tree')
+ end
+ end
+ return nil
+ end,
+ ]]--
+ })
+
+minetest.register_tool("notools:rock", {
+ description = "Rock",
+ inventory_image = "default_stone.png",
+ tool_capabilities = {
+ full_punch_interval = 1.0,
+ max_drop_level = 0,
+ groupcaps={
+ choppy = {times = {[2] = 2.00, [3] = 1.00}, uses = 20, maxlevel = 1},
+ },
+ },
+})
+
+minetest.register_tool("notools:tool_bones", {
+ description = "Bone Tool",
+ inventory_image = "basenodes_tool_bones.png",
+ tool_capabilities = {
+ full_punch_interval = 1.0,
+ max_drop_level = 1,
+ groupcaps={
+ crumbly = {times = {[1]=2.00, [2]=1.00}, uses = 20, maxlevel = 1},
+ snappy = {times = {[2]=3.00, [3]=2.40}, uses = 20, maxlevel = 1},
+ },
+ damage_groups = {fleshy=2},
+ },
+})
diff --git a/games/globo/mods/notools/mod.conf b/games/globo/mods/notools/mod.conf
new file mode 100644
index 000000000..299959151
--- /dev/null
+++ b/games/globo/mods/notools/mod.conf
@@ -0,0 +1,2 @@
+name = notools
+description = Only a hand that can do nothing.
diff --git a/games/globo/mods/notools/textures/basetools_bloodsword.png b/games/globo/mods/notools/textures/basetools_bloodsword.png
new file mode 100644
index 000000000..a521ba4a2
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_bloodsword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_elementalsword.png b/games/globo/mods/notools/textures/basetools_elementalsword.png
new file mode 100644
index 000000000..d007217ee
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_elementalsword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_firesword.png b/games/globo/mods/notools/textures/basetools_firesword.png
new file mode 100644
index 000000000..eca999ba1
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_firesword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_healdagger.png b/games/globo/mods/notools/textures/basetools_healdagger.png
new file mode 100644
index 000000000..3e6eb9cd0
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_healdagger.png differ
diff --git a/games/globo/mods/notools/textures/basetools_healsword.png b/games/globo/mods/notools/textures/basetools_healsword.png
new file mode 100644
index 000000000..f93fddfb2
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_healsword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_icesword.png b/games/globo/mods/notools/textures/basetools_icesword.png
new file mode 100644
index 000000000..55a8d609d
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_icesword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_mesepick.png b/games/globo/mods/notools/textures/basetools_mesepick.png
new file mode 100644
index 000000000..2993b475b
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_mesepick.png differ
diff --git a/games/globo/mods/notools/textures/basetools_mesesword.png b/games/globo/mods/notools/textures/basetools_mesesword.png
new file mode 100644
index 000000000..bc82769bc
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_mesesword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_steelaxe.png b/games/globo/mods/notools/textures/basetools_steelaxe.png
new file mode 100644
index 000000000..aac594d84
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_steelaxe.png differ
diff --git a/games/globo/mods/notools/textures/basetools_steeldagger.png b/games/globo/mods/notools/textures/basetools_steeldagger.png
new file mode 100644
index 000000000..4c9173094
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_steeldagger.png differ
diff --git a/games/globo/mods/notools/textures/basetools_steelpick.png b/games/globo/mods/notools/textures/basetools_steelpick.png
new file mode 100644
index 000000000..bc02aac3e
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_steelpick.png differ
diff --git a/games/globo/mods/notools/textures/basetools_steelpick_l1.png b/games/globo/mods/notools/textures/basetools_steelpick_l1.png
new file mode 100644
index 000000000..dc03f3f65
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_steelpick_l1.png differ
diff --git a/games/globo/mods/notools/textures/basetools_steelpick_l2.png b/games/globo/mods/notools/textures/basetools_steelpick_l2.png
new file mode 100644
index 000000000..011df4584
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_steelpick_l2.png differ
diff --git a/games/globo/mods/notools/textures/basetools_steelshears.png b/games/globo/mods/notools/textures/basetools_steelshears.png
new file mode 100644
index 000000000..04c86c370
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_steelshears.png differ
diff --git a/games/globo/mods/notools/textures/basetools_steelshovel.png b/games/globo/mods/notools/textures/basetools_steelshovel.png
new file mode 100644
index 000000000..8cab60784
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_steelshovel.png differ
diff --git a/games/globo/mods/notools/textures/basetools_steelsword.png b/games/globo/mods/notools/textures/basetools_steelsword.png
new file mode 100644
index 000000000..9909365c3
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_steelsword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_stoneaxe.png b/games/globo/mods/notools/textures/basetools_stoneaxe.png
new file mode 100644
index 000000000..a374c547d
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_stoneaxe.png differ
diff --git a/games/globo/mods/notools/textures/basetools_stonepick.png b/games/globo/mods/notools/textures/basetools_stonepick.png
new file mode 100644
index 000000000..d9156ee3a
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_stonepick.png differ
diff --git a/games/globo/mods/notools/textures/basetools_stoneshears.png b/games/globo/mods/notools/textures/basetools_stoneshears.png
new file mode 100644
index 000000000..0b4bd3b74
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_stoneshears.png differ
diff --git a/games/globo/mods/notools/textures/basetools_stoneshovel.png b/games/globo/mods/notools/textures/basetools_stoneshovel.png
new file mode 100644
index 000000000..3c1bb48cb
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_stoneshovel.png differ
diff --git a/games/globo/mods/notools/textures/basetools_stonesword.png b/games/globo/mods/notools/textures/basetools_stonesword.png
new file mode 100644
index 000000000..6f3e94cda
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_stonesword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_superhealsword.png b/games/globo/mods/notools/textures/basetools_superhealsword.png
new file mode 100644
index 000000000..4175a0917
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_superhealsword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_titaniumsword.png b/games/globo/mods/notools/textures/basetools_titaniumsword.png
new file mode 100644
index 000000000..55e22c7d5
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_titaniumsword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_usespick.png b/games/globo/mods/notools/textures/basetools_usespick.png
new file mode 100644
index 000000000..27850f961
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_usespick.png differ
diff --git a/games/globo/mods/notools/textures/basetools_usessword.png b/games/globo/mods/notools/textures/basetools_usessword.png
new file mode 100644
index 000000000..0eaf4cf38
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_usessword.png differ
diff --git a/games/globo/mods/notools/textures/basetools_woodaxe.png b/games/globo/mods/notools/textures/basetools_woodaxe.png
new file mode 100644
index 000000000..4015e910f
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_woodaxe.png differ
diff --git a/games/globo/mods/notools/textures/basetools_wooddagger.png b/games/globo/mods/notools/textures/basetools_wooddagger.png
new file mode 100644
index 000000000..6e5ab0fd6
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_wooddagger.png differ
diff --git a/games/globo/mods/notools/textures/basetools_woodpick.png b/games/globo/mods/notools/textures/basetools_woodpick.png
new file mode 100644
index 000000000..15c61f408
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_woodpick.png differ
diff --git a/games/globo/mods/notools/textures/basetools_woodshears.png b/games/globo/mods/notools/textures/basetools_woodshears.png
new file mode 100644
index 000000000..4ff92fd7c
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_woodshears.png differ
diff --git a/games/globo/mods/notools/textures/basetools_woodshovel.png b/games/globo/mods/notools/textures/basetools_woodshovel.png
new file mode 100644
index 000000000..6cc52f8a1
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_woodshovel.png differ
diff --git a/games/globo/mods/notools/textures/basetools_woodsword.png b/games/globo/mods/notools/textures/basetools_woodsword.png
new file mode 100644
index 000000000..364016ed6
Binary files /dev/null and b/games/globo/mods/notools/textures/basetools_woodsword.png differ
diff --git a/games/globo/mods/player_monoids/.luacheckrc b/games/globo/mods/player_monoids/.luacheckrc
new file mode 100644
index 000000000..ede251ea5
--- /dev/null
+++ b/games/globo/mods/player_monoids/.luacheckrc
@@ -0,0 +1,9 @@
+
+read_globals = {
+ "minetest",
+ "vector",
+}
+
+globals = {
+ "player_monoids",
+}
diff --git a/games/globo/mods/player_monoids/API.md b/games/globo/mods/player_monoids/API.md
new file mode 100644
index 000000000..a032112bd
--- /dev/null
+++ b/games/globo/mods/player_monoids/API.md
@@ -0,0 +1,76 @@
+#Player Monoids
+
+The idea behind this library is that global player state (physics overrides,
+armor values, etc.) changes from multiple mods should mesh nicely with each
+other. This means they must be combinable in a sane way.
+
+Monoids
+=======
+A player monoid covers a single kind of player state a mod might want to change.
+These can be built-in player state, like speed multipliers or fly permissions,
+or could be custom state introduced by mods, such as corruption or reputation
+level. When you make a player monoid, you must choose some type of value to
+represent state changes - for example, numbers for speed multipliers, or vectors
+for "lucky direction". Each mod can contribute different changes, represented
+by this type of value, and they are all combined together. This combined value
+is interpreted and converted into actual effects on the player's state.
+Privileges could be set, physics overrides would be used to effect speed
+changes, and a mod might change some value to match the monoid.
+
+Definition
+----------
+A player monoid definition is a table with the following:
+
+ * ```combine(elem1, elem2)``` - An associative binary operation
+ * ```fold({elems})``` - Equivalent to combining a whole list with ```combine```
+ * ```identity``` - An identity element for ```combine```
+ * ```apply(value, player)``` - Apply the effect represented by ```value```
+ to ```player```
+ * ```on_change(val1, val2, player)``` - Do something when the value on a
+ player changes. (optional)
+
+Additionally, you should document what values are valid representatives of
+your monoid's effects. When something says that a value is "in a monoid", it
+means that value is a valid representative of your monoid's effects.
+
+combine and fold
+----------------
+```combine``` should take two values in your monoid and produce a third value in
+your monoid. It should also be an associative operation. ```fold`` should take a
+table containing elements of your monoid as input and combine them together in
+key order. It should be equivalent to using ```combine``` to combine all the
+values together. For example, ```combine``` could multiply two speed multipliers
+together, and ```fold``` could multiply every value together.
+
+identity
+--------
+```identity```, when combined with any other value, should result in the other
+value. It also represents the "default" or "neutral" state of the player, and
+will be used when there are no status effects active for a particular monoid.
+For example, the identity of a speed monoid could be the multiplier ```1```.
+
+apply
+-----
+```apply``` is the function that interprets a value in your monoid to do
+something to the player's state. For example, you could set a speed multiplier
+as the speed physics override for the player.
+
+Functions
+=========
+```player_monoids.make_monoid(monoid_def)``` - Creates a new monoid that can be
+used to make changes to the player state. Returns a monoid.
+
+Monoid Methods
+--------------
+```monoid:add_change(player, value[, "id"])``` - Applies the change represented
+by ```value``` to ```player```. Returns an ID for the change. If the optional
+string argument ```"id"``` is supplied, that is used as the ID instead, and any
+existing change with that ID is removed. IDs are only guaranteed to be unique
+per-player. Conversely, you are allowed to make multiple changes with the same
+ID as long as they are all on different players.
+
+```monoid:del_change(player, id)``` - Removes the change with the given ID, from
+the given player, if it exists.
+
+```monoid:value(player)``` - The current combined value of the monoid for the
+given player.
diff --git a/games/globo/mods/player_monoids/COPYING b/games/globo/mods/player_monoids/COPYING
new file mode 100644
index 000000000..8034ed733
--- /dev/null
+++ b/games/globo/mods/player_monoids/COPYING
@@ -0,0 +1,13 @@
+Copyright 2015-2016 raymoo
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/games/globo/mods/player_monoids/README.md b/games/globo/mods/player_monoids/README.md
new file mode 100644
index 000000000..9d5254aaa
--- /dev/null
+++ b/games/globo/mods/player_monoids/README.md
@@ -0,0 +1,205 @@
+# Player Monoids
+
+This is a small library for managing global player state, so that changes made
+from different mods do not result in unexpected behavior. The README gives an
+introduction to the mod, but you might want to reference API.md along the way.
+This mod, combined with playereffects, deprecates monoidal_effects.
+
+Global Player State
+===================
+Players have behavior-affecting state that can be modified through mods. A couple
+examples are physics overrides and armor groups. If more than one mod tries to
+change them, it can result in unexpected results.
+
+For example, a player could be
+under a speed boost effect from a playereffects effect, and then sleep in a bed.
+The bed sets the player's speed to 0, and sets it back to 1 when they get out.
+Because the beds mod had no way of knowing that the player was supposed to have
+a speed boost, it effectively removed it. One hack to "fix" it would be to save
+the player's speed and restore it on wakeup, but this would have its own problems
+if the effect wears off in bed. The beds mod would restore the boosted speed,
+which wouldn't be removed, since the effect already went away. Thus an exploit
+allowing a permanent (until log out) speed boost is introduced.
+
+Player Monoids manages this by creating layers (monoids) on top of player state,
+which can keep track of different changes and combine them usefully.
+
+Monoids
+=======
+
+Creation
+--------
+A monoid in Player Monoids is an interface to one piece of player state. For
+example, you could have one monoid covering physics overrides, and another
+covering fly privilege. You could define a speed monoids like this:
+```
+-- The values in my speed monoid must be speed multipliers (numbers).
+mymod.speed_monoid = player_monoids.make_monoid({
+ combine = function(speed1, speed2)
+ return speed1 * speed2
+ end,
+ fold = function(tab)
+ local res = 1
+ for _, speed in pairs(tab) do
+ res = res * speed
+ end
+ end,
+ identity = 1,
+ apply = function(speed, player)
+ local override = player:get_physics_override()
+ override.speed = speed
+ player:set_physics_override(override)
+ end,
+ on_change = function() return end,
+})
+```
+
+This says that two speed multipliers can be combined by multiplication, that
+1 can be used as a neutral element, and that the "interpretation" of the speed
+multiplier is to set the player's speed physics override to that value. It also
+says that nothing in particular needs to happen when the speed changes, other
+than applying the new speed multiplier.
+
+Use
+---
+To add or remove change through a monoid, you must use the ```add_change```
+and ```del_change``` methods. For example, you could speed the player up
+temporarily like this:
+```
+-- Zoom!
+local zoom_id = mymod.speed_monoid:add_change(some_player, 10)
+
+minetest.after(5,function() mymod.speed_monoid:del_change(some_player, zoom_id) end)
+```
+You could also specify a string ID to use, instead of the numerical one that
+is automatically provided:
+```
+-- Zoom Mk. II
+mymod.speed_monoid:add_change(some_player, 10, "mymod:zoom")
+
+minetest.after(5,function() mymod.speed_monoid:del_change(some_player, "mymod:zoom") end)
+```
+
+Reading Values
+--------------
+You can use ```monoid:value(player)``` to read the current value of the monoid,
+for that player. This could be useful if it doesn't just represent built-in
+player state. For example, it could represent gardening skill, and you might use
+it to calculate the chance of success when harvesting spices.
+
+Nesting Monoids
+---------------
+You may have already noticed one limitation of this design. That is, for each
+kind of player state, you can only combine state changes in one way. If the
+standard speed monoid combines speed multipliers by multiplication, you cannot
+change it to instead choose the highest speed multiplier. Unfortunately, there
+is currently no way change this - you will have to hope that the given monoid
+combines in a useful way. However, it is possible to manage a subset of the
+values in a custom way.
+
+Suppose that a speed monoid (```mymod.speed_monoid```) already exists, using
+multiplication, but you want to write a mod with speed boosts, and only apply
+the strongest boost. Most of it could be done the same way:
+```
+-- My speed boosts monoid takes speed multipliers (numbers) that are at least 1.
+newmod.speed_boosts = player_monoids.make_monoid({
+ combine = function(speed1, speed2)
+ return math.max(speed1, speed2)
+ end,
+ fold = function(tab)
+ local res = 1
+ for _, speed in pairs(tab) do
+ res = math.max(res, speed)
+ end
+ end,
+ identity = 1,
+ apply = ???
+ on_change = function() return end,
+})
+```
+But we cannot just change the player speed in ```apply```, otherwise we will
+break compatibility with the original speed monoid! The trick here is to use
+the original monoid as a proxy for our effects.
+```
+apply = function(speed, player)
+ mymod.speed_monoid:add_change(player, speed, "newmod:speed_boosts")
+end
+```
+This means the speed boosts we control can be limited to the strongest boost, but
+the resulting boost will still play nice with speed effects from other mods.
+You could even add another "nested monoid" just for speed maluses, that takes
+the worst speed drain and applies it as a multiplier.
+
+Standard Monoids
+================
+In the spirit of compatibility, this mod provides some canonical monoids for
+commonly used player state. They combine values in a way that should allow
+different mods to affect player state fairly. If you make another monoid handling
+the same state as one of these, you will break compatibility with any mods using
+the standard monoid.
+
+Physics Overrides
+-----------------
+These monoids set the multiplier of the override they are named after. All three
+take non-negative numbers as values and combine them with multiplication. They
+are:
+ * ```player_monoids.speed```
+ * ```player_monoids.jump```
+ * ```player_monoids.gravity```
+
+Privileges
+----------
+These monoids set privileges that affect the player's ordinary gameplay. They
+take booleans as input and combine them with logical or. They are:
+ * ```player_monoids.fly```
+ * ```player_monoids.noclip```
+
+Other
+-----
+ * ```player_monoids.collisionbox``` - Sets the player's collisionbox. Values are
+ 3D multiplier vectors, which are combined with component-wise multiplication.
+ * ```player_monoids.visual_size``` - Sets the player's collisionbox. Values are
+ 2D multiplier vectors (x and y), which are combined with component-wise
+ multiplication.
+
+Use with playereffects
+======================
+Player Monoids does not provide anything special for persistent effects with
+limited lifetime. By using monoids with Wuzzy's playereffects, you can easily
+create temporary effects that stack with each other. As an example, an effect
+that gives the player 2x speed:
+```
+local speed = player_monoids.speed
+
+local function apply(player)
+ speed:add_change(player, 2, "mymod:2x_speed")
+end
+
+local function cancel(player)
+ speed:del_change(player, "mymod:2x_speed")
+end
+
+local groups = { "mymod:2x_speed" }
+
+playereffects.register_effect_type("mymod:2x_speed", "2x Speed", groups, apply, cancel)
+```
+
+Note that this effect does NOT use the "speed" effect group. As long as other
+speed effects use the speed monoid, we do not want them to be cancelled, since
+the goal is to combine the effects together. It does use a singleton group to
+prevent multiple instances of the same effect. I think that playereffects require
+effects to belong to at least one group, but I am not sure.
+
+Caveats
+=======
+* If the global state managed by a monoid is modified by something other than
+the monoid, you will have the same problem as when two mods both independently
+try to modify global state without going through a monoid.
+ * This includes playereffects effects that affect global player state without
+going through a monoid.
+* You will also get problems if you use multiple monoids to manage the same
+global state.
+* The order that different effects get combined together is based on key order,
+which may not be predictable. So you should try to make your monoids commutative
+in addition to associative, or at least not care if the order of two changes
+is swapped.
\ No newline at end of file
diff --git a/games/globo/mods/player_monoids/bower.json b/games/globo/mods/player_monoids/bower.json
new file mode 100644
index 000000000..830c0d49e
--- /dev/null
+++ b/games/globo/mods/player_monoids/bower.json
@@ -0,0 +1,19 @@
+{
+ "name": "player_monoids",
+ "description": "Library for making player state changes combinable\n",
+ "keywords": [
+ "player_monoids",
+ "monoid",
+ "monoids",
+ "effect",
+ "playereffects"
+ ],
+ "homepage": "https://github.com/raymoo/player_monoids",
+ "forum": "https://forum.minetest.net/viewtopic.php?f=9&t=14895",
+ "screenshots": [
+ "https://example.com/screenshot1.png"
+ ],
+ "authors": [
+ "raymoo"
+ ]
+}
diff --git a/games/globo/mods/player_monoids/init.lua b/games/globo/mods/player_monoids/init.lua
new file mode 100644
index 000000000..652715483
--- /dev/null
+++ b/games/globo/mods/player_monoids/init.lua
@@ -0,0 +1,118 @@
+-- Copyright (c) raymoo 2016
+-- Licensed under Apache 2.0 license. See COPYING for details.
+
+-- Any documentation here are internal details, please avoid using them in your
+-- mod.
+
+local modpath = minetest.get_modpath(minetest.get_current_modname()) .. "/"
+
+player_monoids = {}
+
+local mon_meta = {}
+
+mon_meta.__index = mon_meta
+
+local nop = function() end
+
+-- A monoid object is a table with the following fields:
+-- def: The monoid definition
+-- player_map: A map from player names to their effect tables. Effect tables
+-- are maps from effect IDs to values.
+-- value_cache: A map from player names to the cached value for the monoid.
+-- next_id: The next unique ID to assign an effect.
+
+local function monoid(def)
+ local mon = {}
+
+ local actual_def = {}
+
+ for k, v in pairs(def) do
+ actual_def[k] = v
+ end
+
+ if not actual_def.apply then
+ actual_def.apply = nop
+ end
+
+ if not actual_def.on_change then
+ actual_def.on_change = nop
+ end
+
+ mon.def = actual_def
+
+ local p_map = {}
+ mon.player_map = p_map
+
+ mon.next_id = 1
+
+ local v_cache = {}
+ mon.value_cache = v_cache
+
+ setmetatable(mon, mon_meta)
+
+ minetest.register_on_leaveplayer(function(player)
+ local p_name = player:get_player_name()
+ p_map[p_name] = nil
+ v_cache[p_name] = nil
+ end)
+
+ return mon
+end
+
+player_monoids.make_monoid = monoid
+
+function mon_meta:add_change(player, value, id)
+ local p_name = player:get_player_name()
+
+ local def = self.def
+
+ local p_effects = self.player_map[p_name]
+ if p_effects == nil then
+ p_effects = {}
+ self.player_map[p_name] = p_effects
+ end
+
+ local actual_id
+
+ if id then
+ actual_id = id
+ else
+ actual_id = self.next_id
+ self.next_id = actual_id + 1
+ end
+
+ local old_total = self.value_cache[p_name]
+ p_effects[actual_id] = value
+ local new_total = def.fold(p_effects)
+ self.value_cache[p_name] = new_total
+
+ def.apply(new_total, player)
+ def.on_change(old_total, new_total, player)
+
+ return actual_id
+end
+
+function mon_meta:del_change(player, id)
+ local p_name = player:get_player_name()
+
+ local def = self.def
+
+ local p_effects = self.player_map[p_name]
+ if p_effects == nil then return end
+
+ local old_total = self.value_cache[p_name]
+ p_effects[id] = nil
+ local new_total = def.fold(p_effects)
+ self.value_cache[p_name] = new_total
+
+ def.apply(new_total, player)
+ def.on_change(old_total, new_total, player)
+end
+
+function mon_meta:value(player)
+ local p_name = player:get_player_name()
+ return self.value_cache[p_name] or self.def.identity
+end
+
+dofile(modpath .. "standard_monoids.lua")
+dofile(modpath .. "test.lua")
diff --git a/games/globo/mods/player_monoids/mod.conf b/games/globo/mods/player_monoids/mod.conf
new file mode 100644
index 000000000..ff7de4fcc
--- /dev/null
+++ b/games/globo/mods/player_monoids/mod.conf
@@ -0,0 +1,2 @@
+name=player_monoids
+description=player_monoids is a library for managing global player state, such as physics overrides or player visual size.
diff --git a/games/globo/mods/player_monoids/standard_monoids.lua b/games/globo/mods/player_monoids/standard_monoids.lua
new file mode 100644
index 000000000..6b36134dd
--- /dev/null
+++ b/games/globo/mods/player_monoids/standard_monoids.lua
@@ -0,0 +1,159 @@
+-- Standard effect monoids, to provide canonicity.
+
+local function mult(x, y) return x * y end
+
+local function mult_fold(elems)
+ local tot = 1
+
+ for _, v in pairs(elems) do
+ tot = tot * v
+ end
+
+ return tot
+end
+
+local function v_mult(v1, v2)
+ local res = {}
+
+ for k, v in pairs(v1) do
+ res[k] = v * v2[k]
+ end
+
+ return res
+end
+
+local function v_mult_fold(identity)
+ return function(elems)
+ local tot = identity
+
+ for _, v in pairs(elems) do
+ tot = v_mult(tot, v)
+ end
+
+ return tot
+ end
+end
+
+local monoid = player_monoids.make_monoid
+
+-- Speed monoid. Effect values are speed multipliers. Must be nonnegative
+-- numbers.
+player_monoids.speed = monoid({
+ combine = mult,
+ fold = mult_fold,
+ identity = 1,
+ apply = function(multiplier, player)
+ local ov = player:get_physics_override()
+ ov.speed = multiplier
+ player:set_physics_override(ov)
+ end,
+})
+
+
+-- Jump monoid. Effect values are jump multipliers. Must be nonnegative
+-- numbers.
+player_monoids.jump = monoid({
+ combine = mult,
+ fold = mult_fold,
+ identity = 1,
+ apply = function(multiplier, player)
+ local ov = player:get_physics_override()
+ ov.jump = multiplier
+ player:set_physics_override(ov)
+ end,
+})
+
+
+-- Gravity monoid. Effect values are gravity multipliers.
+player_monoids.gravity = monoid({
+ combine = mult,
+ fold = mult_fold,
+ identity = 1,
+ apply = function(multiplier, player)
+ local ov = player:get_physics_override()
+ ov.gravity = multiplier
+ player:set_physics_override(ov)
+ end,
+})
+
+
+-- Fly ability monoid. The values are booleans, which are combined by or. A true
+-- value indicates having the ability to fly.
+player_monoids.fly = monoid({
+ combine = function(p, q) return p or q end,
+ fold = function(elems)
+ for _, v in pairs(elems) do
+ if v then return true end
+ end
+
+ return false
+ end,
+ identity = false,
+ apply = function(can_fly, player)
+ local p_name = player:get_player_name()
+ local privs = minetest.get_player_privs(p_name)
+
+ if can_fly then
+ privs.fly = true
+ else
+ privs.fly = nil
+ end
+
+ minetest.set_player_privs(p_name, privs)
+
+ end,
+})
+
+
+-- Noclip ability monoid. Works the same as fly monoid.
+player_monoids.noclip = monoid({
+ combine = function(p, q) return p or q end,
+ fold = function(elems)
+ for _, v in pairs(elems) do
+ if v then return true end
+ end
+
+ return false
+ end,
+ identity = false,
+ apply = function(can_noclip, player)
+ local p_name = player:get_player_name()
+ local privs = minetest.get_player_privs(p_name)
+
+ if can_noclip then
+ privs.noclip = true
+ else
+ privs.noclip = nil
+ end
+
+ minetest.set_player_privs(p_name, privs)
+
+ end,
+})
+
+local def_col_scale = { x=0.3, y=1, z=0.3 }
+
+-- Collisionbox scaling factor. Values are a vector of x, y, z multipliers.
+player_monoids.collisionbox = monoid({
+ combine = v_mult,
+ fold = v_mult_fold({x=1, y=1, z=1}),
+ identity = {x=1, y=1, z=1},
+ apply = function(multiplier, player)
+ local v = vector.multiply(def_col_scale, multiplier)
+
+ player:set_properties({
+ collisionbox = { -v.x, -v.y, -v.z, v.z, v.y, v.z }
+ })
+ end,
+})
+
+player_monoids.visual_size = monoid({
+ combine = v_mult,
+ fold = v_mult_fold({x=1, y=1}),
+ identity = {x=1, y=1},
+ apply = function(multiplier, player)
+ player:set_properties({
+ visual_size = multiplier
+ })
+ end,
+})
diff --git a/games/globo/mods/player_monoids/test.lua b/games/globo/mods/player_monoids/test.lua
new file mode 100644
index 000000000..f006d86d5
--- /dev/null
+++ b/games/globo/mods/player_monoids/test.lua
@@ -0,0 +1,27 @@
+
+local speed = player_monoids.speed
+
+minetest.register_privilege("monoid_master", {
+ description = "Allows testing of player monoids.",
+ give_to_singleplayer = false,
+})
+
+local function test(player)
+ local ch_id = speed:add_change(player, 10)
+ local p_name = player:get_player_name()
+
+ minetest.chat_send_player(p_name, "Your speed is: " .. speed:value(player))
+
+ minetest.after(3, function()
+ speed:del_change(player, ch_id)
+ minetest.chat_send_player(p_name, "Your speed is: " .. speed:value(player))
+ end)
+end
+
+minetest.register_chatcommand("test_monoids", {
+ description = "Runs a test on monoids",
+ privs = { monoid_master = true },
+ func = function(p_name)
+ test(minetest.get_player_by_name(p_name))
+ end,
+})
diff --git a/games/globo/mods/temperature/init.lua b/games/globo/mods/temperature/init.lua
new file mode 100644
index 000000000..139597f9c
--- /dev/null
+++ b/games/globo/mods/temperature/init.lua
@@ -0,0 +1,2 @@
+
+
diff --git a/games/globo/mods/temperature/mod.conf b/games/globo/mods/temperature/mod.conf
new file mode 100644
index 000000000..a93e7bbd0
--- /dev/null
+++ b/games/globo/mods/temperature/mod.conf
@@ -0,0 +1,2 @@
+name = temerature
+description = Keep track of player and world temperature.
diff --git a/games/globo/mods/weather/init.lua b/games/globo/mods/weather/init.lua
new file mode 100644
index 000000000..e69de29bb
diff --git a/games/globo/mods/weather/mod.conf b/games/globo/mods/weather/mod.conf
new file mode 100644
index 000000000..73fc2e7d9
--- /dev/null
+++ b/games/globo/mods/weather/mod.conf
@@ -0,0 +1,2 @@
+name = weather
+description = Main entry point for the package
\ No newline at end of file
diff --git a/games/globo/notes.md b/games/globo/notes.md
new file mode 100644
index 000000000..acbb3e040
--- /dev/null
+++ b/games/globo/notes.md
@@ -0,0 +1,62 @@
+TODO:
+- Add creatures
+- Wolf
+- mongoose
+- Lava Ox
+- Chaos Hawk
+- cow
+- badger
+- Ogre
+- Snagon
+- Frost mephit
+- Giant Moth
+- Skipping Fungus
+- Sand Slug
+- Corn: needs to be a plant for awhile and then becomes food
+- ensure the maps aren't too crazy
+- remove sounds
+
+
+to test
+- Pulse blossom: glows periodically and hurts anything around it.
+- do potatoes spread properly
+
+
+Later:
+- potatoes only spread under the right conditions
+- Kill grib_weed if it is too cold for too long
+- sun berry: plant that glows when it is in dry soil.
+
+
+- Each block type has a chance of becoming an item or just disappearing when you break it.
+- Trees from Exile
+- Temperature
+ Look at temp system in Exile
+ you start to die if not kept in a certain temperature range. It is colder at night. Certain parts of the map are colder. Some days are colder than others. If you are too hot you will lose energy faster and get thirsty faster.
+ Energy expenditure raises your core temp
+ The air has an ambient temp
+ Your core temp goes toward this temperature over time
+
+What can we take from existing mods?
+mobs from Exile?
+Natural slopes library (in Exile)
+
+Apple Tree: grows slowly: drops apples occasionally. Has a chance of dropping wood when broken.
+
+Fountain: Will spray water over the nearby blocks.
+Slug: takes up a block. Will move in a direction pushed. Picks up the first block in its path and becomes this when it comes to a stop.
+
+Launcher: anything that stands on this is launched in the air in the direction it was going
+Conveyor belt: Placed on terrain. Any item on it is conveyed along to the end of the belt
+
+- Corpse: provides food. Turns to bones
+
+Every 10 seconds Pulse Blossom starts to glow for 2 seconds at the end of the glow it damages any players or mobs around it.
+
+
+Also grib weed should spread to ground spaces with no flora.
+
+We are trying to use gen_notify to do something when grib weed is created. The grib weed shows up in the world but the gen_notify isn't working. What could be wrong?
+
+
+Thorns should have a random chance of going into the "with fruit" state. This changes the image shown and allows the player to harvest from the node. If harvested it should get out of he "with fruit" state
diff --git a/games/globo/project.md b/games/globo/project.md
new file mode 100644
index 000000000..9c53933c2
--- /dev/null
+++ b/games/globo/project.md
@@ -0,0 +1 @@
+A mod for Minetest written in Lua.
diff --git a/games/globo/screenshot.png b/games/globo/screenshot.png
new file mode 100644
index 000000000..08525e71c
Binary files /dev/null and b/games/globo/screenshot.png differ
diff --git a/src/filesys.cpp b/src/filesys.cpp
index d91199594..3b115c2ab 100644
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -25,6 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include
#include
#include
+#include
+#include
#include "log.h"
#include "config.h"
#include "porting.h"
@@ -63,7 +65,7 @@ std::vector GetDirListing(const std::string &pathstring)
dwError = GetLastError();
if (dwError != ERROR_FILE_NOT_FOUND && dwError != ERROR_PATH_NOT_FOUND) {
errorstream << "GetDirListing: FindFirstFile error."
- << " Error is " << dwError << std::endl;
+ << " Error is " << dwError << std::endl;
}
} else {
// NOTE:
@@ -81,7 +83,7 @@ std::vector GetDirListing(const std::string &pathstring)
DirListNode node;
node.name = FindFileData.cFileName;
node.dir = FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
- if(node.name != "." && node.name != "..")
+ if (node.name != "." && node.name != "..")
listing.push_back(node);
}
@@ -89,10 +91,10 @@ std::vector GetDirListing(const std::string &pathstring)
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES) {
errorstream << "GetDirListing: FindNextFile error."
- << " Error is " << dwError << std::endl;
+ << " Error is " << dwError << std::endl;
listing.clear();
return listing;
- }
+ }
}
return listing;
}
@@ -100,9 +102,9 @@ std::vector GetDirListing(const std::string &pathstring)
bool CreateDir(const std::string &path)
{
bool r = CreateDirectory(path.c_str(), NULL);
- if(r == true)
+ if (r == true)
return true;
- if(GetLastError() == ERROR_ALREADY_EXISTS)
+ if (GetLastError() == ERROR_ALREADY_EXISTS)
return true;
return false;
}
@@ -120,8 +122,7 @@ bool IsPathAbsolute(const std::string &path)
bool IsDir(const std::string &path)
{
DWORD attr = GetFileAttributes(path.c_str());
- return (attr != INVALID_FILE_ATTRIBUTES &&
- (attr & FILE_ATTRIBUTE_DIRECTORY));
+ return (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY));
}
bool IsExecutable(const std::string &path)
@@ -141,27 +142,24 @@ bool RecursiveDelete(const std::string &path)
if (!IsDir(path)) {
infostream << "RecursiveDelete: Deleting file " << path << std::endl;
if (!DeleteFile(path.c_str())) {
- errorstream << "RecursiveDelete: Failed to delete file "
- << path << std::endl;
+ errorstream << "RecursiveDelete: Failed to delete file " << path << std::endl;
return false;
}
return true;
}
- infostream << "RecursiveDelete: Deleting content of directory "
- << path << std::endl;
+ infostream << "RecursiveDelete: Deleting content of directory " << path << std::endl;
std::vector content = GetDirListing(path);
- for (const DirListNode &n: content) {
+ for (const DirListNode &n : content) {
std::string fullpath = path + DIR_DELIM + n.name;
if (!RecursiveDelete(fullpath)) {
- errorstream << "RecursiveDelete: Failed to recurse to "
- << fullpath << std::endl;
+ errorstream << "RecursiveDelete: Failed to recurse to " << fullpath
+ << std::endl;
return false;
}
}
infostream << "RecursiveDelete: Deleting directory " << path << std::endl;
if (!RemoveDirectory(path.c_str())) {
- errorstream << "Failed to recursively delete directory "
- << path << std::endl;
+ errorstream << "Failed to recursively delete directory " << path << std::endl;
return false;
}
return true;
@@ -170,15 +168,12 @@ bool RecursiveDelete(const std::string &path)
bool DeleteSingleFileOrEmptyDirectory(const std::string &path)
{
DWORD attr = GetFileAttributes(path.c_str());
- bool is_directory = (attr != INVALID_FILE_ATTRIBUTES &&
- (attr & FILE_ATTRIBUTE_DIRECTORY));
- if(!is_directory)
- {
+ bool is_directory =
+ (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY));
+ if (!is_directory) {
bool did = DeleteFile(path.c_str());
return did;
- }
- else
- {
+ } else {
bool did = RemoveDirectory(path.c_str());
return did;
}
@@ -187,15 +182,15 @@ bool DeleteSingleFileOrEmptyDirectory(const std::string &path)
std::string TempPath()
{
DWORD bufsize = GetTempPath(0, NULL);
- if(bufsize == 0){
- errorstream<<"GetTempPath failed, error = "< bufsize){
- errorstream<<"GetTempPath failed, error = "< bufsize) {
+ errorstream << "GetTempPath failed, error = " << GetLastError() << std::endl;
return "";
}
buf.resize(len);
@@ -206,8 +201,8 @@ std::string CreateTempFile()
{
std::string path = TempPath() + DIR_DELIM "MT_XXXXXX";
_mktemp_s(&path[0], path.size() + 1); // modifies path
- HANDLE file = CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ HANDLE file = CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, nullptr);
if (file == INVALID_HANDLE_VALUE)
return "";
CloseHandle(file);
@@ -232,8 +227,8 @@ std::vector GetDirListing(const std::string &pathstring)
DIR *dp;
struct dirent *dirp;
- if((dp = opendir(pathstring.c_str())) == NULL) {
- //infostream<<"Error("< GetDirListing(const std::string &pathstring)
// NOTE:
// Be very sure to not include '..' in the results, it will
// result in an epic failure when deleting stuff.
- if(strcmp(dirp->d_name, ".") == 0 || strcmp(dirp->d_name, "..") == 0)
+ if (strcmp(dirp->d_name, ".") == 0 || strcmp(dirp->d_name, "..") == 0)
continue;
DirListNode node;
@@ -257,7 +252,7 @@ std::vector GetDirListing(const std::string &pathstring)
Also we don't know whether symlinks are directories or not.
*/
#ifdef _DIRENT_HAVE_D_TYPE
- if(dirp->d_type != DT_UNKNOWN && dirp->d_type != DT_LNK)
+ if (dirp->d_type != DT_UNKNOWN && dirp->d_type != DT_LNK)
isdir = (dirp->d_type == DT_DIR);
#endif /* _DIRENT_HAVE_D_TYPE */
@@ -265,8 +260,10 @@ std::vector GetDirListing(const std::string &pathstring)
Was d_type DT_UNKNOWN, DT_LNK or nonexistent?
If so, try stat().
*/
- if(isdir == -1) {
- struct stat statbuf{};
+ if (isdir == -1) {
+ struct stat statbuf
+ {
+ };
if (stat((pathstring + "/" + node.name).c_str(), &statbuf))
continue;
isdir = ((statbuf.st_mode & S_IFDIR) == S_IFDIR);
@@ -290,13 +287,14 @@ bool CreateDir(const std::string &path)
if (errno == EEXIST)
return true;
return false;
-
}
bool PathExists(const std::string &path)
{
- struct stat st{};
- return (stat(path.c_str(),&st) == 0);
+ struct stat st
+ {
+ };
+ return (stat(path.c_str(), &st) == 0);
}
bool IsPathAbsolute(const std::string &path)
@@ -306,8 +304,10 @@ bool IsPathAbsolute(const std::string &path)
bool IsDir(const std::string &path)
{
- struct stat statbuf{};
- if(stat(path.c_str(), &statbuf))
+ struct stat statbuf
+ {
+ };
+ if (stat(path.c_str(), &statbuf))
return false; // Actually error; but certainly not a directory
return ((statbuf.st_mode & S_IFDIR) == S_IFDIR);
}
@@ -328,40 +328,34 @@ bool RecursiveDelete(const std::string &path)
Execute the 'rm' command directly, by fork() and execve()
*/
- infostream<<"Removing \""<(argv));
+ execv(argv[0], const_cast(argv));
// Execv shouldn't return. Failed.
_exit(1);
- }
- else
- {
+ } else {
// Parent
int child_status;
pid_t tpid;
- do{
+ do {
tpid = wait(&child_status);
- }while(tpid != child_pid);
+ } while (tpid != child_pid);
return (child_status == 0);
}
}
@@ -372,14 +366,13 @@ bool DeleteSingleFileOrEmptyDirectory(const std::string &path)
bool did = (rmdir(path.c_str()) == 0);
if (!did)
errorstream << "rmdir errno: " << errno << ": " << strerror(errno)
- << std::endl;
+ << std::endl;
return did;
}
bool did = (unlink(path.c_str()) == 0);
if (!did)
- errorstream << "unlink errno: " << errno << ": " << strerror(errno)
- << std::endl;
+ errorstream << "unlink errno: " << errno << ": " << strerror(errno) << std::endl;
return did;
}
@@ -420,7 +413,7 @@ std::string CreateTempFile()
void GetRecursiveDirs(std::vector &dirs, const std::string &dir)
{
- static const std::set chars_to_ignore = { '_', '.' };
+ static const std::set chars_to_ignore = {'_', '.'};
if (dir.empty() || !IsDir(dir))
return;
dirs.push_back(dir);
@@ -434,10 +427,8 @@ std::vector GetRecursiveDirs(const std::string &dir)
return result;
}
-void GetRecursiveSubPaths(const std::string &path,
- std::vector &dst,
- bool list_files,
- const std::set &ignore)
+void GetRecursiveSubPaths(const std::string &path, std::vector &dst,
+ bool list_files, const std::set &ignore)
{
std::vector content = GetDirListing(path);
for (const auto &n : content) {
@@ -453,14 +444,14 @@ void GetRecursiveSubPaths(const std::string &path,
bool RecursiveDeleteContent(const std::string &path)
{
- infostream<<"Removing content of \""< list = GetDirListing(path);
for (const DirListNode &dln : list) {
- if(trim(dln.name) == "." || trim(dln.name) == "..")
+ if (trim(dln.name) == "." || trim(dln.name) == "..")
continue;
std::string childpath = path + DIR_DELIM + dln.name;
bool r = RecursiveDelete(childpath);
- if(!r) {
+ if (!r) {
errorstream << "Removing \"" << childpath << "\" failed" << std::endl;
return false;
}
@@ -473,15 +464,14 @@ bool CreateAllDirs(const std::string &path)
std::vector tocreate;
std::string basepath = path;
- while(!PathExists(basepath))
- {
+ while (!PathExists(basepath)) {
tocreate.push_back(basepath);
basepath = RemoveLastPathComponent(basepath);
- if(basepath.empty())
+ if (basepath.empty())
break;
}
- for(int i=tocreate.size()-1;i>=0;i--)
- if(!CreateDir(tocreate[i]))
+ for (int i = tocreate.size() - 1; i >= 0; i--)
+ if (!CreateDir(tocreate[i]))
return false;
return true;
}
@@ -489,16 +479,16 @@ bool CreateAllDirs(const std::string &path)
bool CopyFileContents(const std::string &source, const std::string &target)
{
FILE *sourcefile = fopen(source.c_str(), "rb");
- if(sourcefile == NULL){
- errorstream< 0){
+ if (readbytes > 0) {
fwrite(readbuffer, 1, readbytes, targetfile);
}
- if(feof(sourcefile) || ferror(sourcefile)){
+ if (feof(sourcefile) || ferror(sourcefile)) {
// flush destination file to catch write errors
// (e.g. disk full)
fflush(targetfile);
done = true;
}
- if(ferror(targetfile)){
- errorstream<clear();
size_t remaining = path.size();
- for(int i = 0; i < count; ++i){
+ for (int i = 0; i < count; ++i) {
// strip a dir delimiter
- while(remaining != 0 && IsDirDelimiter(path[remaining-1]))
+ while (remaining != 0 && IsDirDelimiter(path[remaining - 1]))
remaining--;
// strip a path component
size_t component_end = remaining;
- while(remaining != 0 && !IsDirDelimiter(path[remaining-1]))
+ while (remaining != 0 && !IsDirDelimiter(path[remaining - 1]))
remaining--;
size_t component_start = remaining;
// strip a dir delimiter
- while(remaining != 0 && IsDirDelimiter(path[remaining-1]))
+ while (remaining != 0 && IsDirDelimiter(path[remaining - 1]))
remaining--;
- if(removed){
- std::string component = path.substr(component_start,
- component_end - component_start);
- if(i)
+ if (removed) {
+ std::string component =
+ path.substr(component_start, component_end - component_start);
+ if (i)
*removed = component + DIR_DELIM + *removed;
else
*removed = component;
@@ -682,16 +661,16 @@ std::string RemoveRelativePathComponents(std::string path)
while (pos != 0) {
size_t component_with_delim_end = pos;
// skip a dir delimiter
- while (pos != 0 && IsDirDelimiter(path[pos-1]))
+ while (pos != 0 && IsDirDelimiter(path[pos - 1]))
pos--;
// strip a path component
size_t component_end = pos;
- while (pos != 0 && !IsDirDelimiter(path[pos-1]))
+ while (pos != 0 && !IsDirDelimiter(path[pos - 1]))
pos--;
size_t component_start = pos;
- std::string component = path.substr(component_start,
- component_end - component_start);
+ std::string component =
+ path.substr(component_start, component_end - component_start);
bool remove_this_component = false;
if (component == ".") {
remove_this_component = true;
@@ -704,14 +683,14 @@ std::string RemoveRelativePathComponents(std::string path)
}
if (remove_this_component) {
- while (pos != 0 && IsDirDelimiter(path[pos-1]))
+ while (pos != 0 && IsDirDelimiter(path[pos - 1]))
pos--;
if (component_start == 0) {
// We need to remove the delemiter too
path = path.substr(component_with_delim_end, std::string::npos);
} else {
path = path.substr(0, pos) + DIR_DELIM +
- path.substr(component_with_delim_end, std::string::npos);
+ path.substr(component_with_delim_end, std::string::npos);
}
if (pos > 0)
pos++;
@@ -723,7 +702,7 @@ std::string RemoveRelativePathComponents(std::string path)
// remove trailing dir delimiters
pos = path.size();
- while (pos != 0 && IsDirDelimiter(path[pos-1]))
+ while (pos != 0 && IsDirDelimiter(path[pos - 1]))
pos--;
return path.substr(0, pos);
}
@@ -735,7 +714,8 @@ std::string AbsolutePath(const std::string &path)
#else
char *abs_path = realpath(path.c_str(), NULL);
#endif
- if (!abs_path) return "";
+ if (!abs_path)
+ return "";
std::string abs_path_str(abs_path);
free(abs_path);
return abs_path_str;
@@ -755,56 +735,72 @@ const char *GetFilenameFromPath(const char *path)
bool safeWriteToFile(const std::string &path, const std::string &content)
{
- std::string tmp_file = path + ".~mt";
+ // Write to tmp file
+ std::random_device rd;
+ std::mt19937 gen(rd());
+ std::uniform_int_distribution distrib(0);
- // Write to a tmp file
- std::ofstream os(tmp_file.c_str(), std::ios::binary);
- if (!os.good())
- return false;
- os << content;
- os.flush();
- os.close();
- if (os.fail()) {
- // Remove the temporary file because writing it failed and it's useless.
- remove(tmp_file.c_str());
+ int random_int = distrib(gen);
+
+ std::stringstream ss;
+ ss << std::hex << random_int;
+
+ std::string tmp_path = TempPath() + DIR_DELIM + "minetest_" + ss.str();
+ std::ofstream tmp_os(tmp_path.c_str(), std::ios::binary);
+ if (!tmp_os.good()) {
+ warningstream << "Failed to create temp file: " << tmp_path << std::endl;
return false;
}
- bool rename_success = false;
+ { // scope for the unique_ptr
+ // Attempt to remove the temporary file on exit, but don't worry about checking
+ // success since the OS should clean it up anyway.
+ auto deleter = [&tmp_path](std::ofstream *os) { std::remove(tmp_path.c_str()); };
+ std::unique_ptr tmp_os_ptr(&tmp_os, deleter);
+ tmp_os << content;
+ tmp_os.flush();
+ tmp_os.close();
+ if (tmp_os.fail()) {
+ warningstream << "Failed to write to temp file: " << tmp_path << std::endl;
+ return false;
+ }
- // Move the finished temporary file over the real file
+ bool write_succeeded = false;
#ifdef _WIN32
- // When creating the file, it can cause Windows Search indexer, virus scanners and other apps
- // to query the file. This can make the move file call below fail.
- // We retry up to 5 times, with a 1ms sleep between, before we consider the whole operation failed
- int number_attempts = 0;
- while (number_attempts < 5) {
- rename_success = MoveFileEx(tmp_file.c_str(), path.c_str(),
- MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH);
- if (rename_success)
- break;
- sleep_ms(1);
- ++number_attempts;
- }
+ // On Windows we've observed that the newly created temp file is often
+ // being read by other processes and Windows does not allow moving
+ // of a file while it is being read, so we retry and then fall back to copying.
+ // NOTE: once Windows 10 is the lowest supported verison, we should consider
+ // using FILE_DISPOSITION_POSIX_SEMANTICS to avoid this issue.
+ for (int attempts = 0; attempts < 5; attempts++) {
+ write_succeeded = MoveFileEx(tmp_path.c_str(), path.c_str(),
+ MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH);
+ if (write_succeeded)
+ break;
+ sleep_ms(attempts + 1);
+ }
+ if (!write_succeeded) {
+ write_succeeded = CopyFile(tmp_path.c_str(), path.c_str(), false);
+ }
#else
- // On POSIX compliant systems rename() is specified to be able to swap the
- // file in place of the destination file, making this a truly error-proof
- // transaction.
- rename_success = rename(tmp_file.c_str(), path.c_str()) == 0;
+ // On POSIX rename() is able to swap the file in place of the destination file,
+ // even if it's being read.
+ write_succeeded = (std::rename(tmp_path.c_str(), path.c_str()) == 0);
#endif
- if (!rename_success) {
- warningstream << "Failed to write to file: " << path.c_str() << std::endl;
- // Remove the temporary file because moving it over the target file
- // failed.
- remove(tmp_file.c_str());
- return false;
+ if (write_succeeded) {
+ tmp_os_ptr.release(); // Deletion no longer needed.
+ } else {
+ warningstream << "Failed to write to file: " << path.c_str() << std::endl;
+ return false;
+ }
}
return true;
}
#ifndef SERVER
-bool extractZipFile(io::IFileSystem *fs, const char *filename, const std::string &destination)
+bool extractZipFile(
+ io::IFileSystem *fs, const char *filename, const std::string &destination)
{
// Be careful here not to touch the global file hierarchy in Irrlicht
// since this function needs to be thread-safe!
@@ -817,12 +813,14 @@ bool extractZipFile(io::IFileSystem *fs, const char *filename, const std::string
}
}
if (!zip_loader) {
- warningstream << "fs::extractZipFile(): Irrlicht said it doesn't support ZIPs." << std::endl;
+ warningstream << "fs::extractZipFile(): Irrlicht said it doesn't support ZIPs."
+ << std::endl;
return false;
}
- irr_ptr opened_zip(zip_loader->createArchive(filename, false, false));
- const io::IFileList* files_in_zip = opened_zip->getFileList();
+ irr_ptr opened_zip(
+ zip_loader->createArchive(filename, false, false));
+ const io::IFileList *files_in_zip = opened_zip->getFileList();
for (u32 i = 0; i < files_in_zip->getFileCount(); i++) {
std::string fullpath = destination + DIR_DELIM;
diff --git a/src/filesys.h b/src/filesys.h
index e3b1cce8e..100da659e 100644
--- a/src/filesys.h
+++ b/src/filesys.h
@@ -36,7 +36,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define PATH_DELIM ":"
#endif
-namespace irr::io {
+namespace irr::io
+{
class IFileSystem;
}
@@ -78,12 +79,12 @@ bool DeleteSingleFileOrEmptyDirectory(const std::string &path);
// Returns path to temp directory, can return "" on error
std::string TempPath();
-// Returns path to securely-created temporary file (will already exist when this function returns)
-// can return "" on error
+// Returns path to securely-created temporary file (will already exist when this function
+// returns) can return "" on error
std::string CreateTempFile();
/* Returns a list of subdirectories, including the path itself, but excluding
- hidden directories (whose names start with . or _)
+ hidden directories (whose names start with . or _)
*/
void GetRecursiveDirs(std::vector &dirs, const std::string &dir);
std::vector GetRecursiveDirs(const std::string &dir);
@@ -95,10 +96,8 @@ std::vector GetRecursiveDirs(const std::string &dir);
list files - include files in the list of subpaths.
ignore - paths that start with these charcters will not be listed.
*/
-void GetRecursiveSubPaths(const std::string &path,
- std::vector &dst,
- bool list_files,
- const std::set &ignore = {});
+void GetRecursiveSubPaths(const std::string &path, std::vector &dst,
+ bool list_files, const std::set &ignore = {});
// Only pass full paths to this one. True on success.
bool RecursiveDeleteContent(const std::string &path);
@@ -126,8 +125,8 @@ bool PathStartsWith(const std::string &path, const std::string &prefix);
// returns "" if there is only one path component.
// removed: If non-NULL, receives the removed component(s).
// count: Number of components to remove
-std::string RemoveLastPathComponent(const std::string &path,
- std::string *removed = NULL, int count = 1);
+std::string RemoveLastPathComponent(
+ const std::string &path, std::string *removed = NULL, int count = 1);
// Remove "." and ".." path components and for every ".." removed, remove
// the last normal path component before it. Unlike AbsolutePath,
@@ -145,7 +144,8 @@ const char *GetFilenameFromPath(const char *path);
bool safeWriteToFile(const std::string &path, const std::string &content);
#ifndef SERVER
-bool extractZipFile(irr::io::IFileSystem *fs, const char *filename, const std::string &destination);
+bool extractZipFile(
+ irr::io::IFileSystem *fs, const char *filename, const std::string &destination);
#endif
bool ReadFile(const std::string &path, std::string &out);
diff --git a/src/unittest/CMakeLists.txt b/src/unittest/CMakeLists.txt
index c43a7dbd3..fd47358a2 100644
--- a/src/unittest/CMakeLists.txt
+++ b/src/unittest/CMakeLists.txt
@@ -9,7 +9,7 @@ set (UNITTEST_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/test_compression.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_connection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_craft.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/test_filepath.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test_filesys.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_inventory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_irrptr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_lua.cpp
diff --git a/src/unittest/test_filepath.cpp b/src/unittest/test_filesys.cpp
similarity index 71%
rename from src/unittest/test_filepath.cpp
rename to src/unittest/test_filesys.cpp
index f1a79062d..b88b637a0 100644
--- a/src/unittest/test_filepath.cpp
+++ b/src/unittest/test_filesys.cpp
@@ -26,10 +26,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h"
#include "noise.h"
-class TestFilePath : public TestBase {
+class TestFileSys : public TestBase
+{
public:
- TestFilePath() { TestManager::registerTestModule(this); }
- const char *getName() { return "TestFilePath"; }
+ TestFileSys() { TestManager::registerTestModule(this); }
+ const char *getName() { return "TestFileSys"; }
void runTests(IGameDef *gamedef);
@@ -38,17 +39,19 @@ class TestFilePath : public TestBase {
void testRemoveLastPathComponent();
void testRemoveLastPathComponentWithTrailingDelimiter();
void testRemoveRelativePathComponent();
+ void testSafeWriteToFile();
};
-static TestFilePath g_test_instance;
+static TestFileSys g_test_instance;
-void TestFilePath::runTests(IGameDef *gamedef)
+void TestFileSys::runTests(IGameDef *gamedef)
{
TEST(testIsDirDelimiter);
TEST(testPathStartsWith);
TEST(testRemoveLastPathComponent);
TEST(testRemoveLastPathComponentWithTrailingDelimiter);
TEST(testRemoveRelativePathComponent);
+ TEST(testSafeWriteToFile);
}
////////////////////////////////////////////////////////////////////////////////
@@ -65,16 +68,15 @@ std::string p(std::string path)
}
}
- #ifdef _WIN32
+#ifdef _WIN32
if (path[0] == '\\')
path = "C:" + path;
- #endif
+#endif
return path;
}
-
-void TestFilePath::testIsDirDelimiter()
+void TestFileSys::testIsDirDelimiter()
{
UASSERT(fs::IsDirDelimiter('/') == true);
UASSERT(fs::IsDirDelimiter('A') == false);
@@ -86,23 +88,22 @@ void TestFilePath::testIsDirDelimiter()
#endif
}
-
-void TestFilePath::testPathStartsWith()
+void TestFileSys::testPathStartsWith()
{
const int numpaths = 12;
std::string paths[numpaths] = {
- "",
- p("/"),
- p("/home/user/minetest"),
- p("/home/user/minetest/bin"),
- p("/home/user/.minetest"),
- p("/tmp/dir/file"),
- p("/tmp/file/"),
- p("/tmP/file"),
- p("/tmp"),
- p("/tmp/dir"),
- p("/home/user2/minetest/worlds"),
- p("/home/user2/minetest/world"),
+ "",
+ p("/"),
+ p("/home/user/minetest"),
+ p("/home/user/minetest/bin"),
+ p("/home/user/.minetest"),
+ p("/tmp/dir/file"),
+ p("/tmp/file/"),
+ p("/tmP/file"),
+ p("/tmp"),
+ p("/tmp/dir"),
+ p("/home/user2/minetest/worlds"),
+ p("/home/user2/minetest/world"),
};
/*
expected fs::PathStartsWith results
@@ -114,56 +115,52 @@ void TestFilePath::testPathStartsWith()
FILESYS_CASE_INSENSITIVE is true
*/
int expected_results[numpaths][numpaths] = {
- {1,2,0,0,0,0,0,0,0,0,0,0},
- {1,1,0,0,0,0,0,0,0,0,0,0},
- {1,1,1,0,0,0,0,0,0,0,0,0},
- {1,1,1,1,0,0,0,0,0,0,0,0},
- {1,1,0,0,1,0,0,0,0,0,0,0},
- {1,1,0,0,0,1,0,0,1,1,0,0},
- {1,1,0,0,0,0,1,4,1,0,0,0},
- {1,1,0,0,0,0,4,1,4,0,0,0},
- {1,1,0,0,0,0,0,0,1,0,0,0},
- {1,1,0,0,0,0,0,0,1,1,0,0},
- {1,1,0,0,0,0,0,0,0,0,1,0},
- {1,1,0,0,0,0,0,0,0,0,0,1},
+ {1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
+ {1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
+ {1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0},
+ {1, 1, 0, 0, 0, 0, 1, 4, 1, 0, 0, 0},
+ {1, 1, 0, 0, 0, 0, 4, 1, 4, 0, 0, 0},
+ {1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
+ {1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0},
+ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
+ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
};
for (int i = 0; i < numpaths; i++)
- for (int j = 0; j < numpaths; j++){
- /*verbosestream<<"testing fs::PathStartsWith(\""
- <