Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/entity.cc22
-rw-r--r--src/core/entity.h3
2 files changed, 16 insertions, 9 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();
}
diff --git a/src/core/entity.h b/src/core/entity.h
index de4f210..f5a6d52 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -681,8 +681,9 @@ public:
/**
* @brief nudge the entity out of the radius of other entities in its current zune
+ * @param randomize if false, nudge according to axus.forward(), if false, nudge along a random axis
*/
- void nudge();
+ void nudge(const bool randomize = true);
/**
* @brief physics collision callback