diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs index 4afd8af21c..9427b576bc 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs @@ -25,13 +25,13 @@ public sealed partial class ArtifactComponent : Component /// Minimum number of nodes to generate, inclusive /// [DataField("nodesMin")] - public int NodesMin = 3; + public int NodesMin = 2; /// /// Maximum number of nodes to generate, exclusive /// [DataField("nodesMax")] - public int NodesMax = 9; + public int NodesMax = 10; #endregion /// diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Commands.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Commands.cs index d840a1f209..f9583405e7 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Commands.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Commands.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Text; using Content.Server.Administration; using Content.Shared.Administration; using Robust.Shared.Console; @@ -17,6 +18,10 @@ public partial class ArtifactSystem _conHost.RegisterCommand("getartifactmaxvalue", "Reports the maximum research point value for a given artifact", "forceartifacteffect ", GetArtifactMaxValue); + + // WD added + _conHost.RegisterCommand("listartifacts", "List all artifact ids and names", "forceartifacteffect", + ListArtifacts); } [AdminCommand(AdminFlags.Fun)] @@ -68,4 +73,25 @@ public partial class ArtifactSystem var pointSum = GetResearchPointValue(uid.Value, artifact, true); shell.WriteLine($"Max point value for {ToPrettyString(uid.Value)} with {artifact.NodeTree.Count} nodes: {pointSum}"); } + + + // WD added - start + [AdminCommand(AdminFlags.Admin)] + private void ListArtifacts(IConsoleShell shell, string argstr, string[] args) + { + var items = EntityQuery(); + + var msg = new StringBuilder(); + + foreach (var artifact in items) + { + var entity = artifact.Owner; + var effects = string.Join(", ", artifact.NodeTree.ToArray().Select(x => x.Effect)); + + msg.AppendFormat("{0}: {1}, {2}\n\n", Name(entity), effects, entity); + } + + shell.WriteLine(msg.ToString()); + } + // WD added - end } diff --git a/Content.Server/_White/RandomArtifacts/RandomArtifactsSystem.cs b/Content.Server/_White/RandomArtifacts/RandomArtifactsSystem.cs new file mode 100644 index 0000000000..63378cc845 --- /dev/null +++ b/Content.Server/_White/RandomArtifacts/RandomArtifactsSystem.cs @@ -0,0 +1,84 @@ +using System.Linq; +using Content.Server.Xenoarchaeology.XenoArtifacts; +using Content.Shared._White; +using Content.Shared.GameTicking; +using Content.Shared.Item; +using Robust.Shared.Configuration; +using Robust.Shared.Random; + +namespace Content.Server._White.RandomArtifacts; + +public sealed class RandomArtifactsSystem : EntitySystem +{ + [Dependency] private readonly ArtifactSystem _artifactsSystem = default!; + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly IConfigurationManager _configurationManager = default!; + + private float _itemToArtifactRatio; // from 0 to 100. In % percents. Default is 0.7% + private bool _artifactsEnabled; + + public override void Initialize() + { + base.Initialize(); + + _configurationManager.OnValueChanged(WhiteCVars.EnableRandomArtifacts, b => OnCvarChanged(b), true); + _configurationManager.OnValueChanged(WhiteCVars.ItemToArtifactRatio, r => _itemToArtifactRatio = r, true); + + SubscribeLocalEvent(OnRoundStart); + } + + private void OnRoundStart(RoundStartedEvent ev) + { + if (!_artifactsEnabled) + return; + + // Removing old artifact-items and replace it with new funny stealthy items + foreach (var oldArtifact in EntityQuery()) + { + QueueDel(oldArtifact.Owner); + } + + var items = EntityQuery().ToList(); + _random.Shuffle(items); + + var selectedItems = GetPercentageOfHashSet(items, _itemToArtifactRatio); + + foreach (var item in selectedItems) + { + var entity = item.Owner; + + var artifactComponent = EnsureComp(entity); + _artifactsSystem.RandomizeArtifact(entity, artifactComponent); + } + } + + private HashSet GetPercentageOfHashSet(List sourceList, float percentage) + { + var countToAdd = (int) Math.Round((double) sourceList.Count * percentage / 100); + + return sourceList.Where(x => !Transform(x.Owner).Anchored).Take(countToAdd).ToHashSet(); + } + + private void OnCvarChanged(bool enabled) + { + if (_artifactsEnabled != enabled && !enabled) + { + var items = EntityQuery(); + + foreach (var (_, artifact) in items) + { + RemComp(artifact.Owner); + } + } + + _artifactsEnabled = enabled; + } + +} + +/* + Number of items on maps + DEV - 1527 + WhiteBox - 13692 + WonderBox - 15306 +*/ diff --git a/Content.Shared/_White/WhiteCVars.cs b/Content.Shared/_White/WhiteCVars.cs index 15d48981f4..8fecf88706 100644 --- a/Content.Shared/_White/WhiteCVars.cs +++ b/Content.Shared/_White/WhiteCVars.cs @@ -402,4 +402,14 @@ public sealed class WhiteCVars public static readonly CVarDef TimeTrackerApiKey = CVarDef.Create("white.time_tracker_key", "", CVar.SERVERONLY | CVar.CONFIDENTIAL | CVar.ARCHIVE); + + /* + * Random Artifacts + */ + + public static readonly CVarDef EnableRandomArtifacts = + CVarDef.Create("white.random_artifacts_enabled", true, CVar.SERVERONLY); + + public static readonly CVarDef ItemToArtifactRatio = + CVarDef.Create("white.random_artifacts_ratio", 0.7f, CVar.SERVERONLY); } diff --git a/Resources/Prototypes/Polymorphs/polymorph.yml b/Resources/Prototypes/Polymorphs/polymorph.yml index c7eefef29b..02b98670c2 100644 --- a/Resources/Prototypes/Polymorphs/polymorph.yml +++ b/Resources/Prototypes/Polymorphs/polymorph.yml @@ -129,18 +129,6 @@ revertOnDeath: true duration: 20 -- type: polymorph - id: ArtifactCluwne - configuration: - entity: MobCluwne - forced: true - transferName: true - transferHumanoidAppearance: true - inventory: None - revertOnDeath: true - revertOnCrit: true - duration: 30 - - type: polymorph id: ArtifactLizard configuration: @@ -449,4 +437,58 @@ inventory: None revertOnDeath: true revertOnCrit: true - duration: 20 + duration: 60 + +- type: polymorph # WD + id: ArtifactWallDoor + configuration: + entity: WoodDoor + forced: true + inventory: None + transferName: false + transferDamage: false + revertOnCrit: true + revertOnDeath: true + duration: 120 + +- type: polymorph # WD + id: ArtifactCluwne + configuration: + entity: MobCluwne + forced: true + transferName: true + transferHumanoidAppearance: true + inventory: Transfer + revertOnCrit: false + revertOnDeath: false + duration: 240 + +- type: polymorph # WD + id: ArtifactMouse + configuration: + entity: MobMouse + forced: true + inventory: Drop + revertOnCrit: true + revertOnDeath: true + duration: 60 + +- type: polymorph # WD + id: ArtifactChicken + configuration: + entity: MobChicken + forced: true + inventory: Drop + revertOnCrit: true + revertOnDeath: true + duration: 60 + +- type: polymorph # WD + id: ArtifactGnome + configuration: + entity: MobGnome + forced: true + inventory: Drop + revertOnCrit: true + revertOnDeath: true + duration: 240 diff --git a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml index fae280bfba..cb1723bdde 100644 --- a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml +++ b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml @@ -479,6 +479,19 @@ - Dexalin - Omnizine +- type: artifactEffect # WD + id: EffectChemicalPuddleWaterPotassium + targetDepth: 2 + effectHint: artifact-effect-hint-biochemical + components: + - type: ChemicalPuddleArtifact + chemicalSolution: + maxVol: 500 + canReact: true + possibleChemicals: + - Water + - Potassium + - type: artifactEffect id: EffectChemicalPuddleRare targetDepth: 2 @@ -535,6 +548,46 @@ - type: PolyOthersArtifact polymorphPrototypeName: ArtifactLuminous +- type: artifactEffect # WD + id: EffectPolyWallDoor + targetDepth: 3 + effectHint: artifact-effect-hint-polymorph + components: + - type: PolyOthersArtifact + polymorphPrototypeName: ArtifactWallDoor + +- type: artifactEffect # WD + id: EffectPolyCluwne + targetDepth: 3 + effectHint: artifact-effect-hint-polymorph + components: + - type: PolyOthersArtifact + polymorphPrototypeName: ArtifactCluwne + +- type: artifactEffect # WD + id: EffectPolyMouse + targetDepth: 3 + effectHint: artifact-effect-hint-polymorph + components: + - type: PolyOthersArtifact + polymorphPrototypeName: ArtifactMouse + +- type: artifactEffect # WD + id: EffectPolyChicken + targetDepth: 3 + effectHint: artifact-effect-hint-polymorph + components: + - type: PolyOthersArtifact + polymorphPrototypeName: ArtifactChicken + +- type: artifactEffect # WD + id: EffectPolyGnome + targetDepth: 3 + effectHint: artifact-effect-hint-polymorph + components: + - type: PolyOthersArtifact + polymorphPrototypeName: ArtifactGnome + - type: artifactEffect id: EffectHealAll targetDepth: 3 @@ -582,7 +635,7 @@ components: - type: ShuffleArtifact - type: TelepathicArtifact - range: 7.5 + range: 12 messages: - shuffle-artifact-popup