Readd sophie and glimmer monitor (#207)

* Add sophie back

* Properly reimplement glimmer monitor

* Update sophicscribe.yml
This commit is contained in:
Debug 2023-10-22 03:26:59 +02:00 committed by GitHub
parent d2382caad2
commit ea88904579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 221 additions and 231 deletions

View File

@ -1,10 +1,10 @@
using System.Linq;
using System.Numerics;
using Content.Client.Nyanotrasen.UserInterface;
using Robust.Client.AutoGenerated;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Content.Client.Nyanotrasen.UserInterface.CustomControls;
namespace Content.Client.Nyanotrasen.CartridgeLoader.Cartridges;

View File

@ -1,10 +1,10 @@
using System.Numerics;
using Robust.Client.UserInterface;
using Content.Client.Resources;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Content.Client.Resources;
using Robust.Client.UserInterface;
namespace Content.Client.Nyanotrasen.UserInterface.CustomControls;
namespace Content.Client.Nyanotrasen.UserInterface;
public sealed class GlimmerGraph : Control
{

View File

@ -0,0 +1,22 @@
namespace Content.Server.Nyanotrasen.Research.SophicScribe;
[RegisterComponent]
public sealed partial class SophicScribeComponent : Component
{
[DataField("accumulator")]
public float Accumulator;
[DataField("announceInterval")]
public TimeSpan AnnounceInterval = TimeSpan.FromMinutes(2);
[DataField("nextAnnounce")]
public TimeSpan NextAnnounceTime;
/// <summary>
/// Antispam.
/// </summary>
public TimeSpan StateTime = default!;
[DataField("stateCD")]
public TimeSpan StateCD = TimeSpan.FromSeconds(5);
}

View File

@ -0,0 +1,86 @@
using Content.Server.Abilities.Psionics;
using Content.Server.Chat.Systems;
using Content.Server.Radio.Components;
using Content.Server.Radio.EntitySystems;
using Content.Server.StationEvents.Events;
using Content.Shared.Interaction;
using Content.Shared.Psionics.Glimmer;
using Content.Shared.Radio;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Server.Nyanotrasen.Research.SophicScribe;
public sealed partial class SophicScribeSystem : EntitySystem
{
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly GlimmerSystem _glimmerSystem = default!;
[Dependency] private readonly RadioSystem _radioSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public override void Update(float frameTime)
{
base.Update(frameTime);
if (_glimmerSystem.Glimmer == 0)
return; // yes, return. Glimmer value is global.
var curTime = _timing.CurTime;
var query = EntityQueryEnumerator<SophicScribeComponent>();
while (query.MoveNext(out var scribe, out var scribeComponent))
{
if (curTime < scribeComponent.NextAnnounceTime)
continue;
if (!TryComp<IntrinsicRadioTransmitterComponent>(scribe, out var radio))
continue;
var message = Loc.GetString("glimmer-report", ("level", _glimmerSystem.Glimmer));
var channel = _prototypeManager.Index<RadioChannelPrototype>("Science");
_radioSystem.SendRadioMessage(scribe, message, channel, scribe);
scribeComponent.NextAnnounceTime = curTime + scribeComponent.AnnounceInterval;
}
}
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SophicScribeComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<GlimmerEventEndedEvent>(OnGlimmerEventEnded);
}
private void OnInteractHand(EntityUid uid, SophicScribeComponent component, InteractHandEvent args)
{
//TODO: the update function should be removed eventually too.
if (_timing.CurTime < component.StateTime)
return;
component.StateTime = _timing.CurTime + component.StateCD;
_chat.TrySendInGameICMessage(uid, Loc.GetString("glimmer-report", ("level", _glimmerSystem.Glimmer)), InGameICChatType.Speak, true);
}
private void OnGlimmerEventEnded(GlimmerEventEndedEvent args)
{
var query = EntityQueryEnumerator<SophicScribeComponent>();
while (query.MoveNext(out var scribe, out _))
{
if (!TryComp<IntrinsicRadioTransmitterComponent>(scribe, out var radio)) return;
// mind entities when...
var speaker = scribe;
if (TryComp<MindSwappedComponent>(scribe, out var swapped))
{
speaker = swapped.OriginalEntity;
}
var message = Loc.GetString(args.Message, ("decrease", args.GlimmerBurned), ("level", _glimmerSystem.Glimmer));
var channel = _prototypeManager.Index<RadioChannelPrototype>("Common");
_radioSystem.SendRadioMessage(speaker, message, channel, speaker);
}
}
}

View File

@ -0,0 +1,4 @@
glimmer-monitor-program-name = Glimmer Monitor
glimmer-monitor-current-glimmer = Current Glimmer: {$glimmer}Ψ
glimmer-monitor-interval = Interval
glimmer-monitor-sync = Sync

View File

@ -584,6 +584,12 @@
accentVColor: "#8900c9"
- type: Icon
state: pda-rd
- type: CartridgeLoader # Nyanotrasen - Glimmer Monitor
preinstalled:
- CrewManifestCartridge
- NotekeeperCartridge
- NewsReadCartridge
- GlimmerMonitorCartridge
- type: entity
parent: BasePDA
@ -599,6 +605,12 @@
accentVColor: "#8900c9"
- type: Icon
state: pda-science
- type: CartridgeLoader # Nyanotrasen - Glimmer Monitor
preinstalled:
- CrewManifestCartridge
- NotekeeperCartridge
- NewsReadCartridge
- GlimmerMonitorCartridge
- type: entity
parent: BasePDA

View File

@ -0,0 +1,20 @@
- type: entity
parent: BaseItem
id: GlimmerMonitorCartridge
name: glimmer monitor cartridge
description: A cartridge that keeps track of glimmer.
components:
- type: Sprite
sprite: Nyanotrasen/Objects/Devices/cartridge.rsi
state: cart-psi
- type: Icon
sprite: Nyanotrasen/Objects/Devices/cartridge.rsi
state: cart-psi
- type: UIFragment
ui: !type:GlimmerMonitorUi
- type: Cartridge
programName: glimmer-monitor-program-name
icon:
sprite: Nyanotrasen/Icons/psi.rsi
state: psi
- type: GlimmerMonitorCartridge

View File

@ -100,9 +100,9 @@
state: pda-science
- type: Icon
state: pda-science
# - type: CartridgeLoader
# preinstalled:
# - CrewManifestCartridge
# - NotekeeperCartridge
# - NewsReadCartridge
# - GlimmerMonitorCartridge # Uncomment this entire thing if we re-implement the glimmer monitor.
- type: CartridgeLoader
preinstalled:
- CrewManifestCartridge
- NotekeeperCartridge
- NewsReadCartridge
- GlimmerMonitorCartridge

View File

@ -1,221 +1,39 @@
- type: entity
parent: BaseStructure
id: SophicScribe
name: sophic grammateus
description: Latest reports on the Noösphere!
components:
- type: PotentialPsionic #this makes her easier to access for glimmer events, dw about it
- type: Psionic
- type: Sprite
noRot: true
drawdepth: Mobs
offset: "0.0,0.5"
sprite: DeltaV/Structures/Decoration/statues.rsi
layers:
- state: sophie
- map: ["enum.SolutionContainerLayers.Fill"]
# - type: SophicScribe
# - type: Speech
# speechSounds: Snake
# - type: IntrinsicRadioReceiver
# channels:
# - Common
# - Science
# - type: IntrinsicRadioTransmitter
# channels:
# - Common
# - Science
# - type: ActiveRadio
# channels:
# - Common
# - Science
# - type: ActiveListener
# - type: TypingIndicator
# - type: NPCConversation
# tree: SophiaTree
# - type: Grammar
# attributes:
# gender: female
# proper: true
# - type: SpriteFade
# - type: GuideHelp
# guides:
# - Psionics
# - type: Tag
# tags: []
# - type: npcConversationTree
# id: SophiaTree
# dialogue:
# - prompts: [glimmer, reading]
# responses:
# - is: !type:NPCConversationGetGlimmerEvent
# text: sophia-response-glimmer
# - prompts: [purpose, job, occupation, profession]
# weight: 0.5
# responses:
# - text: sophia-response-job
# - prompts: [help, topics]
# weight: 0.5
# hidden: true
# responses:
# - is: !type:NPCConversationHelpEvent
# text: sophia-response-help
# - prompts: [nature, statue, snake, being]
# weight: 0.3
# responses:
# - text: sophia-response-nature
# - prompts: [epistemics, epi]
# weight: 0.2
# responses:
# - text: sophia-response-epi
# - prompts: [mantis]
# weight: 0.2
# responses:
# - text: sophia-response-mantis
# - prompts: [mystagogue, mysta]
# weight: 0.2
# responses:
# - text: sophia-response-mystagogue
# - prompts: [psionics, psychic]
# weight: 0.2
# responses:
# - text: sophia-response-psionics
# - prompts: [noösphere, noosphere]
# weight: 0.2
# responses:
# - text: sophia-response-noosphere
# - prompts: [metempsychosis, metempsychoses, reincarnation, death, dying, afterlife]
# weight: 0.2
# responses:
# - text: sophia-response-metempsychosis
# - prompts: [calendar]
# weight: 0.2
# responses:
# - text: sophia-response-calendar
# - prompts: [morphotypes, morphotype, species]
# weight: 0.2
# responses:
# - text: sophia-response-morphotype
# - prompts: [gods, god]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-god
# - prompts: [truth, "true", "false", falsity, falsehood]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-truth
# - prompts: [human, humans, humanoid, unmutated]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-human
# - prompts: [felinid, felinids, felid, felids, catperson, catpeople]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-felinid
# - prompts: [oni, onis]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-oni
# - prompts: [arachne, arachnid, arachnids, spiderperson, spiderpeople]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-arachne
# - prompts: [moth, moths, moff, moths]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-moth
# - prompts: [lamiae, lamia, lamias]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-lamiae
# - prompts: [grue, grues, batperson, batpeople]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-grue
# - prompts: [cynocephalus, cynocephali, cyno, cynos]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-cyno
# - prompts: [crisis, causality]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-crisis
# - prompts: [oracle]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-oracle
# - prompts: [abraxas]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-abraxas
# - prompts: [hi, hello, hey, greetings, salutations]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-hello-1
# - text: sophia-response-hello-2
# - prompts: [bye, goodbye, done, farewell, later, seeya]
# weight: 0.1
# hidden: true
# responses:
# - text: sophia-response-bye-1
# event: !type:NPCConversationByeEvent
# - text: sophia-response-bye-2
# event: !type:NPCConversationByeEvent
# - text: sophia-response-bye-3
# event: !type:NPCConversationByeEvent
# attention:
# - text: sophia-response-attention-1
# - text: sophia-response-attention-2
# - text: sophia-response-attention-3
# idle:
# - text: sophia-idle-phrase-1
# - text: sophia-idle-phrase-2
# - text: sophia-idle-phrase-3
# unknown:
# - text: sophia-response-sorry-1
# - text: sophia-response-sorry-2
# - text: sophia-response-sorry-3
- type: entity
parent: BaseStructure
id: SophicScribe
name: sophie
description: Latest reports on the Noösphere!
components:
- type: Sprite
noRot: true
drawdepth: Mobs
offset: "0.0,0.5"
sprite: DeltaV/Structures/Decoration/statues.rsi
layers:
- state: sophie
- map: ["enum.SolutionContainerLayers.Fill"]
- type: SophicScribe
- type: Speech
speechSounds: Tenor
- type: IntrinsicRadioReceiver
channels:
- Common
- Science
- type: IntrinsicRadioTransmitter
channels:
- Common
- Science
- type: ActiveRadio
channels:
- Common
- Science
- type: PotentialPsionic #this makes her easier to access for glimmer events, dw about it
- type: Psionic
- type: Grammar
attributes:
gender: female
proper: true
- type: SpriteFade
#- type: GuideHelp # For whenever someones readds this
# guides:
# - Psionics

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,14 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC0-1.0",
"copyright": "the greeks",
"states": [
{
"name": "psi"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1,14 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Rane",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "cart-psi"
}
]
}