Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Artifexum spray chance to disintegrate #1044

Merged
merged 10 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Content.Server/Chemistry/ReagentEffects/DisintegrateArtifact.cs
Original file line number Diff line number Diff line change
@@ -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
{

/// <summary>
/// Disintegrate chance
/// </summary>
[DataField("probabilityMin"), ViewVariables(VVAccess.ReadWrite)]
public float ProbabilityMax = 0.05f;

/// <summary>
/// Disintegrate chance
/// </summary>
[DataField("probabilityMax"), ViewVariables(VVAccess.ReadWrite)]
public float ProbabilityMin = 0.15f;

/// <summary>
/// The range around the artifact that it will spawn the entity
/// </summary>
[DataField("range")]
public float Range = 0.5f;

public override void Effect(ReagentEffectArgs args)
{
var artifact = args.EntityManager.EntitySysManager.GetEntitySystem<ArtifactSystem>();
artifact.DisintegrateArtifact(args.SolutionEntity, ProbabilityMin, ProbabilityMax, Range);
}

protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
null;
}
32 changes: 27 additions & 5 deletions Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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()
{
Expand Down Expand Up @@ -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);
}
}

/// <summary>
/// Tries to activate the artifact
/// </summary>
Expand Down
Binary file added Resources/Audio/_NF/Ambience/force-field.ogg
Binary file not shown.
4 changes: 4 additions & 0 deletions Resources/Prototypes/Reagents/chemicals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
conditions:
- !type:ReagentThreshold
min: 5
- !type:DisintegrateArtifact
conditions:
- !type:ReagentThreshold
min: 5

- type: reagent
id: Benzene
Expand Down
131 changes: 131 additions & 0 deletions Resources/Prototypes/_NF/Entities/Mobs/NPCs/artifact_construct.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions Resources/Prototypes/ai_factions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@
- Dragon
- WizFedFaction # Frontier
- BloodCultNF # Frontier
- type: npcFaction
id: ArtifactConstruct
hostile:
- NanoTrasen
- Syndicate
- Revolutionary
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Resources/Textures/_NF/Effects/creampie_64.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions Resources/Textures/_NF/Mobs/Aliens/grim_forged.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -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
]
]
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading