mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-11 10:14:17 +00:00
add funnel enable sync
This commit is contained in:
parent
a1d2a60030
commit
42c19ab21a
@ -66,5 +66,6 @@
|
||||
public static string QSBExitHeadZone = "QSBExitHeadZone";
|
||||
public static string QSBNpcAnimEvent = "QSBNpcAnimEvent";
|
||||
public static string QSBHatchState = "QSBHatchState";
|
||||
public static string QSBEnableFunnel = "QSBEnableFunnel";
|
||||
}
|
||||
}
|
@ -44,6 +44,7 @@
|
||||
AnimTrigger,
|
||||
NpcAnimEvent,
|
||||
FlyShip,
|
||||
OpenHatch
|
||||
OpenHatch,
|
||||
EnableFunnel
|
||||
}
|
||||
}
|
@ -80,7 +80,8 @@ namespace QSB.Events
|
||||
new NpcAnimationEvent(),
|
||||
// Ship
|
||||
new FlyShipEvent(),
|
||||
new HatchEvent()
|
||||
new HatchEvent(),
|
||||
new FunnelEnableEvent()
|
||||
};
|
||||
|
||||
if (UnitTestDetector.IsInUnitTest)
|
||||
|
@ -240,6 +240,7 @@
|
||||
<Compile Include="QuantumSync\Patches\QuantumVisibilityPatches.cs" />
|
||||
<Compile Include="QuantumSync\Patches\ServerQuantumPatches.cs" />
|
||||
<Compile Include="SectorSync\TargetType.cs" />
|
||||
<Compile Include="ShipSync\Events\FunnelEnableEvent.cs" />
|
||||
<Compile Include="Syncs\ISectoredSync.cs" />
|
||||
<Compile Include="Syncs\ISync.cs" />
|
||||
<Compile Include="Syncs\RigidbodySync\UnparentedBaseRigidbodySync.cs" />
|
||||
|
26
QSB/ShipSync/Events/FunnelEnableEvent.cs
Normal file
26
QSB/ShipSync/Events/FunnelEnableEvent.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.ShipSync.Events
|
||||
{
|
||||
class FunnelEnableEvent : QSBEvent<PlayerMessage>
|
||||
{
|
||||
public override EventType Type => EventType.EnableFunnel;
|
||||
|
||||
public override void SetupListener()
|
||||
=> GlobalMessenger.AddListener(EventNames.QSBEnableFunnel, Handler);
|
||||
|
||||
public override void CloseListener()
|
||||
=> GlobalMessenger.RemoveListener(EventNames.QSBEnableFunnel, Handler);
|
||||
|
||||
private void Handler() => SendEvent(CreateMessage());
|
||||
|
||||
private PlayerMessage CreateMessage() => new PlayerMessage
|
||||
{
|
||||
AboutId = LocalPlayerId
|
||||
};
|
||||
|
||||
public override void OnReceiveRemote(bool server, PlayerMessage message)
|
||||
=> ShipManager.Instance.ShipTractorBeam.ActivateTractorBeam();
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ namespace QSB.ShipSync.Patches
|
||||
if (!PlayerState.IsInsideShip())
|
||||
{
|
||||
ShipManager.Instance.ShipTractorBeam.ActivateTractorBeam();
|
||||
QSBEventManager.FireEvent(EventNames.QSBEnableFunnel);
|
||||
}
|
||||
QSBEventManager.FireEvent(EventNames.QSBHatchState, true);
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user