Skip to content

Commit

Permalink
Merge branch 'master' into сrossbow
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison authored Oct 11, 2024
2 parents 49bcc60 + a8c9bbf commit 063a800
Show file tree
Hide file tree
Showing 23 changed files with 356 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,25 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<VoiceMaskerComponent, ImplantImplantedEvent>(OnInsert);
SubscribeLocalEvent<VoiceMaskerComponent, SubdermalImplantInserted>(OnInsert); // WD EDIT
SubscribeLocalEvent<SyrinxVoiceMaskComponent, TransformSpeakerNameEvent>(OnSpeakerNameTransform);
SubscribeLocalEvent<SyrinxVoiceMaskComponent, VoiceMaskChangeNameMessage>(OnChangeName);
// We need to remove the SyrinxVoiceMaskComponent from the owner before the implant
// is removed, so we need to execute before the SubdermalImplantSystem.
SubscribeLocalEvent<VoiceMaskerComponent, EntGotRemovedFromContainerMessage>(OnRemove, before: new[] { typeof(SubdermalImplantSystem) });
}

private void OnInsert(EntityUid uid, VoiceMaskerComponent component, ImplantImplantedEvent args)
// WD EDIT START
private void OnInsert(EntityUid uid, VoiceMaskerComponent component, SubdermalImplantInserted args)
{
if (!args.Implanted.HasValue ||
!_tag.HasTag(args.Implant, BionicSyrinxImplant))
if (_tag.HasTag(uid, BionicSyrinxImplant))
return;

var voicemask = EnsureComp<SyrinxVoiceMaskComponent>(args.Implanted.Value);
voicemask.VoiceName = MetaData(args.Implanted.Value).EntityName;
Dirty(args.Implanted.Value, voicemask);
var voicemask = EnsureComp<SyrinxVoiceMaskComponent>(args.Target);
voicemask.VoiceName = MetaData(args.Target).EntityName;
Dirty(args.Target, voicemask);
}
// WD EDIT END

private void OnRemove(EntityUid uid, VoiceMaskerComponent component, EntGotRemovedFromContainerMessage args)
{
Expand Down
64 changes: 0 additions & 64 deletions Content.Server/Mindshield/MindShieldSystem.cs

This file was deleted.

76 changes: 76 additions & 0 deletions Content.Server/_White/Implants/ImplantsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using Content.Server.Administration.Logs;
using Content.Server.Mind;
using Content.Server.Popups;
using Content.Server.Roles;
using Content.Shared._White.Implants.NeuroStabilization;
using Content.Shared.Database;
using Content.Shared.Implants;
using Content.Shared.Implants.Components;
using Content.Shared.Mindshield.Components;
using Content.Shared.Revolutionary.Components;
using Content.Shared.Tag;

namespace Content.Server._White.Implants;

public sealed class ImplantsSystem : EntitySystem
{
[Dependency] private readonly IAdminLogManager _adminLogManager = default!;
[Dependency] private readonly RoleSystem _roleSystem = default!;
[Dependency] private readonly MindSystem _mindSystem = default!;
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;

[ValidatePrototypeId<TagPrototype>]
private const string MindShieldTag = "MindShield";

[ValidatePrototypeId<TagPrototype>]
private const string NeuroStabilizationTag = "NeuroStabilization";

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SubdermalImplantComponent, SubdermalImplantInserted>(OnImplantInserted);
SubscribeLocalEvent<SubdermalImplantComponent, SubdermalImplantRemoved>(OnImplantRemoved);
}

private void OnImplantInserted(EntityUid uid, SubdermalImplantComponent component, SubdermalImplantInserted args)
{
if (_tag.HasTag(uid, MindShieldTag)
&& RevolutionCheck(uid, args.Target))
EnsureComp<MindShieldComponent>(args.Target);

if (_tag.HasTag(uid, NeuroStabilizationTag))
EnsureComp<NeuroStabilizationComponent>(args.Target);
}

private void OnImplantRemoved(EntityUid uid, SubdermalImplantComponent component, SubdermalImplantRemoved args)
{
if (_tag.HasTag(uid, MindShieldTag))
RemComp<MindShieldComponent>(args.Target);

if (_tag.HasTag(uid, NeuroStabilizationTag))
RemComp<NeuroStabilizationComponent>(args.Target);
}

/// <summary>
/// Checks if the implanted person was a Rev or Head Rev and remove role or destroy mindshield respectively.
/// </summary>
private bool RevolutionCheck(EntityUid uid, EntityUid target)
{
if (HasComp<HeadRevolutionaryComponent>(target))
{
_popupSystem.PopupEntity(Loc.GetString("head-rev-break-mindshield"), target);
QueueDel(uid);
return false;
}

if (_mindSystem.TryGetMind(target, out var mindId, out _)
&& _roleSystem.MindTryRemoveRole<RevolutionaryRoleComponent>(mindId))
{
_adminLogManager.Add(LogType.Mind, LogImpact.Medium,
$"{ToPrettyString(target)} was deconverted due to being implanted with a Mindshield.");
}

return true;
}
}
32 changes: 32 additions & 0 deletions Content.Shared/Implants/SharedImplanterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public void Implant(EntityUid user, EntityUid target, EntityUid implanter, Impla
implantContainer.OccludesLight = false;
_container.Insert(implant.Value, implantContainer);

RaiseLocalEvent(implant.Value, new SubdermalImplantInserted(user, target)); // WD EDIT

if (component.CurrentMode == ImplanterToggleMode.Inject && !component.ImplantOnly)
DrawMode(implanter, component);
else
Expand Down Expand Up @@ -146,6 +148,8 @@ public void Draw(EntityUid implanter, EntityUid user, EntityUid target, Implante
_container.Insert(implant, implanterContainer);
permanentFound = implantComp.Permanent;

RaiseLocalEvent(implant, new SubdermalImplantRemoved(user, target)); // WD EDIT

var ev = new TransferDnaEvent { Donor = target, Recipient = implanter };
RaiseLocalEvent(target, ref ev);

Expand Down Expand Up @@ -225,3 +229,31 @@ public AddImplantAttemptEvent(EntityUid user, EntityUid target, EntityUid implan
Implanter = implanter;
}
}

// WD EDIT START
public sealed class SubdermalImplantInserted(EntityUid user, EntityUid target)
{
/// <summary>
/// Entity who implants
/// </summary>
public EntityUid User = user;

/// <summary>
/// Entity being implanted
/// </summary>
public EntityUid Target = target;
}

public sealed class SubdermalImplantRemoved(EntityUid user, EntityUid target)
{
/// <summary>
/// Entity who removes implant
/// </summary>
public EntityUid User = user;

/// <summary>
/// Entity which implant is removing
/// </summary>
public EntityUid Target = target;
}
// WD EDIT END
25 changes: 2 additions & 23 deletions Content.Shared/Implants/SharedSubdermalImplantSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ private void OnInsert(EntityUid uid, SubdermalImplantComponent component, EntGot
}
}
}

var ev = new ImplantImplantedEvent(uid, component.ImplantedEntity.Value);
RaiseLocalEvent(uid, ref ev);
}

private void OnRemoveAttempt(EntityUid uid, SubdermalImplantComponent component, ContainerGettingRemovedAttemptEvent args)
Expand Down Expand Up @@ -125,6 +122,8 @@ public void ForceImplant(EntityUid target, EntityUid implant, SubdermalImplantCo

component.ImplantedEntity = target;
_container.Insert(implant, implantContainer);

RaiseLocalEvent(implant, new SubdermalImplantInserted(target, target)); // WD EDIT
}

/// <summary>
Expand Down Expand Up @@ -185,23 +184,3 @@ public ImplantRelayEvent(T ev)
Event = ev;
}
}

/// <summary>
/// Event that is raised whenever someone is implanted with any given implant.
/// Raised on the the implant entity.
/// </summary>
/// <remarks>
/// implant implant implant implant
/// </remarks>
[ByRefEvent]
public readonly struct ImplantImplantedEvent
{
public readonly EntityUid Implant;
public readonly EntityUid? Implanted;

public ImplantImplantedEvent(EntityUid implant, EntityUid? implanted)
{
Implant = implant;
Implanted = implanted;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Content.Shared._White.Implants.NeuroStabilization;

[RegisterComponent]
public sealed partial class NeuroStabilizationComponent : Component
{
[DataField]
public bool Electrocution = true;

[DataField]
public TimeSpan TimeElectrocution = TimeSpan.FromSeconds(1);

[DataField]
public float DamageModifier = 0.66f;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Content.Shared.Electrocution;
using Content.Shared.Damage.Systems;

namespace Content.Shared._White.Implants.NeuroStabilization;

public sealed class NeuroStabilizationSystem : EntitySystem
{
[Dependency] private readonly SharedElectrocutionSystem _electrocution = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<NeuroStabilizationComponent, BeforeStaminaDamageEvent>(BeforeStaminaDamage);
}

private void BeforeStaminaDamage(EntityUid uid, NeuroStabilizationComponent component, ref BeforeStaminaDamageEvent args)
{
args.Cancelled = true;

if (!component.Electrocution)
return;

var damage = (int) MathF.Round(args.Value * component.DamageModifier);
_electrocution.TryDoElectrocution(uid, null, damage, component.TimeElectrocution,
false, 0.5f, null, true);
}
}
37 changes: 37 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6502,3 +6502,40 @@ Entries:
id: 6360
time: '2024-09-29T12:15:14.0000000+00:00'
url: https://github.com/WWhiteDreamProject/wwdpublic/pull/68
- author: Spatison
changes:
- type: Tweak
message: Dwarf now weigh more / Дварфы теперь весят больше
id: 6361
time: '2024-10-11T03:54:12.0000000+00:00'
url: https://github.com/WWhiteDreamProject/wwdpublic/pull/83
- author: Spatison
changes:
- type: Fix
message: >-
No more discounts in uplink implant / Больше никаких скидок в имплант
аплинка
id: 6362
time: '2024-10-11T03:55:38.0000000+00:00'
url: https://github.com/WWhiteDreamProject/wwdpublic/pull/81
- author: Spatison
changes:
- type: Add
message: Added smoke implant / Добавлен имплант дыма
id: 6363
time: '2024-10-11T04:07:40.0000000+00:00'
url: https://github.com/WWhiteDreamProject/wwdpublic/pull/79
- author: Spatison
changes:
- type: Add
message: Added syndicate implanter / Добавлен имплантер синдиката
id: 6364
time: '2024-10-11T04:26:13.0000000+00:00'
url: https://github.com/WWhiteDreamProject/wwdpublic/pull/78
- author: Spatison
changes:
- type: Add
message: Added neuro stabilization Implant / Добавлен имплант нейро стабильности
id: 6365
time: '2024-10-11T05:03:33.0000000+00:00'
url: https://github.com/WWhiteDreamProject/wwdpublic/pull/80
9 changes: 9 additions & 0 deletions Resources/Locale/en-US/_white/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ uplink-betrayal-knife-desc = Syndicate teleporter, when used, moves 3-8 meters f
uplink-ebow-name = Small energy crossbow
uplink-ebow-desc = A fairly quiet weapon that automatically reloads and stuns. It goes well with other types of weapons.
uplink-neuro-control = Neuro stabilization implanter
uplink-neuro-control-desc = Blocks all of the incoming stamina damage while dealing shock damage instead.
uplink-implanter-name = Implanter
uplink-implanter-desc = An advanced implant that allows you to quickly insert and remove implants.
uplink-smoke-implant-name = Smoke implant
uplink-smoke-implant-desc = Releases a cloud of smoke when activated.
5 changes: 0 additions & 5 deletions Resources/Locale/ru-RU/_white/implants/neurostabilization.ftl

This file was deleted.

2 changes: 2 additions & 0 deletions Resources/Locale/ru-RU/_white/prototypes/actions/types.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ActivateSmokeImplant = Выпустить облако дыма
.desc = Выпускает облако дыма вокруг вас.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ent-NeuroStabilizationImplanter = { ent-BaseImplanter }
.desc = { ent-BaseImplanter.desc }
.suffix = нейро стабилизация
ent-ImplanterSyndi = { ent-BaseImplanter }
.desc = Компактный одноразовый шприц, предназначенный исключительно для введения и извлечения подкожных имплантатов.
ent-SmokeImplanter = { ent-BaseImplanter }
.desc = { ent-BaseImplanter.desc }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ent-NeuroStabilizationImplant = имплант нейро стабализации
.desc = Блокирует весь входящий урон по выносливости за счет шока.
ent-SmokeImplant = имплант дыма
.desc = Этот имплант выпускает облако дыма при активации.
Loading

0 comments on commit 063a800

Please sign in to comment.