Permalink
Browse files

Proximity sensors now pass test.

  • Loading branch information...
thebracket committed Apr 10, 2018
1 parent 8e2a1e7 commit 273974036a2872b2f247b68584ba17e111e4cb62
@@ -259,6 +259,7 @@ namespace systems {
else if (provides.provides == provides_proximity_sensor) {
entity(b.building_target.building_entity)->assign(proximity_sensor_t{});
entity(b.building_target.building_entity)->assign(sends_signal_t{});
entity(b.building_target.building_entity)->assign(viewshed_t{ 8, false, true });
}
else if (provides.provides == provides_and_gate) {
entity(b.building_target.building_entity)->assign(signal_processor_t{ false, AND });
@@ -281,6 +281,18 @@ namespace systems {
{
const auto old_state = sender.active;
sender.active = !view.visible_entities.empty();
if (sender.active)
{
sender.active = false;
for (const auto &id : view.visible_entities)
{
const auto e = entity(id);
if (e)
{
if (e->component<settler_ai_t>() || e->component<grazer_ai>() || e->component<sentient_ai>()) sender.active = true;
}
}
}
if (old_state != sender.active)
{
p.active = sender.active;
@@ -550,7 +562,7 @@ namespace systems {
pulled_levers();
oscillators();
float_sensors();
proximity_sensors();
if (slow_tick) proximity_sensors();
if (dependencies_changed) calc_dependency();
run_circuits();
}
@@ -161,7 +161,8 @@ namespace systems {
auto settler = e.component<settler_ai_t>();
auto sentient = e.component<sentient_ai>();
auto turret = e.component<turret_t>();
if (grazer || settler || sentient || turret) {
auto sensor = e.component<proximity_sensor_t>();
if (grazer || settler || sentient || turret || sensor) {
view.visible_entities.clear();
for (const int &idx : view.visible_cache) {
auto [x,y,z] = idxmap(idx);

0 comments on commit 2739740

Please sign in to comment.