forked from oerkki/voxelands
re-enable cactus farming
This commit is contained in:
parent
df09ff870e
commit
6bef605fb0
|
@ -1322,6 +1322,8 @@ void ServerEnvironment::step(float dtime)
|
||||||
}else if (content_features(testnode).draw_type == CDT_MELONLIKE) {
|
}else if (content_features(testnode).draw_type == CDT_MELONLIKE) {
|
||||||
if (content_features(testnode).param2_type == CPT_PLANTGROWTH)
|
if (content_features(testnode).param2_type == CPT_PLANTGROWTH)
|
||||||
plantgrowth_plant(this,test_p);
|
plantgrowth_plant(this,test_p);
|
||||||
|
}else if (testnode.getContent() == CONTENT_CACTUS) {
|
||||||
|
plantgrowth_cactus(this,test_p);
|
||||||
}else if (testnode.getContent() == CONTENT_FERTILIZER) {
|
}else if (testnode.getContent() == CONTENT_FERTILIZER) {
|
||||||
plantgrowth_fertilizer(this,test_p);
|
plantgrowth_fertilizer(this,test_p);
|
||||||
}else if (testnode.getContent() == CONTENT_AIR) {
|
}else if (testnode.getContent() == CONTENT_AIR) {
|
||||||
|
|
|
@ -558,3 +558,22 @@ void plantgrowth_grass(ServerEnvironment *env, v3s16 p0)
|
||||||
if (add)
|
if (add)
|
||||||
env->getMap().addNodeWithEvent(p0,n);
|
env->getMap().addNodeWithEvent(p0,n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void plantgrowth_cactus(ServerEnvironment *env, v3s16 p0)
|
||||||
|
{
|
||||||
|
int height = 1;
|
||||||
|
for (;; height++) {
|
||||||
|
MapNode nn = env->getMap().getNodeNoEx(p0+v3s16(0,height,0));
|
||||||
|
if (nn.getContent() == CONTENT_AIR) {
|
||||||
|
break;
|
||||||
|
}else if (nn.getContent() != CONTENT_CACTUS || nn.envticks < 5) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height > 4 || myrand_range(0,3) != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MapNode n(CONTENT_CACTUS);
|
||||||
|
env->getMap().addNodeWithEvent(p0+v3s16(0,height,0),n);
|
||||||
|
}
|
||||||
|
|
|
@ -32,5 +32,6 @@ void plantgrowth_fertilizer(ServerEnvironment *env, v3s16 p0);
|
||||||
void plantgrowth_seed(ServerEnvironment *env, v3s16 p0);
|
void plantgrowth_seed(ServerEnvironment *env, v3s16 p0);
|
||||||
void plantgrowth_plant(ServerEnvironment *env, v3s16 p0, s16 height=0);
|
void plantgrowth_plant(ServerEnvironment *env, v3s16 p0, s16 height=0);
|
||||||
void plantgrowth_grass(ServerEnvironment *env, v3s16 p0);
|
void plantgrowth_grass(ServerEnvironment *env, v3s16 p0);
|
||||||
|
void plantgrowth_cactus(ServerEnvironment *env, v3s16 p0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue