diff --git a/Content.Server/_Sunrise/Research/Artifact/Effects/RandomTransformation/ArtifactRandomTransformationComponent.cs b/Content.Server/_Sunrise/Research/Artifact/Effects/RandomTransformation/ArtifactRandomTransformationComponent.cs index 3a6d0840e5..30a1d7e901 100644 --- a/Content.Server/_Sunrise/Research/Artifact/Effects/RandomTransformation/ArtifactRandomTransformationComponent.cs +++ b/Content.Server/_Sunrise/Research/Artifact/Effects/RandomTransformation/ArtifactRandomTransformationComponent.cs @@ -16,4 +16,10 @@ public sealed partial class ArtifactRandomTransformationComponent : Component [DataField] public HashSet>? CategoryBlacklist; + + [DataField] + public HashSet? ComponentBlacklist; + + [DataField] + public HashSet? PrototypeBlacklistExceptions; } diff --git a/Content.Server/_Sunrise/Research/Artifact/Effects/RandomTransformation/ArtifactRandomTransformationSystem.cs b/Content.Server/_Sunrise/Research/Artifact/Effects/RandomTransformation/ArtifactRandomTransformationSystem.cs index 71e5c0f3e6..1a0a28307c 100644 --- a/Content.Server/_Sunrise/Research/Artifact/Effects/RandomTransformation/ArtifactRandomTransformationSystem.cs +++ b/Content.Server/_Sunrise/Research/Artifact/Effects/RandomTransformation/ArtifactRandomTransformationSystem.cs @@ -82,12 +82,40 @@ public sealed class ArtifactRandomTransformationSystem : BaseXAESystem ent, EntityPrototype proto) + private IEnumerable GetAllParentIds(string protoId) { + if (!_prototype.TryIndex(protoId, out var proto)) + yield break; + + if (proto.Parents == null) + yield break; + + foreach (var parentId in proto.Parents) + { + yield return parentId; + + foreach (var parentParentsId in GetAllParentIds(parentId)) + { + yield return parentParentsId; + } + } + } + + private bool CanSpawnEntity(Entity ent, EntityPrototype proto) + { + if (proto.Abstract) + return false; + if (ent.Comp.PrototypeBlacklist != null && ent.Comp.PrototypeBlacklist.Contains(proto.ID)) return false; - if (proto.Abstract) + var isException = ent.Comp.PrototypeBlacklistExceptions != null && ent.Comp.PrototypeBlacklistExceptions.Contains(proto.ID); + + if (!isException && ent.Comp.PrototypeBlacklist != null && GetAllParentIds(proto.ID) + .Any(parentId => ent.Comp.PrototypeBlacklist.Contains(parentId))) + return false; + + if (ent.Comp.ComponentBlacklist != null && proto.Components.Keys.Any(id => ent.Comp.ComponentBlacklist.Contains(id))) return false; if (ent.Comp.CategoryBlacklist != null && proto.Categories.Any(c => ent.Comp.CategoryBlacklist.Contains(c))) diff --git a/Content.Shared/Xenoarchaeology/Artifact/Components/XenoArtifactNodeComponent.cs b/Content.Shared/Xenoarchaeology/Artifact/Components/XenoArtifactNodeComponent.cs index 4a8b8ec49f..04fa776af1 100644 --- a/Content.Shared/Xenoarchaeology/Artifact/Components/XenoArtifactNodeComponent.cs +++ b/Content.Shared/Xenoarchaeology/Artifact/Components/XenoArtifactNodeComponent.cs @@ -52,6 +52,11 @@ public sealed partial class XenoArtifactNodeComponent : Component [DataField, AutoNetworkedField] public int MaxDurability = 5; + // sunrise start + [DataField, AutoNetworkedField] + public bool TriggerDecreasesDurability; + // sunrise end + /// /// The variance from MaxDurability present when a node is created. /// diff --git a/Content.Shared/Xenoarchaeology/Artifact/SharedXenoArtifactSystem.Unlock.cs b/Content.Shared/Xenoarchaeology/Artifact/SharedXenoArtifactSystem.Unlock.cs index 57d6502bfb..430758f23b 100644 --- a/Content.Shared/Xenoarchaeology/Artifact/SharedXenoArtifactSystem.Unlock.cs +++ b/Content.Shared/Xenoarchaeology/Artifact/SharedXenoArtifactSystem.Unlock.cs @@ -75,7 +75,7 @@ public abstract partial class SharedXenoArtifactSystem if (TryGetNodeFromUnlockState(ent, out var node)) { SetNodeUnlocked((ent, artifactComponent), node.Value); - ActivateNode((ent, ent), (node.Value, node.Value), null, null, Transform(ent).Coordinates, false); + ActivateNode((ent, ent), (node.Value, node.Value), null, null, Transform(ent).Coordinates, node.Value.Comp.TriggerDecreasesDurability); unlockAttemptResultMsg = "artifact-unlock-state-end-success"; // as an experiment - unlocking node doesn't activate it, activation is left for player to decide. diff --git a/Resources/Prototypes/_Sunrise/Research/Artifact/effects.yml b/Resources/Prototypes/_Sunrise/Research/Artifact/effects.yml index 29a36f97fc..3eb6447272 100644 --- a/Resources/Prototypes/_Sunrise/Research/Artifact/effects.yml +++ b/Resources/Prototypes/_Sunrise/Research/Artifact/effects.yml @@ -153,6 +153,9 @@ description: artifact-effect-description-spawn-evil-twin categories: [ HideSpawnMenu ] components: + - type: XenoArtifactNode + maxDurability: 1 + triggerDecreasesDurability: true - type: ArtifactStartGameRule rules: EvilTwinSpawn: 2 @@ -199,7 +202,7 @@ categories: [ HideSpawnMenu ] components: - type: XAEShuffle - radius: 70 + radius: 30 - type: entity id: SunriseEffectPolyChair @@ -265,9 +268,37 @@ components: - type: ArtifactRandomTransformation prototypeBlacklist: + - BaseBloodCultGod + - BaseCentcommContraband + - BaseClone + - BaseGameRule + - BaseGrandTheftContraband + - BaseMagicalContraband + - BaseMajorContraband + - BaseMobFleshCult + - BaseSyndicateContraband + - BaseXenoborgContraband + - ContainmentField + - FleshHeart + - GasMinerBase + - ImmovableRod + - Incorporeal + - MobNarsieBase + - MobObserverBase + - MobRatvarBase + - MobTerminatorBase + - MobXenoRounyGhostRole + - NuclearGrenade - Singularity + - SupermatterCrystal - TeslaEnergyBall - TeslaMiniEnergyBall + componentBlacklist: + - MapGrid + - SurgeryStep + - SpawnPoint + - Contraband + - Meteor categoryBlacklist: - HideSpawnMenu - Debug diff --git a/Resources/Prototypes/_Sunrise/Research/Artifact/tables.yml b/Resources/Prototypes/_Sunrise/Research/Artifact/tables.yml index fe14d8d32f..7d91cb65c0 100644 --- a/Resources/Prototypes/_Sunrise/Research/Artifact/tables.yml +++ b/Resources/Prototypes/_Sunrise/Research/Artifact/tables.yml @@ -4,34 +4,48 @@ id: SunriseArtifactEffectsDefaultTable table: !type:GroupSelector children: + # хилит всех энтити в радиусе - id: SunriseEffectHeal weight: 2 + # генерирует энергию - id: SunriseArtifactGenerateEnergy weight: 2 + # артефакт начинает рандомно двигаться - id: SunriseArtifactWandering weight: 3 + # швыряет вещи вокруг - id: SunriseArtifactThrowThingsAround weight: 3 + # открывает ближайшие двери и шлюзы, аналогично заклинанию стука - id: SunriseArtifactKnock weight: 3 + # спавнит мусор - id: SunriseArtifactEffectJunkSpawn weight: 3 + # выбивает все окна - id: SunriseArtifactShatterWindows weight: 3 + # болтирует все шлюзы - id: SunriseEffectBoltAirlocks weight: 3 + # выдаёт голод всем в радиусе - id: SunriseArtifactHunger weight: 2 + # выдаёт жажду всем в радиусе - id: SunriseEffectThirst weight: 2 + # стреляет молниями в ближайших энтити некоторое время - id: SunriseEffectTeslaDischarge weight: 1 + # спавнит злых двойников - id: SunriseEffectSpawnEvilTwin - weight: 1 + weight: 0.6 + # телепортирует того, кто активировал артефакт - id: SunriseArtifactTeleport weight: 2 - id: SunriseArtifactEmp weight: 2 + # поджигает всех в радиусе - id: SunriseEffectIgnite weight: 1 @@ -39,24 +53,33 @@ id: SunriseArtifactEffectsUltraFunnyTable table: !type:GroupSelector children: + # шаффл всех айтемов в радиусе - id: SunriseEffectShuffleUltra weight: 2 + # превращает всех в радиусе в стулья на 2 минуты - id: SunriseEffectPolyChair weight: 3 + # превращает всех в радиусе в арбуз на 2 минуты - id: SunriseEffectPolyWatermelon weight: 3 + # превращает всех в радиусе аппендицит на 2 минуты - id: SunriseEffectPolyAppendix weight: 3 + # превращает всех в радиусе в мусорку на 2 минуты - id: SunriseEffectPolyDisposal weight: 3 + # превращает всех в радиусе в стол на 2 минуты - id: SunriseEffectPolyTable weight: 3 #- id: SunriseEffectSwap # weight: 3 + # превращает все предметы в радиусе в рандомные - id: SunriseEffectRandomTransformation - weight: 1 + weight: 0.3 + # временно притягивает к себе - id: SunriseEffectMagnetUltra weight: 2 + # даёт смешные акценты всем в радиусе - id: SunriseEffectShiftedAsciiTableAccent weight: 3