forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ss14Starlight/Starlight
Antag Weights change
- Loading branch information
Showing
93 changed files
with
570,501 additions
and
409,862 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Content.Server/_Starlight/AccessClothingBlockerSystem/AccessClothingBlockerComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Content.Shared.NPC.Prototypes; | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; | ||
|
||
namespace Content.Server.Starlight.FactionClothingBlockerSystem; | ||
|
||
[RegisterComponent] | ||
public sealed partial class AccessClothingBlockerComponent : Component | ||
{ | ||
[DataField("access", required: false)] | ||
public string? Access = null; | ||
|
||
[DataField("beepSound")] | ||
public SoundSpecifier BeepSound = new SoundPathSpecifier("/Audio/Effects/beep1.ogg"); | ||
} |
84 changes: 84 additions & 0 deletions
84
Content.Server/_Starlight/AccessClothingBlockerSystem/AccessClothingBlockerSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using System.Threading.Tasks; | ||
using System.Linq; | ||
using Content.Server.Body.Systems; | ||
using Content.Server.Explosion.EntitySystems; | ||
using Content.Server.Popups; | ||
using Content.Shared.Access.Components; | ||
using Content.Shared.Access.Systems; | ||
using Content.Shared.Interaction.Components; | ||
using Content.Shared.Inventory.Events; | ||
using Content.Shared.Popups; | ||
using Robust.Server.Audio; | ||
|
||
namespace Content.Server.Starlight.FactionClothingBlockerSystem; | ||
|
||
public sealed class AccessClothingBlockerSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly PopupSystem _popup = default!; | ||
[Dependency] private readonly BodySystem _bodySystem = default!; | ||
[Dependency] private readonly ExplosionSystem _explosionSystem = default!; | ||
[Dependency] private readonly AudioSystem _audioSystem = default!; | ||
[Dependency] private readonly AccessReaderSystem _accessReader = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<AccessClothingBlockerComponent, GotEquippedEvent>(OnGotEquipped); | ||
} | ||
|
||
private async void OnGotEquipped(EntityUid uid, AccessClothingBlockerComponent component, GotEquippedEvent args) | ||
{ | ||
var canUse = false; | ||
if (!TryComp<AccessReaderComponent>(uid, out var accessReader)) | ||
canUse = true; | ||
|
||
if (component.Access != null) | ||
{ | ||
var accesses = _accessReader.FindAccessTags(args.Equipee); | ||
if (accesses.Any(a => a.ToString() == component.Access)) | ||
canUse = true; | ||
} | ||
|
||
else if (_accessReader.IsAllowed(args.Equipee, uid, accessReader) ) | ||
canUse = true; | ||
|
||
if (canUse) | ||
return; | ||
|
||
EntityManager.EnsureComponent<UnremoveableComponent>(uid); | ||
await PopupWithDelays(uid, component); | ||
_bodySystem.GibBody(args.Equipee, true); | ||
_explosionSystem.QueueExplosion(uid, "Default", 50, 5, 30, canCreateVacuum: false); | ||
} | ||
|
||
private async Task PopupWithDelays(EntityUid uid, AccessClothingBlockerComponent component) | ||
{ | ||
var notifications = new[] | ||
{ | ||
new { Message = Loc.GetString("access-clothing-blocker-notify-wrong-user-detected"), Delay = TimeSpan.FromSeconds(2), PopupType = PopupType.LargeCaution }, | ||
new { Message = Loc.GetString("access-clothing-blocker-notify-inclusion-bolts"), Delay = TimeSpan.FromSeconds(2), PopupType = PopupType.LargeCaution }, | ||
new { Message = Loc.GetString("access-clothing-blocker-notify-activate-self-destruction"), Delay = TimeSpan.FromSeconds(2), PopupType = PopupType.LargeCaution } | ||
}; | ||
|
||
foreach (var notification in notifications) | ||
{ | ||
|
||
_audioSystem.PlayPvs(component.BeepSound, uid); | ||
await PopupWithDelay(notification.Message, uid, notification.PopupType); | ||
await Task.Delay(notification.Delay); | ||
} | ||
|
||
for (int i = 10; i > 0; i--) | ||
{ | ||
_audioSystem.PlayPvs(component.BeepSound, uid); | ||
await PopupWithDelay(i.ToString(), uid, PopupType.LargeCaution); | ||
await Task.Delay(TimeSpan.FromSeconds(1)); | ||
} | ||
} | ||
|
||
private async Task PopupWithDelay(string message, EntityUid uid, PopupType popupType) | ||
{ | ||
_popup.PopupEntity(message, uid, popupType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
Content.Shared/Mech/Equipment/Components/MechNightVisionComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Content.Shared.Mech.Equipment.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class MechNightVisionComponent : Component | ||
{ | ||
} |
Oops, something went wrong.