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