It can be used by the owner of the spawner to send additional packets
to initialize the entity.
message.position = tf.position;
message.rotation = tf.rotation;
message.scale = tf.scale;
+
if(target>=0)
networking.send(target, message);
else
for(unsigned p: players)
networking.send(p, message);
}
+
+ info.spawner->notify_spawn_sent(re.entity, target);
}
void Replicator::receive(const Messages::SpawnEntity &message)
handler.spawned(move(entity));
}
+void Spawner::notify_spawn_sent(Handle<Entity> entity, unsigned target) const
+{
+ handler.spawn_sent(entity, target);
+}
+
} // namespace Msp::Game
{
public:
virtual void spawned(Owned<Entity>) = 0;
+ virtual void spawn_sent(Handle<Entity>, unsigned) { }
};
private:
void spawn(const SpawnableType &, const std::string &, const TransformValues &);
+
+public:
+ void notify_spawn_sent(Handle<Entity>, unsigned) const;
};