mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-25 09:38:09 +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>
119 lines
4.2 KiB
C#
119 lines
4.2 KiB
C#
using System.Linq;
|
|
using System.Numerics;
|
|
using Content.Server.Emp;
|
|
using Content.Server.Explosion.EntitySystems;
|
|
using Content.Shared._Goobstation.Blob;
|
|
using Content.Shared._Goobstation.Blob.Components;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Mobs;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Weapons.Melee.Events;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Map.Components;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Server._Goobstation.Blob;
|
|
|
|
public sealed class BlobbernautSystem : SharedBlobbernautSystem
|
|
{
|
|
[Dependency] private readonly EntityLookupSystem _entityLookupSystem = default!;
|
|
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
|
|
|
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
[Dependency] private readonly EmpSystem _empSystem = default!;
|
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
[Dependency] private readonly TransformSystem _transform = default!;
|
|
//private EntityQuery<MapGridComponent> _mapGridQuery;
|
|
private EntityQuery<BlobTileComponent> _tileQuery;
|
|
private EntityQuery<BlobCoreComponent> _coreQuery;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<BlobbernautComponent, MeleeHitEvent>(OnMeleeHit);
|
|
|
|
//_mapGridQuery = GetEntityQuery<MapGridComponent>();
|
|
_tileQuery = GetEntityQuery<BlobTileComponent>();
|
|
_coreQuery = GetEntityQuery<BlobCoreComponent>();
|
|
}
|
|
|
|
|
|
private readonly HashSet<Entity<BlobTileComponent>> _entitySet = new();
|
|
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
var blobFactoryQuery = EntityQueryEnumerator<BlobbernautComponent, MobStateComponent>();
|
|
while (blobFactoryQuery.MoveNext(out var ent, out var comp, out var mobStateComponent))
|
|
{
|
|
if (_mobStateSystem.IsDead(ent,mobStateComponent))
|
|
continue;
|
|
|
|
comp.NextDamage += frameTime;
|
|
|
|
if (comp.DamageFrequency > comp.NextDamage)
|
|
continue;
|
|
|
|
comp.NextDamage -= comp.DamageFrequency;
|
|
|
|
if (TerminatingOrDeleted(comp.Factory))
|
|
{
|
|
TryChangeDamage("blobberaut-factory-destroy", ent, comp.Damage);
|
|
continue;
|
|
}
|
|
|
|
var xform = Transform(ent);
|
|
|
|
if (xform.GridUid == null)
|
|
continue;
|
|
|
|
var mapPos = _transform.ToMapCoordinates(xform.Coordinates);
|
|
|
|
_entitySet.Clear();
|
|
_entityLookupSystem.GetEntitiesInRange(mapPos.MapId, mapPos.Position, 1f, _entitySet);
|
|
|
|
if(_entitySet.Count != 0)
|
|
continue;
|
|
|
|
TryChangeDamage("blobberaut-not-on-blob-tile", ent, comp.Damage);
|
|
}
|
|
}
|
|
|
|
private void OnMeleeHit(EntityUid uid, BlobbernautComponent component, MeleeHitEvent args)
|
|
{
|
|
if (args.HitEntities.Count < 1)
|
|
return;
|
|
if (!_tileQuery.TryComp(component.Factory, out var blobTileComponent))
|
|
return;
|
|
if (!_coreQuery.TryComp(blobTileComponent.Core, out var blobCoreComponent))
|
|
return;
|
|
|
|
switch (blobCoreComponent.CurrentChem)
|
|
{
|
|
case BlobChemType.ExplosiveLattice:
|
|
_explosionSystem.QueueExplosion(args.HitEntities.FirstOrDefault(), blobCoreComponent.BlobExplosive, 4, 1, 2, maxTileBreak: 0);
|
|
break;
|
|
case BlobChemType.ElectromagneticWeb:
|
|
{
|
|
var xform = Transform(args.HitEntities.FirstOrDefault());
|
|
if (_random.Prob(0.2f))
|
|
_empSystem.EmpPulse(_transform.GetMapCoordinates(xform), 3f, 50f, 3f);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private DamageSpecifier? TryChangeDamage(string msg, EntityUid ent, DamageSpecifier dmg)
|
|
{
|
|
_popup.PopupEntity(Loc.GetString(msg), ent, ent, PopupType.LargeCaution);
|
|
return _damageableSystem.TryChangeDamage(ent, dmg);
|
|
}
|
|
}
|