фиксы артефактов (#2637)

Co-authored-by: ThereDrD <88589686+ThereDrD0@users.noreply.github.com>
This commit is contained in:
Ligyb 2025-07-31 23:13:17 +05:00 committed by ReWAFFlution
parent ea74b3a69c
commit 84b09ebf37
6 changed files with 99 additions and 6 deletions

View file

@ -16,4 +16,10 @@ public sealed partial class ArtifactRandomTransformationComponent : Component
[DataField]
public HashSet<ProtoId<EntityCategoryPrototype>>? CategoryBlacklist;
[DataField]
public HashSet<string>? ComponentBlacklist;
[DataField]
public HashSet<EntProtoId>? PrototypeBlacklistExceptions;
}

View file

@ -82,12 +82,40 @@ public sealed class ArtifactRandomTransformationSystem : BaseXAESystem<ArtifactR
}
}
private static bool CanSpawnEntity(Entity<ArtifactRandomTransformationComponent> ent, EntityPrototype proto)
private IEnumerable<string> GetAllParentIds(string protoId)
{
if (!_prototype.TryIndex<EntityPrototype>(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<ArtifactRandomTransformationComponent> 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)))

View file

@ -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
/// <summary>
/// The variance from MaxDurability present when a node is created.
/// </summary>

View file

@ -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.

View file

@ -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

View file

@ -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