mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-27 10:38:02 +03:00
* Уэээээээ * Почти настрадались * Скоро конец.... * СКОРО * Мышки плакали, кололись, но продолжали упорно жрать кактус * Все ближе! * Это такой конец? * Книжка говна * фиксики * ОНО ЖИВОЕ * Телепорт * разное * Added byond * ивенты теперь работают * Разфикс телепорта * Свет мой зеркальце скажи, да всю правду доложи - Я ль робастней всех на свете? * Разное * Еще многа всего * Многа разнава * Скоро конец.... * ЭТО КОНЕЦ * Фикс линтера (ну, или я на это надеюсь) * Еще один фикс линтера * Победа! * фиксики * пу пу пу * Фикс подмастерья * Мисклик * Высокочастотный меч * Неймспейсы * Пул способностей мага
61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
// SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
|
|
// SPDX-FileCopyrightText: 2025 Aviu00 <93730715+Aviu00@users.noreply.github.com>
|
|
// SPDX-FileCopyrightText: 2025 Misandry <mary@thughunt.ing>
|
|
// SPDX-FileCopyrightText: 2025 gus <august.eymann@gmail.com>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Audio.Systems;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Physics.Systems;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Random;
|
|
|
|
namespace Content.Shared._Shitcode.Wizard.Traps;
|
|
|
|
public sealed class SparksSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly INetManager _net = default!;
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
|
|
|
private static readonly EntProtoId SparkPrototype = "EffectSpark";
|
|
|
|
private static readonly SoundSpecifier Sound = new SoundCollectionSpecifier("sparks");
|
|
|
|
public void DoSparks(EntityCoordinates coords,
|
|
int minSparks = 3,
|
|
int maxSparks = 6,
|
|
float minVelocity = 1f,
|
|
float maxVelocity = 4f,
|
|
bool playSound = true)
|
|
{
|
|
if (_net.IsClient)
|
|
return;
|
|
|
|
var amount = _random.Next(minSparks, maxSparks + 1);
|
|
|
|
if (amount <= 0)
|
|
return;
|
|
|
|
if (playSound)
|
|
_audio.PlayPvs(Sound, coords);
|
|
|
|
var mapCoords = _transform.ToMapCoordinates(coords);
|
|
|
|
float? velocityOverride = minVelocity < maxVelocity ? null : minVelocity;
|
|
|
|
for (var i = 0; i < amount; i++)
|
|
{
|
|
var velocity = velocityOverride ?? _random.NextFloat(minVelocity, maxVelocity);
|
|
var dir = _random.NextAngle().ToVec() * velocity;
|
|
var spark = Spawn(SparkPrototype, mapCoords);
|
|
_physics.SetLinearVelocity(spark, dir);
|
|
}
|
|
}
|
|
}
|