-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #487 from FaDeOkno/upd
В этот раз реально BIG UPDATE™
- Loading branch information
Showing
122 changed files
with
15,880 additions
and
133 deletions.
There are no files selected for viewing
105 changes: 105 additions & 0 deletions
105
Content.Server/ADT/Changeling/EntitySystems/ChangelingSlugSystem.Abilities.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,105 @@ | ||
using Content.Shared.Changeling.Components; | ||
using Content.Shared.Changeling; | ||
using Content.Shared.Inventory; | ||
using Content.Server.Hands.Systems; | ||
using Robust.Shared.Prototypes; | ||
using Content.Server.Body.Systems; | ||
using Content.Shared.Popups; | ||
using Content.Shared.IdentityManagement; | ||
using Robust.Shared.Audio.Systems; | ||
using Content.Server.Emp; | ||
using Content.Shared.DoAfter; | ||
using Content.Shared.Humanoid; | ||
using Content.Server.Fluids.EntitySystems; | ||
|
||
namespace Content.Server.Changeling.EntitySystems; | ||
|
||
public sealed partial class LingSlugSystem | ||
{ | ||
[Dependency] private readonly IPrototypeManager _proto = default!; | ||
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!; | ||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!; | ||
[Dependency] private readonly EntityManager _entityManager = default!; | ||
|
||
private void InitializeLingAbilities() | ||
{ | ||
SubscribeLocalEvent<LingSlugComponent, LingEggActionEvent>(OnLayEggs); | ||
SubscribeLocalEvent<LingSlugComponent, LingEggDoAfterEvent>(OnLayEggsDoAfter); | ||
} | ||
|
||
private void OnLayEggs(EntityUid uid, LingSlugComponent component, LingEggActionEvent args) | ||
{ | ||
if (args.Handled) | ||
return; | ||
|
||
var target = args.Target; | ||
|
||
if (!HasComp<HumanoidAppearanceComponent>(target)) | ||
{ | ||
var selfMessage = Loc.GetString("changeling-dna-fail-nohuman", ("target", Identity.Entity(target, EntityManager))); | ||
_popup.PopupEntity(selfMessage, uid, uid); | ||
return; | ||
} | ||
|
||
if (!_mobState.IsIncapacitated(target)) // if target isn't crit or dead dont let absorb | ||
{ | ||
var selfMessage = Loc.GetString("changeling-dna-fail-notdead", ("target", Identity.Entity(target, EntityManager))); | ||
_popup.PopupEntity(selfMessage, uid, uid); | ||
return; | ||
} | ||
|
||
if (HasComp<AbsorbedComponent>(target)) | ||
{ | ||
var selfMessage = Loc.GetString("changeling-dna-alreadyabsorbed", ("target", Identity.Entity(target, EntityManager))); | ||
_popup.PopupEntity(selfMessage, uid, uid); | ||
return; | ||
} | ||
|
||
if (_tagSystem.HasTag(target, "ChangelingBlacklist")) | ||
{ | ||
var selfMessage = Loc.GetString("changeling-dna-sting-fail-nodna", ("target", Identity.Entity(target, EntityManager))); | ||
_popup.PopupEntity(selfMessage, uid, uid); | ||
return; | ||
} | ||
|
||
if (LayEggs(uid, target, component)) | ||
{ | ||
args.Handled = true; | ||
|
||
var selfMessage = Loc.GetString("changeling-eggs-self-start", ("target", Identity.Entity(target, EntityManager))); | ||
_popup.PopupEntity(selfMessage, uid, uid, PopupType.MediumCaution); | ||
} | ||
|
||
} | ||
|
||
private void OnLayEggsDoAfter(EntityUid uid, LingSlugComponent component, LingEggDoAfterEvent args) | ||
{ | ||
if (args.Handled || args.Args.Target == null) | ||
return; | ||
|
||
args.Handled = true; | ||
var target = args.Args.Target.Value; | ||
|
||
if (args.Cancelled || !_mobState.IsIncapacitated(target) || HasComp<AbsorbedComponent>(target)) | ||
{ | ||
var selfMessage = Loc.GetString("changeling-eggs-interrupted"); | ||
_popup.PopupEntity(selfMessage, uid, uid); | ||
return; | ||
} | ||
|
||
else | ||
{ | ||
EnsureComp<LingEggsHolderComponent>(target); | ||
|
||
var selfMessage = Loc.GetString("changeling-eggs-self-success", ("target", Identity.Entity(target, EntityManager))); | ||
_popup.PopupEntity(selfMessage, uid, uid, PopupType.MediumCaution); | ||
|
||
component.EggsLaid = true; | ||
component.EggLing = target; | ||
|
||
_action.RemoveAction(uid, component.LayEggsActionEntity); /// Яйца откладываются только один раз | ||
|
||
return; | ||
} | ||
} | ||
} |
127 changes: 127 additions & 0 deletions
127
Content.Server/ADT/Changeling/EntitySystems/ChangelingSlugSystem.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,127 @@ | ||
using Content.Server.Actions; | ||
using Content.Server.Store.Systems; | ||
using Content.Shared.Changeling; | ||
using Content.Shared.Changeling.Components; | ||
using Content.Shared.Popups; | ||
using Content.Server.Traitor.Uplink; | ||
using Content.Server.Body.Components; | ||
using Content.Shared.Mobs.Systems; | ||
using Content.Shared.Humanoid; | ||
using Content.Shared.IdentityManagement; | ||
using Content.Server.Polymorph.Systems; | ||
using Content.Shared.Actions; | ||
using Robust.Shared.Serialization.Manager; | ||
using Content.Shared.Alert; | ||
using Content.Shared.Tag; | ||
using Content.Shared.StatusEffect; | ||
using Content.Shared.Chemistry.Components; | ||
using Content.Shared.Damage.Prototypes; | ||
using Content.Shared.Movement.Systems; | ||
using Content.Shared.Damage.Systems; | ||
using Content.Shared.Damage; | ||
using Content.Shared.Gibbing.Systems; | ||
using Content.Shared.Mind; | ||
using Content.Shared.DoAfter; | ||
using Robust.Shared.Prototypes; | ||
using Content.Shared.Nutrition.Components; | ||
|
||
namespace Content.Server.Changeling.EntitySystems; | ||
|
||
public sealed partial class LingSlugSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedPopupSystem _popup = default!; | ||
[Dependency] private readonly ActionsSystem _action = default!; | ||
[Dependency] private readonly MobStateSystem _mobState = default!; | ||
[Dependency] private readonly PolymorphSystem _polymorph = default!; | ||
[Dependency] private readonly ActionContainerSystem _actionContainer = default!; | ||
[Dependency] private readonly TagSystem _tagSystem = default!; | ||
[Dependency] private readonly DamageableSystem _damageableSystem = default!; | ||
[Dependency] private readonly SharedMindSystem _mindSystem = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<LingSlugComponent, ComponentStartup>(OnStartup); | ||
SubscribeLocalEvent<LingSlugComponent, MapInitEvent>(OnMapInit); | ||
|
||
InitializeLingAbilities(); | ||
} | ||
private void OnStartup(EntityUid uid, LingSlugComponent component, ComponentStartup args) | ||
{ | ||
RemComp<HungerComponent>(uid); | ||
RemComp<ThirstComponent>(uid); | ||
} | ||
private void OnMapInit(EntityUid uid, LingSlugComponent component, MapInitEvent args) | ||
{ | ||
_action.AddAction(uid, ref component.LayEggsActionEntity, component.LayEggsAction); | ||
} | ||
|
||
public ProtoId<DamageGroupPrototype> BruteDamageGroup = "Brute"; | ||
|
||
public override void Update(float frameTime) | ||
{ | ||
base.Update(frameTime); | ||
|
||
var query = EntityQueryEnumerator<LingSlugComponent>(); | ||
while (query.MoveNext(out var uid, out var ling)) | ||
{ | ||
if (ling.EggsLaid) | ||
{ | ||
if (ling.EggLing != null) | ||
{ | ||
var oldUid = uid; | ||
var newLing = EnsureComp<ChangelingComponent>(ling.EggLing.Value); | ||
newLing.EggedBody = true; | ||
_action.AddAction(ling.EggLing.Value, ref newLing.ChangelingHatchActionEntity, newLing.ChangelingHatchAction); | ||
|
||
if (_mindSystem.TryGetMind(uid, out var mindId, out var mind)) | ||
_mindSystem.TransferTo(mindId, ling.EggLing.Value, mind: mind); | ||
|
||
if (!_entityManager.TryGetComponent<BloodstreamComponent>(oldUid, out var bloodstream)) | ||
return; | ||
|
||
var toxinInjection = new Solution(ling.ChemicalToxin, ling.ToxinAmount); | ||
_bloodstreamSystem.TryAddToChemicals(oldUid, toxinInjection, bloodstream); | ||
|
||
ling.EggsLaid = false; | ||
|
||
return; | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
private bool LayEggs(EntityUid uid, EntityUid target, LingSlugComponent component) | ||
{ | ||
if (!TryComp<MetaDataComponent>(target, out var metaData)) | ||
return false; | ||
if (!TryComp<HumanoidAppearanceComponent>(target, out var humanoidappearance)) | ||
{ | ||
return false; | ||
} | ||
|
||
if (HasComp<ChangelingComponent>(target)) | ||
{ | ||
var selfMessage = Loc.GetString("changeling-sting-fail-self", ("target", Identity.Entity(target, EntityManager))); | ||
_popup.PopupEntity(selfMessage, uid, uid); | ||
|
||
var targetMessage = Loc.GetString("changeling-sting-fail-target"); | ||
_popup.PopupEntity(targetMessage, target, target); | ||
return false; | ||
} | ||
|
||
var doAfter = new DoAfterArgs(EntityManager, uid, component.LayingDuration, new LingEggDoAfterEvent(), uid, target: target) | ||
{ | ||
DistanceThreshold = 2, | ||
BreakOnUserMove = true, | ||
BreakOnTargetMove = true, | ||
BreakOnDamage = true, | ||
AttemptFrequency = AttemptFrequency.StartAndEnd | ||
}; | ||
|
||
_doAfter.TryStartDoAfter(doAfter); | ||
return true; | ||
} | ||
} |
Oops, something went wrong.