diff --git a/Content.Server/Chemistry/ReagentEffects/DisintegrateArtifact.cs b/Content.Server/Chemistry/ReagentEffects/DisintegrateArtifact.cs new file mode 100644 index 00000000000..fc9b18e2e49 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/DisintegrateArtifact.cs @@ -0,0 +1,36 @@ +using Content.Server.Xenoarchaeology.XenoArtifacts; +using Content.Shared.Chemistry.Reagent; +using Robust.Shared.Prototypes; + +namespace Content.Server.Chemistry.ReagentEffects; + +public sealed partial class DisintegrateArtifact : ReagentEffect +{ + + /// + /// Disintegrate chance + /// + [DataField("probabilityMin"), ViewVariables(VVAccess.ReadWrite)] + public float ProbabilityMax = 0.05f; + + /// + /// Disintegrate chance + /// + [DataField("probabilityMax"), ViewVariables(VVAccess.ReadWrite)] + public float ProbabilityMin = 0.15f; + + /// + /// The range around the artifact that it will spawn the entity + /// + [DataField("range")] + public float Range = 0.5f; + + public override void Effect(ReagentEffectArgs args) + { + var artifact = args.EntityManager.EntitySysManager.GetEntitySystem(); + artifact.DisintegrateArtifact(args.SolutionEntity, ProbabilityMin, ProbabilityMax, Range); + } + + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => + null; +} diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs index 9628244b708..b0d12318524 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs @@ -1,18 +1,15 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Numerics; using Content.Server.Cargo.Systems; -using Content.Server.GameTicking; using Content.Server.Power.EntitySystems; using Content.Server.Xenoarchaeology.Equipment.Components; using Content.Server.Xenoarchaeology.XenoArtifacts.Events; -using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components; -using Content.Shared.CCVar; using Content.Shared.Tiles; using Content.Shared.Xenoarchaeology.XenoArtifacts; using JetBrains.Annotations; -using Robust.Shared.Audio; +using Robust.Server.GameObjects; using Robust.Shared.Audio.Systems; -using Robust.Shared.Configuration; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager; @@ -28,6 +25,9 @@ public sealed partial class ArtifactSystem : EntitySystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ISerializationManager _serialization = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly TransformSystem _transform = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + public override void Initialize() { @@ -135,6 +135,28 @@ public void RandomizeArtifact(EntityUid uid, ArtifactComponent component) EnterNode(uid, ref firstNode, component); } + public void DisintegrateArtifact(EntityUid uid, float probabilityMin, float probabilityMax, float range) + { + // Make a chance between probabilityMin and probabilityMax + var randomChanceForDisintegration = _random.NextFloat(probabilityMin, probabilityMax); + var willDisintegrate = _random.Prob(randomChanceForDisintegration); + + if (willDisintegrate) + { + var artifactCoord = _transform.GetMapCoordinates(uid); + var flashEntity = Spawn("EffectFlashBluespace", artifactCoord); + _transform.AttachToGridOrMap(flashEntity); + + var dx = _random.NextFloat(-range, range); + var dy = _random.NextFloat(-range, range); + var spawnCord = artifactCoord.Offset(new Vector2(dx, dy)); + var mobEntity = Spawn("MobGrimForged", spawnCord); + _transform.AttachToGridOrMap(mobEntity); + + _entityManager.DeleteEntity(uid); + } + } + /// /// Tries to activate the artifact /// diff --git a/Resources/Audio/_NF/Ambience/force-field.ogg b/Resources/Audio/_NF/Ambience/force-field.ogg new file mode 100644 index 00000000000..f2fe8e69478 Binary files /dev/null and b/Resources/Audio/_NF/Ambience/force-field.ogg differ diff --git a/Resources/Prototypes/Reagents/chemicals.yml b/Resources/Prototypes/Reagents/chemicals.yml index b2b4850c8f6..644d3be8cad 100644 --- a/Resources/Prototypes/Reagents/chemicals.yml +++ b/Resources/Prototypes/Reagents/chemicals.yml @@ -80,6 +80,10 @@ conditions: - !type:ReagentThreshold min: 5 + - !type:DisintegrateArtifact + conditions: + - !type:ReagentThreshold + min: 5 - type: reagent id: Benzene diff --git a/Resources/Prototypes/_NF/Entities/Mobs/NPCs/artifact_construct.yml b/Resources/Prototypes/_NF/Entities/Mobs/NPCs/artifact_construct.yml new file mode 100644 index 00000000000..c3a7dc02cf6 --- /dev/null +++ b/Resources/Prototypes/_NF/Entities/Mobs/NPCs/artifact_construct.yml @@ -0,0 +1,131 @@ +- type: entity + abstract: true + parent: + - BaseMob + - MobDamageable + - MobCombat + id: SimpleArtifactMobBase # Mob without barotrauma, freezing and asphyxiation (for space carps!?) + suffix: AI + components: + - type: NpcFactionMember + factions: + - ArtifactConstruct + - type: HTN + rootTask: + task: SimpleHostileCompound + blackboard: + NavClimb: !type:Bool + true + NavSmash: !type:Bool + true + - type: MobThresholds + thresholds: + 0: Alive + 120: Dead + - type: Body + - type: Climbing + - type: NameIdentifier + group: GenericNumber + - type: SlowOnDamage + speedModifierThresholds: + 60: 0.7 + 80: 0.5 + - type: ZombieImmune # Artifact constructs should not be able to become zombie + - type: MobPrice + price: 1000 # Living critters are valuable in space. + +- type: entity + parent: [ SimpleArtifactMobBase, FlyingMobBase ] + id: BaseMobArtifactConstruct + name: artifact construct + description: A towering golem crafted from twisted metal and ancient stones. + abstract: true + components: + - type: Tag + tags: + - DoorBumpOpener + - type: Sprite + drawdepth: Mobs + sprite: _NF/Mobs/Aliens/grim_forged.rsi + - type: MovementAlwaysTouching + - type: MovementSpeedModifier + baseWalkSpeed: 1 + baseSprintSpeed: 1.5 + - type: StatusEffects + allowed: + - SlowedDown + - Electrocution + - type: MobState + allowedStates: + - Alive + - Dead + - type: CombatMode + - type: MeleeWeapon + damage: + types: + Blunt: 20 + animation: WeaponArcFist + - type: ReplacementAccent + accent: genericAggressive + +- type: entity + parent: BaseMobArtifactConstruct + id: MobGrimForged + name: artifact construct 1 + components: + - type: Sprite + layers: + - map: [ "enum.DamageStateVisualLayers.Base" ] + state: move + - map: [ "enum.DamageStateVisualLayers.BaseUnshaded" ] + state: flash + shader: unshaded + - map: [ "clownedon" ] + sprite: "_NF/Effects/creampie_64.rsi" + state: "creampie_grimforged" + visible: false + - type: GenericVisualizer + visuals: + enum.CreamPiedVisuals.Creamed: + clownedon: + True: { visible: true } + False: { visible: false } + - type: AmbientSound + volume: -6 + range: 8 + sound: + path: /Audio/_NF/Ambience/force-field.ogg + - type: CreamPied + - type: DamageStateVisuals + states: + Alive: + Base: move + Critical: + Base: dead + Dead: + Base: dead + - type: MobThresholds + thresholds: + 0: Alive + 50: Dead + - type: HTN + rootTask: + task: SimpleRangedHostileCompound + - type: Stamina + critThreshold: 300 + - type: HitscanBatteryAmmoProvider + proto: RedLightLaser + fireCost: 50 + - type: BatterySelfRecharger + autoRecharge: true + autoRechargeRate: 50 + - type: Battery + maxCharge: 1000 + startingCharge: 1000 + - type: Gun + fireRate: 1 + useKey: false + selectedMode: SemiAuto + availableModes: + - SemiAuto + soundGunshot: /Audio/Weapons/Guns/Gunshots/laser_cannon.ogg diff --git a/Resources/Prototypes/ai_factions.yml b/Resources/Prototypes/ai_factions.yml index 1ad7071ea62..6188509124e 100644 --- a/Resources/Prototypes/ai_factions.yml +++ b/Resources/Prototypes/ai_factions.yml @@ -99,3 +99,9 @@ - Dragon - WizFedFaction # Frontier - BloodCultNF # Frontier +- type: npcFaction + id: ArtifactConstruct + hostile: + - NanoTrasen + - Syndicate + - Revolutionary diff --git a/Resources/Textures/_NF/Effects/creampie_64.rsi/creampie_grimforged.png b/Resources/Textures/_NF/Effects/creampie_64.rsi/creampie_grimforged.png new file mode 100644 index 00000000000..35c5102c3d4 Binary files /dev/null and b/Resources/Textures/_NF/Effects/creampie_64.rsi/creampie_grimforged.png differ diff --git a/Resources/Textures/_NF/Effects/creampie_64.rsi/meta.json b/Resources/Textures/_NF/Effects/creampie_64.rsi/meta.json new file mode 100644 index 00000000000..5149f1a6092 --- /dev/null +++ b/Resources/Textures/_NF/Effects/creampie_64.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from https://github.com/tgstation/tgstation at 0d9c9a8233dfc3fc55edc538955a761a6328bee0. creampie_moth by MilenVolf, creampie_arachnid by PixelTheKermit (Github)", + "size": { + "x": 64, + "y": 64 + }, + "states": [ + { + "name": "creampie_grimforged" + } + ] +} diff --git a/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/dead.png b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/dead.png new file mode 100644 index 00000000000..2fb108b03e5 Binary files /dev/null and b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/dead.png differ diff --git a/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/flash.png b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/flash.png new file mode 100644 index 00000000000..2f6cd342471 Binary files /dev/null and b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/flash.png differ diff --git a/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/meta.json b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/meta.json new file mode 100644 index 00000000000..24c25dca722 --- /dev/null +++ b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/meta.json @@ -0,0 +1,71 @@ +{ + "version": 1, + "size": { + "x": 64, + "y": 64 + }, + "license": "CC-BY-SA-3.0", + "copyright": "Created by GreaseMonk for frontier-station-14, credit to MatthewBadger (discord) for original concepts and designs", + "states": [ + { + "name": "dead" + }, + { + "name": "off" + }, + { + "name": "move", + "delays": [ + [ + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06 + ] + ] + }, + { + "name": "flash", + "delays": [ + [ + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06, + 0.06 + ] + ] + } + ] +} diff --git a/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/move.png b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/move.png new file mode 100644 index 00000000000..e063f568e18 Binary files /dev/null and b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/move.png differ diff --git a/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/off.png b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/off.png new file mode 100644 index 00000000000..1b7ac3eb536 Binary files /dev/null and b/Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/off.png differ