И твой сорванный голос мне напомнит о прошлом
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Content.Server._Miracle.GulagSystem;
|
||||
using Content.Server.Actions;
|
||||
using Content.Server.Antag;
|
||||
@@ -321,6 +322,21 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
||||
return potentialTargets;
|
||||
}
|
||||
|
||||
public void AdminMakeCultist(EntityUid entity)
|
||||
{
|
||||
var cultistRule = EntityQuery<CultRuleComponent>().FirstOrDefault();
|
||||
if (cultistRule == null)
|
||||
{
|
||||
GameTicker.StartGameRule("Cult", out var ruleEntity);
|
||||
cultistRule = Comp<CultRuleComponent>(ruleEntity);
|
||||
}
|
||||
|
||||
if (HasComp<CultistComponent>(entity))
|
||||
return;
|
||||
|
||||
MakeCultist(entity, cultistRule);
|
||||
}
|
||||
|
||||
public bool MakeCultist(EntityUid cultist, CultRuleComponent rule)
|
||||
{
|
||||
if (!_mindSystem.TryGetMind(cultist, out var mindId, out var mind))
|
||||
|
||||
@@ -94,7 +94,8 @@ public partial class CultSystem
|
||||
|
||||
private void OnTeleport(EntityUid uid, CultistComponent component, CultTeleportTargetActionEvent args)
|
||||
{
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out var bloodstream) || !TryComp<ActorComponent>(uid, out var actor))
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out var bloodstream) ||
|
||||
!TryComp<ActorComponent>(uid, out var actor))
|
||||
return;
|
||||
|
||||
if (!TryComp<CultistComponent>(args.Target, out _) &&
|
||||
@@ -246,8 +247,7 @@ public partial class CultSystem
|
||||
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.Performer, TimeSpan.FromSeconds(2),
|
||||
new ShacklesEvent(), args.Performer, args.Target)
|
||||
{
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true,
|
||||
BreakOnMove = true,
|
||||
BreakOnDamage = true
|
||||
});
|
||||
|
||||
@@ -304,4 +304,4 @@ public partial class CultSystem
|
||||
_handsSystem.TryPickupAnyHand(args.Performer, dagger);
|
||||
args.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server._White.Cult.GameRule;
|
||||
using Content.Server._White.Cult.Runes.Comps;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared._White.Cult;
|
||||
using Content.Shared._White.Cult.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using CultistComponent = Content.Shared._White.Cult.Components.CultistComponent;
|
||||
|
||||
namespace Content.Server._White.Cult.Runes.Systems;
|
||||
@@ -16,6 +16,7 @@ public partial class CultSystem
|
||||
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinition = default!;
|
||||
[Dependency] private readonly MapSystem _map = default!;
|
||||
|
||||
public void InitializeBuffSystem()
|
||||
{
|
||||
@@ -32,12 +33,10 @@ public partial class CultSystem
|
||||
|
||||
private void AnyCultistNearTile()
|
||||
{
|
||||
var cultists = EntityQuery<CultistComponent>();
|
||||
var cultistsQuery = EntityQueryEnumerator<CultistComponent>();
|
||||
|
||||
foreach (var cultist in cultists)
|
||||
while (cultistsQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
var uid = cultist.Owner;
|
||||
|
||||
if (HasComp<CultBuffComponent>(uid))
|
||||
continue;
|
||||
|
||||
@@ -56,16 +55,15 @@ public partial class CultSystem
|
||||
|
||||
private void UpdateBuffTimers(float frameTime)
|
||||
{
|
||||
var buffs = EntityQuery<CultBuffComponent>();
|
||||
var buffsQuery = EntityQueryEnumerator<CultBuffComponent>();
|
||||
|
||||
foreach (var buff in buffs)
|
||||
while (buffsQuery.MoveNext(out var uid, out var buff))
|
||||
{
|
||||
var uid = buff.Owner;
|
||||
var remainingTime = buff.BuffTime;
|
||||
|
||||
remainingTime -= TimeSpan.FromSeconds(frameTime);
|
||||
|
||||
if (TryComp<CultistComponent>(uid, out var cultist))
|
||||
if (HasComp<CultistComponent>(uid))
|
||||
{
|
||||
if (remainingTime < CultBuffComponent.CultTileBuffTime && AnyCultTilesNearby(uid))
|
||||
remainingTime = CultBuffComponent.CultTileBuffTime;
|
||||
@@ -75,21 +73,35 @@ public partial class CultSystem
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool AnyCultTilesNearby(EntityUid uid)
|
||||
{
|
||||
var localpos = Transform(uid).Coordinates.Position;
|
||||
|
||||
if (!TryComp<CultistComponent>(uid, out var cultist))
|
||||
if (!TryComp<CultistComponent>(uid, out _))
|
||||
return false;
|
||||
|
||||
var radius = CultBuffComponent.NearbyTilesBuffRadius;
|
||||
|
||||
if (!_mapManager.TryGetGrid(Transform(uid).GridUid, out var grid))
|
||||
var gridUid = Transform(uid).GridUid;
|
||||
if (!gridUid.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryComp(gridUid, out MapGridComponent? grid))
|
||||
return false;
|
||||
|
||||
var tilesRefs = grid.GetLocalTilesIntersecting(new Box2(localpos + new Vector2(-radius, -radius), localpos + new Vector2(radius, radius)));
|
||||
var cultTileDef = (ContentTileDefinition) _tileDefinition[$"{CultRuleComponent.CultFloor}"];
|
||||
var tilesRefs = _map.GetLocalTilesIntersecting(gridUid.Value, grid, new Box2(
|
||||
localpos + new Vector2(-radius, -radius),
|
||||
localpos + new Vector2(radius, radius)));
|
||||
|
||||
var cultRule = EntityManager.EntityQuery<CultRuleComponent>().FirstOrDefault();
|
||||
if (cultRule is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var cultTileDef = (ContentTileDefinition) _tileDefinition[$"{cultRule.CultFloor}"];
|
||||
var cultTile = new Tile(cultTileDef.TileId);
|
||||
|
||||
return tilesRefs.Any(tileRef => tileRef.Tile.TypeId == cultTile.TypeId);
|
||||
@@ -97,11 +109,10 @@ public partial class CultSystem
|
||||
|
||||
private void RemoveExpiredBuffs()
|
||||
{
|
||||
var buffs = EntityQuery<CultBuffComponent>();
|
||||
var buffsQuery = EntityQueryEnumerator<CultBuffComponent>();
|
||||
|
||||
foreach (var buff in buffs)
|
||||
while (buffsQuery.MoveNext(out var uid, out var buff))
|
||||
{
|
||||
var uid = buff.Owner;
|
||||
var remainingTime = buff.BuffTime;
|
||||
|
||||
if (remainingTime <= TimeSpan.Zero)
|
||||
@@ -111,4 +122,4 @@ public partial class CultSystem
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,10 +112,8 @@ public sealed partial class CultSystem : EntitySystem
|
||||
InitializeConstructs();
|
||||
InitializeBarrierSystem();
|
||||
InitializeConstructsAbilities();
|
||||
InitializeCultists();
|
||||
InitializeActions();
|
||||
InitializeVerb();
|
||||
|
||||
}
|
||||
|
||||
private float _timeToDraw;
|
||||
@@ -325,9 +323,15 @@ public sealed partial class CultSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var cultRule = EntityManager.EntityQuery<CultRuleComponent>().FirstOrDefault();
|
||||
if (cultRule is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var solutions = _solutionContainerSystem.EnumerateSolutions((args.OtherEntity, solution));
|
||||
|
||||
if (solutions.Any(x => x.Solution.Comp.Solution.ContainsPrototype(CultRuleComponent.HolyWaterReagent)))
|
||||
if (solutions.Any(x => x.Solution.Comp.Solution.ContainsPrototype(cultRule.HolyWaterReagent)))
|
||||
{
|
||||
Del(uid);
|
||||
}
|
||||
@@ -522,10 +526,7 @@ public sealed partial class CultSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_entityManager.TryGetComponent<ActorComponent>(target, out var actorComponent))
|
||||
return false;
|
||||
|
||||
_ruleSystem.MakeCultist(actorComponent.PlayerSession);
|
||||
_ruleSystem.AdminMakeCultist(target);
|
||||
_stunSystem.TryStun(target, TimeSpan.FromSeconds(2f), false);
|
||||
HealCultist(target);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public sealed partial class CultSystem
|
||||
new DoAfterArgs(_entityManager, ent, creationTime, new SpellCreatedEvent {Spell = action}, ent)
|
||||
{
|
||||
BreakOnDamage = true,
|
||||
BreakOnUserMove = true
|
||||
BreakOnMove = true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user