@@ -56,23 +56,39 @@ public sealed class ChargeActionSystem : SharedChargingSystem
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
if (_playerManager.LocalEntity is not { } user)
|
||||
if (!_timing.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
if (_playerManager.LocalEntity is not { } user)
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_mobState.IsAlive(user) || _statusEffects.HasStatusEffect(user, "Incorporeal"))
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_timing.IsFirstTimePredicted || _controller == null || _controller.SelectingTargetFor is not { } actionId)
|
||||
if (_controller == null || _controller.SelectingTargetFor is not { } actionId)
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_actionsSystem.TryGetActionData(actionId, out var baseAction) ||
|
||||
baseAction is not BaseTargetActionComponent action || !action.IsChargeEnabled)
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!action.Enabled
|
||||
|| action is { Charges: 0, RenewCharges: false }
|
||||
|| action.Cooldown.HasValue && action.Cooldown.Value.End > _timing.CurTime)
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,6 +155,17 @@ public sealed class ChargeActionSystem : SharedChargingSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
_charging = false;
|
||||
_prevCharging = false;
|
||||
_chargeTime = 0f;
|
||||
_chargeLevel = 0;
|
||||
_prevChargeLevel = 0;
|
||||
_isChargingPlaying = false;
|
||||
_isChargedPlaying = false;
|
||||
}
|
||||
|
||||
private void HandleAction(EntityUid actionId, BaseTargetActionComponent action, EntityUid user, int chargeLevel)
|
||||
{
|
||||
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);
|
||||
|
||||
@@ -164,8 +164,7 @@ public sealed class MagicSystem : EntitySystem
|
||||
if (!_wizardSpells.CanCast(args)) // WD EDIT
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
Speak(args);
|
||||
_wizardSpells.Cast(args); // WD EDIT
|
||||
|
||||
var transform = Transform(args.Performer);
|
||||
var coords = transform.Coordinates;
|
||||
@@ -190,9 +189,7 @@ public sealed class MagicSystem : EntitySystem
|
||||
if (!_wizardSpells.CanCast(ev)) // WD EDIT
|
||||
return;
|
||||
|
||||
ev.Handled = true;
|
||||
|
||||
Speak(ev);
|
||||
_wizardSpells.Cast(ev); // WD EDIT
|
||||
|
||||
var direction = _transformSystem.GetMapCoordinates(ev.Target).Position - _transformSystem.GetMapCoordinates(ev.Performer).Position;
|
||||
var impulseVector = direction * 10000;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Shared._White.Wizard;
|
||||
using Content.Shared._White.Wizard.Charging;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Mobs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Player;
|
||||
@@ -25,10 +26,13 @@ public sealed class ChargingSystem : SharedChargingSystem
|
||||
SubscribeNetworkEvent<RequestSpellChargingAudio>(OnCharging);
|
||||
SubscribeNetworkEvent<RequestSpellChargedAudio>(OnCharged);
|
||||
SubscribeNetworkEvent<RequestAudioSpellStop>(OnStop);
|
||||
|
||||
SubscribeLocalEvent<PlayerDetachedEvent>(OnDetach);
|
||||
SubscribeLocalEvent<MobStateChangedEvent>(OnStateChanged);
|
||||
|
||||
SubscribeNetworkEvent<AddWizardChargeEvent>(Add);
|
||||
SubscribeNetworkEvent<RemoveWizardChargeEvent>(Remove);
|
||||
|
||||
}
|
||||
|
||||
#region Audio
|
||||
@@ -103,40 +107,29 @@ public sealed class ChargingSystem : SharedChargingSystem
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
if (_chargingLoops.TryGetValue(user.Value, out var currentStream))
|
||||
{
|
||||
_audio.Stop(currentStream);
|
||||
_chargingLoops.Remove(user.Value);
|
||||
}
|
||||
|
||||
if (_chargedLoop.TryGetValue(user.Value, out var chargedLoop))
|
||||
{
|
||||
_audio.Stop(chargedLoop);
|
||||
_chargedLoop.Remove(user.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDetach(PlayerDetachedEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
var user = msg.Entity;
|
||||
|
||||
if (_chargingLoops.TryGetValue(user, out var currentStream))
|
||||
{
|
||||
_audio.Stop(currentStream);
|
||||
_chargingLoops.Remove(user);
|
||||
}
|
||||
|
||||
if (_chargedLoop.TryGetValue(user, out var chargedLoop))
|
||||
{
|
||||
_audio.Stop(chargedLoop);
|
||||
_chargedLoop.Remove(user);
|
||||
}
|
||||
StopAllSounds(user.Value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Charges
|
||||
|
||||
private void OnDetach(PlayerDetachedEvent msg)
|
||||
{
|
||||
var user = msg.Entity;
|
||||
|
||||
RemoveAllCharges(user);
|
||||
StopAllSounds(user);
|
||||
}
|
||||
|
||||
private void OnStateChanged(MobStateChangedEvent ev)
|
||||
{
|
||||
var user = ev.Target;
|
||||
|
||||
RemoveAllCharges(user);
|
||||
StopAllSounds(user);
|
||||
}
|
||||
|
||||
private void Add(AddWizardChargeEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
if (args.SenderSession.AttachedEntity != null)
|
||||
@@ -153,6 +146,21 @@ public sealed class ChargingSystem : SharedChargingSystem
|
||||
|
||||
#region Helpers
|
||||
|
||||
public void StopAllSounds(EntityUid uid)
|
||||
{
|
||||
if (_chargingLoops.TryGetValue(uid, out var currentStream))
|
||||
{
|
||||
_audio.Stop(currentStream);
|
||||
_chargingLoops.Remove(uid);
|
||||
}
|
||||
|
||||
if (_chargedLoop.TryGetValue(uid, out var chargedLoop))
|
||||
{
|
||||
_audio.Stop(chargedLoop);
|
||||
_chargedLoop.Remove(uid);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddCharge(EntityUid uid, string msgChargeProto)
|
||||
{
|
||||
var itemEnt = Spawn(msgChargeProto, Transform(uid).Coordinates);
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server._White.Cult;
|
||||
using Content.Server._White.IncorporealSystem;
|
||||
using Content.Server._White.Wizard.Charging;
|
||||
using Content.Server._White.Wizard.Magic.Amaterasu;
|
||||
using Content.Server._White.Wizard.Magic.Other;
|
||||
using Content.Server._White.Wizard.Magic.TeslaProjectile;
|
||||
@@ -80,6 +81,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
[Dependency] private readonly EuiManager _euiManager = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
|
||||
[Dependency] private readonly ChargingSystem _charging = default!;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -125,7 +127,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
msg.Handled = true;
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -143,8 +145,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
var comp = EnsureComp<PreventCollideComponent>(ent);
|
||||
comp.Uid = msg.Performer;
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -187,8 +188,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
_standing.TryLieDown(uid);
|
||||
_standing.TryLieDown(target);
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
|
||||
SwapComponent<WizardComponent>(uid, target);
|
||||
SwapComponent<RevolutionaryComponent>(uid, target);
|
||||
@@ -213,8 +213,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
_euiManager.OpenEui(eui, actor.PlayerSession);
|
||||
eui.StateDirty();
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg, false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -264,8 +263,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
_handsSystem.TryForcePickupAnyHand(msg.Performer, recallComponent.Item.Value);
|
||||
_audio.PlayPvs(recallComponent.RecallSound, msg.Performer);
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -293,8 +291,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
|
||||
Spawn("AdminInstantEffectSmoke3", Transform(msg.Target).Coordinates);
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -317,8 +314,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
|
||||
Spawn("AdminInstantEffectSmoke3", Transform(msg.Target).Coordinates);
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -340,8 +336,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
|
||||
Spawn("AdminInstantEffectSmoke3", Transform(msg.Target).Coordinates);
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -357,8 +352,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
|
||||
_empSystem.EmpPulse(coords, 15, 1000000, 60f);
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -381,8 +375,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
_statusEffectsSystem.TryAddStatusEffect<IncorporealComponent>(msg.Performer, "Incorporeal",
|
||||
TimeSpan.FromSeconds(10), false);
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -434,8 +427,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
Spawn("AdminInstantEffectSmoke3", oldCoords);
|
||||
Spawn("AdminInstantEffectSmoke3", coords);
|
||||
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -460,9 +452,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
break;
|
||||
}
|
||||
|
||||
SetCooldown(msg.Action, msg.ActionUseType);
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
private void ForcewallSpellDefault(ForceWallSpellEvent msg)
|
||||
@@ -533,9 +523,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
SetCooldown(msg.Action, msg.ActionUseType);
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
private void CardsSpellDefault(CardsSpellEvent msg)
|
||||
@@ -638,9 +626,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
SetCooldown(msg.Action, msg.ActionUseType);
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
private void FireballSpellDefault(FireballSpellEvent msg)
|
||||
@@ -725,9 +711,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
SetCooldown(msg.Action, msg.ActionUseType);
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
private bool ForceSpellAlt(ForceSpellEvent msg)
|
||||
@@ -782,9 +766,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
SetCooldown(msg.Action, msg.ActionUseType);
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
Cast(msg);
|
||||
}
|
||||
|
||||
private bool ArcSpellDefault(ArcSpellEvent msg)
|
||||
@@ -844,6 +826,17 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
RaiseLocalEvent(uid, new EnergyDomeClothesTurnOffEvent());
|
||||
}
|
||||
|
||||
public void Cast(BaseActionEvent msg, bool removeAllCharges = true)
|
||||
{
|
||||
SetCooldown(msg.Action, msg.ActionUseType);
|
||||
msg.Handled = true;
|
||||
Speak(msg);
|
||||
if (!removeAllCharges)
|
||||
return;
|
||||
_charging.RemoveAllCharges(msg.Performer);
|
||||
_charging.StopAllSounds(msg.Performer);
|
||||
}
|
||||
|
||||
public bool CanCast(BaseActionEvent msg)
|
||||
{
|
||||
return !msg.Handled && CheckRequirements(msg.Action, msg.Performer) &&
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.EUI;
|
||||
using Content.Server._White.Wizard.Charging;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared._White.Wizard.Teleport;
|
||||
using Content.Shared.Eui;
|
||||
@@ -15,6 +16,7 @@ public sealed class WizardTeleportSpellEui : BaseEui
|
||||
private readonly TeleportLocationSystem _teleportLocation;
|
||||
private readonly PullingSystem _pulling;
|
||||
private readonly PopupSystem _popupSystem;
|
||||
private readonly ChargingSystem _charging;
|
||||
|
||||
private readonly EntityUid _performer;
|
||||
|
||||
@@ -28,6 +30,7 @@ public sealed class WizardTeleportSpellEui : BaseEui
|
||||
_pulling = _entityManager.System<PullingSystem>();
|
||||
_teleportLocation = _entityManager.System<TeleportLocationSystem>();
|
||||
_popupSystem = _entityManager.System<PopupSystem>();
|
||||
_charging = _entityManager.System<ChargingSystem>();
|
||||
|
||||
_performer = performer;
|
||||
|
||||
@@ -107,6 +110,9 @@ public sealed class WizardTeleportSpellEui : BaseEui
|
||||
_entityManager.SpawnEntity("AdminInstantEffectSmoke10", oldCoords);
|
||||
_entityManager.SpawnEntity("AdminInstantEffectSmoke10", coords);
|
||||
|
||||
_charging.RemoveAllCharges(_performer);
|
||||
_charging.StopAllSounds(_performer);
|
||||
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,12 +15,15 @@
|
||||
- type: Clothing
|
||||
sprite: White/Objects/Weapons/Chaplain/hfrequency.rsi
|
||||
slots:
|
||||
- back
|
||||
- suitStorage
|
||||
- none
|
||||
- type: Reflect
|
||||
reflectProb: 0.4
|
||||
- type: Item
|
||||
sprite: White/Objects/Weapons/Chaplain/hfrequency.rsi
|
||||
size: Large
|
||||
storedRotation: 44
|
||||
shape:
|
||||
- 0, 0, 3, 0
|
||||
|
||||
- type: entity
|
||||
name: клинок заклинаний
|
||||
|
||||
Reference in New Issue
Block a user