Skip to content

Commit

Permalink
Оно запустилось
Browse files Browse the repository at this point in the history
  • Loading branch information
FaDeOkno committed Oct 25, 2024
1 parent 9b91c6d commit 822b513
Show file tree
Hide file tree
Showing 66 changed files with 487 additions and 725 deletions.
106 changes: 0 additions & 106 deletions Content.Client/ADT/Changeling/ChangelingPanelSystem.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Content.Server.Changeling.EntitySystems;

public sealed partial class ChangelingSystem
{
private void InitializeLingCombatAbilities()
private void InitializeCombatAbilities()
{
SubscribeLocalEvent<ChangelingComponent, LingEMPActionEvent>(OnLingEmp);
SubscribeLocalEvent<ChangelingComponent, LingResonantShriekEvent>(OnResonantShriek);
Expand Down
21 changes: 3 additions & 18 deletions Content.Server/ADT/Changeling/Systems/ChangelingSystem.Useful.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Content.Server.Changeling.EntitySystems;

public sealed partial class ChangelingSystem
{
private void InitializeLingAbilities()
private void InitializeUsefulAbilities()
{
SubscribeLocalEvent<ChangelingComponent, LingAbsorbActionEvent>(StartAbsorbing);
SubscribeLocalEvent<ChangelingComponent, AbsorbDoAfterEvent>(OnAbsorbDoAfter);
Expand Down Expand Up @@ -491,18 +491,7 @@ private void OnLesserForm(EntityUid uid, ChangelingComponent component, Changeli
var selfMessage = Loc.GetString("changeling-lesser-form-activate-monkey");
_popup.PopupEntity(selfMessage, transformedUid.Value, transformedUid.Value);

var copiedComp = _serialization.CreateCopy(component, notNullableOverride: true);
RemComp(uid, component);
AddComp(transformedUid.Value, copiedComp);

if (TryComp<StoreComponent>(uid, out var storeComp))
{
var copiedStoreComponent = (Component) _serialization.CreateCopy(storeComp, notNullableOverride: true);
RemComp<StoreComponent>(transformedUid.Value);
AddComp(transformedUid.Value, copiedStoreComponent);
}

_actionContainer.TransferAllActionsWithNewAttached(uid, transformedUid.Value, transformedUid.Value);
CopyLing(uid, transformedUid.Value);
}
else
{
Expand Down Expand Up @@ -564,7 +553,7 @@ private void OnBiodegrade(EntityUid uid, ChangelingComponent component, LingBiod

_doAfter.TryStartDoAfter(doAfter);
}
private void OnBiodegradeDoAfter(EntityUid uid, ChangelingComponent component, BiodegradeDoAfterEvent args) // DoAfter, та полоска над персонажем
private void OnBiodegradeDoAfter(EntityUid uid, ChangelingComponent component, BiodegradeDoAfterEvent args)
{
if (args.Handled || args.Args.Target == null)
return;
Expand Down Expand Up @@ -627,9 +616,5 @@ public void OnTransformSting(EntityUid uid, ChangelingComponent component, Trans
var selfMessage = Loc.GetString("changeling-transform-sting-activate", ("target", selectedHumanoidData.MetaDataComponent.EntityName));
_popup.PopupEntity(selfMessage, transformedUid.Value, transformedUid.Value);
}

if (!TryComp(transformedUid.Value, out InventoryComponent? inventory))
return;
}

}
86 changes: 49 additions & 37 deletions Content.Server/ADT/Changeling/Systems/ChangelingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public override void Initialize()
SubscribeNetworkEvent<SelectChangelingFormEvent>(OnSelectChangelingForm);
SubscribeLocalEvent<ChangelingComponent, MobStateChangedEvent>(OnMobState);

InitializeLingAbilities();
InitializeUsefulAbilities();
InitializeCombatAbilities();
}

private void OnSelectChangelingForm(SelectChangelingFormEvent ev)
Expand Down Expand Up @@ -340,7 +341,7 @@ public void OnCycleDNA(EntityUid uid, ChangelingComponent component, ChangelingC
args.Handled = true;
}

public HumanoidCharacterProfile BuildProfile(PolymorphHumanoidData data)
private HumanoidCharacterProfile BuildProfile(PolymorphHumanoidData data)
{
HumanoidCharacterAppearance hca = new();
var humanoid = data.HumanoidAppearanceComponent;
Expand Down Expand Up @@ -447,18 +448,7 @@ public void TransformChangeling(EntityUid uid, ChangelingComponent component, Se
var selfMessage = Loc.GetString("changeling-transform-activate", ("target", selectedHumanoidData.MetaDataComponent.EntityName));
_popup.PopupEntity(selfMessage, transformedUid.Value, transformedUid.Value);

var newComp = _serialization.CreateCopy(component, notNullableOverride: true);
RemComp(uid, component);
AddComp(transformedUid.Value, newComp);

if (TryComp(uid, out StoreComponent? storeComp))
{
var copiedStoreComponent = (Component)_serialization.CreateCopy(storeComp, notNullableOverride: true);
RemComp<StoreComponent>(transformedUid.Value);
EntityManager.AddComponent(transformedUid.Value, copiedStoreComponent);
}

_actionContainer.TransferAllActionsWithNewAttached(uid, transformedUid.Value, transformedUid.Value);
CopyLing(uid, transformedUid.Value);
}
}
i++;
Expand Down Expand Up @@ -519,29 +509,7 @@ public void OnTransform(EntityUid uid, ChangelingComponent component, Changeling
var selfMessage = Loc.GetString("changeling-transform-activate", ("target", selectedHumanoidData.MetaDataComponent.EntityName));
_popup.PopupEntity(selfMessage, transformedUid.Value, transformedUid.Value);

var newLingComponent = EnsureComp<ChangelingComponent>(transformedUid.Value);
newLingComponent.Chemicals = component.Chemicals;
newLingComponent.ChemicalsPerSecond = component.ChemicalsPerSecond;
newLingComponent.StoredDNA = component.StoredDNA;
newLingComponent.SelectedDNA = component.SelectedDNA;
newLingComponent.ArmBladeActive = component.ArmBladeActive;
newLingComponent.ChameleonSkinActive = component.ChameleonSkinActive;
newLingComponent.LingArmorActive = component.LingArmorActive;
newLingComponent.CanRefresh = component.CanRefresh;
newLingComponent.AbsorbedDnaModifier = component.AbsorbedDnaModifier;
RemComp(uid, component);

if (TryComp(uid, out StoreComponent? storeComp))
{
var copiedStoreComponent = (Component)_serialization.CreateCopy(storeComp, notNullableOverride: true);
RemComp<StoreComponent>(transformedUid.Value);
EntityManager.AddComponent(transformedUid.Value, copiedStoreComponent);
}

_actionContainer.TransferAllActionsWithNewAttached(uid, transformedUid.Value, transformedUid.Value);

if (!TryComp(transformedUid.Value, out InventoryComponent? inventory))
return;
CopyLing(uid, transformedUid.Value);
}
}

Expand Down Expand Up @@ -573,4 +541,48 @@ private void OnMobState(EntityUid uid, ChangelingComponent component, MobStateCh
// _mindSystem.TransferTo(mindId, slug, mind: mind);
// return true;
// }

public void CopyLing(EntityUid from, EntityUid to, ChangelingComponent? comp = null)
{
if (!Resolve(from, ref comp))
return;
if (HasComp<ChangelingComponent>(to))
RemComp<ChangelingComponent>(to);

var newLingComponent = EnsureComp<ChangelingComponent>(to);
newLingComponent.Chemicals = comp.Chemicals;
newLingComponent.ChemicalsPerSecond = comp.ChemicalsPerSecond;
newLingComponent.StoredDNA = comp.StoredDNA;
newLingComponent.SelectedDNA = comp.SelectedDNA;
newLingComponent.ArmBladeActive = comp.ArmBladeActive;
newLingComponent.ChameleonSkinActive = comp.ChameleonSkinActive;
newLingComponent.LingArmorActive = comp.LingArmorActive;
newLingComponent.CanRefresh = comp.CanRefresh;
newLingComponent.LesserFormActive = comp.LesserFormActive;
newLingComponent.AbsorbedDnaModifier = comp.AbsorbedDnaModifier;
RemComp(from, comp);

if (TryComp(from, out StoreComponent? storeComp))
{
var copiedStoreComponent = (Component)_serialization.CreateCopy(storeComp, notNullableOverride: true);
RemComp<StoreComponent>(to);
EntityManager.AddComponent(to, copiedStoreComponent);
}

if (TryComp(from, out StealthComponent? stealthComp)) // copy over stealth status
{
if (TryComp(from, out StealthOnMoveComponent? stealthOnMoveComp))
{
var copiedStealthComponent = (Component)_serialization.CreateCopy(stealthComp, notNullableOverride: true);
EntityManager.AddComponent(to, copiedStealthComponent);
RemComp(from, stealthComp);

var copiedStealthOnMoveComponent = (Component)_serialization.CreateCopy(stealthOnMoveComp, notNullableOverride: true);
EntityManager.AddComponent(to, copiedStealthOnMoveComponent);
RemComp(from, stealthOnMoveComp);
}
}

_actionContainer.TransferAllActionsWithNewAttached(from, to, to);
}
}
19 changes: 0 additions & 19 deletions Content.Server/ADT/Chemistry/LingEggs.cs

This file was deleted.

22 changes: 0 additions & 22 deletions Content.Server/Atmos/Rotting/LingEggsHoldingSystem.cs

This file was deleted.

10 changes: 5 additions & 5 deletions Content.Server/GameTicking/Rules/ChangelingRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ public bool TryMakeChangeling(EntityUid target, ChangelingRuleComponent rule)
// Ensure Changeling component and role
EnsureComp<ChangelingComponent>(target);

var store = EnsureComp<StoreComponent>(target);
foreach (var category in rule.StoreCategories)
store.Categories.Add(category);
store.CurrencyWhitelist.Add(Currency);
store.Balance.Add(Currency, 2);
// var store = EnsureComp<StoreComponent>(target);
// foreach (var category in rule.StoreCategories)
// store.Categories.Add(category);
// store.CurrencyWhitelist.Add(Currency);
// store.Balance.Add(Currency, 2);

rule.Minds.Add(mindId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Prototypes;
using Content.Shared.Actions;
using Robust.Shared.GameStates;

namespace Content.Shared.Changeling.Components;

[RegisterComponent]
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState(true)]
public sealed partial class ChangelingComponent : Component
{
Expand Down
Loading

0 comments on commit 822b513

Please sign in to comment.