Spells stuff (#153)
* -add: Create and remove blood spells using verbs. * - add: Blood spells now have charges and disappear. * - add: Localize spells. * - add: New blood spells.
This commit is contained in:
@@ -179,7 +179,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
||||
|
||||
foreach (var empower in component.SelectedEmpowers)
|
||||
{
|
||||
_actions.RemoveAction(uid, empower);
|
||||
_actions.RemoveAction(uid, GetEntity(empower));
|
||||
}
|
||||
|
||||
RemoveCultistAppearance(uid);
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Server.Emp;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server._White.Cult.UI;
|
||||
using Content.Shared._White.Chaplain;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
@@ -15,8 +16,11 @@ using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared._White.Cult;
|
||||
using Content.Shared._White.Cult.Actions;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Cuffs.Components;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Mindshield.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
@@ -38,38 +42,71 @@ public partial class CultSystem
|
||||
SubscribeLocalEvent<CultistComponent, CultTwistedConstructionActionEvent>(OnTwistedConstructionAction);
|
||||
SubscribeLocalEvent<CultistComponent, CultSummonDaggerActionEvent>(OnSummonDaggerAction);
|
||||
SubscribeLocalEvent<CultistComponent, CultShadowShacklesTargetActionEvent>(OnShadowShackles);
|
||||
SubscribeLocalEvent<CultistComponent, CultElectromagneticPulseTargetActionEvent>(OnElectromagneticPulse);
|
||||
SubscribeLocalEvent<CultistComponent, CultElectromagneticPulseInstantActionEvent>(OnElectromagneticPulse);
|
||||
SubscribeLocalEvent<CultistComponent, CultSummonCombatEquipmentTargetActionEvent>(OnSummonCombatEquipment);
|
||||
SubscribeLocalEvent<CultistComponent, CultConcealPresenceWorldActionEvent>(OnConcealPresence);
|
||||
SubscribeLocalEvent<CultistComponent, CultBloodRitesInstantActionEvent>(OnBloodRites);
|
||||
SubscribeLocalEvent<CultistComponent, CultTeleportTargetActionEvent>(OnTeleport);
|
||||
SubscribeLocalEvent<CultistComponent, CultStunTargetActionEvent>(OnStunTarget);
|
||||
SubscribeLocalEvent<CultistComponent, ActionGettingRemovedEvent>(OnActionRemoved);
|
||||
SubscribeLocalEvent<CultistComponent, ShacklesEvent>(OnShackles);
|
||||
}
|
||||
|
||||
private void OnShackles(Entity<CultistComponent> ent, ref ShacklesEvent args)
|
||||
{
|
||||
if (args.Cancelled || args.Target == null)
|
||||
return;
|
||||
|
||||
if (!TryComp(args.Target, out CuffableComponent? cuffable) || cuffable.Container.ContainedEntities.Count > 0)
|
||||
return;
|
||||
|
||||
var cuffs = Spawn("ShadowShackles", Transform(ent).Coordinates);
|
||||
if (!_cuffable.TryAddNewCuffs(args.Target.Value, args.User, cuffs, cuffable))
|
||||
QueueDel(cuffs);
|
||||
}
|
||||
|
||||
private void OnActionRemoved(Entity<CultistComponent> ent, ref ActionGettingRemovedEvent args)
|
||||
{
|
||||
ent.Comp.SelectedEmpowers.Remove(GetNetEntity(args.Action));
|
||||
Dirty(ent);
|
||||
}
|
||||
|
||||
private void OnStunTarget(EntityUid uid, CultistComponent component, CultStunTargetActionEvent args)
|
||||
{
|
||||
if (args.Target == uid || !HasComp<StatusEffectsComponent>(args.Target))
|
||||
if (args.Target == uid || !TryComp<BloodstreamComponent>(args.Performer, out var bloodstream) ||
|
||||
HasComp<HolyComponent>(args.Target) || !TryComp<StatusEffectsComponent>(args.Target, out var status))
|
||||
return;
|
||||
|
||||
if (_stunSystem.TryStun(args.Target, TimeSpan.FromSeconds(6), true))
|
||||
if (HasComp<MindShieldComponent>(args.Target))
|
||||
{
|
||||
args.Handled = true;
|
||||
_popupSystem.PopupEntity("Он имплантирован чипом защиты разума.", args.Performer, args.Performer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_stunSystem.TryParalyze(args.Target, TimeSpan.FromSeconds(6), true, status) &
|
||||
!_statusEffectsSystem.TryAddStatusEffect(args.Target, "Muted", TimeSpan.FromSeconds(12), true, "Muted",
|
||||
status))
|
||||
return;
|
||||
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -10, bloodstream, createPuddle: false);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnTeleport(EntityUid uid, CultistComponent component, CultTeleportTargetActionEvent args)
|
||||
{
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out _) || !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 _) &&
|
||||
!(TryComp<MobStateComponent>(args.Target, out var mobStateComponent) &&
|
||||
mobStateComponent.CurrentState is not MobState.Alive))
|
||||
{
|
||||
_popupSystem.PopupEntity("Цель должна быть культистом или лежать", args.Performer);
|
||||
_popupSystem.PopupEntity("Цель должна быть культистом или лежать.", args.Performer, args.Performer);
|
||||
return;
|
||||
}
|
||||
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -5, bloodstream, createPuddle: false);
|
||||
|
||||
var eui = new TeleportSpellEui(args.Performer, args.Target);
|
||||
_euiManager.OpenEui(eui, actor.PlayerSession);
|
||||
eui.StateDirty();
|
||||
@@ -148,10 +185,10 @@ public partial class CultSystem
|
||||
CultistComponent component,
|
||||
CultSummonCombatEquipmentTargetActionEvent args)
|
||||
{
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out _))
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out var bloodstream))
|
||||
return;
|
||||
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -20, createPuddle: false);
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -20, bloodstream, createPuddle: false);
|
||||
|
||||
var coordinates = Transform(uid).Coordinates;
|
||||
var helmet = Spawn("ClothingHeadHelmetCult", coordinates);
|
||||
@@ -177,30 +214,42 @@ public partial class CultSystem
|
||||
private void OnElectromagneticPulse(
|
||||
EntityUid uid,
|
||||
CultistComponent component,
|
||||
CultElectromagneticPulseTargetActionEvent args)
|
||||
CultElectromagneticPulseInstantActionEvent args)
|
||||
{
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out _))
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out var bloodstream))
|
||||
return;
|
||||
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -20, createPuddle: false);
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -10, bloodstream, createPuddle: false);
|
||||
|
||||
var xform = Transform(uid);
|
||||
|
||||
_empSystem.EmpPulse(xform.MapPosition, 10, 100000, 10f);
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -20, createPuddle: false);
|
||||
_empSystem.EmpPulse(_transform.GetMapCoordinates(uid), 5, 100000, 10f);
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnShadowShackles(EntityUid uid, CultistComponent component, CultShadowShacklesTargetActionEvent args)
|
||||
{
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out _))
|
||||
if (args.Target == uid || !TryComp<BloodstreamComponent>(args.Performer, out var bloodstream))
|
||||
return;
|
||||
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -20, createPuddle: false);
|
||||
_bloodstreamSystem.TryModifyBloodLevel(uid, -5, bloodstream, createPuddle: false);
|
||||
|
||||
var cuffs = Spawn("CultistCuffs", Transform(uid).Coordinates);
|
||||
_handsSystem.TryPickupAnyHand(uid, cuffs);
|
||||
if (!HasComp<HolyComponent>(args.Target) &&
|
||||
_statusEffectsSystem.TryAddStatusEffect(args.Target, "Muted", TimeSpan.FromSeconds(10), true, "Muted"))
|
||||
{
|
||||
_popupSystem.PopupEntity("Цель обезмолвлена.", args.Performer, args.Performer);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
if (!TryComp(args.Target, out CuffableComponent? cuffs) || cuffs.Container.ContainedEntities.Count > 0)
|
||||
return;
|
||||
|
||||
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.Performer, TimeSpan.FromSeconds(2),
|
||||
new ShacklesEvent(), args.Performer, args.Target)
|
||||
{
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true,
|
||||
BreakOnDamage = true
|
||||
});
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
@@ -229,14 +278,14 @@ public partial class CultSystem
|
||||
|
||||
var material = _entityManager.SpawnEntity(RunicMetalPrototypeId, transform);
|
||||
|
||||
_bloodstreamSystem.TryModifyBloodLevel(args.Performer, -15, bloodstreamComponent, false);
|
||||
_bloodstreamSystem.TryModifyBloodLevel(args.Performer, -stack.Count / 2f, bloodstreamComponent, false);
|
||||
|
||||
if (!_entityManager.TryGetComponent<StackComponent>(material, out var stackNew))
|
||||
return;
|
||||
|
||||
stackNew.Count = count;
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("Конвертируем сталь в руиник металл!"), args.Performer, args.Performer);
|
||||
_popupSystem.PopupEntity("Конвертируем сталь в руинический металл!", args.Performer, args.Performer);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
@@ -251,7 +300,7 @@ public partial class CultSystem
|
||||
var xform = Transform(args.Performer).Coordinates;
|
||||
var dagger = _entityManager.SpawnEntity(RitualDaggerPrototypeId, xform);
|
||||
|
||||
_bloodstreamSystem.TryModifyBloodLevel(args.Performer, -30, bloodstreamComponent, false);
|
||||
_bloodstreamSystem.TryModifyBloodLevel(args.Performer, -20, bloodstreamComponent, false);
|
||||
_handsSystem.TryPickupAnyHand(args.Performer, dagger);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ using Content.Server.Weapons.Ranged.Systems;
|
||||
using Content.Server._White.Cult.GameRule;
|
||||
using Content.Server._White.Cult.Runes.Comps;
|
||||
using Content.Shared._White.Chaplain;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Cuffs.Components;
|
||||
using Content.Shared.Damage;
|
||||
@@ -28,16 +27,15 @@ using Content.Shared.Popups;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Content.Shared._White.Cult;
|
||||
using Content.Shared._White.Cult.Components;
|
||||
using Content.Shared._White.Cult.Runes;
|
||||
using Content.Shared._White.Cult.UI;
|
||||
using Content.Shared.Cuffs;
|
||||
using Content.Shared.Mindshield.Components;
|
||||
using Content.Shared.Pulling;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Components;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Events;
|
||||
@@ -65,6 +63,7 @@ public sealed partial class CultSystem : EntitySystem
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly FlammableSystem _flammableSystem = default!;
|
||||
[Dependency] private readonly SharedPullingSystem _pulling = default!;
|
||||
[Dependency] private readonly SharedCuffableSystem _cuffable = default!;
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
@@ -110,6 +109,7 @@ public sealed partial class CultSystem : EntitySystem
|
||||
InitializeBarrierSystem();
|
||||
InitializeConstructsAbilities();
|
||||
InitializeActions();
|
||||
InitializeVerb();
|
||||
}
|
||||
|
||||
private float _timeToDraw;
|
||||
@@ -518,6 +518,14 @@ public sealed partial class CultSystem : EntitySystem
|
||||
_stunSystem.TryStun(target, TimeSpan.FromSeconds(2f), false);
|
||||
HealCultist(target);
|
||||
|
||||
if (TryComp(target, out CuffableComponent? cuffs) && cuffs.Container.ContainedEntities.Count >= 1)
|
||||
{
|
||||
var lastAddedCuffs = cuffs.LastAddedCuffs;
|
||||
_cuffable.Uncuff(target, user, lastAddedCuffs);
|
||||
}
|
||||
|
||||
_statusEffectsSystem.TryRemoveStatusEffect(target, "Muted");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1143,17 +1151,19 @@ public sealed partial class CultSystem : EntitySystem
|
||||
|
||||
if (component.IsRune)
|
||||
{
|
||||
if (comp.SelectedEmpowers.Count > component.MaxAllowedCultistActions)
|
||||
if (comp.SelectedEmpowers.Count >= component.MaxAllowedCultistActions)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("cult-too-much-empowers"), uid);
|
||||
return;
|
||||
}
|
||||
|
||||
comp.SelectedEmpowers.Add(_actionsSystem.AddAction(playerEntity.Value, action));
|
||||
comp.SelectedEmpowers.Add(GetNetEntity(_actionsSystem.AddAction(playerEntity.Value, action)));
|
||||
Dirty(playerEntity.Value, comp);
|
||||
}
|
||||
else if (comp.SelectedEmpowers.Count < component.MinRequiredCultistActions)
|
||||
{
|
||||
comp.SelectedEmpowers.Add(_actionsSystem.AddAction(playerEntity.Value, action));
|
||||
comp.SelectedEmpowers.Add(GetNetEntity(_actionsSystem.AddAction(playerEntity.Value, action)));
|
||||
Dirty(playerEntity.Value, comp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
115
Content.Server/_White/Cult/Runes/Systems/CultSystem.Verb.cs
Normal file
115
Content.Server/_White/Cult/Runes/Systems/CultSystem.Verb.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Shared._White.Cult;
|
||||
using Content.Shared._White.Cult.Components;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server._White.Cult.Runes.Systems;
|
||||
|
||||
public sealed partial class CultSystem
|
||||
{
|
||||
public void InitializeVerb()
|
||||
{
|
||||
SubscribeLocalEvent<CultistComponent, GetVerbsEvent<Verb>>(OnGetVerbs);
|
||||
SubscribeLocalEvent<CultistComponent, CultEmpowerSelectedBuiMessage>(OnCultistEmpowerSelected);
|
||||
SubscribeLocalEvent<CultistComponent, CultEmpowerRemoveBuiMessage>(OnCultistEmpowerRemove);
|
||||
SubscribeLocalEvent<CultistComponent, SpellCreatedEvent>(OnSpellCreated);
|
||||
}
|
||||
|
||||
private void OnCultistEmpowerRemove(Entity<CultistComponent> ent, ref CultEmpowerRemoveBuiMessage args)
|
||||
{
|
||||
var entity = GetEntity(args.ActionType);
|
||||
ent.Comp.SelectedEmpowers.Remove(args.ActionType);
|
||||
_actionsSystem.RemoveAction(entity);
|
||||
Dirty(ent);
|
||||
}
|
||||
|
||||
private void OnSpellCreated(EntityUid ent, CultistComponent comp, SpellCreatedEvent args)
|
||||
{
|
||||
if (args.Cancelled || comp.SelectedEmpowers.Count >= 1)
|
||||
return;
|
||||
|
||||
var action = CultistComponent.CultistActions.FirstOrDefault(x => x.Equals(args.Spell));
|
||||
|
||||
if (action == null)
|
||||
return;
|
||||
|
||||
var howMuchBloodTake = HasComp<CultBuffComponent>(ent) ? -10f : -20f;
|
||||
|
||||
if (!TryComp<BloodstreamComponent>(ent, out var bloodstreamComponent))
|
||||
return;
|
||||
|
||||
_bloodstreamSystem.TryModifyBloodLevel(ent, howMuchBloodTake, bloodstreamComponent, createPuddle: false);
|
||||
|
||||
comp.SelectedEmpowers.Add(GetNetEntity(_actionsSystem.AddAction(ent, args.Spell)));
|
||||
|
||||
Dirty(ent, comp);
|
||||
}
|
||||
|
||||
private void OnCultistEmpowerSelected(EntityUid ent, CultistComponent comp, CultEmpowerSelectedBuiMessage args)
|
||||
{
|
||||
var action = CultistComponent.CultistActions.FirstOrDefault(x => x.Equals(args.ActionType));
|
||||
|
||||
if (action == null)
|
||||
return;
|
||||
|
||||
if (comp.SelectedEmpowers.Count >= 1)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("verb-spell-create-too-much"), ent);
|
||||
return;
|
||||
}
|
||||
|
||||
var creationTime = HasComp<CultBuffComponent>(ent) ? 2.5f : 5f;
|
||||
|
||||
_doAfterSystem.TryStartDoAfter(
|
||||
new DoAfterArgs(_entityManager, ent, creationTime, new SpellCreatedEvent {Spell = action}, ent)
|
||||
{
|
||||
BreakOnDamage = true,
|
||||
BreakOnUserMove = true
|
||||
});
|
||||
}
|
||||
|
||||
private void OnGetVerbs(Entity<CultistComponent> ent, ref GetVerbsEvent<Verb> args)
|
||||
{
|
||||
if (ent.Owner != args.User || !TryComp<ActorComponent>(args.User, out var actor))
|
||||
return;
|
||||
|
||||
var createSpellVerb = new Verb
|
||||
{
|
||||
Text = Loc.GetString("verb-spell-create-text"),
|
||||
Message = Loc.GetString("verb-spell-create-message"),
|
||||
Category = VerbCategory.Cult,
|
||||
Act = () =>
|
||||
{
|
||||
_ui.TryOpen(ent, CultEmpowerUiKey.Key, actor.PlayerSession);
|
||||
}
|
||||
};
|
||||
|
||||
var removeSpellVerb = new Verb
|
||||
{
|
||||
Text = Loc.GetString("verb-spell-remove-text"),
|
||||
Message = Loc.GetString("verb-spell-remove-message"),
|
||||
Category = VerbCategory.Cult,
|
||||
Act = () =>
|
||||
{
|
||||
RemoveSpell(ent, actor.PlayerSession);
|
||||
}
|
||||
};
|
||||
|
||||
args.Verbs.Add(createSpellVerb);
|
||||
args.Verbs.Add(removeSpellVerb);
|
||||
}
|
||||
|
||||
private void RemoveSpell(Entity<CultistComponent> ent, ICommonSession session)
|
||||
{
|
||||
if (ent.Comp.SelectedEmpowers.Count == 0)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("verb-spell-remove-no-spells"), ent);
|
||||
return;
|
||||
}
|
||||
|
||||
_ui.TryOpen(ent, CultEmpowerRemoveUiKey.Key, session);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user