- change atoi for stoi. Thanks XYZ
- Put a minime of tree (1).
- If max is smaller than min, invert variables.
Hola:
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/blob/stable-0.4/README.txt
First Open src/subgame.cpp
Primero Abre src/subgame.cpp
Chage this:
Cambia esto:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- 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");
}
For this:
Por esto:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- 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");
}
Now open src/mapgen.cpp
Ahora abre src/mapgen.cpp
Change this:
Cambia esto:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- 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;
For This
Por Esto:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- 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;
Add This:
Añade Esto:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
extern int minhtree;
extern int maxhtree;
above this at mapgen.cpp
encima de esto en el mapgen.cpp
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
namespace mapgen
Now Compile It.
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:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
treehmin = min_number
treehmax = max_number
Ejemplo:
Example:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
name = MinetestCreative
treehmin = 5
treehmax = 8
Divierte
Have fun with this.
:)
Bye