- change atoi for stoi. Thanks XYZ
- Put a minime of tree (1).
- If max is smaller than min, invert variables.
He estado desarrollando una modificación en el engine para hacer una cierta modificación. Cambiar el tamaño de los arboles. Solo necesitas modificar dos .cpp del codigo fuente y compilarlo.
Hi:
I was developping a mod for engine ore to make a good thing. Change tree heihgt. You only need to modificate 2 source files, and compile Minetest.
Como Compilar: How to Compile: https://github.com/celeron55/minetest/b ... README.txt
First Open src/subgame.cpp
Primero Abre src/subgame.cpp
Chage this:
Cambia esto:
Code: Select all
std::string getGameName(const std::string &game_path)
{
std::string conf_path = game_path + DIR_DELIM + "game.conf";
Settings conf;
bool succeeded = conf.readConfigFile(conf_path.c_str());
if(!succeeded)
return "";
if(!conf.exists("name"))
return "";
return conf.get("name");
}
Por esto:
Code: Select all
int minhtree = 0;
int maxhtree = 0;
std::string getGameName(const std::string &game_path)
{
std::string conf_path = game_path + DIR_DELIM + "game.conf";
Settings conf;
bool succeeded = conf.readConfigFile(conf_path.c_str());
if(!succeeded)
return "";
if(!conf.exists("name"))
return "";
/*
Get Tree size
*/
if(!conf.exists("treehmin"))
minhtree = 4;
else
minhtree = stoi(conf.get("treehmin"));
if(!conf.exists("treehmax"))
maxhtree = 5;
else
maxhtree = stoi(conf.get("treehmin"));
/*
Prevent user Error
*/
if(minhtree > maxhtree)
{
int j = minhtree;
minhtree = maxhtree;
maxhtree = j;
}
if(minhtree < 1) minhtree = 1;
if(maxhtree < 1) maxhtree = 1;
return conf.get("name");
}
Ahora abre src/mapgen.cpp
Change this:
Cambia esto:
Code: Select all
void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
bool is_apple_tree, INodeDefManager *ndef)
{
MapNode treenode(ndef->getId("mapgen_tree"));
MapNode leavesnode(ndef->getId("mapgen_leaves"));
MapNode applenode(ndef->getId("mapgen_apple"));
s16 trunk_h = myrand_range(4, 5);
v3s16 p1 = p0;
for(s16 ii=0; ii<trunk_h; ii++)
{
if(vmanip.m_area.contains(p1))
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
p1.Y++;
}
// p1 is now the last piece of the trunk
p1.Y -= 1;
Por Esto:
Code: Select all
void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
bool is_apple_tree, INodeDefManager *ndef)
{
MapNode treenode(ndef->getId("mapgen_tree"));
MapNode leavesnode(ndef->getId("mapgen_leaves"));
MapNode applenode(ndef->getId("mapgen_apple"));
s16 trunk_h = myrand_range(minhtree, maxhtree);
v3s16 p1 = p0;
for(s16 ii=0; ii<trunk_h; ii++)
{
if(vmanip.m_area.contains(p1))
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
p1.Y++;
}
// p1 is now the last piece of the trunk
p1.Y -= 1;
Añade Esto:
Code: Select all
extern int minhtree;
extern int maxhtree;
encima de esto en el mapgen.cpp
Code: Select all
namespace mapgen
Ahora Compila
Ahora si quieres cambiar el tamaño sigue adelante.
Sino no sigas, no se alterará el tamaño actual.
Atención: Afecta a todos los arboles nuevos creados en cualquier mapa. Recomendado usar un minetest_game para cada tamaño.
Now Continue if you want change size.
If not, don't continue, height doesn't change.
Warring: it made that all new generated trees at any map chages. I recomed use a diferent minetest_game for every size do you want.
Y solo necesitas ir a games/minetest (o games/nombre_de_tu_juego) y añadir al game.conf:
And you only need to go to games/minetest (or games/name_of_your_game) and adds to game.conf:
Code: Select all
treehmin = min_number
treehmax = max_number
Example:
Code: Select all
name = MinetestCreative
treehmin = 5
treehmax = 8
Have fun with this.
Bye