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

Glimmer Mite - pest that causes glimmer #564

Merged
merged 14 commits into from
Feb 1, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Content.Server.StationEvents.Events;
using Robust.Shared.Prototypes;

namespace Content.Server.StationEvents.Components;

[RegisterComponent, Access(typeof(GlimmerMobRule))]
public sealed partial class GlimmerMobRuleComponent : Component
{
[DataField(required: true)]
DebugOk marked this conversation as resolved.
Show resolved Hide resolved
public EntProtoId MobPrototype = string.Empty;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System.Linq;
using Robust.Shared.Random;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.NPC.Components;
using Content.Server.Psionics.Glimmer;
using Content.Server.StationEvents.Components;
using Content.Shared.Psionics.Glimmer;
using Content.Shared.Abilities.Psionics;

namespace Content.Server.StationEvents.Events;

public sealed class GlimmerMobRule : StationEventSystem<GlimmerMobRuleComponent>
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly GlimmerSystem _glimmerSystem = default!;


protected override void Started(EntityUid uid, GlimmerMobRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);

var glimmerSources = EntityQuery<GlimmerSourceComponent, TransformComponent>().ToList();
var normalSpawnLocations = EntityQuery<VentCritterSpawnLocationComponent, TransformComponent>().ToList();
var hiddenSpawnLocations = EntityQuery<MidRoundAntagSpawnLocationComponent, TransformComponent>().ToList();

var baseCount = Math.Max(1, EntityQuery<PsionicComponent, NpcFactionMemberComponent>().Count() / 10);
int multiplier = Math.Max(1, (int) _glimmerSystem.GetGlimmerTier() - 2);

var total = baseCount * multiplier;

int i = 0;
while (i < total)
{
if (glimmerSources.Count != 0 && _robustRandom.Prob(0.4f))
{
Spawn(component.MobPrototype, _robustRandom.Pick(glimmerSources).Item2.Coordinates);
i++;
continue;
}

if (normalSpawnLocations.Count != 0)
{
Spawn(component.MobPrototype, _robustRandom.Pick(normalSpawnLocations).Item2.Coordinates);
i++;
continue;
}

if (hiddenSpawnLocations.Count != 0)
{
Spawn(component.MobPrototype, _robustRandom.Pick(hiddenSpawnLocations).Item2.Coordinates);
i++;
continue;
}
}
}
}
4 changes: 4 additions & 0 deletions Resources/Audio/DeltaV/Glimmer_Creatures/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- files: [mite.ogg]
copyright: '"mite.ogg" by leonardo-dabepis'
license: CC0-1.0
source: https://github.com/DeltaV-Station/Delta-v/pull/564
Binary file not shown.
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/nyanotrasen/reagents/toxins.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ reagent-desc-soulbreaker-toxin = An anti-psionic about 4 times as powerful as mi

reagent-name-lotophagoi-oil = lotophagoi oil
reagent-desc-lotophagoi-oil = A super potent drug that is much better at inducing psionics than normal hallucinogens, but with worse side effects.

reagent-name-ectoplasm = ectoplasm
reagent-desc-ectoplasm = The physical component of semi-corporeal spirits.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
- type: entity
name: glimmer mite
parent: MobCockroach
id: MobGlimmerMite
description: A strange pest from a world beyond the noosphere.
components:
- type: Sprite
sprite: DeltaV/Mobs/Ghosts/glimmermite.rsi
layers:
- map: ["enum.DamageStateVisualLayers.Base"]
state: mite
- type: DamageStateVisuals
states:
Alive:
Base: mite
Dead:
Base: mite_dead
baseDecayRate: 0.25
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: Ectoplasm
Quantity: 5
- type: Bloodstream
bloodReagent: Ectoplasm
bloodMaxVolume: 20
- type: PotentialPsionic
- type: Psionic
- type: GlimmerSource
- type: AmbientSound
range: 6
volume: -3
sound: /Audio/DeltaV/Glimmer_Creatures/mite.ogg
- type: AmbientOnPowered
12 changes: 12 additions & 0 deletions Resources/Prototypes/Nyanotrasen/GameRules/events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,15 @@
maximumGlimmer: 900
report: glimmer-event-report-signatures
- type: GlimmerRevenantRule

- type: entity
id: GlimmerMiteSpawn
parent: BaseGlimmerEvent
noSpawn: true
components:
- type: GlimmerEvent
minimumGlimmer: 50
maximumGlimmer: 900
report: glimmer-event-report-signatures
- type: GlimmerMobRule
mobPrototype: MobGlimmerMite
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions Resources/Textures/DeltaV/Mobs/Ghosts/glimmermite.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "leonardo_dabepis (232229415176634368) on Discord",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "mite",
"directions": 4,
"delays": [
[
0.2,
0.3
],
[
0.2,
0.3
],
[
0.2,
0.3
],
[
0.2,
0.3
]
]
},
{
"name": "icon"
},
{
"name": "mite_dead"
}
]
}
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