-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into hardlight-spear
- Loading branch information
Showing
18 changed files
with
216 additions
and
104 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 was deleted.
Oops, something went wrong.
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,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; | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
Content.Shared/_White/Implants/NeuroStabilization/NeuroStabilizerComponent.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,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; | ||
} |
28 changes: 28 additions & 0 deletions
28
Content.Shared/_White/Implants/NeuroStabilization/NeuroStabilizerSystem.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,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); | ||
} | ||
} |
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
5 changes: 0 additions & 5 deletions
5
Resources/Locale/ru-RU/_white/implants/neurostabilization.ftl
This file was deleted.
Oops, something went wrong.
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
3 changes: 3 additions & 0 deletions
3
Resources/Locale/ru-RU/_white/prototypes/entities/objects/misc/subdermal_implants.ftl
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
ent-HardlightSpearImplant = имплант световое копьё | ||
.desc = Этот имплант создаёт световое копьё в ваших руках. | ||
ent-NeuroStabilizationImplant = имплант нейро стабализации | ||
.desc = Блокирует весь входящий урон по выносливости за счет шока. | ||
ent-SmokeImplant = имплант дыма | ||
.desc = Этот имплант выпускает облако дыма при активации. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,7 +322,6 @@ | |
noSpawn: true | ||
components: | ||
- type: SubdermalImplant | ||
permanent: true | ||
- type: Tag | ||
tags: | ||
- MindShield |
Oops, something went wrong.