Skip to content

Commit

Permalink
НАДЕЮСЬ ВСЕ ЫАЫАФЫАФЫАФЫАФЫАФЫАФЫ................
Browse files Browse the repository at this point in the history
  • Loading branch information
Inconnu1337 committed Oct 21, 2024
1 parent 3ff9c80 commit 72c44cc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
5 changes: 2 additions & 3 deletions Content.Server/ADT/DNALocker/Components/DNALockerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ namespace Content.Server.DNALocker;
public sealed partial class DNALockerComponent : Component
{
[DataField]
public string? DNA;
public string DNA = string.Empty;

[DataField]
public bool Locked = false;
public bool IsLocked => DNA != string.Empty;

[DataField]
public bool IsEquipped = false;
Expand Down
33 changes: 16 additions & 17 deletions Content.Server/ADT/DNALocker/Systems/DNALockerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public void LockEntity(EntityUid uid, DNALockerComponent component, EntityUid eq
}

component.DNA = dna.DNA;
component.Locked = true;
_audioSystem.PlayPvs(component.LockSound, uid);
var selfMessage = Loc.GetString("dna-locker-success");
_popup.PopupEntity(selfMessage, equipee, equipee);
Expand All @@ -62,7 +61,7 @@ public void ExplodeEntity(EntityUid uid, DNALockerComponent component, EntityUid
private void OnEquip(EntityUid uid, DNALockerComponent component, GotEquippedEvent args)
{
Log.Debug($"{args.Slot}");
if (!component.Locked)
if (!component.IsLocked)
{
LockEntity(uid, component, args.Equipee);
return;
Expand All @@ -79,25 +78,25 @@ private void OnEquip(EntityUid uid, DNALockerComponent component, GotEquippedEve

private void OnGotEmagged(EntityUid uid, DNALockerComponent component, ref GotEmaggedEvent args)
{
if (component.CanBeEmagged)
if (!component.CanBeEmagged)
return;

component.DNA = string.Empty;
_audioSystem.PlayPvs(component.EmagSound, uid);
var userUid = args.UserUid;
Timer.Spawn(1500, () =>
{
component.Locked = false;
_audioSystem.PlayPvs(component.EmagSound, uid);
var userUid = args.UserUid;
Timer.Spawn(1500, () =>
{
_audioSystem.PlayPvs(component.LockSound, uid);
var selfMessage = Loc.GetString("dna-locker-unlock");
_popup.PopupEntity(selfMessage, uid, userUid);
});
args.Repeatable = true;
args.Handled = true;
}
_audioSystem.PlayPvs(component.LockSound, uid);
var selfMessage = Loc.GetString("dna-locker-unlock");
_popup.PopupEntity(selfMessage, uid, userUid);
});
args.Repeatable = true;
args.Handled = true;
}

private void OnAltVerb(EntityUid uid, DNALockerComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!component.Locked)
if (!component.IsLocked)
return;

AlternativeVerb verbDNALock = new()
Expand All @@ -116,7 +115,7 @@ private void MakeUnlocked(EntityUid uid, DNALockerComponent component, EntityUid
var unlocked = Loc.GetString("dna-locker-unlock");
_audioSystem.PlayPvs(component.LockSound, userUid);
_popup.PopupEntity(unlocked, uid, userUid);
component.Locked = false;
component.DNA = string.Empty;
}
else
{
Expand Down

0 comments on commit 72c44cc

Please sign in to comment.