aboutsummaryrefslogtreecommitdiff
path: root/src/cavegen.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2013-12-14 01:52:06 -0500
committerkwolekr <kwolekr@minetest.net>2013-12-14 01:52:24 -0500
commitc3708b456e90bccf19e7c82c54a93c8cb7c8896c (patch)
tree2f23bf39c67a34fc9582db07220b6f72209e1c39 /src/cavegen.cpp
parent83853ccd413c06a4a37a3c91f8c2cb270e42109c (diff)
downloadminetest-c3708b456e90bccf19e7c82c54a93c8cb7c8896c.tar.gz
minetest-c3708b456e90bccf19e7c82c54a93c8cb7c8896c.tar.bz2
minetest-c3708b456e90bccf19e7c82c54a93c8cb7c8896c.zip
Add map feature generation notify Lua API
Diffstat (limited to 'src/cavegen.cpp')
-rw-r--r--src/cavegen.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cavegen.cpp b/src/cavegen.cpp
index f04c02db9..b32e140f8 100644
--- a/src/cavegen.cpp
+++ b/src/cavegen.cpp
@@ -110,9 +110,21 @@ void CaveV6::makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height) {
(float)(ps->next() % ar.Z) + 0.5
);
+ int notifytype = large_cave ? GENNOTIFY_LARGECAVE_BEGIN : GENNOTIFY_CAVE_BEGIN;
+ if (mg->gennotify & (1 << notifytype)) {
+ std::vector <v3s16> *nvec = mg->gen_notifications[notifytype];
+ nvec->push_back(v3s16(of.X + orp.X, of.Y + orp.Y, of.Z + orp.Z));
+ }
+
// Generate some tunnel starting from orp
for (u16 j = 0; j < tunnel_routepoints; j++)
makeTunnel(j % dswitchint == 0);
+
+ notifytype = large_cave ? GENNOTIFY_LARGECAVE_END : GENNOTIFY_CAVE_END;
+ if (mg->gennotify & (1 << notifytype)) {
+ std::vector <v3s16> *nvec = mg->gen_notifications[notifytype];
+ nvec->push_back(v3s16(of.X + orp.X, of.Y + orp.Y, of.Z + orp.Z));
+ }
}
@@ -347,9 +359,21 @@ void CaveV7::makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height) {
(float)(ps->next() % ar.Z) + 0.5
);
+ int notifytype = large_cave ? GENNOTIFY_LARGECAVE_BEGIN : GENNOTIFY_CAVE_BEGIN;
+ if (mg->gennotify & (1 << notifytype)) {
+ std::vector <v3s16> *nvec = mg->gen_notifications[notifytype];
+ nvec->push_back(v3s16(of.X + orp.X, of.Y + orp.Y, of.Z + orp.Z));
+ }
+
// Generate some tunnel starting from orp
for (u16 j = 0; j < tunnel_routepoints; j++)
makeTunnel(j % dswitchint == 0);
+
+ notifytype = large_cave ? GENNOTIFY_LARGECAVE_END : GENNOTIFY_CAVE_END;
+ if (mg->gennotify & (1 << notifytype)) {
+ std::vector <v3s16> *nvec = mg->gen_notifications[notifytype];
+ nvec->push_back(v3s16(of.X + orp.X, of.Y + orp.Y, of.Z + orp.Z));
+ }
}