Ritualizm (#474)
* ritual cucumber setup
* entities requirements
* try graph???
* Revert "try graph???"
This reverts commit c90c6353cb.
* pipyau
* fixes
* yay, it works
* spawn effect
* regex lower message restrictions
* unique speakers support
* apply entity effect ritual
* ritual chalk
* Update SpawnEntity.cs
* ritual stability
* stability event
* add guidebook description to all ritual actions
* Readability added
* Update RequiredResource.cs
* finish describer
* clean up describer
* Update triggers.ftl
* cave ambient loop
* parry sound update
* rituals end start
* magic ambience add
* global sharedization
* Update phases.yml
* daytime requirement
* Update phases.yml
* start ritual
* fixes
* more ambient work
* rritual visualizer
* end ritual
* magic orbs!
* required orbs
* orbs design
* consume orbs
* setup neutral cluster triggers and edges
* listener proxy
* restucture graph
* fix time triggers
* healing cluster
* fixes
* Create CP14RitualTest.cs
* test errors for check test
* YEEEE
* Fuck triggers, its broken now, YAY
* triggers redo
* fix
* fix test
* Update CP14RitualTest.cs
* Update neutral_cluster.yml
* Update CP14RitualSystem.Triggers.cs
* clean up, documentation
* redo triggers again
* and another one
* species sacrifice trigger
* whitelist trigger
* fix
* describer refactor
* fix memory leaking + hyperlinks
* dd
This commit is contained in:
61
Content.Shared/_CP14/MagicRitual/CP14SharedRitualSystem.cs
Normal file
61
Content.Shared/_CP14/MagicRitual/CP14SharedRitualSystem.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Content.Shared._CP14.MagicRitual.Prototypes;
|
||||
using Content.Shared.Follower;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._CP14.MagicRitual;
|
||||
|
||||
public partial class CP14SharedRitualSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly INetManager _net = default!;
|
||||
|
||||
public void ChangeRitualStability(Entity<CP14MagicRitualComponent> ritual, float dStab)
|
||||
{
|
||||
var newS = MathHelper.Clamp01(ritual.Comp.Stability + dStab);
|
||||
|
||||
var ev = new CP14RitualStabilityChangedEvent(ritual.Comp.Stability, newS);
|
||||
RaiseLocalEvent(ritual, ev);
|
||||
|
||||
ritual.Comp.Stability = newS;
|
||||
}
|
||||
|
||||
public void AddOrbToRitual(Entity<CP14MagicRitualComponent> ritual, EntProtoId orb)
|
||||
{
|
||||
if (_net.IsClient)
|
||||
return;
|
||||
|
||||
if (!_proto.TryIndex(orb, out var indexedOrb))
|
||||
return;
|
||||
|
||||
if (ritual.Comp.Orbs.Count >= ritual.Comp.MaxOrbCapacity)
|
||||
return;
|
||||
|
||||
var spawnedOrb = Spawn(orb, _transform.GetMapCoordinates(ritual));
|
||||
|
||||
if (!TryComp<CP14MagicRitualOrbComponent>(spawnedOrb, out var orbComp))
|
||||
{
|
||||
QueueDel(spawnedOrb);
|
||||
return;
|
||||
}
|
||||
|
||||
_followerSystem.StartFollowingEntity(spawnedOrb, ritual);
|
||||
ritual.Comp.Orbs.Add((spawnedOrb, orbComp));
|
||||
}
|
||||
|
||||
public void ConsumeOrbType(Entity<CP14MagicRitualComponent> ritual, ProtoId<CP14MagicTypePrototype> magicType)
|
||||
{
|
||||
foreach (var orb in ritual.Comp.Orbs)
|
||||
{
|
||||
var powers = orb.Comp.Powers;
|
||||
if (!powers.ContainsKey(magicType))
|
||||
continue;
|
||||
|
||||
ritual.Comp.Orbs.Remove(orb);
|
||||
QueueDel(orb);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user