2021-11-13 23:29:06 -08:00
|
|
|
|
using QSB.Events;
|
|
|
|
|
using QSB.MeteorSync.WorldObjects;
|
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
using QSB.WorldSync.Events;
|
|
|
|
|
|
|
|
|
|
namespace QSB.MeteorSync.Events
|
|
|
|
|
{
|
|
|
|
|
public class MeteorSpecialImpactEvent : QSBEvent<WorldObjectMessage>
|
|
|
|
|
{
|
2021-12-05 11:03:09 +00:00
|
|
|
|
public override bool RequireWorldObjectsReady => true;
|
2021-12-04 16:39:37 +00:00
|
|
|
|
|
2021-11-13 23:29:06 -08:00
|
|
|
|
public override void SetupListener()
|
|
|
|
|
=> GlobalMessenger<QSBMeteor>.AddListener(EventNames.QSBMeteorSpecialImpact, Handler);
|
|
|
|
|
|
|
|
|
|
public override void CloseListener()
|
|
|
|
|
=> GlobalMessenger<QSBMeteor>.RemoveListener(EventNames.QSBMeteorSpecialImpact, Handler);
|
|
|
|
|
|
|
|
|
|
private void Handler(QSBMeteor qsbMeteor) => SendEvent(CreateMessage(qsbMeteor));
|
|
|
|
|
|
2021-11-20 19:49:50 +00:00
|
|
|
|
private WorldObjectMessage CreateMessage(QSBMeteor qsbMeteor) => new()
|
2021-11-13 23:29:06 -08:00
|
|
|
|
{
|
|
|
|
|
ObjectId = qsbMeteor.ObjectId
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public override void OnReceiveRemote(bool isHost, WorldObjectMessage message)
|
|
|
|
|
{
|
|
|
|
|
var qsbMeteor = QSBWorldSync.GetWorldFromId<QSBMeteor>(message.ObjectId);
|
|
|
|
|
qsbMeteor.SpecialImpact();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|