Fix being able to play structure instruments while in crit/dead.
Fixes #4038
This commit is contained in:
@@ -292,26 +292,30 @@ namespace Content.Server.Instruments
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (Handheld || !eventArgs.User.TryGetComponent(out ActorComponent? actor)) return;
|
||||
if (Handheld)
|
||||
return;
|
||||
|
||||
if (InstrumentPlayer != null) return;
|
||||
|
||||
InstrumentPlayer = actor.PlayerSession;
|
||||
OpenUserInterface(actor.PlayerSession);
|
||||
InteractInstrument(eventArgs.User);
|
||||
}
|
||||
|
||||
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.User.TryGetComponent(out ActorComponent? actor)) return false;
|
||||
|
||||
if (InstrumentPlayer == actor.PlayerSession)
|
||||
{
|
||||
OpenUserInterface(actor.PlayerSession);
|
||||
}
|
||||
|
||||
InteractInstrument(eventArgs.User);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void InteractInstrument(IEntity user)
|
||||
{
|
||||
if (!user.TryGetComponent(out ActorComponent? actor)) return;
|
||||
|
||||
if (InstrumentPlayer != null || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user)) return;
|
||||
|
||||
InstrumentPlayer = actor.PlayerSession;
|
||||
OpenUserInterface(InstrumentPlayer);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private void UserInterfaceOnClosed(IPlayerSession player)
|
||||
{
|
||||
if (Handheld || player != InstrumentPlayer) return;
|
||||
|
||||
4
Resources/Changelog/Parts/instrument_dead.yml
Normal file
4
Resources/Changelog/Parts/instrument_dead.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
author: Zumorica
|
||||
changes:
|
||||
- type: Fix
|
||||
message: Fix being able to play
|
||||
Reference in New Issue
Block a user