diff --git a/Content.Server/Body/Systems/BodySystem.cs b/Content.Server/Body/Systems/BodySystem.cs index 2063887798..b5166b1016 100644 --- a/Content.Server/Body/Systems/BodySystem.cs +++ b/Content.Server/Body/Systems/BodySystem.cs @@ -14,6 +14,7 @@ using Content.Shared.Movement.Systems; using Robust.Shared.Audio; using Robust.Shared.Timing; using Robust.Shared.Player; +using Content.Server._Starlight.Medical.Limbs; namespace Content.Server.Body.Systems; @@ -25,6 +26,7 @@ public sealed class BodySystem : SharedBodySystem [Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly SharedMindSystem _mindSystem = default!; [Dependency] private readonly ISharedPlayerManager _player = default!; + [Dependency] private readonly LimbSystem _limbSystem = default!;//🌟Starlight🌟 public override void Initialize() { @@ -74,6 +76,9 @@ public sealed class BodySystem : SharedBodySystem var layers = HumanoidVisualLayersExtension.Sublayers(layer.Value); _humanoidSystem.SetLayersVisibility(bodyEnt.Owner, layers, visible: true); } + + if (TryComp(bodyEnt, out var humanoid)) + _limbSystem.AddLimbVisual((bodyEnt, humanoid), partEnt); //🌟Starlight🌟 } protected override void RemovePart( diff --git a/Content.Server/_Sunrise/Animations/EmoteAnimationSystem.cs b/Content.Server/_Sunrise/Animations/EmoteAnimationSystem.cs index 17bfc3ec32..33c4a1817c 100644 --- a/Content.Server/_Sunrise/Animations/EmoteAnimationSystem.cs +++ b/Content.Server/_Sunrise/Animations/EmoteAnimationSystem.cs @@ -30,12 +30,18 @@ public sealed class EmoteAnimationSystem : EntitySystem { SubscribeLocalEvent(OnGetState); SubscribeLocalEvent(OnEmote); - SubscribeLocalEvent(OnPlayEmote); + SubscribeAllEvent(OnPlayEmote); } - private void OnPlayEmote(EntityUid uid, EmoteAnimationComponent component, PlayEmoteMessage args) + private void OnPlayEmote(PlayEmoteMessage msg, EntitySessionEventArgs args) { - if (!_prototypeManager.TryIndex(args.ProtoId, out var proto)) + if (args.SenderSession.AttachedEntity is not {} uid) + return; + + if (!HasComp(uid)) + return; + + if (!_prototypeManager.TryIndex(msg.ProtoId, out var proto)) return; _chat.TryEmoteWithChat(uid, proto.ID); diff --git a/Content.Server/_Sunrise/CryoTeleport/CryoTeleportSystem.cs b/Content.Server/_Sunrise/CryoTeleport/CryoTeleportSystem.cs index 3b7b39ecf8..d39003e22e 100644 --- a/Content.Server/_Sunrise/CryoTeleport/CryoTeleportSystem.cs +++ b/Content.Server/_Sunrise/CryoTeleport/CryoTeleportSystem.cs @@ -127,7 +127,7 @@ public sealed class CryoTeleportationSystem : EntitySystem var container = _container.EnsureContainer(cryoStorage.Value, "storage"); - if (!_container.Insert(uid, container)) + if (_container.Insert(uid, container)) _cryostorage.HandleEnterCryostorage((uid, containedComp), comp.UserId); } } diff --git a/Content.Server/_Sunrise/Disease/DiseaseRoleSystem.cs b/Content.Server/_Sunrise/Disease/DiseaseRoleSystem.cs index 170dedf219..e535c95786 100644 --- a/Content.Server/_Sunrise/Disease/DiseaseRoleSystem.cs +++ b/Content.Server/_Sunrise/Disease/DiseaseRoleSystem.cs @@ -118,7 +118,7 @@ public sealed class DiseaseRoleSystem : SharedDiseaseRoleSystem infoText.AppendLine("├─ " + Loc.GetString("disease-info-infected-count") + ": " + component.Infected.Count); infoText.Append("└─ " + Loc.GetString("disease-info-total-infected") + ": " + component.SickOfAllTime); - _popup.PopupEntity(infoText.ToString(), uid, PopupType.Large); + _popup.PopupEntity(infoText.ToString(), uid, uid, PopupType.Large); } diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 6397ac0dff..301707c66b 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -352,7 +352,7 @@ namespace Content.Shared.Cuffs if (!args.Cancelled && TryAddNewCuffs(target, user, uid, cuffable)) { - // component.Used = true; // Starlight-Abductor edit + component.Used = true; _audio.PlayPredicted(component.EndCuffSound, uid, user); var popupText = (user == target) diff --git a/Content.Shared/_Starlight/Medical/Surgery/SharedSurgerySystem.BaseSteps.cs b/Content.Shared/_Starlight/Medical/Surgery/SharedSurgerySystem.BaseSteps.cs index 4892d551d9..c7f2e43476 100644 --- a/Content.Shared/_Starlight/Medical/Surgery/SharedSurgerySystem.BaseSteps.cs +++ b/Content.Shared/_Starlight/Medical/Surgery/SharedSurgerySystem.BaseSteps.cs @@ -1,6 +1,8 @@ using Content.Shared.Body.Part; +using Content.Shared.Body.Systems; using Content.Shared.Buckle.Components; using Content.Shared.DoAfter; +using Content.Shared.Interaction; using Content.Shared.Inventory; using Content.Shared.Item; using Content.Shared.Item.ItemToggle.Components; @@ -24,6 +26,7 @@ public abstract partial class SharedSurgerySystem SubscribeLocalEvent(OnClearProgressStep); SubscribeLocalEvent(OnStep); SubscribeLocalEvent(OnTargetDoAfter); + SubscribeLocalEvent(OnOverrideAccess); SubscribeLocalEvent(OnCanPerformStep); @@ -71,6 +74,24 @@ public abstract partial class SharedSurgerySystem RefreshUI(ent); } + private void OnOverrideAccess(Entity ent, ref AccessibleOverrideEvent args) + { + // Check if the entity is the target to avoid giving the hooked entity access to everything. + // If we already have access we don't need to run more code. + if (args.Accessible || args.Target != ent.Owner) + return; + + var xform = Transform(ent); + var root = _containers.GetContainingContainers((ent, xform)).FirstOrDefault(x => x.ID == SharedBodySystem.BodyRootContainerId); //get the root container + if (root == null) + return; + if (!_interaction.CanAccess(args.User, root.Owner)) + return; + + args.Accessible = true; + args.Handled = true; + } + private void OnClearProgressStep(Entity ent, ref SurgeryStepCompleteEvent args) { var progress = Comp(args.Part); @@ -148,7 +169,7 @@ public abstract partial class SharedSurgerySystem if (args.Invalid != StepInvalidReason.None) return; - + if (_inventory.TryGetContainerSlotEnumerator(args.Body, out var enumerator, args.TargetSlots)) { var items = 0f; @@ -270,7 +291,7 @@ public abstract partial class SharedSurgerySystem foreach (var requirementId in requirementsIds) { if (!_entitySystem.TryGetSingleton(requirementId, out var requirement) - && GetNextStep(body, part, requirement, requirements) is { } requiredNext + && GetNextStep(body, part, requirement, requirements) is { } requiredNext && IsSurgeryValid(body, part, requirementId, requiredNext.Surgery.Comp.Steps[requiredNext.Step], out _, out _, out _)) return requiredNext; } @@ -296,8 +317,8 @@ public abstract partial class SharedSurgerySystem foreach (var requirement in requirements) { if (!_entitySystem.TryGetSingleton(requirement, out var requiredEnt) - || !TryComp(requiredEnt, out SurgeryComponent? requiredComp) - || !PreviousStepsComplete(body, part, (requiredEnt, requiredComp), step) + || !TryComp(requiredEnt, out SurgeryComponent? requiredComp) + || !PreviousStepsComplete(body, part, (requiredEnt, requiredComp), step) && IsSurgeryValid(body, part, requirement, step, out _, out _, out _)) return false; } diff --git a/Content.Shared/_Starlight/Medical/Surgery/SharedSurgerySystem.cs b/Content.Shared/_Starlight/Medical/Surgery/SharedSurgerySystem.cs index 1349d23839..5ac67034d1 100644 --- a/Content.Shared/_Starlight/Medical/Surgery/SharedSurgerySystem.cs +++ b/Content.Shared/_Starlight/Medical/Surgery/SharedSurgerySystem.cs @@ -49,6 +49,7 @@ public abstract partial class SharedSurgerySystem : EntitySystem [Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly SharedItemSystem _item = default!; [Dependency] private readonly StarlightEntitySystem _entitySystem = default!; + [Dependency] private readonly SharedInteractionSystem _interaction = default!; public override void Initialize() {