summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-18 19:46:24 +0000
committerPaweł Redman <pawel.redman@gmail.com>2017-12-18 19:46:24 +0000
commit2d0ca20e5f8775960e1e93add81876ed6fa26707 (patch)
tree000f24aec2f339cf09ef58ebfd8903222b48856e /src/game
parent4c3e827488cdea1da1b7069ddd78e94fed87d010 (diff)
Spawn lone spiders instead of most nests.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/worldgen.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/game/worldgen.cpp b/src/game/worldgen.cpp
index 0bf67ed..f7d4757 100644
--- a/src/game/worldgen.cpp
+++ b/src/game/worldgen.cpp
@@ -4,7 +4,7 @@ namespace game {
using namespace world;
-void add_decoration(world_t *world, state_t *game, v2f_t x)
+static void add_entity(world_t *world, state_t *game, v2f_t x)
{
float noise;
deco_t *deco;
@@ -21,10 +21,14 @@ void add_decoration(world_t *world, state_t *game, v2f_t x)
offset[1] = world->perlin.get(x, 0.19571f);
center = x + v2f_t(0.5f, 0.5f) + offset.norm() * 0.1;
- if (noise > 0.39) {
+ if (noise > 0.42) {
unit_nest_t *nest = new unit_nest_t(game);
nest->place(world, center);
return;
+ } else if (noise > 0.39) {
+ unit_spider_t *spider = new unit_spider_t(game);
+ spider->place(world, center);
+ return;
}
if (noise > 0.36)
@@ -94,7 +98,7 @@ decos:
x = v2f_t(index) * SECTOR_SIZE + v2f_t(lx, ly);
if (tile->type == TILE_DIRT)
- add_decoration(world, game, x);
+ add_entity(world, game, x);
}
}