diff --git a/Content.Server/Execution/ExecutionSystem.cs b/Content.Server/Execution/ExecutionSystem.cs index 4354608ca3..976c21149b 100644 --- a/Content.Server/Execution/ExecutionSystem.cs +++ b/Content.Server/Execution/ExecutionSystem.cs @@ -49,29 +49,29 @@ public sealed class ExecutionSystem : EntitySystem public override void Initialize() { base.Initialize(); - + SubscribeLocalEvent>(OnGetInteractionVerbsMelee); SubscribeLocalEvent>(OnGetInteractionVerbsGun); - + SubscribeLocalEvent(OnDoafterMelee); SubscribeLocalEvent(OnDoafterGun); } private void OnGetInteractionVerbsMelee( - EntityUid uid, + EntityUid uid, SharpComponent component, GetVerbsEvent args) { if (args.Hands == null || args.Using == null || !args.CanAccess || !args.CanInteract) return; - + var attacker = args.User; var weapon = args.Using!.Value; var victim = args.Target; if (!CanExecuteWithMelee(weapon, victim, attacker)) return; - + UtilityVerb verb = new() { Act = () => @@ -87,7 +87,7 @@ public sealed class ExecutionSystem : EntitySystem } private void OnGetInteractionVerbsGun( - EntityUid uid, + EntityUid uid, GunComponent component, GetVerbsEvent args) { @@ -100,7 +100,7 @@ public sealed class ExecutionSystem : EntitySystem if (!CanExecuteWithGun(weapon, victim, attacker)) return; - + UtilityVerb verb = new() { Act = () => @@ -120,15 +120,15 @@ public sealed class ExecutionSystem : EntitySystem // No point executing someone if they can't take damage if (!TryComp(victim, out var damage)) return false; - + // You can't execute something that cannot die if (!TryComp(victim, out var mobState)) return false; - + // You're not allowed to execute dead people (no fun allowed) if (_mobStateSystem.IsDead(victim, mobState)) return false; - + // You must be able to attack people to execute if (!_actionBlockerSystem.CanAttack(attacker, victim)) return false; @@ -144,25 +144,25 @@ public sealed class ExecutionSystem : EntitySystem private bool CanExecuteWithMelee(EntityUid weapon, EntityUid victim, EntityUid user) { if (!CanExecuteWithAny(weapon, victim, user)) return false; - + // We must be able to actually hurt people with the weapon if (!TryComp(weapon, out var melee) && melee!.Damage.GetTotal() > 0.0f) return false; return true; } - + private bool CanExecuteWithGun(EntityUid weapon, EntityUid victim, EntityUid user) { if (!CanExecuteWithAny(weapon, victim, user)) return false; - + // We must be able to actually fire the gun if (!TryComp(weapon, out var gun) && _gunSystem.CanShoot(gun!)) return false; return true; } - + private void TryStartMeleeExecutionDoafter(EntityUid weapon, EntityUid victim, EntityUid attacker) { if (!CanExecuteWithMelee(weapon, victim, attacker)) @@ -180,7 +180,7 @@ public sealed class ExecutionSystem : EntitySystem ShowExecutionPopup("execution-popup-melee-initial-internal", Filter.Entities(attacker), PopupType.Medium, attacker, victim, weapon); ShowExecutionPopup("execution-popup-melee-initial-external", Filter.PvsExcept(attacker), PopupType.MediumCaution, attacker, victim, weapon); } - + var doAfter = new DoAfterArgs(EntityManager, attacker, executionTime, new ExecutionDoAfterEvent(), weapon, target: victim, used: weapon) { @@ -192,12 +192,12 @@ public sealed class ExecutionSystem : EntitySystem _doAfterSystem.TryStartDoAfter(doAfter); } - + private void TryStartGunExecutionDoafter(EntityUid weapon, EntityUid victim, EntityUid attacker) { if (!CanExecuteWithGun(weapon, victim, attacker)) return; - + if (attacker == victim) { ShowExecutionPopup("suicide-popup-gun-initial-internal", Filter.Entities(attacker), PopupType.Medium, attacker, victim, weapon); @@ -225,10 +225,10 @@ public sealed class ExecutionSystem : EntitySystem { if (args.Handled || args.Cancelled || args.Used == null || args.Target == null) return false; - + if (!CanExecuteWithAny(args.Used.Value, args.Target.Value, uid)) return false; - + // All checks passed return true; } @@ -237,7 +237,7 @@ public sealed class ExecutionSystem : EntitySystem { if (args.Handled || args.Cancelled || args.Used == null || args.Target == null) return; - + var attacker = args.User; var victim = args.Target!.Value; var weapon = args.Used!.Value; @@ -246,7 +246,7 @@ public sealed class ExecutionSystem : EntitySystem if (!TryComp(weapon, out var melee) && melee!.Damage.GetTotal() > 0.0f) return; - + _damageableSystem.TryChangeDamage(victim, melee.Damage * DamageModifier, true); _audioSystem.PlayEntity(melee.HitSound, Filter.Pvs(weapon), weapon, true, AudioParams.Default); @@ -261,26 +261,26 @@ public sealed class ExecutionSystem : EntitySystem ShowExecutionPopup("execution-popup-melee-complete-external", Filter.PvsExcept(attacker), PopupType.MediumCaution, attacker, victim, weapon); } } - + // TODO: This repeats a lot of the code of the serverside GunSystem, make it not do that private void OnDoafterGun(EntityUid uid, GunComponent component, DoAfterEvent args) { if (args.Handled || args.Cancelled || args.Used == null || args.Target == null) return; - + var attacker = args.User; var weapon = args.Used!.Value; var victim = args.Target!.Value; if (!CanExecuteWithGun(weapon, victim, attacker)) return; - + // Check if any systems want to block our shot var prevention = new ShotAttemptedEvent { User = attacker, Used = weapon }; - + RaiseLocalEvent(weapon, ref prevention); if (prevention.Cancelled) return; @@ -288,7 +288,7 @@ public sealed class ExecutionSystem : EntitySystem RaiseLocalEvent(attacker, ref prevention); if (prevention.Cancelled) return; - + // Not sure what this is for but gunsystem uses it so ehhh var attemptEv = new AttemptShootEvent(attacker, null); RaiseLocalEvent(weapon, ref attemptEv); @@ -297,11 +297,11 @@ public sealed class ExecutionSystem : EntitySystem { if (attemptEv.Message != null) { - _popupSystem.PopupClient(attemptEv.Message, weapon, attacker); + _popupSystem.PopupEntity(attemptEv.Message, weapon, attacker); return; } } - + // Take some ammunition for the shot (one bullet) var fromCoordinates = Transform(attacker).Coordinates; var ev = new TakeAmmoEvent(1, new List<(EntityUid? Entity, IShootable Shootable)>(), fromCoordinates, attacker); @@ -314,7 +314,7 @@ public sealed class ExecutionSystem : EntitySystem ShowExecutionPopup("execution-popup-gun-empty", Filter.Pvs(weapon), PopupType.Medium, attacker, victim, weapon); return; } - + // Information about the ammo like damage DamageSpecifier damage = new DamageSpecifier(); @@ -335,9 +335,9 @@ public sealed class ExecutionSystem : EntitySystem cartridge.Spent = true; _appearanceSystem.SetData(ammoUid!.Value, AmmoVisuals.Spent, true); Dirty(ammoUid.Value, cartridge); - + break; - + case AmmoComponent newAmmo: TryComp(ammoUid, out var projectileB); if (projectileB != null) @@ -346,11 +346,11 @@ public sealed class ExecutionSystem : EntitySystem } Del(ammoUid); break; - + case HitscanPrototype hitscan: damage = hitscan.Damage!; break; - + default: throw new ArgumentOutOfRangeException(); } @@ -369,11 +369,11 @@ public sealed class ExecutionSystem : EntitySystem return; } } - + // Gun successfully fired, deal damage _damageableSystem.TryChangeDamage(victim, damage * DamageModifier, true); _audioSystem.PlayEntity(component.SoundGunshot, Filter.Pvs(weapon), weapon, false, AudioParams.Default); - + // Popups if (attacker != victim) { @@ -394,4 +394,4 @@ public sealed class ExecutionSystem : EntitySystem locString, ("attacker", attacker), ("victim", victim), ("weapon", weapon)), attacker, filter, true, type); } -} \ No newline at end of file +} diff --git a/Content.Server/Interaction/InteractionPopupSystem.cs b/Content.Server/Interaction/InteractionPopupSystem.cs index eaeaf14bae..1115f2c0d8 100644 --- a/Content.Server/Interaction/InteractionPopupSystem.cs +++ b/Content.Server/Interaction/InteractionPopupSystem.cs @@ -120,7 +120,7 @@ public sealed class InteractionPopupSystem : EntitySystem _popupSystem.PopupEntity(msg, uid, user); _popupSystem.PopupEntity(msgOthers, uid, Filter.PvsExcept(user, entityManager: EntityManager), true); } - else + else if (msg != "") // WD edit _popupSystem.PopupEntity(msg, uid, user); //play only for the initiating entity. if (sfx is not null) //not all cases will have sound. diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 5f8904e94b..f73ba26b68 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -323,7 +323,7 @@ namespace Content.Server.VendingMachines if (_accessReader.IsAllowed(sender, uid, accessReader) || HasComp(uid)) return true; - Popup.PopupClient(Loc.GetString("vending-machine-component-try-eject-access-denied"), uid, sender); + Popup.PopupEntity(Loc.GetString("vending-machine-component-try-eject-access-denied"), uid, sender); Deny(uid, vendComponent); return false; } @@ -352,7 +352,7 @@ namespace Content.Server.VendingMachines if (entry == null) { if (sender.HasValue) - Popup.PopupClient(Loc.GetString("vending-machine-component-try-eject-invalid-item"), uid, sender.Value); + Popup.PopupEntity(Loc.GetString("vending-machine-component-try-eject-invalid-item"), uid, sender.Value); Deny(uid, vendComponent); @@ -362,7 +362,7 @@ namespace Content.Server.VendingMachines if (entry.Amount <= 0) { if (sender.HasValue) - Popup.PopupClient(Loc.GetString("vending-machine-component-try-eject-out-of-stock"), uid, sender.Value); + Popup.PopupEntity(Loc.GetString("vending-machine-component-try-eject-out-of-stock"), uid, sender.Value); Deny(uid, vendComponent); return; diff --git a/Content.Server/Xenoarchaeology/Equipment/Systems/NodeScannerSystem.cs b/Content.Server/Xenoarchaeology/Equipment/Systems/NodeScannerSystem.cs index 3cafefe389..e3e6d60540 100644 --- a/Content.Server/Xenoarchaeology/Equipment/Systems/NodeScannerSystem.cs +++ b/Content.Server/Xenoarchaeology/Equipment/Systems/NodeScannerSystem.cs @@ -1,7 +1,7 @@ -using Content.Server.Popups; using Content.Server.Xenoarchaeology.Equipment.Components; using Content.Server.Xenoarchaeology.XenoArtifacts; using Content.Shared.Interaction; +using Content.Shared.Popups; using Content.Shared.Timing; namespace Content.Server.Xenoarchaeology.Equipment.Systems; @@ -9,7 +9,7 @@ namespace Content.Server.Xenoarchaeology.Equipment.Systems; public sealed class NodeScannerSystem : EntitySystem { [Dependency] private readonly UseDelaySystem _useDelay = default!; - [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedPopupSystem _popupSystem = default!; /// public override void Initialize() @@ -36,7 +36,7 @@ public sealed class NodeScannerSystem : EntitySystem return; // WD edit - _popupSystem.PopupClient(Loc.GetString("node-scan-popup", + _popupSystem.PopupEntity(Loc.GetString("node-scan-popup", ("id", $"{artifact.CurrentNodeId}")), target, args.User); } } diff --git a/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs b/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs index 52729f4d94..d3dff143eb 100644 --- a/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs +++ b/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs @@ -147,12 +147,12 @@ public sealed class CultistFactorySystem : EntitySystem if (args.IsAnchored) { _transform.Unanchor(target, xform); - _popup.PopupClient(Loc.GetString("anchorable-unanchored"), uid, args.User); + _popup.PopupEntity(Loc.GetString("anchorable-unanchored"), uid, args.User); } else { _transform.AnchorEntity(target, xform); - _popup.PopupClient(Loc.GetString("anchorable-anchored"), uid, args.User); + _popup.PopupEntity(Loc.GetString("anchorable-anchored"), uid, args.User); } _audio.PlayPvs("/Audio/Items/ratchet.ogg", uid); diff --git a/Content.Shared/_White/BetrayalDagger/BackstabSystem.cs b/Content.Shared/_White/BetrayalDagger/BackstabSystem.cs index 72882c38de..fa11986080 100644 --- a/Content.Shared/_White/BetrayalDagger/BackstabSystem.cs +++ b/Content.Shared/_White/BetrayalDagger/BackstabSystem.cs @@ -48,5 +48,10 @@ public sealed class BackstabSystem : EntitySystem args.PenetrateArmor = ent.Comp.PenetrateArmor; + if (!_net.IsServer) + return; + + var message = Loc.GetString("backstab-damage-betrayal-dagger", ("damage", damage)); + _popup.PopupClient(message, args.User, args.User, PopupType.MediumCaution); } } diff --git a/Resources/Locale/ru-RU/White/items/betrayal-dagger.ftl b/Resources/Locale/ru-RU/White/items/betrayal-dagger.ftl new file mode 100644 index 0000000000..288bb28d72 --- /dev/null +++ b/Resources/Locale/ru-RU/White/items/betrayal-dagger.ftl @@ -0,0 +1 @@ +backstab-damage-betrayal-dagger = Удар в спину: {$damage}!