Work on basic of minetest game. Updating water washaway, firmness, flowers.

master
SFENCE 2019-12-22 23:23:30 +01:00
parent 028be540c4
commit 1b46825b3b
94 changed files with 853 additions and 171 deletions

41
mods/animal/animal.lua Normal file
View File

@ -0,0 +1,41 @@
local S = animal.S;
--
-- animal
--
animal.registered_animals = {};
--
-- animal definition
--
-- state -> table of conditions variables, see state definition, key is name of state
--
-- grow_chance -> chance to grow, like efect, should use some animal parameters like age, size, vitality etc.
-- grow_step -> grow step
function animal.register_animal(animal_name, animal_def)
end
--
-- state definition
--
-- name -> stored like key of table, where it is stored
--
-- function -> function(animal_state, parameters) will be called to calculate state value,
-- -> animal_state -> animal instance state
-- -> parameters -> parameters for calculation function
-- parameters -> table with parameters for function
--
function animal.get_state_value(state_def, condition)
end
--
-- state value definition
--
-- value -> state actual value
-- last_time -> last time of recalculation

30
mods/animal/efect.lua Normal file
View File

@ -0,0 +1,30 @@
local S = animal.S;
--
-- animal efect function
--
-- max_efect*abs(1/(1+lower_steepness^(-x+lower_border)) + 1/(1+upper_steepness^(x-upper_border)) - 1)
--
-- efect in lower_border and upper_border is 0.5,
-- between lower_border and upper_border probability increase to 1,
-- outside borders probability is decrease to 0,
-- steepnees of decrease and increase is done by lower_steepness and upper_steepness.
-- when lower_steepness < upper_steepness, function select area where vegetation can be found
-- when lower_steepness > upper_steepness, function select area where vegetation cannot be found
-- lower_steepness and upper_steepness have to be bigger then 1, values near to 1 means more gradually steepness.
-- use some program to show function graph to see probability changes
-- x is value of parameter in location
-- max_efect have to be 1 if not used, lower when you want to limit max efect, higger when you want make efect stronger.
-- setting lower_steepness and upper_steepness and max_probability to 1, disable probability sensitivity to x
-- all function parameters are stored
-- in settings table (max_probability, lower_steepness, lower_border, upper_steepness, upper_border)
-- x is stored in actual_value fucntion parameter
function animal.efect_function(presence, actual_value)
local first_part = 1/(1+presence.lower_steepness^(-actual_value+presence.lower_border));
local second_part = 1/(1+presence.upper_steepness^(actual_value-presence.upper_border));
local efect = max_efect*math.abs(first_part + second_part - 1);
return efect;
end

View File

@ -0,0 +1,2 @@
local S = animal.S;

18
mods/animal/init.lua Normal file
View File

@ -0,0 +1,18 @@
-- Mods which include functions for animals
-- Definitions made by this mod that other mods can use too
animal = {}
-- localize support via initlib
animal.S = function(s) return s end
if minetest.get_modpath("intllib") and intllib then
animal.S = intllib.Getter()
end
-- Load files
local animal_path = minetest.get_modpath("animal")
dofile(animal_path.."/vitality.lua")
animal.S = nil

15
mods/animal/vitality.lua Normal file
View File

@ -0,0 +1,15 @@
local S = animal.S;
-- vitality
animal.animals = {};
--
--
-- name -> parameter name
--
-- min -> minimal
function animal.register_vitality_parameter(animal_name, parameter_def)
end

View File

@ -4,20 +4,20 @@ local S = default.S;
function default.erosion_air(pos, node)
--minetest.log("warning", "Air erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local positions = default.shared_positions_in_sphere(pos, 1, false);
local positions = default.shared_positions_in_sphere(pos, 1, 1, false);
local erosion_chance = 0.0;
local erosion_air = minetest.get_item_group(node.name, "erosion_air")/100.0;
for check_index,check_pos in pairs(positions) do
check_node = minetest.get_node(check_pos);
local check_node = minetest.get_node(check_pos);
if ((check_node.name=="air") or (minetest.get_item_group(check_node.name, "air")>0)) then
erosion_chance = default.shared_add_chance_happen(erosion_chance, erosion_air);
end
end
local chance = default.random_generator:next(0, 16777215)/16777215.0;
minetest.log("warning", "Air erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z).." chance: "..tostring(erosion_chance))
--minetest.log("warning", "Air erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z).." chance: "..tostring(erosion_chance))
if (chance<=erosion_chance) then
default.apply_node_change(pos, node, "erosion");
@ -27,7 +27,7 @@ end
function default.erosion_wind(pos, node)
--minetest.log("warning", "Wind erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local positions = default.shared_positions_in_sphere(pos, 1, false);
local positions = default.shared_positions_in_sphere(pos, 1, 1, false);
local erosion_chance = 0.0;
local erosion_wind = minetest.get_item_group(node.name, "erosion_wind")/100.0;
@ -50,7 +50,7 @@ end
function default.erosion_water(pos, node)
minetest.log("warning", "Water erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local positions = default.shared_positions_in_sphere(pos, 1, false);
local positions = default.shared_positions_in_sphere(pos, 1, 1, false);
local erosion_chance = 0.0;
local erosion_water = minetest.get_item_group(node.name, "erosion_water")/100.0;
@ -75,12 +75,12 @@ function default.erosion_water(pos, node)
end
function default.erosion_heat(pos, node)
minetest.log("warning", "Heat erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
--minetest.log("warning", "Heat erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
default.apply_node_change(pos, node, "erosion");
end
function default.erosion_dry(pos, node)
minetest.log("warning", "Dry erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
--minetest.log("warning", "Dry erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local erosion_chance = 0.0;
@ -98,9 +98,9 @@ function default.erosion_dry(pos, node)
end
function default.erosion_wet(pos, node)
minetest.log("warning", "Wet erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
--minetest.log("warning", "Wet erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local positions = default.shared_positions_in_sphere(pos, 1, false);
local positions = default.shared_positions_in_sphere(pos, 1, 1, false);
local erosion_chance = 0.0;
local erosion_wet = minetest.get_item_group(node.name, "erosion_wet")/100.0;
@ -127,49 +127,76 @@ function default.erosion_wet(pos, node)
end
end
minetest.register_abm({
label = "Air erosion",
nodenames = {"group:erosion_air"},
neighbors = {"group:air","air"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_air,
})
function default.erosion_drying(pos, node)
--minetest.log("warning", "Drying erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local erosion_chance = minetest.get_item_group(node.name, "erosion_drying")/10000.0;
local chance = default.random_generator:next(0, 16777215)/16777215.0;
if (chance<=erosion_chance) then
default.apply_node_change(pos, node, "erosion");
end
end
minetest.register_abm({
label = "Water erosion",
nodenames = {"group:erosion_water"},
neighbors = {"group:water"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_water,
})
function default.erosion_wetting(pos, node)
--minetest.log("warning", "Weting erosion of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local erosion_chance = minetest.get_item_group(node.name, "erosion_wetting")/10000.0;
local chance = default.random_generator:next(0, 16777215)/16777215.0;
if (chance<=erosion_chance) then
default.apply_node_change(pos, node, "erosion");
end
end
minetest.register_abm({
label = "Heat erosion",
nodenames = {"group:erosion_heat"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_heat,
})
if (false) then
minetest.register_abm({
label = "Air erosion",
nodenames = {"group:erosion_air"},
neighbors = {"group:air","air"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_air,
})
minetest.register_abm({
label = "Dry erosion",
nodenames = {"group:erosion_dry"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_dry,
})
minetest.register_abm({
label = "Water erosion",
nodenames = {"group:erosion_water"},
neighbors = {"group:water"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_water,
})
minetest.register_abm({
label = "Heat erosion",
nodenames = {"group:erosion_heat"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_heat,
})
minetest.register_abm({
label = "Dry erosion",
nodenames = {"group:erosion_dry"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_dry,
})
minetest.register_abm({
label = "Wet erosion",
nodenames = {"group:erosion_wet"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_wet,
})
end
minetest.register_abm({
label = "Wet erosion",
nodenames = {"group:erosion_wet"},
interval = 60,
chance = 2,
catch_up = false,
action = default.erosion_wet,
})

View File

@ -514,13 +514,15 @@ function default.register_node_with_firmness(node_def, settings)
end
end
minetest.register_abm({
label = "Check Firmness",
nodenames = {"group:firmness"},
neighbors = {"group:air","group:water","air"},
interval = 20,
chance = 6,
catch_up = false,
action = default.firmness_abm_action,
}
)
if (false) then
minetest.register_abm({
label = "Check Firmness",
nodenames = {"group:firmness"},
neighbors = {"group:air","group:water","air"},
interval = 20,
chance = 6,
catch_up = false,
action = default.firmness_abm_action,
})
end

View File

@ -18,6 +18,10 @@ erosion_water -> risk of erosion when is in contact with water
erosion_heat -> risk of erosion by heat difference
erosion_dry -> risk of erosion by dry out (by fire, etc)
erosion_wet -> risk of erosion when is wet
erosion_wetting -> risk of erosion when getting more wet
erosion_drying -> risk of erosion when getting more dry
washaway -> risk of washaway of falling node by water
flora_plant -> for plant grow calling
flora_tree_plant -> for plant grow calling with longer period/chance then for flora_plant

View File

@ -53,6 +53,8 @@ dofile(default_path.."/rock.lua")
dofile(default_path.."/wet.lua")
dofile(default_path.."/erosion.lua")
dofile(default_path.."/firmness.lua")
dofile(default_path.."/washaway.lua")
dofile(default_path.."/water.lua")
dofile(default_path.."/ores.lua")
dofile(default_path.."/functions.lua")

View File

@ -452,7 +452,7 @@ minetest.register_node("default:obsidian_block", {
minetest.register_node("default:dirt", {
description = S("Dirt"),
tiles = {"default_dirt.png"},
groups = {crumbly = 3, falling_node = 1, soil = 1},
groups = {crumbly = 3, falling_node = 1, soil = 1, washaway = 10},
drowning = 1,
--stack_max = 1,
sounds = default.node_sound_dirt_defaults(),
@ -594,7 +594,7 @@ minetest.register_node("default:permafrost_with_moss", {
minetest.register_node("default:sand", {
description = S("Sand"),
tiles = {"default_sand.png"},
groups = {crumbly = 3, falling_node = 1, sand = 1},
groups = {crumbly = 3, falling_node = 1, sand = 1, washaway = 25,},
drowning = 1,
sounds = default.node_sound_sand_defaults(),
drop = {
@ -613,7 +613,7 @@ minetest.register_node("default:sand", {
minetest.register_node("default:desert_sand", {
description = S("Desert Sand"),
tiles = {"default_desert_sand.png"},
groups = {crumbly = 3, falling_node = 1, sand = 1},
groups = {crumbly = 3, falling_node = 1, sand = 1, washaway = 25,},
drowning = 1,
sounds = default.node_sound_sand_defaults(),
drop = {
@ -632,7 +632,7 @@ minetest.register_node("default:desert_sand", {
minetest.register_node("default:silver_sand", {
description = S("Silver Sand"),
tiles = {"default_silver_sand.png"},
groups = {crumbly = 3, falling_node = 1, sand = 1},
groups = {crumbly = 3, falling_node = 1, sand = 1, washaway = 25,},
drowning = 1,
sounds = default.node_sound_sand_defaults(),
drop = {
@ -2381,7 +2381,7 @@ minetest.register_node("default:water_flowing", {
liquid_alternative_source = "default:water_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
groups = {water = 3, liquid = 3, salt_water = 1, not_in_creative_inventory = 1,
groups = {water = 3, water_flowing = 1, liquid = 3, salt_water = 1, not_in_creative_inventory = 1,
cools_lava = 1},
sounds = default.node_sound_water_defaults(),
})
@ -2481,7 +2481,7 @@ minetest.register_node("default:river_water_flowing", {
liquid_renewable = false,
liquid_range = 8,
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
groups = {water = 3, liquid = 3, not_in_creative_inventory = 1,
groups = {water = 3, water_flowing = 1, liquid = 3, not_in_creative_inventory = 1,
cools_lava = 1},
sounds = default.node_sound_water_defaults(),
})
@ -2524,8 +2524,8 @@ minetest.register_node("default:spring_water_source", {
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "default:fresh_water_flowing",
liquid_alternative_source = "default:fresh_water_source",
liquid_alternative_flowing = "default:spring_water_flowing",
liquid_alternative_source = "default:spring_water_source",
liquid_viscosity = 1,
-- Not renewable to avoid horizontal spread of water sources in sloping
-- rivers that can cause water to overflow riverbanks and cause floods.
@ -2538,6 +2538,56 @@ minetest.register_node("default:spring_water_source", {
sounds = default.node_sound_water_defaults(),
})
minetest.register_node("default:spring_water_flowing", {
description = S("Flowing Spring Water"),
drawtype = "flowingliquid",
tiles = {"default_river_water.png"},
special_tiles = {
{
name = "default_river_water_flowing_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8,
},
},
{
name = "default_river_water_flowing_animated.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8,
},
},
},
alpha = 160,
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "default:spring_water_flowing",
liquid_alternative_source = "default:spring_water_source",
liquid_viscosity = 1,
liquid_renewable = false,
liquid_range = 8,
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
groups = {water = 3, liquid = 3, water_flowing = 1, not_in_creative_inventory = 1,
cools_lava = 1},
sounds = default.node_sound_water_defaults(),
})
default.register_changeable_node_change("default:fresh_water_flowing", "flowing_to_source", {new_node_name="default:fresh_water_source",check_stability=false});
minetest.register_node("default:lava_source", {
description = S("Lava Source"),
drawtype = "liquid",

View File

@ -5,18 +5,30 @@ local S = default.S;
-- shared functions
--
function default.shared_positions_in_cube(pos, distance, include_pos)
function default.shared_positions_in_cube(pos, diff_limits, include_pos)
local positions = {};
local check_pos = table.copy(pos);
distance = math.floor(distance);
local x_diff_limit = 0;
local y_diff_limit = 0;
local z_diff_limit = 0;
if (type(diff_limits)=="number") then
diff_limits = math.floor(diff_limits);
x_diff_limit = diff_limits;
y_diff_limit = diff_limits;
z_diff_limit = diff_limits;
else
x_diff_limit = math.floor(diff_limits.x);
y_diff_limit = math.floor(diff_limits.y);
z_diff_limit = math.floor(diff_limits.z);
end
for x_diff = -distance,distance,1 do
check_pos.x = pos.x + x_diff;
for y_diff = -distance,distance,1 do
for z_diff = -z_diff_limit,z_diff_limit,1 do
check_pos.z = pos.z + z_diff;
for y_diff = -y_diff_limit,y_diff_limit,1 do
check_pos.y = pos.y + y_diff;
for z_diff = -distance,distance,1 do
check_pos.z = pos.z + z_diff;
for x_diff = -x_diff_limit,x_diff_limit,1 do
check_pos.x = pos.x + x_diff;
if (include_pos==true) then
table.insert(positions, table.copy(check_pos));
@ -32,18 +44,30 @@ function default.shared_positions_in_cube(pos, distance, include_pos)
return positions;
end
function default.shared_positions_with_distance_in_cube(pos, distance, include_pos)
function default.shared_positions_with_distance_in_cube(pos, diff_limits, include_pos)
local positions_and_distance = {};
local check_pos = table.copy(pos);
distance = math.floor(distance);
local x_diff_limit = 0;
local y_diff_limit = 0;
local z_diff_limit = 0;
if (type(diff_limits)=="number") then
diff_limits = math.floor(diff_limits);
x_diff_limit = diff_limits;
y_diff_limit = diff_limits;
z_diff_limit = diff_limits;
else
x_diff_limit = math.floor(diff_limits.x);
y_diff_limit = math.floor(diff_limits.y);
z_diff_limit = math.floor(diff_limits.z);
end
for x_diff = -distance,distance,1 do
check_pos.x = pos.x + x_diff;
for y_diff = -distance,distance,1 do
for z_diff = -z_diff_limit,z_diff_limit,1 do
check_pos.z = pos.z + z_diff;
for y_diff = -y_diff_limit,y_diff_limit,1 do
check_pos.y = pos.y + y_diff;
for z_diff = -distance,distance,1 do
check_pos.z = pos.z + z_diff;
for x_diff = -x_diff_limit,x_diff_limit,1 do
check_pos.x = pos.x + x_diff;
local check_distance = vector.distance(check_pos, pos);
@ -61,18 +85,30 @@ function default.shared_positions_with_distance_in_cube(pos, distance, include_p
return positions_and_distance;
end
function default.shared_positions_in_sphere(pos, distance, include_pos)
function default.shared_positions_in_sphere(pos, distance, diff_limits, include_pos)
local positions = {};
local check_pos = table.copy(pos);
local diff_limit = math.floor(distance);
local x_diff_limit = 0;
local y_diff_limit = 0;
local z_diff_limit = 0;
if (type(diff_limits)=="number") then
diff_limits = math.floor(diff_limits);
x_diff_limit = diff_limits;
y_diff_limit = diff_limits;
z_diff_limit = diff_limits;
else
x_diff_limit = math.floor(diff_limits.x);
y_diff_limit = math.floor(diff_limits.y);
z_diff_limit = math.floor(diff_limits.z);
end
for x_diff = -diff_limit,diff_limit,1 do
check_pos.x = pos.x + x_diff;
for y_diff = -diff_limit,diff_limit,1 do
for z_diff = -z_diff_limit,z_diff_limit,1 do
check_pos.z = pos.z + z_diff;
for y_diff = -y_diff_limit,y_diff_limit,1 do
check_pos.y = pos.y + y_diff;
for z_diff = -diff_limit,diff_limit,1 do
check_pos.z = pos.z + z_diff;
for x_diff = -x_diff_limit,x_diff_limit,1 do
check_pos.x = pos.x + x_diff;
local check_distance = vector.distance(check_pos, pos);
@ -96,14 +132,26 @@ function default.shared_positions_with_distance_in_sphere(pos, distance, include
local positions_and_distance = {};
local check_pos = table.copy(pos);
local diff_limit = math.floor(distance);
local x_diff_limit = 0;
local y_diff_limit = 0;
local z_diff_limit = 0;
if (type(diff_limits)=="number") then
diff_limits = math.floor(diff_limits);
x_diff_limit = diff_limits;
y_diff_limit = diff_limits;
z_diff_limit = diff_limits;
else
x_diff_limit = math.floor(diff_limits.x);
y_diff_limit = math.floor(diff_limits.y);
z_diff_limit = math.floor(diff_limits.z);
end
for x_diff = -diff_limit,diff_limit,1 do
check_pos.x = pos.x + x_diff;
for y_diff = -diff_limit,diff_limit,1 do
for z_diff = -z_diff_limit,z_diff_limit,1 do
check_pos.z = pos.z + z_diff;
for y_diff = -y_diff_limit,y_diff_limit,1 do
check_pos.y = pos.y + y_diff;
for z_diff = -diff_limit,diff_limit,1 do
check_pos.z = pos.z + z_diff;
for x_diff = -x_diff_limit,x_diff_limit,1 do
check_pos.x = pos.x + x_diff;
local check_distance = vector.distance(check_pos, pos);
@ -131,6 +179,20 @@ function default.shared_add_chance_no_happen(chance_happen, add_no_happen_chance
return (1.0-((1.0-chance_happen)*add_no_happen_chance));
end
function default.shared_add_chance_power_no_happen(chance_happen, power_no_happen_chance)
return (1.0-math.pow((1.0-chance_happen), power_no_happen_chance));
end
function default.shared_sum_from_table(table_data, points_field_name)
-- sum of points
local sum_points = 0;
for index,value in pairs(table_data) do
sum_points = sum_points + value[points_field_name];
end
return sum_points;
end
function default.shared_random_from_table(table_data, points_field_name)
-- sum of points
local sum_points = 0;
@ -140,6 +202,8 @@ function default.shared_random_from_table(table_data, points_field_name)
-- select field
local rand_points = default.random_generator:next(0, sum_points);
local rand = default.random_generator:next(0, 16777215)/16777215.0;
local rand_points = rand*sum_points;
for index,value in pairs(table_data) do
rand_points = rand_points - value[points_field_name];
if (rand_points<=0) then

238
mods/default/washaway.lua Normal file
View File

@ -0,0 +1,238 @@
local S = default.S;
--
-- Wash Away by flowing water
--
local function flowing_water_washaways_risk(pos, node)
if (node==nil) then
node = minetest.get_node(pos)
end
local positions = default.shared_positions_in_sphere(pos, 1, 1, false);
local washaways = {};
local stable_neighbours = 0;
local check_node;
local check_def;
local water_flowing;
local flow_level;
local flow_max_level;
local flow_power;
local upper_pos;
local upper_node;
for check_index, check_pos in pairs(positions) do
check_node = minetest.get_node(check_pos);
water_flowing = minetest.get_item_group(check_node.name, "water_flowing");
if (water_flowing>0) then
flow_level = minetest.get_node_level(check_pos);
flow_max_level = minetest.get_node_max_level(check_pos);
minetest.log("warning", "Level: "..tostring(flow_level).." Max level: "..tostring(flow_max_level).." param2: "..tostring(check_node.param2))
flow_power = flow_level/flow_max_level;
if (check_pos.y<pos.y) then
-- if falling water form top should be analyzed
upper_pos = table.copy(check_pos);
flow_power = 0;
for i = 1,10 do
upper_pos.y = check_pos.y + i;
upper_node = minetest.get_node(upper_pos);
water_flowing = minetest.get_item_group(upper_node.name, "water_flowing");
if (water_flowing==0) then
break;
end
flow_level = minetest.get_node_level(upper_pos);
flow_max_level = minetest.get_node_max_level(upper_pos);
flow_power = flow_power + flow_level/flow_max_level;
if (flow_level<flow_max_level) then
break;
end
end
elseif (check_pos.y==pos.y) then
-- if water is start to fall
check_pos.y = check_pos.y - 1;
upper_node = minetest.get_node(check_pos);
water_flowing = minetest.get_item_group(upper_node.name, "water");
if (water_flowing>0) then
flow_power = 10*flow_power;
end
check_pos.y = check_pos.y + 1;
end
if (flow_power>0) then
table.insert(washaways, {pos=check_pos,power=flow_power});
end
else
-- if this function is called for node, flowing water have to be in the sphere with diameter 2
-- so, if there is not flowing water source in node neightbour, flowing water can be beside it.
water_flowing = minetest.get_item_group(check_node.name, "water");
if (water_flowing>0) then
table.insert(washaways, {pos=check_pos,power=0.01});
elseif (check_pos.y==pos.y) then
check_def = minetest.registered_nodes[check_node.name];
if ((check_def==nil) or (check_def.buildable_to==false)) then
stable_neighbours = stable_neighbours + 1;
end
end
end
end
if (stable_neighbours>=4) then
return {};
end
return washaways;
end
local function flowing_water_washaway_sediment(pos, node)
if (node==nil) then
node = minetest.get_node(pos)
end
local flow_level = 0;
local flow_max_level = 0;
local from_flow = 0;
while (1) do
local water_flowing = minetest.get_item_group(node.name, "water_flowing");
if (water_flowing>0) then
flow_level = minetest.get_node_level(pos);
flow_max_level = minetest.get_node_max_level(pos);
from_flow = flow_level/flow_max_level;
else
-- water source
from_flow = 1.1;
end
local to_flow = 0;
local flow_chances = {};
local flow_power = 0;
local positions = default.shared_positions_in_sphere(pos, 1, 1, false);
for check_index,check_pos in pairs(positions) do
local check_node = minetest.get_node(check_pos);
water_flowing = minetest.get_item_group(check_node.name, "water_flowing")
if (check_pos.y>=pos.y) then
if (water_flowing>0) then
flow_level = minetest.get_node_level(check_pos);
flow_max_level = minetest.get_node_max_level(check_pos);
to_flow = flow_level/flow_max_level;
if (to_flow<from_flow) then
flow_power = from_flow-to_flow;
-- check for water falling in location
check_pos.y = check_pos.y - 1;
check_node = minetest.get_node(check_pos);
water_flowing = minetest.get_item_group(check_node.name, "water_flowing");
if (water_flowing>0) then
flow_power = flow_power*10.0;
end
-- add to table
check_pos.y = check_pos.y + 1;
minetest.log("warning","Flow_target node: "..check_node.name.." pos: "..dump(check_pos))
table.insert(flow_chances, {pos=table.copy(check_pos),power=flow_power,sediment=false});
end
end
else
-- can sediment on actual location?
local check_def = minetest.registered_nodes[check_node.name];
if ((check_def~=nil) and (check_def.buildable_to==true)) then
flow_power = 10.0;
if (water_flowing>0) then
flow_level = minetest.get_node_level(check_pos);
flow_max_level = minetest.get_node_max_level(check_pos);
to_flow = flow_level/flow_max_level;
flow_power = flow_power + 10*to_flow;
end
table.insert(flow_chances, {pos=table.copy(check_pos),power=flow_power,sediment=true});
end
end
end
-- look to table
minetest.log("warning","Flow_chances: "..dump(flow_chances))
if (#flow_chances==0) then
return nil;
end
local flow_select = default.shared_random_from_table(flow_chances, "power");
if (flow_select.sediment==true) then
return flow_select.pos;
end
pos = flow_select.pos;
node = minetest.get_node(pos);
end
end
function default.washaway_node(pos, node)
local washaway_chance = 0.0;
local washaway_risk = minetest.get_item_group(node.name, "washaway")/100.0;
--minetest.log("warning",dump(minetest.registered_items[node.name]))
local washaways = flowing_water_washaways_risk(pos, node);
local washaway_power = default.shared_sum_from_table(washaways, "power");
--minetest.log("warning","Washaway_power: "..tostring(washaway_power).." risk: "..tostring(washaway_risk).." list: "..dump(washaways));
washaway_chance = default.shared_add_chance_power_no_happen(washaway_risk, washaway_power);
minetest.log("warning", "Wash away node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z).." chance: "..tostring(washaway_chance).." washaways: "..tostring(#washaways));
local chance = default.random_generator:next(0, 16777215)/16777215.0;
if (chance<=washaway_chance) then
-- select wash away from table
local washaway_data = default.shared_random_from_table(washaways, "power");
minetest.log("warning","Washaway: "..dump(washaway_data));
local sediment_pos = flowing_water_washaway_sediment(washaway_data.pos);
minetest.log("warning","Sediment: "..dump(sediment_pos));
if (sediment_pos~=nil) then
minetest.set_node(sediment_pos, node);
minetest.remove_node(pos);
minetest.check_for_falling(pos);
end
end
end
if (false) then
minetest.register_abm({
label = "Wash away by water",
nodenames = {"group:washaway"},
neighbors = {"group:water_flowing"},
interval = 12,
chance = 5,
catch_up = false,
action = default.washaway_node,
})
end

84
mods/default/water.lua Normal file
View File

@ -0,0 +1,84 @@
local S = default.S;
--
-- control water flooding and water evaporate
--
function default.water_flowing_to_source(pos, step)
local node = minetest.get_node(pos);
local water_flowing = minetest.get_item_group(node.name, "water_flowing");
if (water_flowing>0) then
local flow_max_level = minetest.get_node_max_level(pos);
local flow_level = minetest.get_node_level(pos);
if (flow_max_level==flow_level) then
local positions = default.shared_positions_in_sphere(pos, 1, 1);
local check_node;
local check_def;
for check_idnex, check_pos in pairs(positions) do
check_node = minetest.get_node(check_pos);
water_flowing = minetest.get_item_group(check_node.name, "water_flowing");
if (water_flowing>0) then
if (check_pos.y<pos.y) then
-- cannot be flooded, water is falling down
return;
end
else
check_def = minetest.registered_nodes[check_node.name];
if ((check_def~=nil) and (check_def.buildable_to==true)) then
return;
end
step = step + 1;
end
end
step = step + 1;
-- 360 steps will be reduced to 60 when 1x1 area into solid block is going to be flooded
if (step>360) then
-- change to source
default.apply_node_change(pos, node, "flowing_to_source")
else
minetest.after(1, default.water_flowing_to_source, pos, step);
end
end
end
end
function default.water_flowing_abm(pos, node)
local random_after = default.random_generator:next(1, 19)/10;
--minetest.after(random_after, default.water_flowing_to_source, pos, 0);
end
function default.water_evaporate(pos, node)
-- depend on temp
end
default.register_changeable_node_change("default:water_flowing", "flowing_to_source", {new_node_name="default:water_source",check_stability=false});
if (false) then
minetest.register_abm({
label = "Water flowing to source",
nodenames = {"group:water_flowing"},
interval = 15,
chance = 15,
catch_up = false,
action = default.water_flowing_abm,
})
minetest.register_abm({
label = "Water evaporate",
nodenames = {"group:water_flowing"},
neighbors = {"air"},
interval = 15,
chance = 1024,
catch_up = false,
action = default.water_evaporate,
})
end

View File

@ -4,7 +4,7 @@ local S = default.S;
function default.wet_more_wet(pos, node)
--minetest.log("warning", "Wet of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local positions = default.shared_positions_in_sphere(pos, 1, false);
local positions = default.shared_positions_in_sphere(pos, 1, 1, false);
local wet_chance = 0.0;
local absorbing_power = minetest.get_item_group(node.name, "absorbing_power")/100.0;
@ -34,13 +34,13 @@ function default.wet_more_wet(pos, node)
end
elseif (minetest.get_item_group(check_node.name, "damp")>0) then
absorbing_part = 0.083; --0.25 * 0.33;
table.insert(wet_from, {pos=check_pos,points=math.ceil(83*height_coeficient)})
table.insert(wet_from, {pos=check_pos,node=check_node,points=math.ceil(83*height_coeficient)})
elseif (minetest.get_item_group(check_node.name, "wet")>0) then
absorbing_part = 0.167; -- 0.50 * 0.33;
table.insert(wet_from, {pos=check_pos,points=math.ceil(167*height_coeficient)})
table.insert(wet_from, {pos=check_pos,node=check_node,points=math.ceil(167*height_coeficient)})
elseif (minetest.get_item_group(check_node.name, "soggy")>0) then
absorbing_part = 0.25; -- 0.75 * 0.33;
table.insert(wet_from, {pos=check_pos,points=math.ceil(250*height_coeficient)})
table.insert(wet_from, {pos=check_pos,node=check_node,points=math.ceil(250*height_coeficient)})
end
--minetest.log("warning", "Near node "..check_node.name.." pos X:"..tostring(check_pos.x).." Y:"..tostring(check_pos.y).." Z:"..tostring(check_pos.z).." absorbing_part: "..tostring(absorbing_part).." absorbing_power: "..tostring(absorbing_power));
@ -50,48 +50,61 @@ function default.wet_more_wet(pos, node)
end
end
minetest.log("warning", "Wet of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z).." chance: "..tostring(wet_chance));
--minetest.log("warning", "Wet of node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z).." chance: "..tostring(wet_chance));
local chance = default.random_generator:next(0, 16777215)/16777215.0;
if (chance<=wet_chance) then
default.apply_node_change(pos, node, "wet");
default.erosion_wetting(pos, node);
if (water_near==false) then
from_data = default.shared_random_from_table(wet_from, "points");
default.apply_node_change(from_data.pos, nil, "dry");
local from_data = default.shared_random_from_table(wet_from, "points");
default.apply_node_change(from_data.pos, from_data.node, "dry");
default.erosion_drying(from_data.pos, from_data.node);
end
end
end
function default.wet_create_spring(pos, node)
--minetest.log("warning", "Create spring on node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
local positions = default.shared_positions_in_sphere(pos, 1, false);
local positions = default.shared_positions_in_sphere(pos, 1, 1, false);
local desiccation_chance = 0.0;
local desiccation = minetest.get_item_group(node.name, "desiccation")/100.0;
local dry_positions = {};
for check_index,check_pos in pairs(positions) do
local check_node = minetest.get_node(check_pos);
local desiccation = minetest.get_item_group(check_node.name, "desiccation")/100.0;
if (desiccation>0) then
local capabilities = minetest.get_item_group(check_node.name, "capabilities")/1000.0;
local height_coeficient = 0.5;
if (check_pos.y>pos.y) then
height_coeficient = 1.0-capabilities;
elseif (check_pos.y<pos.y) then
height_coeficient = capabilities;
end
table.insert(dry_positions, check_pos);
desiccation_chance = default.shared_add_chance_happen(desiccation_chance, desiccation);
desiccation_chance = default.shared_add_chance_happen(desiccation_chance, height_coeficient*desiccation);
end
end
minetest.log("warning", "Create spring on node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z).." chance: "..tostring(desiccation_chance));
--minetest.log("warning", "Create spring on node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z).." chance: "..tostring(desiccation_chance));
local chance = default.random_generator:next(0, 16777215)/16777215.0;
if (chance<=desiccation_chance) then
local fresh_def = minetest.registered_nodes["default:fresh_water_flowing"];
local leveled = fresh_def.leveled;
local create_level = math.floor(chance/(desiccation_chance/(leveled+1)));
minetest.set_node(pos, {name="default:fresh_water_flowing"});
local leveled = minetest.get_node_max_level(pos);
local create_level = math.floor(chance/(desiccation_chance/(10*leveled+1)));
--minetest.log("warning", "Level: "..tostring(create_level).." Max level: "..tostring(leveled))
if (create_level>0) then
minetest.set_node(pos, {name="default:fresh_water_flowing"});
create_level = math.ceil(create_level/10.0);
if (create_level>leveled) then
create_level = leveled;
end
@ -105,23 +118,44 @@ function default.wet_create_spring(pos, node)
end
end
minetest.register_abm({
label = "Wet of dry",
nodenames = {"group:absorbing_power"},
neighbors = {"group:water","group:damp","group:wet","group:soggy"},
interval = 11,
chance = 2,
catch_up = false,
action = default.wet_more_wet,
})
function default.wet_dry_spring(pos, node)
--minetest.log("warning", "Dry spring on node "..node.name.." pos X:"..tostring(pos.x).." Y:"..tostring(pos.y).." Z:"..tostring(pos.z))
minetest.set_node(pos, {name="default:fresh_water_flowing"});
local leveled = minetest.get_node_max_level(pos);
minetest.set_node_level(pos, leveled);
if (leveled<7) then
minetest.log("error","Flwint water set leveled problem.")
end
end
minetest.register_abm({
label = "Create spring",
nodenames = {"group:air","air"},
neighbors = {"group:desiccation"},
interval = 110,
chance = 110,
catch_up = false,
action = default.wet_more_dry,
})
if (false) then
minetest.register_abm({
label = "Wet of dry",
nodenames = {"group:absorbing_power"},
neighbors = {"group:water","group:damp","group:wet","group:soggy"},
interval = 11,
chance = 2,
catch_up = false,
action = default.wet_more_wet,
})
minetest.register_abm({
label = "Create spring",
nodenames = {"group:air","air"},
neighbors = {"group:desiccation"},
interval = 11,
chance = 5,
catch_up = false,
action = default.wet_create_spring,
})
minetest.register_abm({
label = "Dry spring",
nodenames = {"default:spring_water_source"},
interval = 12,
chance = 5,
catch_up = false,
action = default.wet_dry_spring,
})
end

View File

@ -112,7 +112,7 @@ minetest.register_node("farming:dry_soil_wet", {
})
minetest.override_item("default:desert_sand", {
groups = {crumbly=3, falling_node=1, sand=1, soil = 1},
groups = {crumbly=3, falling_node=1, sand=1, soil = 1, washaway = 25},
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",

View File

@ -12,47 +12,49 @@ end
-- Load files
local flora_path = minetest.get_modpath("flora")
-- abm function
minetest.register_abm({
label = "Flora growing",
nodenames = {"group:flora_plant"},
interval = 10,
chance = 1,
catch_up = false,
action = function (pos, node, active_object_count, active_object_coumt_wider)
minetest.log("warning", "ABM flora grow node "..node.name.." x: "..tostring(pos.x).." y: "..tostring(pos.y).." z: "..tostring(pos.z));
--minetest.log("warning", "ABM flora grow node "..dump(node).." on "..dump(pos));
vegetation.plant_grow(pos, node);
end,
});
-- abm function
minetest.register_abm({
label = "Stump growing",
nodenames = {"group:flora_stump"},
interval = 39,
chance = 1,
catch_up = false,
action = function (pos, node, active_object_count, active_object_coumt_wider)
minetest.log("warning", "ABM stump grow node "..node.name.." x: "..tostring(pos.x).." y: "..tostring(pos.y).." z: "..tostring(pos.z));
--minetest.log("warning", "ABM flora grow node "..dump(node).." on "..dump(pos));
vegetation.tree_stump_grow(pos, node);
end,
});
-- abm function
minetest.register_abm({
label = "Tree growing",
nodenames = {"group:flora_tree_plant"},
interval = 19,
chance = 1,
catch_up = false,
action = function (pos, node, active_object_count, active_object_coumt_wider)
minetest.log("warning", "ABM tree plant grow node "..node.name.." x: "..tostring(pos.x).." y: "..tostring(pos.y).." z: "..tostring(pos.z));
--minetest.log("warning", "ABM flora grow node "..dump(node).." on "..dump(pos));
vegetation.plant_grow(pos, node);
end,
});
if (false) then
-- abm function
minetest.register_abm({
label = "Flora growing",
nodenames = {"group:flora_plant"},
interval = 10,
chance = 1,
catch_up = false,
action = function (pos, node, active_object_count, active_object_coumt_wider)
minetest.log("warning", "ABM flora grow node "..node.name.." x: "..tostring(pos.x).." y: "..tostring(pos.y).." z: "..tostring(pos.z));
--minetest.log("warning", "ABM flora grow node "..dump(node).." on "..dump(pos));
vegetation.plant_grow(pos, node);
end,
});
-- abm function
minetest.register_abm({
label = "Stump growing",
nodenames = {"group:flora_stump"},
interval = 39,
chance = 1,
catch_up = false,
action = function (pos, node, active_object_count, active_object_coumt_wider)
minetest.log("warning", "ABM stump grow node "..node.name.." x: "..tostring(pos.x).." y: "..tostring(pos.y).." z: "..tostring(pos.z));
--minetest.log("warning", "ABM flora grow node "..dump(node).." on "..dump(pos));
vegetation.tree_stump_grow(pos, node);
end,
});
-- abm function
minetest.register_abm({
label = "Tree growing",
nodenames = {"group:flora_tree_plant"},
interval = 19,
chance = 1,
catch_up = false,
action = function (pos, node, active_object_count, active_object_coumt_wider)
minetest.log("warning", "ABM tree plant grow node "..node.name.." x: "..tostring(pos.x).." y: "..tostring(pos.y).." z: "..tostring(pos.z));
--minetest.log("warning", "ABM flora grow node "..dump(node).." on "..dump(pos));
vegetation.plant_grow(pos, node);
end,
});
end
flora.S = nil

View File

@ -0,0 +1,2 @@
default
recipes

18
mods/minerals/init.lua Normal file
View File

@ -0,0 +1,18 @@
-- Mods which include special recipes functions
-- Definitions made by this mod that other mods can use too
minerals = {}
-- localize support via initlib
minerals.S = function(s) return s end
if minetest.get_modpath("intllib") and intllib then
minerals.S = intllib.Getter()
end
-- Load files
local minerals_path = minetest.get_modpath("minerals")
dofile(minerals_path.."/nodes.lua")
minerals.S = nil

24
mods/minerals/nodes.lua Normal file
View File

@ -0,0 +1,24 @@
local S = minerals.S;
--
--
--
minetest.register_node("minerals:ore_iron", {
description = S("Iron ore SF"),
tiles = {"default_stone.png^minerals_iron.png"},
groups = {cracky = 1, firmness = 2, resilience = 3, cavein = 5},
drop = "default:iron",
legacy_mineral = true,
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("minerals:ore_iron_crack", {
description = S("Cracky iron ore"),
tiles = {"default_stone.png^minerals_iron.png^default_stone_crack.png"},
groups = {cracky = 1, falling_node = 1},
drop = "default:iron",
legacy_mineral = true,
sounds = default.node_sound_stone_defaults(),
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

19
mods/person/init.lua Normal file
View File

@ -0,0 +1,19 @@
-- Mods which include functions for persons
-- Definitions made by this mod that other mods can use too
person = {}
-- localize support via initlib
person.S = function(s) return s end
if minetest.get_modpath("intllib") and intllib then
person.S = intllib.Getter()
end
-- Load files
local person_path = minetest.get_modpath("person")
dofile(person_path.."/person.lua")
person.S = nil

6
mods/person/person.lua Normal file
View File

@ -0,0 +1,6 @@
local S = person.S;
-- lives, vitality etc.