summaryrefslogtreecommitdiff
path: root/src/game/unit_builder.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-26 11:44:23 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-26 11:44:23 +0200
commit86872106dc9aa960b417b5ff7f4a175c81058411 (patch)
treee8da47396f7f7eb37efe80b559e68d84aec9e818 /src/game/unit_builder.cpp
parentd04e1b48bd934f8d9d91aab13e9e51393fd7b6ba (diff)
Add the replicator.
Diffstat (limited to 'src/game/unit_builder.cpp')
-rw-r--r--src/game/unit_builder.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/game/unit_builder.cpp b/src/game/unit_builder.cpp
index 0deae3c..801639e 100644
--- a/src/game/unit_builder.cpp
+++ b/src/game/unit_builder.cpp
@@ -95,6 +95,11 @@ void unit_builder_t::command_build(v2f_t where, type_t what)
price = 250;
break;
+ case UNIT_REPLICATOR:
+ built = new unit_replicator_t(game);
+ price = 200;
+ break;
+
default:
abort();
}
@@ -107,7 +112,7 @@ void unit_builder_t::command_build(v2f_t where, type_t what)
cmodel.bounds[0] = where + built->size[0];
cmodel.bounds[1] = where + built->size[1];
- cmodel.cflags = CF_SOLID|CF_SURFACE2|CF_WATER|CF_DECOS;
+ cmodel.cflags = CF_SOLID|CF_SURFACE2|CF_WATER|CF_DECOS|CF_BODY|CF_BODY_SMALL;
if (world->test_rect(&cmodel, nullptr)) {
say("Nie ma tutaj miejsca.");
@@ -131,10 +136,14 @@ void unit_builder_t::repair(void)
world::trace_t trace;
unit_t *unit;
- if (!move.moving)
+ if (!move.moving) {
+ world::cflags_t save = move.cflags;
+ move.cflags &= ~CF_SOLID;
start_moving(repairing_at);
+ move.cflags = save;
+ }
- if ((x - repairing_at).len() > 0.5f)
+ if ((x - repairing_at).len() > 1.0f)
return;
if (next_repair && next_repair > game->time)
@@ -147,7 +156,8 @@ void unit_builder_t::repair(void)
}
unit = dynamic_cast<unit_t*>(trace.ent);
- if (unit->type != UNIT_TELEPORTER || unit->health >= unit->max_health) {
+ if ((unit->type != UNIT_TELEPORTER && unit->type != UNIT_REPLICATOR)
+ || unit->health >= unit->max_health) {
repairing = false;
return;
}