mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-28 11:07:50 +03:00
Ports Blob from https://github.com/Goob-Station/Goob-Station/pull/975 that was ported from https://github.com/Rxup/space-station-14. Credit to VigersRay for original code, Roudenn and Rxup for maintaining and jorgun for the Goob port. --- - [X] Port https://github.com/Goob-Station/Goob-Station/pull/975; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1209; - [X] Port Blob related code from https://github.com/Goob-Station/Goob-Station/pull/1262; - [X] Port Blob related code from https://github.com/Goob-Station/Goob-Station/pull/1340; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1408; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1419; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1440; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1817; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/2077; - [ ] ~Port https://github.com/Goob-Station/Goob-Station/pull/1916~; - [ ] ~Port https://github.com/Goob-Station/Goob-Station/pull/1917~; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/2077; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/2092; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/2546; - [X] Port https://github.com/Rxup/space-station-14/pull/963; - [X] Port https://github.com/Rxup/space-station-14/pull/998; - [ ] ~Port https://github.com/Goob-Station/Goob-Station/pull/2563~. - [X] Enable Blob and Blob gamemode; - [X] Add `StationGlobConfig` to all stations; - [X] Use `AnnouncerSystem` in `BlobRuleSystem.cs`; - [X] Blob language and Hivemind (from https://github.com/Rxup/space-station-14/pull/176); - [x] Change CVars location; - [X] Add media. --- <details><summary><h1>Media</h1></summary> <p> https://youtu.be/-WtMQwRcmrU?si=su3An6RtiCTZg-DV </p> </details> --- 🆑 VigersRay, Roudenn, Rxup, vladospupuos, fishbait and Kyoth25f - add: Added a new antagonist: Blob --------- Co-authored-by: fishbait <gnesse@gmail.com> Co-authored-by: Fishbait <Fishbait@git.ml> Co-authored-by: Aiden <aiden@djkraz.com> Co-authored-by: beck-thompson <107373427+beck-thompson@users.noreply.github.com> Co-authored-by: lanse12 <cloudability.ez@gmail.com> Co-authored-by: BombasterDS <deniskaporoshok@gmail.com> Co-authored-by: Aviu00 <93730715+Aviu00@users.noreply.github.com> Co-authored-by: Piras314 <p1r4s@proton.me> Co-authored-by: shibe <95730644+shibechef@users.noreply.github.com> Co-authored-by: Ilya246 <57039557+Ilya246@users.noreply.github.com> Co-authored-by: JohnOakman <sremy2012@hotmail.fr> Co-authored-by: Fat Engineer Gaming <159075414+Fat-Engineer-Gaming@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Rouden <149893554+Roudenn@users.noreply.github.com>
164 lines
6.0 KiB
C#
164 lines
6.0 KiB
C#
using Content.Server._Goobstation.Blob.Components;
|
||
using Content.Server.Popups;
|
||
using Content.Shared._Goobstation.Blob.Components;
|
||
using Content.Shared.Chemistry.Components;
|
||
using Content.Shared.Chemistry.Reagent;
|
||
using Content.Shared.Damage;
|
||
using Content.Shared.Destructible;
|
||
using Content.Shared.Explosion.Components;
|
||
using Content.Shared.FixedPoint;
|
||
using Content.Shared.Weapons.Melee;
|
||
using Robust.Shared.Prototypes;
|
||
|
||
namespace Content.Server._Goobstation.Blob.Systems;
|
||
|
||
public sealed class BlobFactorySystem : EntitySystem
|
||
{
|
||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||
|
||
private EntityQuery<BlobTileComponent> _tile;
|
||
private EntityQuery<BlobCoreComponent> _core;
|
||
|
||
public override void Initialize()
|
||
{
|
||
base.Initialize();
|
||
|
||
SubscribeLocalEvent<BlobFactoryComponent, BlobSpecialGetPulseEvent>(OnPulsed);
|
||
SubscribeLocalEvent<BlobFactoryComponent, ProduceBlobbernautEvent>(OnProduceBlobbernaut);
|
||
SubscribeLocalEvent<BlobFactoryComponent, DestructionEventArgs>(OnDestruction);
|
||
|
||
_tile = GetEntityQuery<BlobTileComponent>();
|
||
_core = GetEntityQuery<BlobCoreComponent>();
|
||
}
|
||
|
||
private void OnDestruction(EntityUid uid, BlobFactoryComponent component, DestructionEventArgs args)
|
||
{
|
||
if (TryComp<BlobbernautComponent>(component.Blobbernaut, out var blobbernautComponent))
|
||
{
|
||
blobbernautComponent.Factory = null;
|
||
}
|
||
}
|
||
|
||
private void OnProduceBlobbernaut(EntityUid uid, BlobFactoryComponent component, ProduceBlobbernautEvent args)
|
||
{
|
||
if (component.Blobbernaut != null)
|
||
return;
|
||
|
||
if (!_tile.TryComp(uid, out var blobTileComponent) || blobTileComponent.Core == null)
|
||
return;
|
||
|
||
if (!_core.TryComp(blobTileComponent.Core, out var blobCoreComponent))
|
||
return;
|
||
|
||
var xform = Transform(uid);
|
||
|
||
var blobbernaut = Spawn(component.BlobbernautId, xform.Coordinates);
|
||
|
||
component.Blobbernaut = blobbernaut;
|
||
if (TryComp<BlobbernautComponent>(blobbernaut, out var blobbernautComponent))
|
||
{
|
||
blobbernautComponent.Factory = uid;
|
||
blobbernautComponent.Color = blobCoreComponent.ChemСolors[blobCoreComponent.CurrentChem];
|
||
Dirty(blobbernaut, blobbernautComponent);
|
||
}
|
||
if (TryComp<MeleeWeaponComponent>(blobbernaut, out var meleeWeaponComponent))
|
||
{
|
||
var blobbernautDamage = new DamageSpecifier();
|
||
foreach (var keyValuePair in blobCoreComponent.ChemDamageDict[blobCoreComponent.CurrentChem].DamageDict)
|
||
{
|
||
blobbernautDamage.DamageDict.Add(keyValuePair.Key, keyValuePair.Value * 0.8f);
|
||
}
|
||
meleeWeaponComponent.Damage = blobbernautDamage;
|
||
}
|
||
}
|
||
|
||
[ValidatePrototypeId<ReagentPrototype>]
|
||
private const string Phlogiston = "Phlogiston";
|
||
|
||
[ValidatePrototypeId<ReagentPrototype>]
|
||
private const string TearGas = "TearGas";
|
||
|
||
[ValidatePrototypeId<ReagentPrototype>]
|
||
|
||
private const string Lexorin = "Lexorin";
|
||
|
||
[ValidatePrototypeId<ReagentPrototype>]
|
||
private const string Mold = "Mold";
|
||
|
||
[ValidatePrototypeId<ReagentPrototype>]
|
||
private const string Bicaridine = "Bicaridine";
|
||
|
||
[ValidatePrototypeId<ReagentPrototype>]
|
||
private const string Aluminium = "Aluminium";
|
||
[ValidatePrototypeId<ReagentPrototype>]
|
||
private const string Iron = "Iron";
|
||
[ValidatePrototypeId<ReagentPrototype>]
|
||
private const string Uranium = "Uranium";
|
||
|
||
private void FillSmokeGas(Entity<BlobPodComponent> ent, BlobChemType currentChem)
|
||
{
|
||
var blobGas = EnsureComp<SmokeOnTriggerComponent>(ent).Solution;
|
||
switch (currentChem)
|
||
{
|
||
case BlobChemType.BlazingOil:
|
||
blobGas.AddSolution(new Solution(Phlogiston, FixedPoint2.New(30))
|
||
{
|
||
Temperature = 1000
|
||
},
|
||
_prototypeManager);
|
||
break;
|
||
case BlobChemType.ReactiveSpines:
|
||
blobGas.AddSolution(new Solution(Mold, FixedPoint2.New(30)),_prototypeManager);
|
||
break;
|
||
case BlobChemType.RegenerativeMateria:
|
||
blobGas.AddSolution(new Solution(Bicaridine, FixedPoint2.New(30)),_prototypeManager);
|
||
break;
|
||
case BlobChemType.ExplosiveLattice:
|
||
blobGas.AddSolution(new Solution(Lexorin, FixedPoint2.New(30))
|
||
{
|
||
Temperature = 1000
|
||
},
|
||
_prototypeManager);
|
||
break;
|
||
case BlobChemType.ElectromagneticWeb:
|
||
blobGas.AddSolution(new Solution(Aluminium, FixedPoint2.New(10)){ CanReact = false },_prototypeManager);
|
||
blobGas.AddSolution(new Solution(Iron, FixedPoint2.New(10)){ CanReact = false },_prototypeManager);
|
||
blobGas.AddSolution(new Solution(Uranium, FixedPoint2.New(10)){ CanReact = false },_prototypeManager);
|
||
break;
|
||
default:
|
||
blobGas.AddSolution(new Solution(TearGas, FixedPoint2.New(30)),_prototypeManager);
|
||
break;
|
||
}
|
||
}
|
||
|
||
private void OnPulsed(EntityUid uid, BlobFactoryComponent component, BlobSpecialGetPulseEvent args)
|
||
{
|
||
if (component.SpawnedCount >= component.MaxPods)
|
||
return;
|
||
|
||
if (component.Accumulator < component.AccumulateToSpawn)
|
||
{
|
||
component.Accumulator++;
|
||
return;
|
||
}
|
||
|
||
if (!_tile.TryComp(uid, out var blobTileComponent) || blobTileComponent.Core == null)
|
||
return;
|
||
|
||
if (!_core.TryComp(blobTileComponent.Core, out var blobCoreComponent))
|
||
return;
|
||
|
||
var core = blobTileComponent.Core.Value;
|
||
var xform = Transform(uid);
|
||
|
||
var pod = Spawn(component.Pod, xform.Coordinates);
|
||
component.BlobPods.Add(pod);
|
||
var blobPod = EnsureComp<BlobPodComponent>(pod);
|
||
blobPod.Core = core;
|
||
FillSmokeGas((pod,blobPod), blobCoreComponent.CurrentChem);
|
||
|
||
component.SpawnedCount += 1;
|
||
component.Accumulator = 0;
|
||
}
|
||
}
|