EEntityDeleted now provides an EntityWrapper instead of just an ID
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
#define EEntityDeleted_h__
|
||||
|
||||
#include "Event.h"
|
||||
#include "Entity.h"
|
||||
#include "EntityWrapper.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct EntityDeleted : Event
|
||||
{
|
||||
EntityID DeletedEntity;
|
||||
EntityWrapper DeletedEntity;
|
||||
// True if the entity deletion was triggered because the entity's parent was deleted before it
|
||||
bool Cascaded;
|
||||
};
|
||||
|
||||
@@ -223,7 +223,7 @@ void World::deleteEntityRecursive(EntityID entity, bool cascaded /*= false*/)
|
||||
|
||||
if (m_EventBroker != nullptr) {
|
||||
Events::EntityDeleted e;
|
||||
e.DeletedEntity = entity;
|
||||
e.DeletedEntity = EntityWrapper(this, entity);
|
||||
e.Cascaded = cascaded;
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ bool Server::OnEntityDeleted(const Events::EntityDeleted & e)
|
||||
{
|
||||
if (!e.Cascaded) {
|
||||
Packet packet = Packet(MessageType::EntityDeleted);
|
||||
packet.WritePrimitive<EntityID>(e.DeletedEntity);
|
||||
packet.WritePrimitive<EntityID>(e.DeletedEntity.ID);
|
||||
reliableBroadcast(packet);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -284,7 +284,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
|
||||
|
||||
bool AnimationSystem::OnEntityDeleted(Events::EntityDeleted& e)
|
||||
{
|
||||
EntityWrapper entity = EntityWrapper(m_World, e.DeletedEntity);
|
||||
EntityWrapper entity = e.DeletedEntity;
|
||||
|
||||
if (entity.HasComponent("Model")) {
|
||||
Model* model;
|
||||
|
||||
@@ -67,7 +67,7 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
||||
bool PlayerDeathSystem::OnEntityDeleted(Events::EntityDeleted& e)
|
||||
{
|
||||
// We only care about when the local players death effect is removed.
|
||||
if (m_LocalPlayerDeathEffect.ID != e.DeletedEntity) {
|
||||
if (m_LocalPlayerDeathEffect != e.DeletedEntity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user