И твой сорванный голос мне напомнит о прошлом
This commit is contained in:
@@ -19,7 +19,7 @@ public sealed class ChairLeakAspect : AspectSystem<ChairLeakAspectComponent>
|
||||
while (query.MoveNext(out var ent, out _))
|
||||
{
|
||||
if (TryComp(ent, out StrapComponent? strap))
|
||||
_buckle.StrapRemoveAll(strap);
|
||||
_buckle.StrapRemoveAll(ent, strap);
|
||||
|
||||
EntityManager.DeleteEntity(ent);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Content.Server._Miracle.GulagSystem;
|
||||
using Content.Server.Actions;
|
||||
using Content.Server.Antag;
|
||||
@@ -321,6 +322,21 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
||||
return potentialTargets;
|
||||
}
|
||||
|
||||
public void AdminMakeCultist(EntityUid entity)
|
||||
{
|
||||
var cultistRule = EntityQuery<CultRuleComponent>().FirstOrDefault();
|
||||
if (cultistRule == null)
|
||||
{
|
||||
GameTicker.StartGameRule("Cult", out var ruleEntity);
|
||||
cultistRule = Comp<CultRuleComponent>(ruleEntity);
|
||||
}
|
||||
|
||||
if (HasComp<CultistComponent>(entity))
|
||||
return;
|
||||
|
||||
MakeCultist(entity, cultistRule);
|
||||
}
|
||||
|
||||
public bool MakeCultist(EntityUid cultist, CultRuleComponent rule)
|
||||
{
|
||||
if (!_mindSystem.TryGetMind(cultist, out var mindId, out var mind))
|
||||
|
||||
@@ -94,7 +94,8 @@ public partial class CultSystem
|
||||
|
||||
private void OnTeleport(EntityUid uid, CultistComponent component, CultTeleportTargetActionEvent args)
|
||||
{
|
||||
if (!TryComp<BloodstreamComponent>(args.Performer, out var bloodstream) || !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 _) &&
|
||||
@@ -246,8 +247,7 @@ public partial class CultSystem
|
||||
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.Performer, TimeSpan.FromSeconds(2),
|
||||
new ShacklesEvent(), args.Performer, args.Target)
|
||||
{
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true,
|
||||
BreakOnMove = true,
|
||||
BreakOnDamage = true
|
||||
});
|
||||
|
||||
@@ -304,4 +304,4 @@ public partial class CultSystem
|
||||
_handsSystem.TryPickupAnyHand(args.Performer, dagger);
|
||||
args.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server._White.Cult.GameRule;
|
||||
using Content.Server._White.Cult.Runes.Comps;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared._White.Cult;
|
||||
using Content.Shared._White.Cult.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using CultistComponent = Content.Shared._White.Cult.Components.CultistComponent;
|
||||
|
||||
namespace Content.Server._White.Cult.Runes.Systems;
|
||||
@@ -16,6 +16,7 @@ public partial class CultSystem
|
||||
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinition = default!;
|
||||
[Dependency] private readonly MapSystem _map = default!;
|
||||
|
||||
public void InitializeBuffSystem()
|
||||
{
|
||||
@@ -32,12 +33,10 @@ public partial class CultSystem
|
||||
|
||||
private void AnyCultistNearTile()
|
||||
{
|
||||
var cultists = EntityQuery<CultistComponent>();
|
||||
var cultistsQuery = EntityQueryEnumerator<CultistComponent>();
|
||||
|
||||
foreach (var cultist in cultists)
|
||||
while (cultistsQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
var uid = cultist.Owner;
|
||||
|
||||
if (HasComp<CultBuffComponent>(uid))
|
||||
continue;
|
||||
|
||||
@@ -56,16 +55,15 @@ public partial class CultSystem
|
||||
|
||||
private void UpdateBuffTimers(float frameTime)
|
||||
{
|
||||
var buffs = EntityQuery<CultBuffComponent>();
|
||||
var buffsQuery = EntityQueryEnumerator<CultBuffComponent>();
|
||||
|
||||
foreach (var buff in buffs)
|
||||
while (buffsQuery.MoveNext(out var uid, out var buff))
|
||||
{
|
||||
var uid = buff.Owner;
|
||||
var remainingTime = buff.BuffTime;
|
||||
|
||||
remainingTime -= TimeSpan.FromSeconds(frameTime);
|
||||
|
||||
if (TryComp<CultistComponent>(uid, out var cultist))
|
||||
if (HasComp<CultistComponent>(uid))
|
||||
{
|
||||
if (remainingTime < CultBuffComponent.CultTileBuffTime && AnyCultTilesNearby(uid))
|
||||
remainingTime = CultBuffComponent.CultTileBuffTime;
|
||||
@@ -75,21 +73,35 @@ public partial class CultSystem
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool AnyCultTilesNearby(EntityUid uid)
|
||||
{
|
||||
var localpos = Transform(uid).Coordinates.Position;
|
||||
|
||||
if (!TryComp<CultistComponent>(uid, out var cultist))
|
||||
if (!TryComp<CultistComponent>(uid, out _))
|
||||
return false;
|
||||
|
||||
var radius = CultBuffComponent.NearbyTilesBuffRadius;
|
||||
|
||||
if (!_mapManager.TryGetGrid(Transform(uid).GridUid, out var grid))
|
||||
var gridUid = Transform(uid).GridUid;
|
||||
if (!gridUid.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryComp(gridUid, out MapGridComponent? grid))
|
||||
return false;
|
||||
|
||||
var tilesRefs = grid.GetLocalTilesIntersecting(new Box2(localpos + new Vector2(-radius, -radius), localpos + new Vector2(radius, radius)));
|
||||
var cultTileDef = (ContentTileDefinition) _tileDefinition[$"{CultRuleComponent.CultFloor}"];
|
||||
var tilesRefs = _map.GetLocalTilesIntersecting(gridUid.Value, grid, new Box2(
|
||||
localpos + new Vector2(-radius, -radius),
|
||||
localpos + new Vector2(radius, radius)));
|
||||
|
||||
var cultRule = EntityManager.EntityQuery<CultRuleComponent>().FirstOrDefault();
|
||||
if (cultRule is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var cultTileDef = (ContentTileDefinition) _tileDefinition[$"{cultRule.CultFloor}"];
|
||||
var cultTile = new Tile(cultTileDef.TileId);
|
||||
|
||||
return tilesRefs.Any(tileRef => tileRef.Tile.TypeId == cultTile.TypeId);
|
||||
@@ -97,11 +109,10 @@ public partial class CultSystem
|
||||
|
||||
private void RemoveExpiredBuffs()
|
||||
{
|
||||
var buffs = EntityQuery<CultBuffComponent>();
|
||||
var buffsQuery = EntityQueryEnumerator<CultBuffComponent>();
|
||||
|
||||
foreach (var buff in buffs)
|
||||
while (buffsQuery.MoveNext(out var uid, out var buff))
|
||||
{
|
||||
var uid = buff.Owner;
|
||||
var remainingTime = buff.BuffTime;
|
||||
|
||||
if (remainingTime <= TimeSpan.Zero)
|
||||
@@ -111,4 +122,4 @@ public partial class CultSystem
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,10 +112,8 @@ public sealed partial class CultSystem : EntitySystem
|
||||
InitializeConstructs();
|
||||
InitializeBarrierSystem();
|
||||
InitializeConstructsAbilities();
|
||||
InitializeCultists();
|
||||
InitializeActions();
|
||||
InitializeVerb();
|
||||
|
||||
}
|
||||
|
||||
private float _timeToDraw;
|
||||
@@ -325,9 +323,15 @@ public sealed partial class CultSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var cultRule = EntityManager.EntityQuery<CultRuleComponent>().FirstOrDefault();
|
||||
if (cultRule is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var solutions = _solutionContainerSystem.EnumerateSolutions((args.OtherEntity, solution));
|
||||
|
||||
if (solutions.Any(x => x.Solution.Comp.Solution.ContainsPrototype(CultRuleComponent.HolyWaterReagent)))
|
||||
if (solutions.Any(x => x.Solution.Comp.Solution.ContainsPrototype(cultRule.HolyWaterReagent)))
|
||||
{
|
||||
Del(uid);
|
||||
}
|
||||
@@ -522,10 +526,7 @@ public sealed partial class CultSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_entityManager.TryGetComponent<ActorComponent>(target, out var actorComponent))
|
||||
return false;
|
||||
|
||||
_ruleSystem.MakeCultist(actorComponent.PlayerSession);
|
||||
_ruleSystem.AdminMakeCultist(target);
|
||||
_stunSystem.TryStun(target, TimeSpan.FromSeconds(2f), false);
|
||||
HealCultist(target);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public sealed partial class CultSystem
|
||||
new DoAfterArgs(_entityManager, ent, creationTime, new SpellCreatedEvent {Spell = action}, ent)
|
||||
{
|
||||
BreakOnDamage = true,
|
||||
BreakOnUserMove = true
|
||||
BreakOnMove = true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -4,39 +4,28 @@ using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared._White.Jukebox;
|
||||
using Robust.Server.Audio;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameStates;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server._White.Jukebox;
|
||||
|
||||
public sealed class JukeboxSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly IResourceManager _resourceManager = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly PvsOverrideSystem _pvsOverrideSystem = default!;
|
||||
|
||||
private readonly List<JukeboxComponent> _playingJukeboxes = [];
|
||||
|
||||
private readonly List<JukeboxComponent> _playingJukeboxes = new();
|
||||
|
||||
private float _updateTimerDefaultTime = 1f;
|
||||
private const float UpdateTimerDefaultTime = 1f;
|
||||
private float _updateTimer;
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeNetworkEvent<JukeboxRequestSongPlay>(OnSongRequestPlay);
|
||||
SubscribeLocalEvent<JukeboxComponent, InteractUsingEvent>(OnInteract);
|
||||
SubscribeLocalEvent<JukeboxComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<JukeboxComponent, JukeboxStopRequest>(OnRequestStop);
|
||||
SubscribeLocalEvent<JukeboxComponent, JukeboxRepeatToggled>(OnRepeatToggled);
|
||||
SubscribeLocalEvent<JukeboxComponent, JukeboxEjectRequest>(OnEjectRequest);
|
||||
@@ -57,13 +46,13 @@ public sealed class JukeboxSystem : EntitySystem
|
||||
|
||||
private void OnEjectRequest(EntityUid uid, JukeboxComponent component, JukeboxEjectRequest args)
|
||||
{
|
||||
if(component.PlayingSongData != null) return;
|
||||
if (component.PlayingSongData != null) return;
|
||||
|
||||
var containedEntities = component.TapeContainer.ContainedEntities;
|
||||
|
||||
if (containedEntities.Count > 0)
|
||||
{
|
||||
_containerSystem.EmptyContainer(component.TapeContainer, true).ToList();
|
||||
_containerSystem.EmptyContainer(component.TapeContainer, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +62,7 @@ public sealed class JukeboxSystem : EntitySystem
|
||||
if (jukeboxComponent.PlayingSongData != null) return;
|
||||
if (jukeboxComponent.TapeContainer.ContainedEntities.Count == 0) return;
|
||||
|
||||
var removeTapeVerb = new Verb()
|
||||
var removeTapeVerb = new Verb
|
||||
{
|
||||
Text = "Вытащить касету",
|
||||
Priority = 10000,
|
||||
@@ -95,77 +84,78 @@ public sealed class JukeboxSystem : EntitySystem
|
||||
|
||||
private void OnRepeatToggled(EntityUid uid, JukeboxComponent component, JukeboxRepeatToggled args)
|
||||
{
|
||||
component.Repeating = args.NewState;
|
||||
Dirty(component);
|
||||
component.Playing = args.NewState;
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private void OnRequestStop(EntityUid uid, JukeboxComponent component, JukeboxStopRequest args)
|
||||
{
|
||||
component.PlayingSongData = null;
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
|
||||
private void OnInteract(EntityUid uid, JukeboxComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if(component.PlayingSongData != null) return;
|
||||
if (component.PlayingSongData != null) return;
|
||||
|
||||
if (TryComp<TapeComponent>(args.Used, out var tape))
|
||||
if (!HasComp<TapeComponent>(args.Used))
|
||||
return;
|
||||
|
||||
var containedEntities = component.TapeContainer.ContainedEntities;
|
||||
|
||||
if (containedEntities.Count >= 1)
|
||||
{
|
||||
var containedEntities = component.TapeContainer.ContainedEntities;
|
||||
var removedTapes = _containerSystem.EmptyContainer(component.TapeContainer, true).ToList();
|
||||
_containerSystem.Insert(args.Used, component.TapeContainer);
|
||||
|
||||
if (containedEntities.Count >= 1)
|
||||
foreach (var tapeUid in removedTapes)
|
||||
{
|
||||
var removedTapes = _containerSystem.EmptyContainer(component.TapeContainer, true).ToList();
|
||||
component.TapeContainer.Insert(args.Used);
|
||||
|
||||
foreach (var tapeUid in removedTapes)
|
||||
{
|
||||
_handsSystem.PickupOrDrop(args.User, tapeUid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
component.TapeContainer.Insert(args.Used);
|
||||
_handsSystem.PickupOrDrop(args.User, tapeUid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_containerSystem.Insert(args.Used, component.TapeContainer);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSongRequestPlay(JukeboxRequestSongPlay msg, EntitySessionEventArgs args)
|
||||
{
|
||||
var jukebox = Comp<JukeboxComponent>(GetEntity(msg.Jukebox!.Value));
|
||||
jukebox.Repeating = true;
|
||||
var entity = GetEntity(msg.Jukebox!.Value);
|
||||
var jukebox = Comp<JukeboxComponent>(entity);
|
||||
jukebox.Playing = true;
|
||||
|
||||
var songData = new PlayingSongData()
|
||||
var songData = new PlayingSongData
|
||||
{
|
||||
SongName = msg.SongName,
|
||||
SongPath = msg.SongPath,
|
||||
ActualSongLengthSeconds = msg.SongDuration,
|
||||
PlaybackPosition = 0f
|
||||
};
|
||||
|
||||
jukebox.PlayingSongData = songData;
|
||||
|
||||
_playingJukeboxes.Add(jukebox);
|
||||
|
||||
Dirty(jukebox);
|
||||
Dirty(entity, jukebox);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
if (_updateTimer <= _updateTimerDefaultTime)
|
||||
if (_updateTimer <= UpdateTimerDefaultTime)
|
||||
{
|
||||
_updateTimer += frameTime;
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessPlayingJukeboxes(frameTime);
|
||||
ProcessPlayingJukeboxes();
|
||||
}
|
||||
|
||||
private void ProcessPlayingJukeboxes(float frameTime)
|
||||
private void ProcessPlayingJukeboxes()
|
||||
{
|
||||
for (int i = _playingJukeboxes.Count - 1; i >= 0; i--)
|
||||
for (var i = _playingJukeboxes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var playingJukeboxData = _playingJukeboxes[i];
|
||||
|
||||
@@ -177,9 +167,10 @@ public sealed class JukeboxSystem : EntitySystem
|
||||
|
||||
playingJukeboxData.PlayingSongData.PlaybackPosition += _updateTimer;
|
||||
|
||||
if (playingJukeboxData.PlayingSongData.PlaybackPosition >= playingJukeboxData.PlayingSongData.ActualSongLengthSeconds)
|
||||
if (playingJukeboxData.PlayingSongData.PlaybackPosition >=
|
||||
playingJukeboxData.PlayingSongData.ActualSongLengthSeconds)
|
||||
{
|
||||
if (playingJukeboxData.Repeating)
|
||||
if (playingJukeboxData.Playing)
|
||||
{
|
||||
playingJukeboxData.PlayingSongData.PlaybackPosition = 0;
|
||||
}
|
||||
@@ -195,14 +186,4 @@ public sealed class JukeboxSystem : EntitySystem
|
||||
|
||||
_updateTimer = 0;
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, JukeboxComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new JukeboxComponentState()
|
||||
{
|
||||
SongData = component.PlayingSongData,
|
||||
Playing = component.Repeating,
|
||||
Volume = component.Volume
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public sealed class ServerJukeboxSongsSyncManager : JukeboxSongsSyncManager
|
||||
}
|
||||
}
|
||||
|
||||
public (string songName, ResPath path) SyncSongData(string songName, List<byte> bytes)
|
||||
public (string SongName, ResPath Path) SyncSongData(string songName, List<byte> bytes)
|
||||
{
|
||||
if (ContentRoot.TryGetFile(new ResPath(songName + ".ogg"), out _))
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared._White.Jukebox;
|
||||
using Robust.Shared.Configuration;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -16,16 +16,15 @@ namespace Content.Server._White.Jukebox;
|
||||
|
||||
public sealed class TapeCreatorSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly ServerJukeboxSongsSyncManager _songsSyncManager = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly ContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
|
||||
private const int RecordTime = 25;
|
||||
|
||||
private readonly int _recordTime = 25;
|
||||
|
||||
private static string TapeCreatorContainerName = "tape_creator_container";
|
||||
private const string TapeCreatorContainerName = "tape_creator_container";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -44,7 +43,7 @@ public sealed class TapeCreatorSystem : EntitySystem
|
||||
if (ev.Hands == null) return;
|
||||
if (component.TapeContainer.ContainedEntities.Count == 0) return;
|
||||
|
||||
var removeTapeVerb = new Verb()
|
||||
var removeTapeVerb = new Verb
|
||||
{
|
||||
Text = "Вытащить касету",
|
||||
Priority = 10000,
|
||||
@@ -52,15 +51,15 @@ public sealed class TapeCreatorSystem : EntitySystem
|
||||
Act = () =>
|
||||
{
|
||||
var tapes = component.TapeContainer.ContainedEntities.ToList();
|
||||
_containerSystem.EmptyContainer(component.TapeContainer, true);
|
||||
_container.EmptyContainer(component.TapeContainer, true);
|
||||
|
||||
foreach (var tape in tapes)
|
||||
{
|
||||
_handsSystem.PickupOrDrop(ev.User, tape);
|
||||
_hands.PickupOrDrop(ev.User, tape);
|
||||
}
|
||||
|
||||
component.InsertedTape = null;
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,7 +68,7 @@ public sealed class TapeCreatorSystem : EntitySystem
|
||||
|
||||
private void OnTapeStateChanged(EntityUid uid, TapeComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new TapeComponentState()
|
||||
args.State = new TapeComponentState
|
||||
{
|
||||
Songs = component.Songs
|
||||
};
|
||||
@@ -87,95 +86,105 @@ public sealed class TapeCreatorSystem : EntitySystem
|
||||
|
||||
private void OnComponentInit(EntityUid uid, TapeCreatorComponent component, ComponentInit args)
|
||||
{
|
||||
component.TapeContainer = _containerSystem.EnsureContainer<Container>(uid, TapeCreatorContainerName);
|
||||
component.TapeContainer = _container.EnsureContainer<Container>(uid, TapeCreatorContainerName);
|
||||
}
|
||||
|
||||
private void OnInteract(EntityUid uid, TapeCreatorComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if(component.Recording) return;
|
||||
if (component.Recording)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp<TapeComponent>(args.Used, out var tape))
|
||||
if (HasComp<TapeComponent>(args.Used))
|
||||
{
|
||||
var containedEntities = component.TapeContainer.ContainedEntities;
|
||||
|
||||
if (containedEntities.Count > 1)
|
||||
{
|
||||
var removedTapes = _containerSystem.EmptyContainer(component.TapeContainer, true).ToList();
|
||||
component.TapeContainer.Insert(args.Used);
|
||||
var removedTapes = _container.EmptyContainer(component.TapeContainer, true).ToList();
|
||||
_container.Insert(args.Used, component.TapeContainer);
|
||||
|
||||
foreach (var tapes in removedTapes)
|
||||
{
|
||||
_handsSystem.PickupOrDrop(args.User, tapes);
|
||||
_hands.PickupOrDrop(args.User, tapes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
component.TapeContainer.Insert(args.Used);
|
||||
_container.Insert(args.Used, component.TapeContainer);
|
||||
}
|
||||
|
||||
component.InsertedTape = GetNetEntity(tape.Owner);
|
||||
Dirty(component);
|
||||
component.InsertedTape = GetNetEntity(args.Used);
|
||||
Dirty(uid, component);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_tagSystem.HasTag(args.Used, "TapeRecorderCoin"))
|
||||
if (_tag.HasTag(args.Used, "TapeRecorderCoin"))
|
||||
{
|
||||
Del(args.Used);
|
||||
component.CoinBalance += 1;
|
||||
Dirty(component);
|
||||
|
||||
return;
|
||||
Dirty(uid, component);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSongUploaded(JukeboxSongUploadRequest ev)
|
||||
{
|
||||
if(!TryComp<TapeCreatorComponent>(GetEntity(ev.TapeCreatorUid), out var tapeCreatorComponent)) return;
|
||||
var tapeCreator = GetEntity(ev.TapeCreatorUid);
|
||||
if (!TryComp<TapeCreatorComponent>(tapeCreator, out var tapeCreatorComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tapeCreatorComponent.InsertedTape.HasValue || tapeCreatorComponent.CoinBalance <= 0)
|
||||
{
|
||||
_popupSystem.PopupEntity("Т# %ак@ э*^о сdf{ал б2я~b? Запись была прервана.", tapeCreatorComponent.Owner);
|
||||
_popup.PopupEntity("Т# %ак@ э*^о сdf{ал б2я~b? Запись была прервана.", tapeCreator);
|
||||
return;
|
||||
}
|
||||
|
||||
tapeCreatorComponent.CoinBalance -= 1;
|
||||
tapeCreatorComponent.Recording = true;
|
||||
|
||||
var tapeComponent = Comp<TapeComponent>(GetEntity(tapeCreatorComponent.InsertedTape.Value));
|
||||
var insertedTape = GetEntity(tapeCreatorComponent.InsertedTape.Value);
|
||||
var tapeComponent = Comp<TapeComponent>(insertedTape);
|
||||
var songData = _songsSyncManager.SyncSongData(ev.SongName, ev.SongBytes);
|
||||
|
||||
var song = new JukeboxSong()
|
||||
var song = new JukeboxSong
|
||||
{
|
||||
SongName = songData.songName,
|
||||
SongPath = songData.path
|
||||
SongName = songData.SongName,
|
||||
SongPath = songData.Path
|
||||
};
|
||||
|
||||
tapeComponent.Songs.Add(song);
|
||||
_popupSystem.PopupEntity($"Запись началась, примерное время ожидания: {_recordTime} секунд", tapeCreatorComponent.Owner);
|
||||
_popup.PopupEntity($"Запись началась, примерное время ожидания: {RecordTime} секунд", tapeCreator);
|
||||
|
||||
DirtyEntity(GetEntity(ev.TapeCreatorUid));
|
||||
Dirty(tapeComponent);
|
||||
StartRecordDelayAsync(tapeCreatorComponent, _popupSystem, _containerSystem);
|
||||
Dirty(insertedTape, tapeComponent);
|
||||
StartRecordDelayAsync(tapeCreator, tapeCreatorComponent, _popup, _container);
|
||||
}
|
||||
|
||||
private async void StartRecordDelayAsync(TapeCreatorComponent component, SharedPopupSystem popupSystem, SharedContainerSystem containerSystem)
|
||||
private async void StartRecordDelayAsync(
|
||||
EntityUid uid,
|
||||
TapeCreatorComponent component,
|
||||
SharedPopupSystem popupSystem,
|
||||
SharedContainerSystem containerSystem)
|
||||
{
|
||||
var recordTimeDelay = _recordTime * 1000 / 10;
|
||||
const int recordTimeDelay = RecordTime * 1000 / 10;
|
||||
|
||||
await Task.Delay(1000);
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
popupSystem.PopupEntity($"Запись мозговой активности выполнена на {i * 10}%", component.Owner);
|
||||
popupSystem.PopupEntity($"Запись мозговой активности выполнена на {i * 10}%", uid);
|
||||
await Task.Delay(recordTimeDelay);
|
||||
}
|
||||
|
||||
|
||||
containerSystem.EmptyContainer(component.TapeContainer, force: true).ToList();
|
||||
containerSystem.EmptyContainer(component.TapeContainer, force: true);
|
||||
|
||||
component.Recording = false;
|
||||
component.InsertedTape = null;
|
||||
|
||||
popupSystem.PopupEntity($"Запись мозговой активности завершена", component.Owner);
|
||||
Dirty(component);
|
||||
popupSystem.PopupEntity("Запись мозговой активности завершена", uid);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ namespace Content.Server._White.Keyhole;
|
||||
|
||||
public sealed partial class KeyholeSystem : EntitySystem
|
||||
{
|
||||
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
@@ -37,6 +36,11 @@ public sealed partial class KeyholeSystem : EntitySystem
|
||||
|
||||
private void OnKeyInsert(EntityUid uid, KeyComponent component, AfterInteractEvent ev)
|
||||
{
|
||||
if (!ev.Target.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp<KeyformComponent>(ev.Target, out var keyformComponent))
|
||||
OnKeyInsertForm(uid, component, keyformComponent, ev);
|
||||
|
||||
@@ -45,24 +49,24 @@ public sealed partial class KeyholeSystem : EntitySystem
|
||||
|
||||
keyholeComponent.FormId ??= component.FormId;
|
||||
|
||||
if (!CanLock(keyholeComponent.Owner, keyholeComponent, component))
|
||||
if (!CanLock(ev.Target.Value, keyholeComponent, component))
|
||||
return;
|
||||
|
||||
var doAfterEventArgs =
|
||||
new DoAfterArgs(EntityManager, ev.User, keyholeComponent.Delay, new KeyInsertDoAfterEvent(), ev.Target, ev.Used)
|
||||
{
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true,
|
||||
BreakOnDamage = true
|
||||
};
|
||||
var doAfterEventArgs = new DoAfterArgs(EntityManager, ev.User, keyholeComponent.Delay,
|
||||
new KeyInsertDoAfterEvent(), ev.Target, ev.Used)
|
||||
{
|
||||
BreakOnMove = true,
|
||||
BreakOnDamage = true
|
||||
};
|
||||
|
||||
_doAfter.TryStartDoAfter(doAfterEventArgs);
|
||||
}
|
||||
|
||||
private bool CanLock(EntityUid uid, KeyholeComponent keyholeComponent, KeyComponent keyComponent)
|
||||
{
|
||||
var can = TryComp<DoorComponent>(uid, out var doorComponent) &&
|
||||
keyholeComponent.FormId == keyComponent.FormId &&
|
||||
doorComponent.State == DoorState.Closed;
|
||||
keyholeComponent.FormId == keyComponent.FormId &&
|
||||
doorComponent.State == DoorState.Closed;
|
||||
|
||||
return can;
|
||||
}
|
||||
@@ -80,13 +84,14 @@ public sealed partial class KeyholeSystem : EntitySystem
|
||||
private bool IsStateChanging(EntityUid uid)
|
||||
{
|
||||
return TryComp<DoorComponent>(uid, out var doorComponent) &&
|
||||
(doorComponent.State == DoorState.Closing || doorComponent.State == DoorState.Opening);
|
||||
(doorComponent.State == DoorState.Closing || doorComponent.State == DoorState.Opening);
|
||||
}
|
||||
|
||||
private void Lock(EntityUid uid, KeyholeComponent component, EntityUid user)
|
||||
{
|
||||
var sound = component.Locked ? component.UnlockSound : component.LockSound;
|
||||
var message = Loc.GetString(component.Locked ? "key-unlock-message" : "key-lock-message", ("name", user), ("door", uid));
|
||||
var message = Loc.GetString(component.Locked ? "key-unlock-message" : "key-lock-message", ("name", user),
|
||||
("door", uid));
|
||||
|
||||
var audioParams = new AudioParams().WithVolume(-5f);
|
||||
|
||||
@@ -96,7 +101,11 @@ public sealed partial class KeyholeSystem : EntitySystem
|
||||
component.Locked = !component.Locked;
|
||||
}
|
||||
|
||||
private void OnKeyInsertForm(EntityUid uid, KeyComponent keyComponent, KeyformComponent keyformComponent, AfterInteractEvent args)
|
||||
private void OnKeyInsertForm(
|
||||
EntityUid uid,
|
||||
KeyComponent keyComponent,
|
||||
KeyformComponent keyformComponent,
|
||||
AfterInteractEvent args)
|
||||
{
|
||||
if (!keyformComponent.IsUsed)
|
||||
{
|
||||
@@ -104,16 +113,16 @@ public sealed partial class KeyholeSystem : EntitySystem
|
||||
_appearance.SetData(keyformComponent.Owner, KeyformVisuals.IsUsed, true);
|
||||
|
||||
_audio.PlayPvs(keyformComponent.PressSound, uid);
|
||||
_popupSystem.PopupEntity(Loc.GetString("key-pressed-in-keyform-message-first", ("user", args.User), ("key", uid)), uid);
|
||||
_popupSystem.PopupEntity(
|
||||
Loc.GetString("key-pressed-in-keyform-message-first", ("user", args.User), ("key", uid)), uid);
|
||||
|
||||
keyformComponent.IsUsed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyComponent.FormId = keyformComponent.FormId;
|
||||
_popupSystem.PopupEntity(Loc.GetString("key-pressed-in-keyform-message", ("user", args.User), ("key", uid)), uid);
|
||||
_popupSystem.PopupEntity(Loc.GetString("key-pressed-in-keyform-message", ("user", args.User), ("key", uid)),
|
||||
uid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
using Content.Server.Chat.Managers;
|
||||
using System.Linq;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Chat.Managers;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Store.Components;
|
||||
using Content.Server.Store.Systems;
|
||||
using Content.Server._White.Sponsors;
|
||||
@@ -17,18 +14,11 @@ using Content.Shared.GameTicking;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared._White;
|
||||
using Content.Shared._White.MeatyOre;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared._White;
|
||||
using Content.Shared._White.MeatyOre;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameStates;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
@@ -49,21 +39,19 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
|
||||
[Dependency] private readonly PvsOverrideSystem _pvsOverrideSystem = default!;
|
||||
[Dependency] private readonly RoleSystem _roleSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedJobSystem _jobSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
|
||||
private HttpClient _httpClient = default!;
|
||||
private string _apiUrl = default!;
|
||||
|
||||
private static readonly string StorePresetPrototype = "StorePresetMeatyOre";
|
||||
private static readonly string MeatyOreCurrencyPrototype = "MeatyOreCoin";
|
||||
private const string StorePresetPrototype = "StorePresetMeatyOre";
|
||||
private const string MeatyOreCurrencyPrototype = "MeatyOreCoin";
|
||||
|
||||
private bool _meatyOrePanelEnabled;
|
||||
private bool _antagGrantEnabled;
|
||||
|
||||
private readonly Dictionary<NetUserId, StoreComponent> _meatyOreStores = new();
|
||||
private readonly Dictionary<NetUserId, (EntityUid Entity, StoreComponent Component)> _meatyOreStores = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -73,17 +61,16 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
|
||||
_configurationManager.OnValueChanged(WhiteCVars.MeatyOrePanelEnabled, OnPanelEnableChanged, true);
|
||||
_configurationManager.OnValueChanged(WhiteCVars.OnlyInOhio, s => _apiUrl = s, true);
|
||||
_configurationManager.OnValueChanged(WhiteCVars.EnableGrantAntag, b => _antagGrantEnabled = b, true );
|
||||
_configurationManager.OnValueChanged(WhiteCVars.EnableGrantAntag, b => _antagGrantEnabled = b, true);
|
||||
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnPostRoundCleanup);
|
||||
SubscribeNetworkEvent<MeatyOreShopRequestEvent>(OnShopRequested);
|
||||
SubscribeLocalEvent<GetVerbsEvent<Verb>>(MeatyOreVerbs);
|
||||
|
||||
}
|
||||
|
||||
private void MeatyOreVerbs(GetVerbsEvent<Verb> ev)
|
||||
{
|
||||
if(!_antagGrantEnabled)
|
||||
if (!_antagGrantEnabled)
|
||||
return;
|
||||
|
||||
if (!EntityManager.TryGetComponent<ActorComponent>(ev.User, out var actorComponent))
|
||||
@@ -95,23 +82,22 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
if (!HasComp<HumanoidAppearanceComponent>(ev.Target))
|
||||
return;
|
||||
|
||||
if (!TryGetStore(actorComponent.PlayerSession, out var store))
|
||||
if (!TryGetStore(actorComponent.PlayerSession, out var store, out var storeEntity))
|
||||
return;
|
||||
|
||||
var verb = new Verb()
|
||||
var verb = new Verb
|
||||
{
|
||||
Text = $"Выдать роль.",
|
||||
Text = "Выдать роль.",
|
||||
ConfirmationPopup = true,
|
||||
Message = $"Цена - {MeatyOreCurrencyPrototype}:10",
|
||||
Act = () =>
|
||||
{
|
||||
TryAddRole(ev.User, ev.Target, store);
|
||||
TryAddRole(ev.User, ev.Target, store, storeEntity.Value);
|
||||
},
|
||||
Category = VerbCategory.MeatyOre
|
||||
};
|
||||
|
||||
ev.Verbs.Add(verb);
|
||||
|
||||
}
|
||||
|
||||
private void OnPanelEnableChanged(bool enabled)
|
||||
@@ -120,57 +106,66 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
{
|
||||
foreach (var meatyOreStoreData in _meatyOreStores)
|
||||
{
|
||||
var session = _playerManager.GetSessionByUserId(meatyOreStoreData.Key);
|
||||
var session = _playerManager.GetSessionById(meatyOreStoreData.Key);
|
||||
|
||||
var playerEntity = session.AttachedEntity;
|
||||
|
||||
if(!playerEntity.HasValue)
|
||||
if (!playerEntity.HasValue)
|
||||
continue;
|
||||
|
||||
_storeSystem.CloseUi(playerEntity.Value, meatyOreStoreData.Value);
|
||||
_storeSystem.CloseUi(playerEntity.Value, meatyOreStoreData.Value.Component);
|
||||
}
|
||||
}
|
||||
|
||||
_meatyOrePanelEnabled = enabled;
|
||||
}
|
||||
|
||||
private void OnShopRequested(MeatyOreShopRequestEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
|
||||
var playerSession = args.SenderSession;
|
||||
|
||||
if (!_meatyOrePanelEnabled)
|
||||
{
|
||||
_chatManager.DispatchServerMessage(playerSession!, "Мясная панель отключена на данном сервере! Приятной игры!");
|
||||
_chatManager.DispatchServerMessage(playerSession,
|
||||
"Мясная панель отключена на данном сервере! Приятной игры!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var playerEntity = args.SenderSession.AttachedEntity;
|
||||
|
||||
if(!playerEntity.HasValue)
|
||||
if (!playerEntity.HasValue)
|
||||
return;
|
||||
|
||||
if(!HasComp<HumanoidAppearanceComponent>(playerEntity.Value))
|
||||
if (!HasComp<HumanoidAppearanceComponent>(playerEntity.Value))
|
||||
return;
|
||||
|
||||
if(!TryGetStore(playerSession!, out var storeComponent))
|
||||
if (!TryGetStore(playerSession, out var storeComponent, out var storeEntity))
|
||||
return;
|
||||
|
||||
_pvsOverrideSystem.AddSessionOverride(storeComponent.Owner, playerSession!);
|
||||
_storeSystem.ToggleUi(playerEntity.Value, storeComponent.Owner, storeComponent);
|
||||
_pvsOverrideSystem.AddSessionOverride(storeEntity.Value, playerSession);
|
||||
_storeSystem.ToggleUi(playerEntity.Value, storeEntity.Value, storeComponent);
|
||||
}
|
||||
|
||||
private bool TryGetStore(ICommonSession session, out StoreComponent store)
|
||||
private bool TryGetStore(ICommonSession session, out StoreComponent store, [NotNullWhen(true)] out EntityUid? storeEntity)
|
||||
{
|
||||
store = null!;
|
||||
storeEntity = null!;
|
||||
|
||||
if (!_sponsorsManager.TryGetInfo(session.UserId, out var sponsorInfo))
|
||||
return false;
|
||||
if (_meatyOreStores.TryGetValue(session.UserId, out store!))
|
||||
|
||||
if (_meatyOreStores.TryGetValue(session.UserId, out var pair))
|
||||
{
|
||||
storeEntity = pair.Entity;
|
||||
store = pair.Component;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sponsorInfo.MeatyOreCoin == 0)
|
||||
return false;
|
||||
|
||||
store = CreateStore(session.UserId, sponsorInfo.MeatyOreCoin);
|
||||
(storeEntity, store) = CreateStore(session.UserId, sponsorInfo.MeatyOreCoin);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -178,29 +173,31 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
{
|
||||
foreach (var store in _meatyOreStores.Values)
|
||||
{
|
||||
Del(store.Owner);
|
||||
Del(store.Entity);
|
||||
}
|
||||
|
||||
_meatyOreStores.Clear();
|
||||
}
|
||||
|
||||
private StoreComponent CreateStore(NetUserId userId, int balance)
|
||||
private (EntityUid, StoreComponent) CreateStore(NetUserId userId, int balance)
|
||||
{
|
||||
var session = _playerManager.GetSessionByUserId(userId);
|
||||
var shopEntity = _entityManager.SpawnEntity("StoreMeatyOreEntity", MapCoordinates.Nullspace);
|
||||
var storeComponent = Comp<StoreComponent>(shopEntity);
|
||||
var session = _playerManager.GetSessionById(userId);
|
||||
var storeEntity = _entityManager.SpawnEntity("StoreMeatyOreEntity", MapCoordinates.Nullspace);
|
||||
var storeComponent = Comp<StoreComponent>(storeEntity);
|
||||
|
||||
_storeSystem.InitializeFromPreset(StorePresetPrototype, shopEntity, storeComponent);
|
||||
_storeSystem.InitializeFromPreset(StorePresetPrototype, storeEntity, storeComponent);
|
||||
storeComponent.Balance.Clear();
|
||||
|
||||
_storeSystem.TryAddCurrency(new Dictionary<string, FixedPoint2>() { { MeatyOreCurrencyPrototype, balance } }, storeComponent.Owner, storeComponent);
|
||||
_meatyOreStores[userId] = storeComponent;
|
||||
_pvsOverrideSystem.AddSessionOverride(shopEntity, session);
|
||||
_storeSystem.TryAddCurrency(new Dictionary<string, FixedPoint2> { { MeatyOreCurrencyPrototype, balance } },
|
||||
storeEntity, storeComponent);
|
||||
|
||||
return storeComponent;
|
||||
_meatyOreStores[userId] = (storeEntity, storeComponent);
|
||||
_pvsOverrideSystem.AddSessionOverride(storeEntity, session);
|
||||
|
||||
return (storeEntity, storeComponent);
|
||||
}
|
||||
|
||||
private async void TryAddRole(EntityUid user, EntityUid target, StoreComponent store)
|
||||
private async void TryAddRole(EntityUid user, EntityUid target, StoreComponent store, EntityUid storeEntity)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent<ActorComponent>(user, out var userActorComponent))
|
||||
return;
|
||||
@@ -217,10 +214,9 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
if (!store.Balance.TryGetValue(MeatyOreCurrencyPrototype, out var currency))
|
||||
return;
|
||||
|
||||
if(currency - 10 < 0)
|
||||
if (currency - 10 < 0)
|
||||
return;
|
||||
|
||||
|
||||
var fake = _roleSystem.MindIsAntagonist(targetMind.Mind.Value) || !_jobSystem.CanBeAntag(mindComponent.Session);
|
||||
|
||||
var ckey = userActorComponent.PlayerSession.Name;
|
||||
@@ -229,21 +225,23 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
|
||||
if (result)
|
||||
{
|
||||
_storeSystem.TryAddCurrency(new Dictionary<string, FixedPoint2> { { MeatyOreCurrencyPrototype, -10 } }, store.Owner, store);
|
||||
_storeSystem.TryAddCurrency(new Dictionary<string, FixedPoint2> { { MeatyOreCurrencyPrototype, -10 } },
|
||||
storeEntity, store);
|
||||
|
||||
if (!fake)
|
||||
{
|
||||
_traitorRuleSystem.MakeTraitor(targetActorComponent.PlayerSession);
|
||||
_traitorRuleSystem.MakeTraitorAdmin(target, true, true);
|
||||
|
||||
var msg = $"Игрок с сикеем {ckey} выдал антажку {targetActorComponent.PlayerSession.Name}";
|
||||
_chatManager.SendAdminAnnouncement(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = $"Игрок с сикеем {ckey} попытался выдать антажку {targetActorComponent.PlayerSession.Name}. Но обосрался. Была выдана фейковая антажка.";
|
||||
var msg =
|
||||
$"Игрок с сикеем {ckey} попытался выдать антажку {targetActorComponent.PlayerSession.Name}. Но обосрался. Была выдана фейковая антажка.";
|
||||
|
||||
_chatManager.SendAdminAnnouncement(msg);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -301,9 +299,7 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
url = $"{_apiUrl}/api/Antagonist/cooldownFriend?userId={ckey}";
|
||||
}
|
||||
|
||||
HttpResponseMessage response;
|
||||
|
||||
response = await _httpClient.GetAsync(url);
|
||||
var response = await _httpClient.GetAsync(url);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
@@ -311,7 +307,8 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
if (!string.IsNullOrEmpty(responseData))
|
||||
{
|
||||
var jsonObject = JObject.Parse(responseData);
|
||||
if (jsonObject.TryGetValue("remainingTime", out var remainingTimeToken) && TimeSpan.TryParse(remainingTimeToken.ToString(), out var remainingTime))
|
||||
if (jsonObject.TryGetValue("remainingTime", out var remainingTimeToken) &&
|
||||
TimeSpan.TryParse(remainingTimeToken.ToString(), out var remainingTime))
|
||||
{
|
||||
var time = new TimeSpan(remainingTime.Hours, remainingTime.Minutes, 0);
|
||||
return time;
|
||||
@@ -330,4 +327,4 @@ public sealed class MeatyOreStoreSystem : EntitySystem
|
||||
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Server._White.SelfHeal;
|
||||
|
||||
public sealed class SelfHealSystem: EntitySystem
|
||||
public sealed class SelfHealSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
@@ -49,7 +49,6 @@ public sealed class SelfHealSystem: EntitySystem
|
||||
|
||||
private void OnDoAfter(EntityUid uid, DamageableComponent component, SelfHealDoAfterEvent args)
|
||||
{
|
||||
var dontRepeat = false;
|
||||
|
||||
if (!TryComp(args.User, out SelfHealComponent? healing) || args.Target == null)
|
||||
return;
|
||||
@@ -57,9 +56,9 @@ public sealed class SelfHealSystem: EntitySystem
|
||||
if (args.Handled || args.Cancelled)
|
||||
return;
|
||||
|
||||
if (healing.DamageContainers is not null &&
|
||||
component.DamageContainerID is not null &&
|
||||
!healing.DamageContainers.Contains(component.DamageContainerID))
|
||||
if (healing.DamageContainers is not null
|
||||
&& component.DamageContainerID is not null
|
||||
&& !healing.DamageContainers.Contains(component.DamageContainerID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -70,12 +69,11 @@ public sealed class SelfHealSystem: EntitySystem
|
||||
Heal(args.Target.Value, healing, args);
|
||||
|
||||
// Logic to determine the whether or not to repeat the healing action
|
||||
args.Repeat = (HasDamage(component, healing) && !dontRepeat);
|
||||
if (!args.Repeat && !dontRepeat)
|
||||
args.Repeat = HasDamage(component, healing);
|
||||
if (!args.Repeat)
|
||||
_popupSystem.PopupEntity(Loc.GetString("self-heal-finished-using", ("name", uid)), uid, args.User);
|
||||
|
||||
args.Handled = true;
|
||||
|
||||
}
|
||||
|
||||
private void Heal(EntityUid uid, SelfHealComponent component, SelfHealDoAfterEvent args)
|
||||
@@ -92,6 +90,7 @@ public sealed class SelfHealSystem: EntitySystem
|
||||
var healMessage = uid != args.User
|
||||
? $"{userString:user} healed {targetString:target} for {total:damage} by licking"
|
||||
: $"{userString:user} healed themselves for {total:damage} by licking";
|
||||
|
||||
_adminLogger.Add(LogType.Healed, $"{healMessage}");
|
||||
|
||||
if (TryComp<SelfHealComponent>(args.User, out var selfHealComponent))
|
||||
@@ -100,13 +99,15 @@ public sealed class SelfHealSystem: EntitySystem
|
||||
var audioParams = new AudioParams().WithVariation(2f).WithVolume(-5f);
|
||||
|
||||
_audio.PlayPvs(audio, args.User, audioParams);
|
||||
_popupSystem.PopupEntity(Loc.GetString("self-heal-using-other", ("user", args.Args.User), ("target", uid)), uid);
|
||||
_popupSystem.PopupEntity(Loc.GetString("self-heal-using-other", ("user", args.Args.User), ("target", uid)),
|
||||
uid);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanHeal(EntityUid user, EntityUid target, SelfHealComponent component)
|
||||
{
|
||||
if (!TryComp<DamageableComponent>(target, out var targetDamage) || !HasComp<HumanoidAppearanceComponent>(target))
|
||||
if (!TryComp<DamageableComponent>(target, out var targetDamage) ||
|
||||
!HasComp<HumanoidAppearanceComponent>(target))
|
||||
return false;
|
||||
|
||||
if (user != target && !_interactionSystem.InRangeUnobstructed(user, target, popup: true))
|
||||
@@ -140,7 +141,9 @@ public sealed class SelfHealSystem: EntitySystem
|
||||
{
|
||||
if (_inventorySystem.TryGetSlotEntity(target, clothing, out var blockedClothing))
|
||||
{
|
||||
var popup = Loc.GetString("self-heal-cant-use-clothing-other", ("name", target), ("clothing", blockedClothing));
|
||||
var popup = Loc.GetString("self-heal-cant-use-clothing-other", ("name", target),
|
||||
("clothing", blockedClothing));
|
||||
|
||||
_popupSystem.PopupEntity(popup, user, user);
|
||||
return false;
|
||||
}
|
||||
@@ -158,10 +161,10 @@ public sealed class SelfHealSystem: EntitySystem
|
||||
var doAfterEventArgs =
|
||||
new DoAfterArgs(EntityManager, user, component.Delay, new SelfHealDoAfterEvent(), target, target)
|
||||
{
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true,
|
||||
BreakOnMove = true,
|
||||
BreakOnDamage = true,
|
||||
};
|
||||
|
||||
_doAfter.TryStartDoAfter(doAfterEventArgs);
|
||||
}
|
||||
|
||||
@@ -177,4 +180,4 @@ public sealed class SelfHealSystem: EntitySystem
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user