EEntityDeleted now provides an EntityWrapper instead of just an ID

This commit is contained in:
2016-03-09 23:47:42 +01:00
parent 91bad517d3
commit f6113b9d9c
5 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -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;
};
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
}