From d4f8d1c8fde01a58bc757b588c9850e69225bc24 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 10 Nov 2013 01:46:24 +0000 Subject: Corrected a small bug in Entity::print(), added nudge randomizer option. --- src/core/entity.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index 5c1fe5c..7d538a0 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -291,7 +291,7 @@ void Entity::print() const con_print << " ^Nmodule type ^B" << moduletype() << std::endl; // print entity flags - con_print << " ^Nflags ^B"; + con_print << " ^Nflags ^B"; if (has_flag(NonSolid)) { con_print << " nonsolid"; } @@ -311,6 +311,9 @@ void Entity::print() const if (inventory()) { con_print << " ^Ninventory ^Byes" << std::endl; } + if (slots()) { + con_print << " ^Nslots ^Byes" << std::endl; + } if (faction()) { con_print << " ^Nfaction ^B" << faction()->label() << std::endl; } @@ -843,7 +846,7 @@ void EntityDynamic::set_state(int state) } } -void EntityDynamic::nudge() +void EntityDynamic::nudge(const bool randomize) { if (!zone()) { return; @@ -857,12 +860,15 @@ void EntityDynamic::nudge() const float r = radius() + other->radius(); if ( d < r ) { - // nudge into randomize direction - math::Axis nudge_axis(axis()); - nudge_axis.change_direction(math::randomf(60.0f) - 30.0f); - nudge_axis.change_pitch(math::randomf(60.0f) - 30.0f); - set_location(location() + nudge_axis.forward() * (r - d + 0.001f)); - + if (randomize) { + // nudge into randomize direction + math::Axis nudge_axis(axis()); + nudge_axis.change_direction(math::randomf(60.0f) - 30.0f); + nudge_axis.change_pitch(math::randomf(60.0f) - 30.0f); + set_location(location() + nudge_axis.forward() * (r - d + 0.001f)); + } else { + set_location(location() + axis().forward() * (r - d + 0.001f)); + } // restart search it = zone()->content().begin(); } -- cgit v1.2.3