Timestop spell (#370)
* - tweak: Tweak mindswap. * - fix: Mindswap and cult fixes. * - add: Timestop v1. * - add: Timestop spell. * - remove: What? * - fix: Fixes.
This commit is contained in:
@@ -29,6 +29,7 @@ using Content.Shared._White.Mood;
|
||||
using Content.Shared.Cloning;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.NPC.Systems;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Server.Player;
|
||||
|
||||
namespace Content.Server._White.Cult.GameRule;
|
||||
@@ -50,6 +51,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly GulagSystem _gulag = default!;
|
||||
[Dependency] private readonly BloodSpearSystem _bloodSpear = default!;
|
||||
[Dependency] private readonly ContainerSystem _container = default!;
|
||||
|
||||
private const int PlayerPerCultist = 10;
|
||||
private int _minStartingCultists;
|
||||
@@ -160,22 +162,18 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
||||
|
||||
private void OnCultistComponentInit(EntityUid uid, CultistComponent component, ComponentInit args)
|
||||
{
|
||||
RaiseLocalEvent(uid, new MoodEffectEvent("CultFocused"));
|
||||
|
||||
var query = QueryActiveRules();
|
||||
while (query.MoveNext(out _, out var cult, out _))
|
||||
{
|
||||
if (!TryComp<MindContainerComponent>(uid, out var mindComponent))
|
||||
return;
|
||||
|
||||
if (!mindComponent.HasMind)
|
||||
return;
|
||||
|
||||
cult.CurrentCultists.Add(component);
|
||||
|
||||
var name = Name(uid);
|
||||
|
||||
if (TryComp<ActorComponent>(uid, out var actor) && !cult.CultistsCache.ContainsKey(name))
|
||||
if (TryComp<ActorComponent>(uid, out var actor))
|
||||
{
|
||||
cult.CultistsCache.Add(name, actor.PlayerSession.Name);
|
||||
cult.CultistsCache.TryAdd(name, actor.PlayerSession.Name);
|
||||
}
|
||||
|
||||
UpdateCultistsAppearance(cult);
|
||||
@@ -203,17 +201,23 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
||||
while (query.MoveNext(out _, out var cult, out _))
|
||||
{
|
||||
cult.CurrentCultists.Remove(component);
|
||||
|
||||
_bloodSpear.DetachSpearFromUser((uid, component));
|
||||
|
||||
foreach (var empower in component.SelectedEmpowers)
|
||||
{
|
||||
_actions.RemoveAction(uid, GetEntity(empower));
|
||||
}
|
||||
|
||||
RemoveCultistAppearance(uid);
|
||||
CheckRoundShouldEnd();
|
||||
}
|
||||
|
||||
if (!TerminatingOrDeleted(uid))
|
||||
{
|
||||
RemoveAllCultistItems(uid);
|
||||
RemoveCultistAppearance(uid);
|
||||
RaiseLocalEvent(uid, new MoodRemoveEffectEvent("CultFocused"));
|
||||
}
|
||||
|
||||
_bloodSpear.DetachSpearFromUser((uid, component));
|
||||
|
||||
foreach (var empower in component.SelectedEmpowers)
|
||||
{
|
||||
_actions.RemoveAction(uid, GetEntity(empower));
|
||||
}
|
||||
|
||||
CheckRoundShouldEnd();
|
||||
}
|
||||
|
||||
private void OnCultistsStateChanged(EntityUid uid, CultistComponent component, MobStateChangedEvent ev)
|
||||
@@ -422,8 +426,6 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
||||
_factionSystem.RemoveFaction(cultist, "NanoTrasen", false);
|
||||
_factionSystem.AddFaction(cultist, "Cultist");
|
||||
|
||||
RaiseLocalEvent(cultist, new MoodEffectEvent("CultFocused"));
|
||||
|
||||
if (_inventorySystem.TryGetSlotEntity(cultist, "back", out var backPack))
|
||||
{
|
||||
foreach (var itemPrototype in rule.StartingItems)
|
||||
@@ -442,6 +444,20 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
||||
return true;
|
||||
}
|
||||
|
||||
private void RemoveAllCultistItems(EntityUid uid)
|
||||
{
|
||||
if (!_inventorySystem.TryGetContainerSlotEnumerator(uid, out var enumerator))
|
||||
return;
|
||||
|
||||
while (enumerator.MoveNext(out var container))
|
||||
{
|
||||
if (container.ContainedEntity != null && HasComp<CultItemComponent>(container.ContainedEntity.Value))
|
||||
{
|
||||
_container.Remove(container.ContainedEntity.Value, container, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TransferRole(EntityUid transferFrom, EntityUid transferTo)
|
||||
{
|
||||
if (HasComp<PentagramComponent>(transferFrom))
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
using System.Threading;
|
||||
using Content.Server._White.Cult.GameRule;
|
||||
using Content.Server.Objectives.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared._White.Cult.Components;
|
||||
using Content.Shared._White.Mood;
|
||||
using Content.Shared.Jittering;
|
||||
using Content.Shared.Mind;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Prototypes;
|
||||
using CultistComponent = Content.Shared._White.Cult.Components.CultistComponent;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
@@ -60,26 +53,10 @@ public sealed partial class DeconvertCultist : ReagentEffect
|
||||
|
||||
cultist.HolyConvertToken = null;
|
||||
|
||||
var inventory = entityManager.System<InventorySystem>();
|
||||
var containerSystem = entityManager.System<ContainerSystem>();
|
||||
if (!inventory.TryGetContainerSlotEnumerator(uid, out var enumerator))
|
||||
return;
|
||||
|
||||
while (enumerator.MoveNext(out var container))
|
||||
{
|
||||
if (container.ContainedEntity != null &&
|
||||
entityManager.HasComponent<CultItemComponent>(container.ContainedEntity.Value))
|
||||
{
|
||||
containerSystem.Remove(container.ContainedEntity.Value, container, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
entityManager.RemoveComponent<CultistComponent>(uid);
|
||||
entityManager.RemoveComponent<PentagramComponent>(uid);
|
||||
|
||||
var cultRuleSystem = entityManager.System<CultRuleSystem>();
|
||||
cultRuleSystem.RemoveObjectiveAndRole(uid);
|
||||
|
||||
entityManager.EventBus.RaiseLocalEvent(uid, new MoodRemoveEffectEvent("CultFocused"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,7 @@ public sealed partial class CultRobeModifierComponent : Component
|
||||
public string DamageModifierSetId = "CultRobe";
|
||||
|
||||
public string? StoredDamageSetId { get; set; }
|
||||
|
||||
[ViewVariables]
|
||||
public bool Active;
|
||||
}
|
||||
|
||||
@@ -29,18 +29,22 @@ public sealed class CultRobeModifierSystem : EntitySystem
|
||||
if (args.Slot != "outerClothing")
|
||||
return;
|
||||
|
||||
component.Active = true;
|
||||
|
||||
ModifySpeed(args.Equipee, component, true);
|
||||
ModifyDamage(args.Equipee, component, true);
|
||||
}
|
||||
|
||||
private void OnUnequip(EntityUid uid, CultRobeModifierComponent component, GotUnequippedEvent args)
|
||||
{
|
||||
if (!HasComp<CultistComponent>(args.Equipee))
|
||||
if (!component.Active)
|
||||
return;
|
||||
|
||||
if (args.Slot != "outerClothing")
|
||||
return;
|
||||
|
||||
component.Active = false;
|
||||
|
||||
ModifySpeed(args.Equipee, component, false);
|
||||
ModifyDamage(args.Equipee, component, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user