|
|
|
|
@@ -151,8 +151,7 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|
|
|
|
if (IsHolopadControlLocked(entity, args.Actor))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (entityTelephone.CurrentState != TelephoneState.EndingCall && entityTelephone.CurrentState != TelephoneState.Idle)
|
|
|
|
|
_telephoneSystem.EndTelephoneCalls((entity, entityTelephone));
|
|
|
|
|
_telephoneSystem.EndTelephoneCalls((entity, entityTelephone));
|
|
|
|
|
|
|
|
|
|
// If the user is an AI, end all calls originating from its
|
|
|
|
|
// associated core to ensure that any broadcasts will end
|
|
|
|
|
@@ -160,8 +159,7 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|
|
|
|
!_stationAiSystem.TryGetStationAiCore((args.Actor, stationAiHeld), out var stationAiCore))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (TryComp<TelephoneComponent>(stationAiCore, out var telephone) &&
|
|
|
|
|
telephone.CurrentState != TelephoneState.EndingCall && telephone.CurrentState != TelephoneState.Idle)
|
|
|
|
|
if (TryComp<TelephoneComponent>(stationAiCore, out var telephone))
|
|
|
|
|
_telephoneSystem.EndTelephoneCalls((stationAiCore.Value, telephone));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -215,7 +213,8 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|
|
|
|
{
|
|
|
|
|
var receiver = new Entity<TelephoneComponent>(receiverUid, receiverTelephone);
|
|
|
|
|
|
|
|
|
|
if (!_telephoneSystem.IsSourceAbleToReachReceiver(source, receiver))
|
|
|
|
|
// Check if the core can reach the call source, rather than the other way around
|
|
|
|
|
if (!_telephoneSystem.IsSourceAbleToReachReceiver(receiver, source))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (_telephoneSystem.IsTelephoneEngaged(receiver))
|
|
|
|
|
@@ -230,10 +229,9 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|
|
|
|
LinkHolopadToUser(entity, args.Actor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!reachableAiCores.Any())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_telephoneSystem.BroadcastCallToTelephones(source, reachableAiCores, args.Actor);
|
|
|
|
|
// Ignore range so that holopads that ignore other devices on the same grid can request the AI
|
|
|
|
|
var options = new TelephoneCallOptions { IgnoreRange = true };
|
|
|
|
|
_telephoneSystem.BroadcastCallToTelephones(source, reachableAiCores, args.Actor, options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -354,6 +352,9 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|
|
|
|
|
|
|
|
|
private void OnHolopadShutdown(Entity<HolopadComponent> entity, ref ComponentShutdown args)
|
|
|
|
|
{
|
|
|
|
|
if (TryComp<TelephoneComponent>(entity, out var telphone) && _telephoneSystem.IsTelephoneEngaged((entity.Owner, telphone)))
|
|
|
|
|
_telephoneSystem.EndTelephoneCalls((entity, telphone));
|
|
|
|
|
|
|
|
|
|
ShutDownHolopad(entity);
|
|
|
|
|
SetHolopadAmbientState(entity, false);
|
|
|
|
|
}
|
|
|
|
|
@@ -610,14 +611,8 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|
|
|
|
UnlinkHolopadFromUser(entity, entity.Comp.User.Value);
|
|
|
|
|
|
|
|
|
|
if (TryComp<StationAiCoreComponent>(entity, out var stationAiCore))
|
|
|
|
|
{
|
|
|
|
|
_stationAiSystem.SwitchRemoteEntityMode((entity.Owner, stationAiCore), true);
|
|
|
|
|
|
|
|
|
|
if (TryComp<TelephoneComponent>(entity, out var stationAiCoreTelphone) &&
|
|
|
|
|
stationAiCoreTelphone.CurrentState != TelephoneState.EndingCall && stationAiCoreTelphone.CurrentState != TelephoneState.Idle)
|
|
|
|
|
_telephoneSystem.EndTelephoneCalls((entity, stationAiCoreTelphone));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dirty(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -668,8 +663,12 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|
|
|
|
|
|
|
|
|
var source = new Entity<TelephoneComponent>(stationAiCore.Value, stationAiTelephone);
|
|
|
|
|
|
|
|
|
|
// Check if the AI is unable to activate the projector (unlikely this will ever pass; its just a safeguard)
|
|
|
|
|
if (!_telephoneSystem.IsSourceInRangeOfReceiver(source, receiver))
|
|
|
|
|
{
|
|
|
|
|
_popupSystem.PopupEntity(Loc.GetString("holopad-ai-is-unable-to-activate-projector"), receiver, user);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Terminate any calls that the core is hosting and immediately connect to the receiver
|
|
|
|
|
_telephoneSystem.TerminateTelephoneCalls(source);
|
|
|
|
|
@@ -714,7 +713,6 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|
|
|
|
var receiverTelephoneEntity = new Entity<TelephoneComponent>(receiver, receiverTelephone);
|
|
|
|
|
|
|
|
|
|
if (sourceTelephoneEntity == receiverTelephoneEntity ||
|
|
|
|
|
receiverTelephone.UnlistedNumber ||
|
|
|
|
|
!_telephoneSystem.IsSourceAbleToReachReceiver(sourceTelephoneEntity, receiverTelephoneEntity))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|