Merge remote-tracking branch 'WD-core/master' into upstream-core

This commit is contained in:
BIGZi0348
2025-01-01 19:40:47 +03:00
31 changed files with 298 additions and 54 deletions

View File

@@ -0,0 +1,12 @@
namespace Content.Server._White.RandomArtifactDesc
{
/// <summary>
/// WD.
/// Добавляет описание предмету.
/// </summary>
[RegisterComponent]
public sealed partial class RandomArtifactDescComponent : Component
{
}
}

View File

@@ -0,0 +1,22 @@
using Content.Shared.Examine;
namespace Content.Server._White.RandomArtifactDesc;
public sealed class RandomArtifactDescSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RandomArtifactDescComponent, ExaminedEvent>(OnExamined);
}
private void OnExamined(EntityUid uid, RandomArtifactDescComponent component, ExaminedEvent args)
{
if (args.IsInDetailsRange)
{
args.PushMarkup("С этим предметом что-то не так.");
}
}
}

View File

@@ -2,10 +2,16 @@
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Server.Xenoarchaeology.XenoArtifacts;
using Content.Server._White.RandomArtifactDesc;
using Content.Shared._White;
using Content.Shared.Damage;
using Content.Shared.Stacks;
using Content.Shared.Item;
using Robust.Shared.Configuration;
using Robust.Shared.Random;
using Robust.Server.GameObjects;
using Content.Shared.Body.Organ;
using Content.Shared.Body.Part;
namespace Content.Server._White.RandomArtifacts;
@@ -15,8 +21,9 @@ public sealed class RandomArtifactsSystem : EntitySystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;
private float _itemToArtifactRatio; // from 0 to 100. In % percents. Default is 0.7%
private float _itemToArtifactRatio; // from 0 to 100. In % percents. Default is 0.4%
private bool _artifactsEnabled;
public override void Initialize()
@@ -34,11 +41,12 @@ public sealed class RandomArtifactsSystem : EntitySystem
if (!_artifactsEnabled)
return;
// Removing old artifact-items and replace it with new funny stealthy items
foreach (var oldArtifact in EntityQuery<ArtifactComponent>())
{
QueueDel(oldArtifact.Owner);
}
// No we don't
// // Removing old artifact-items and replace it with new funny stealthy items
// foreach (var oldArtifact in EntityQuery<ArtifactComponent>())
// {
// QueueDel(oldArtifact.Owner);
// }
var items = EntityQuery<ItemComponent>().ToList();
_random.Shuffle(items);
@@ -55,8 +63,26 @@ public sealed class RandomArtifactsSystem : EntitySystem
if (!HasComp<StationDataComponent>(station))
continue;
var artifactComponent = EnsureComp<ArtifactComponent>(entity);
_artifactsSystem.RandomizeArtifact(entity, artifactComponent);
if (HasComp<StackComponent>(entity))
continue;
if (HasComp<PointLightComponent>(entity))
continue;
if (HasComp<OrganComponent>(entity))
continue;
if (HasComp<BodyPartComponent>(entity))
continue;
// var artifactComponent = EnsureComp<ArtifactComponent>(entity);
var comp = (ArtifactComponent) _componentFactory.GetComponent("Artifact");
comp.Owner = entity;
_artifactsSystem.SafeRandomizeArtifact(entity, ref comp);
AddComp(entity, comp);
EnsureComp<RandomArtifactDescComponent>(entity);
EnsureComp<DamageableComponent>(entity);
}
}
@@ -75,7 +101,11 @@ public sealed class RandomArtifactsSystem : EntitySystem
foreach (var (_, artifact) in items)
{
RemComp<ArtifactComponent>(artifact.Owner);
if (HasComp<RandomArtifactDescComponent>(artifact.Owner))
{
RemComp<ArtifactComponent>(artifact.Owner);
RemComp<RandomArtifactDescComponent>(artifact.Owner);
}
}
}

View File

@@ -32,6 +32,9 @@ namespace Content.Server._White._Engi.PacifiedOnChaplainAction
private void Action(PacifiedOnChaplainActionComponent component, EntityUid target, EntityUid user)
{
if (!HasComp<PacifiedOnChaplainActionComponent>(target))
return;
var popup = "";
if (HasComp<PacifiedComponent>(target))