Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Очистка ДНК генокрада #507

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private void OnLayEggs(EntityUid uid, LingSlugComponent component, LingEggAction

}

public ProtoId<DamageGroupPrototype> GeneticDamageGroup = "Genetic";
private void OnLayEggsDoAfter(EntityUid uid, LingSlugComponent component, LingEggDoAfterEvent args)
{
if (args.Handled || args.Args.Target == null)
Expand All @@ -98,6 +99,11 @@ private void OnLayEggsDoAfter(EntityUid uid, LingSlugComponent component, LingEg
else
{
var holderComp = EnsureComp<LingEggsHolderComponent>(target);

holderComp.Stomach = ContainerSystem.EnsureContainer<Container>(target, "stomach");
var damage_genetic = new DamageSpecifier(_proto.Index(GeneticDamageGroup), holderComp.DamageAmount);
_damageableSystem.TryChangeDamage(target, damage_genetic); /// To be sure that target is dead

var lingComp = EnsureComp<ChangelingComponent>(target);
var xform = Transform(target);
var selfMessage = Loc.GetString("changeling-eggs-self-success", ("target", Identity.Entity(target, EntityManager)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
using Content.Shared.Mind;
using Content.Shared.Alert;
using Robust.Shared.Containers;
using Robust.Server.GameObjects;
using Content.Server.Resist;

namespace Content.Server.Changeling.EntitySystems;

public sealed partial class ChangelingEggSystem : EntitySystem
public sealed partial class ChangelingSyntEggSystem : EntitySystem
{
[Dependency] private readonly ActionsSystem _action = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
Expand All @@ -19,29 +21,44 @@ public sealed partial class ChangelingEggSystem : EntitySystem
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;

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

SubscribeLocalEvent<LingEggsHolderComponent, MapInitEvent>(OnInit);
SubscribeLocalEvent<LingEggsHolderComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<SyntLingEggsHolderComponent, MapInitEvent>(OnInit);
SubscribeLocalEvent<SyntLingEggsHolderComponent, ComponentShutdown>(OnShutdown);

}
public const string LingSlugId = "ChangelingHeadslug";
public ProtoId<DamageGroupPrototype> BruteDamageGroup = "Genetic";
private void OnInit(EntityUid uid, LingEggsHolderComponent component, MapInitEvent args)
private void OnInit(EntityUid uid, SyntLingEggsHolderComponent component, MapInitEvent args)
{
var slug = Spawn(LingSlugId, Transform(uid).Coordinates);
var slugComp = EnsureComp<LingSlugComponent>(slug);
slugComp.EggLing = uid;
var xform = Transform(uid);
_transform.SetParent(slug, xform.ParentUid);
_transform.SetCoordinates(slug, xform.Coordinates);
component.Stomach = ContainerSystem.EnsureContainer<Container>(uid, "stomach");
ContainerSystem.Insert(slug, component.Stomach);
RemComp<CanEscapeInventoryComponent>(slug);

if (_mindSystem.TryGetMind(uid, out var mindId, out var mind))
_mindSystem.TransferTo(mindId, slug, mind: mind);
_action.RemoveAction(slug, slugComp.LayEggsActionEntity); /// Яйца откладываются только один раз
_action.AddAction(slug, ref component.ChangelingHatchActionEntity, component.ChangelingHatchAction);

var damage_burn = new DamageSpecifier(_proto.Index(BruteDamageGroup), component.DamageAmount);
_damageableSystem.TryChangeDamage(uid, damage_burn); /// To be sure that target is dead
var newLing = EnsureComp<ChangelingComponent>(uid);
newLing.EggedBody = true; /// To make egged person into a ling
var selfMessage = Loc.GetString("changeling-eggs-inform");
_popup.PopupEntity(selfMessage, uid, uid, PopupType.LargeCaution); /// Popup
}
private void OnShutdown(EntityUid uid, LingEggsHolderComponent component, ComponentShutdown args)
private void OnShutdown(EntityUid uid, SyntLingEggsHolderComponent component, ComponentShutdown args)
{
RemComp<ChangelingComponent>(uid);
//_action.RemoveAction(uid, component.ChangelingHatchActionEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using Content.Shared.Mobs;
using Content.Server.Destructible;
using Content.Server.Ghost.Components;
using Content.Shared.Alert;

namespace Content.Server.Changeling.EntitySystems;

Expand Down Expand Up @@ -54,7 +55,6 @@ private void InitializeLingAbilities()
SubscribeLocalEvent<ChangelingComponent, StasisDeathActionEvent>(OnStasisDeathAction);
SubscribeLocalEvent<ChangelingComponent, BlindStingEvent>(OnBlindSting);
SubscribeLocalEvent<ChangelingComponent, AdrenalineActionEvent>(OnAdrenaline);
SubscribeLocalEvent<ChangelingComponent, ChangelingRefreshActionEvent>(OnRefresh);
SubscribeLocalEvent<ChangelingComponent, OmniHealActionEvent>(OnOmniHeal);
SubscribeLocalEvent<ChangelingComponent, MuteStingEvent>(OnMuteSting);
SubscribeLocalEvent<ChangelingComponent, DrugStingEvent>(OnDrugSting);
Expand Down Expand Up @@ -203,6 +203,7 @@ private void OnAbsorbDoAfter(EntityUid uid, ChangelingComponent component, Absor
var selfMessage = Loc.GetString("changeling-dna-success", ("target", Identity.Entity(target, EntityManager)));
_popup.PopupEntity(selfMessage, uid, uid, PopupType.Medium);
component.CanRefresh = true;
_alertsSystem.ShowAlert(uid, AlertType.ADTAlertLingRefresh);
component.AbsorbedDnaModifier = component.AbsorbedDnaModifier + 1;
}
}
Expand Down Expand Up @@ -941,31 +942,6 @@ private void OnOmniHeal(EntityUid uid, ChangelingComponent component, OmniHealAc

}

private void OnRefresh(EntityUid uid, ChangelingComponent component, ChangelingRefreshActionEvent args)
{
if (args.Handled)
return;

if (component.LesserFormActive)
{
var selfMessage = Loc.GetString("changeling-transform-fail-lesser-form");
_popup.PopupEntity(selfMessage, uid, uid);
return;
}

if (!TryUseAbility(uid, component, component.ChemicalsCostFree))
return;

if (Refresh(uid, component))
{
args.Handled = true;

var selfMessage = Loc.GetString("changeling-refresh-self-success");
_popup.PopupEntity(selfMessage, uid, uid, PopupType.MediumCaution);
}

}

private void OnMuscles(EntityUid uid, ChangelingComponent component, ChangelingMusclesActionEvent args)
{
if (args.Handled)
Expand Down
31 changes: 14 additions & 17 deletions Content.Server/ADT/Changeling/EntitySystems/ChangelingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public sealed partial class ChangelingSystem : EntitySystem
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly GibbingSystem _gibbingSystem = default!;
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
[Dependency] private readonly SharedCombatModeSystem _combat = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -152,7 +152,7 @@ private void OnMapInit(EntityUid uid, ChangelingComponent component, MapInitEven
_action.AddAction(uid, ref component.ChangelingDNAStingActionEntity, component.ChangelingDNAStingAction);
_action.AddAction(uid, ref component.ChangelingDNACycleActionEntity, component.ChangelingDNACycleAction);
_action.AddAction(uid, ref component.ChangelingTransformActionEntity, component.ChangelingTransformAction);
_action.AddAction(uid, ref component.ChangelingRefreshActionEntity, component.ChangelingRefreshAction);
//_action.AddAction(uid, ref component.ChangelingRefreshActionEntity, component.ChangelingRefreshAction);
}

private void OnShutdown(EntityUid uid, ChangelingComponent component, ComponentShutdown args)
Expand All @@ -163,7 +163,7 @@ private void OnShutdown(EntityUid uid, ChangelingComponent component, ComponentS
_action.RemoveAction(uid, component.ChangelingDNAStingActionEntity);
_action.RemoveAction(uid, component.ChangelingDNACycleActionEntity);
_action.RemoveAction(uid, component.ChangelingTransformActionEntity);
_action.RemoveAction(uid, component.ChangelingRefreshActionEntity);
//_action.RemoveAction(uid, component.ChangelingRefreshActionEntity);
}
private void OnShop(EntityUid uid, ChangelingComponent component, ChangelingEvolutionMenuActionEvent args)
{
Expand Down Expand Up @@ -530,6 +530,14 @@ public bool Refresh(EntityUid uid, ChangelingComponent component) /// Очис
_popup.PopupEntity(selfMessage, uid, uid, PopupType.MediumCaution);
return false;
}

if (component.LesserFormActive)
{
var selfMessage = Loc.GetString("changeling-transform-fail-lesser-form");
_popup.PopupEntity(selfMessage, uid, uid);
return false;
}

else
{
component.StoredDNA = new List<PolymorphHumanoidData>(); /// Создание нового ДНК списка
Expand All @@ -541,22 +549,11 @@ public bool Refresh(EntityUid uid, ChangelingComponent component) /// Очис

/// Удаление всех способностей - нихуя не понял, потом сделаю. Надеюсь.

///_action.RemoveAction(uid, component.ChangelingArmBladeActionEntity);
///_action.RemoveAction(uid, component.ChangelingArmorActionActionEntity);
///_action.RemoveAction(uid, component.ChangelingInvisibleActionEntity);
///_action.RemoveAction(uid, component.ChangelingEMPActionEntity);
///_action.RemoveAction(uid, component.ChangelingStasisDeathActionEntity);
///_action.RemoveAction(uid, component.ChangelingBlindStingActionEntity);
///_action.RemoveAction(uid, component.ChangelingAdrenalineActionEntity);
///_action.RemoveAction(uid, component.ChangelingOmniHealActionEntity);
///_action.RemoveAction(uid, component.ChangelingMuteStingActionEntity);

/// Всё ещё не работает, закомменчу что вышло, надо разобраться как при покупке использовать вместо
/// _action.AddAction(uid, component.Action);
/// _action.AddAction(uid, ref component.ActionEntity, component.Action);
component.CanRefresh = false;

_alertsSystem.ClearAlert(uid, AlertType.ADTAlertLingRefresh);
component.SelectedDNA = 0;
var selfMessage = Loc.GetString("changeling-refresh-self-success");
_popup.PopupEntity(selfMessage, uid, uid, PopupType.MediumCaution);
return true;
}

Expand Down
19 changes: 19 additions & 0 deletions Content.Server/ADT/Changeling/EntitySystems/DNARefresh.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Content.Shared.Alert;
using Content.Server.Abilities.Mime;
using Content.Shared.Changeling.Components;

namespace Content.Server.Changeling.EntitySystems;

[DataDefinition]
public sealed partial class DNARefresh : IAlertClick
{
public void AlertClicked(EntityUid player)
{
var entManager = IoCManager.Resolve<IEntityManager>();
if (entManager.TryGetComponent(player, out ChangelingComponent? component))
{
entManager.System<ChangelingSystem>().Refresh(player, component);
}
}
}

4 changes: 2 additions & 2 deletions Content.Server/Chemistry/ReagentEffects/LingEggs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Content.Server.Chemistry.ReagentEffects;

public sealed partial class LingEggs : ReagentEffect
public sealed partial class LingEggs : ReagentEffect
{
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability));
Expand All @@ -14,6 +14,6 @@ public sealed partial class LingEggs : ReagentEffect
public override void Effect(ReagentEffectArgs args)
{
var entityManager = args.EntityManager;
entityManager.EnsureComponent<LingEggsHolderComponent>(args.SolutionEntity);
entityManager.EnsureComponent<SyntLingEggsHolderComponent>(args.SolutionEntity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public sealed partial class ChangelingComponent : Component
public float MuteAmount = 20f;

[ViewVariables(VVAccess.ReadWrite), DataField("drugAmount")]
public float SpaceDrugsAmount = 20f;
public float SpaceDrugsAmount = 35f;

#endregion

Expand Down
20 changes: 20 additions & 0 deletions Content.Shared/ADT/Changeling/Components/SyntLingEggsHolder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Containers;

namespace Content.Shared.Changeling.Components;

[RegisterComponent]
[AutoGenerateComponentState(true)]
public sealed partial class SyntLingEggsHolderComponent : Component
{
[DataField]
public EntProtoId ChangelingHatchAction = "ActionLingHatch";

[DataField, AutoNetworkedField]
public EntityUid? ChangelingHatchActionEntity;

[DataField]
public float DamageAmount = 500f; /// Damage gain to die

public Container Stomach = default!;
}
3 changes: 2 additions & 1 deletion Content.Shared/Alert/AlertType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public enum AlertType : byte
Chemicals,
PainKiller,
ADTAlertPolymorph,
ADTAlertApathy
ADTAlertApathy,
ADTAlertLingRefresh
}

}
4 changes: 3 additions & 1 deletion Resources/Locale/ru-RU/ADT/alerts.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ alerts-polymorph-desc = [color=#b26de3]С вашим телом происход
alerts-painkiller-name = [color=yellow]На болеутоляющих[/color]
alerts-painkiller-desc = Вас ничего не сковывает.
alerts-apathy-name = Апатия
alerts-apathy-desc = Ваши эмоции стали блёклыми, а отношение к окружающему вас миру более равнодушным.
alerts-apathy-desc = Ваши эмоции стали блёклыми, а отношение к окружающему вас миру более равнодушным.
alerts-ling-refresh-name = Очистить ДНК
alerts-ling-refresh-desc = Нажмите, чтобы очистить все сохранённые цепочки ДНК и получить 2 очка эволюции.
7 changes: 7 additions & 0 deletions Resources/Prototypes/ADT/Alerts/alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@
state: apathy
name: alerts-apathy-name
description: alerts-apathy-desc

- type: alert
id: ADTAlertLingRefresh
icons: [ /Textures/Interface/Alerts/ling-refresh.png ]
name: alerts-ling-refresh-name
onClick: !type:DNARefresh { }
description: alerts-ling-refresh-desc
Binary file added Resources/Textures/Interface/Alerts/ling-refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading