diff --git a/Aquaria/Avatar.cpp b/Aquaria/Avatar.cpp index 90780d9..cc0c525 100644 --- a/Aquaria/Avatar.cpp +++ b/Aquaria/Avatar.cpp @@ -3063,11 +3063,6 @@ void Avatar::setBlockSinging(bool v) } } -bool Avatar::canSetBoneLock() -{ - return true; -} - void Avatar::onSetBoneLock() { Entity::onSetBoneLock(); diff --git a/Aquaria/Avatar.h b/Aquaria/Avatar.h index 36d4f2a..c36caa3 100644 --- a/Aquaria/Avatar.h +++ b/Aquaria/Avatar.h @@ -300,8 +300,6 @@ public: Web *web; float rollDelay; - bool canSetBoneLock() OVERRIDE; - void revert(); void doBindSong(); void doShieldSong(); diff --git a/Aquaria/Entity.cpp b/Aquaria/Entity.cpp index 46e44d1..ea941ad 100644 --- a/Aquaria/Entity.cpp +++ b/Aquaria/Entity.cpp @@ -61,17 +61,18 @@ void Entity::setIngredientData(const std::string &name) void Entity::entityDied(Entity *e) { for (size_t i = 0; i < targets.size(); i++) + if(targets[i] == e) + targets[i] = NULL; + + if (boneLock.on && boneLock.entity == e) { - targets[i] = 0; + setBoneLock(BoneLock(), true); } - if (boneLock.on) - { - if (boneLock.entity == e) - { - setBoneLock(BoneLock()); - } - } + if(riding == e) + riding = NULL; + if(ridingOnEntity == e) + ridingOnEntity = NULL; } void Entity::setBounceType(BounceType bt) @@ -98,14 +99,13 @@ void Entity::generateCollisionMask(int ovrCollideRadius) } } - - -bool Entity::setBoneLock(const BoneLock &bl) +bool Entity::setBoneLock(const BoneLock &bl, bool force) { - if (!canSetBoneLock()) return false; - - if (bl.on && boneLockDelay > 0) return false; - if (boneLock.on && bl.on) return false; + if(!force) + { + if (bl.on && boneLockDelay > 0) return false; + if (boneLock.on && bl.on) return false; + } if (boneLock.on && !bl.on) { @@ -138,11 +138,6 @@ bool Entity::setBoneLock(const BoneLock &bl) return true; } -bool Entity::canSetBoneLock() -{ - return true; -} - Entity::Entity() { addType(SCO_ENTITY); diff --git a/Aquaria/Entity.h b/Aquaria/Entity.h index 5a3e0b8..915726f 100644 --- a/Aquaria/Entity.h +++ b/Aquaria/Entity.h @@ -91,7 +91,7 @@ public: float health; float maxHealth; - bool setBoneLock(const BoneLock &boneLock); + bool setBoneLock(const BoneLock &boneLock, bool force = false); void heal(float a, int type=0); @@ -330,8 +330,6 @@ public: void setPoison(float m, float t); inline float getPoison() const { return poison; } - virtual bool canSetBoneLock(); - void initHair(int numSegments, float segmentLength, float width, const std::string &tex); void updateHair(float dt); void setHairHeadPosition(const Vector &pos); diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index a1ffe44..e959ab1 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -2333,10 +2333,7 @@ void Game::entityDied(Entity *eDead) FOR_ENTITIES(i) { e = *i; - if (e != eDead && e->isv(EV_ENTITYDIED,1)) - { - e->entityDied(eDead); - } + e->entityDied(eDead); } dsq->continuity.entityDied(eDead); diff --git a/Aquaria/ScriptedEntity.cpp b/Aquaria/ScriptedEntity.cpp index 4bfeb83..ac36cb7 100644 --- a/Aquaria/ScriptedEntity.cpp +++ b/Aquaria/ScriptedEntity.cpp @@ -688,7 +688,7 @@ void ScriptedEntity::entityDied(Entity *e) { CollideEntity::entityDied(e); - if (script) + if (script && e != this && e->isv(EV_ENTITYDIED,1)) { script->call("entityDied", this, e); }