summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-13 23:39:29 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-13 23:39:29 +0300
commit4ba35c456af28479b547f2ab2c0bd02c40c292f6 (patch)
tree007ba5942a6e9a62ee64f9b85e21cc5780eceae4 /src/net
parent2c302cc6cb54881fbe354cc9d5a9997788f63e56 (diff)
downloadManaVerse-4ba35c456af28479b547f2ab2c0bd02c40c292f6.tar.gz
ManaVerse-4ba35c456af28479b547f2ab2c0bd02c40c292f6.tar.bz2
ManaVerse-4ba35c456af28479b547f2ab2c0bd02c40c292f6.tar.xz
ManaVerse-4ba35c456af28479b547f2ab2c0bd02c40c292f6.zip
Add npc attribute what allow or prevent removing npc after out of sight.
New npc attribute: allowDelete
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/beingrecv.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp
index be3cc4cb9..f09979e58 100644
--- a/src/net/ea/beingrecv.cpp
+++ b/src/net/ea/beingrecv.cpp
@@ -64,6 +64,7 @@ void BeingRecv::processBeingRemove(Net::MessageIn &msg)
// A being should be removed or has died
const BeingId id = msg.readBeingId("being id");
+ const uint8_t type = msg.readUInt8("remove flag");
Being *const dstBeing = actorManager->findBeing(id);
if (!dstBeing)
{
@@ -79,7 +80,7 @@ void BeingRecv::processBeingRemove(Net::MessageIn &msg)
if (dstBeing == localPlayer->getTarget())
localPlayer->stopAttack(true);
- if (msg.readUInt8("dead flag?") == 1U)
+ if (type == 1U)
{
if (dstBeing->getCurrentAction() != BeingAction::DEAD)
{
@@ -87,6 +88,12 @@ void BeingRecv::processBeingRemove(Net::MessageIn &msg)
dstBeing->recalcSpritesOrder();
}
}
+ else if (type == 0U && dstBeing->getType() == ActorType::Npc)
+ {
+ const BeingInfo *const info = dstBeing->getInfo();
+ if (!info || info->getAllowDelete())
+ actorManager->destroy(dstBeing);
+ }
else
{
if (dstBeing->getType() == ActorType::Player)