Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-10 01:46:24 +0000
committerStijn Buys <ingar@osirion.org>2013-11-10 01:46:24 +0000
commitd4f8d1c8fde01a58bc757b588c9850e69225bc24 (patch)
tree76b0ba82fca051d95a7570e13c9a58f648ed45bf /src/core/entity.cc
parent1a1842473c826f4cf327d336b30a1f874e0e470b (diff)
Corrected a small bug in Entity::print(),
added nudge randomizer option.
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r--src/core/entity.cc22
1 files changed, 14 insertions, 8 deletions
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();
}