diff --git a/Content.Server/_CP14/Religion/CP14ReligionSystem.cs b/Content.Server/_CP14/Religion/CP14ReligionSystem.cs index 53857f0d1f..394c6931e9 100644 --- a/Content.Server/_CP14/Religion/CP14ReligionSystem.cs +++ b/Content.Server/_CP14/Religion/CP14ReligionSystem.cs @@ -159,20 +159,20 @@ public sealed partial class CP14ReligionGodSystem : CP14SharedReligionGodSystem public FixedPoint2 GetFollowerPercentage(Entity god) { - var total = 0; - var followers = 0; + FixedPoint2 total = 0; + FixedPoint2 followers = 0; var allHumans = Mind.GetAliveHumans(); foreach (var human in allHumans) { - total++; + total += 1; if (!TryComp(human.Comp.CurrentEntity, out var relFollower)) continue; if (relFollower.Religion != god.Comp.Religion) continue; - followers++; + followers += 1; } if (total == 0) diff --git a/Content.Shared/Inventory/InventorySystem.Relay.cs b/Content.Shared/Inventory/InventorySystem.Relay.cs index 38897746e0..14463f3b70 100644 --- a/Content.Shared/Inventory/InventorySystem.Relay.cs +++ b/Content.Shared/Inventory/InventorySystem.Relay.cs @@ -1,5 +1,6 @@ using Content.Shared._CP14.MagicEssence; using Content.Shared._CP14.MagicSpell.Events; +using Content.Shared._CP14.ResearchTable; using Content.Shared.Armor; using Content.Shared.Atmos; using Content.Shared.Chat; @@ -37,6 +38,7 @@ public partial class InventorySystem //CP14 Relayed events SubscribeLocalEvent(RelayInventoryEvent); SubscribeLocalEvent(RelayInventoryEvent); + SubscribeLocalEvent(RelayInventoryEvent); //CP14 End SubscribeLocalEvent(RelayInventoryEvent); diff --git a/Content.Shared/_CP14/ResearchTable/CP14SharedResearchSystem.cs b/Content.Shared/_CP14/ResearchTable/CP14SharedResearchSystem.cs index 04c032a6ea..f2103f0fc2 100644 --- a/Content.Shared/_CP14/ResearchTable/CP14SharedResearchSystem.cs +++ b/Content.Shared/_CP14/ResearchTable/CP14SharedResearchSystem.cs @@ -1,12 +1,78 @@ +using System.Text; +using Content.Shared._CP14.Skill; +using Content.Shared._CP14.Skill.Components; using Content.Shared._CP14.Skill.Prototypes; using Content.Shared.DoAfter; +using Content.Shared.Examine; +using Content.Shared.Inventory; +using Content.Shared.Verbs; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; +using Robust.Shared.Utility; namespace Content.Shared._CP14.ResearchTable; public abstract class CP14SharedResearchSystem : EntitySystem { + [Dependency] private readonly ExamineSystemShared _examine = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; + [Dependency] private readonly CP14SharedSkillSystem _skill = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnSkillScan); + SubscribeLocalEvent>((e, c, ev) => OnSkillScan(e, c, ev.Args)); + + SubscribeLocalEvent>(OnExamined); + } + + private void OnExamined(Entity ent, ref GetVerbsEvent args) + { + var scanEvent = new CP14SkillScanEvent(); + RaiseLocalEvent(args.User, scanEvent); + + if (!scanEvent.CanScan) + return; + + var markup = GetSkillExamine(ent); + + _examine.AddDetailedExamineVerb( + args, + ent.Comp, + markup, + Loc.GetString("cp14-skill-examine"), + "/Textures/Interface/students-cap.svg.192dpi.png"); + } + + private FormattedMessage GetSkillExamine(Entity ent) + { + var msg = new FormattedMessage(); + + var sb = new StringBuilder(); + + sb.Append(Loc.GetString("cp14-skill-examine-title") + "\n"); + + foreach (var skill in ent.Comp.LearnedSkills) + { + if (!_proto.TryIndex(skill, out var indexedSkill)) + continue; + + if(!_proto.TryIndex(indexedSkill.Tree, out var indexedTree)) + continue; + + var skillName = _skill.GetSkillName(skill); + sb.Append($"• [color={indexedTree.Color.ToHex()}]{skillName}[/color]\n"); + } + msg.AddMarkupOrThrow(sb.ToString()); + return msg; + } + + private void OnSkillScan(EntityUid uid, CP14SkillScannerComponent component, CP14SkillScanEvent args) + { + args.CanScan = true; + } } [Serializable, NetSerializable] @@ -17,3 +83,9 @@ public sealed partial class CP14ResearchDoAfterEvent : DoAfterEvent public override DoAfterEvent Clone() => this; } + +public sealed class CP14SkillScanEvent : EntityEventArgs, IInventoryRelayEvent +{ + public bool CanScan; + public SlotFlags TargetSlots { get; } = SlotFlags.EYES; +} diff --git a/Content.Shared/_CP14/Skill/Components/CP14SkillScannerComponent.cs b/Content.Shared/_CP14/Skill/Components/CP14SkillScannerComponent.cs new file mode 100644 index 0000000000..d5653364a7 --- /dev/null +++ b/Content.Shared/_CP14/Skill/Components/CP14SkillScannerComponent.cs @@ -0,0 +1,11 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared._CP14.Skill.Components; + +/// +/// Allows you to see what skills the creature possesses +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class CP14SkillScannerComponent : Component +{ +} diff --git a/Resources/Locale/en-US/_CP14/skill/skill_meta_gods.ftl b/Resources/Locale/en-US/_CP14/skill/skill_meta_gods.ftl index 4ed5976601..0a6297a92b 100644 --- a/Resources/Locale/en-US/_CP14/skill/skill_meta_gods.ftl +++ b/Resources/Locale/en-US/_CP14/skill/skill_meta_gods.ftl @@ -1,3 +1,6 @@ cp14-skill-lumera-t1-name = The origins of the secret night cp14-skill-lumera-t2-name = The waxing moon -cp14-skill-lumera-t3-name = The full moon of Lumera \ No newline at end of file +cp14-skill-lumera-t3-name = The full moon of Lumera + +cp14-skill-lumera-mind-scan-name = Study of minds +cp14-skill-lumera-mind-scan-desc = You are able to discern the skills possessed by mortals. You can see what spells they are capable of casting and what they are capable of doing. \ No newline at end of file diff --git a/Resources/Locale/en-US/_CP14/skill/ui.ftl b/Resources/Locale/en-US/_CP14/skill/ui.ftl index ff7a558384..7217fa18b2 100644 --- a/Resources/Locale/en-US/_CP14/skill/ui.ftl +++ b/Resources/Locale/en-US/_CP14/skill/ui.ftl @@ -16,4 +16,7 @@ cp14-research-craft = Research cp14-skill-desc-add-mana = Increases your character's mana amount by {$mana}. cp14-skill-desc-unlock-recipes = Opens up the possibility of crafting: -cp14-skill-popup-added-points = The boundaries of your consciousness are expanding. New memory points: {$count} \ No newline at end of file +cp14-skill-popup-added-points = The boundaries of your consciousness are expanding. New memory points: {$count} + +cp14-skill-examine-verb = Learn the character's skills +cp14-skill-examine-title = This character has the following skills: \ No newline at end of file diff --git a/Resources/Locale/ru-RU/_CP14/skill/skill_meta_gods.ftl b/Resources/Locale/ru-RU/_CP14/skill/skill_meta_gods.ftl index 7b0f26b259..14138cb193 100644 --- a/Resources/Locale/ru-RU/_CP14/skill/skill_meta_gods.ftl +++ b/Resources/Locale/ru-RU/_CP14/skill/skill_meta_gods.ftl @@ -1,3 +1,6 @@ cp14-skill-lumera-t1-name = Истоки тайной ночи cp14-skill-lumera-t2-name = Растущая луна -cp14-skill-lumera-t3-name = Полнолуние Лумеры \ No newline at end of file +cp14-skill-lumera-t3-name = Полнолуние Лумеры + +cp14-skill-lumera-mind-scan-name = Изучение разумов +cp14-skill-lumera-mind-scan-desc = Вы способны узнавать какими навыками владеют смертные. Видеть, какие заклинания им подвластны, и на что они способны. \ No newline at end of file diff --git a/Resources/Locale/ru-RU/_CP14/skill/ui.ftl b/Resources/Locale/ru-RU/_CP14/skill/ui.ftl index 012506991f..3981ca2fee 100644 --- a/Resources/Locale/ru-RU/_CP14/skill/ui.ftl +++ b/Resources/Locale/ru-RU/_CP14/skill/ui.ftl @@ -16,4 +16,7 @@ cp14-research-craft = Исследовать cp14-skill-desc-add-mana = Увеличивает объем маны вашего персонажа на {$mana}. cp14-skill-desc-unlock-recipes = Открывает возможность создания: -cp14-skill-popup-added-points = Границы вашего сознания расширяются. Новых очков памяти: {$count} \ No newline at end of file +cp14-skill-popup-added-points = Границы вашего сознания расширяются. Новых очков памяти: {$count} + +cp14-skill-examine-verb = Изучить навыки персонажа +cp14-skill-examine-title = Этот персонаж владеет следующими навыками: \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml b/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml index 0bfaec4328..5e8fb10d96 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml @@ -88,6 +88,7 @@ #- type: WirelessNetworkConnection # range: 500 #- type: StationLimitedNetwork + - type: CP14SkillScanner - type: Thieving stripTimeReduction: 9999 stealthy: true diff --git a/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_upgrade.yml b/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_upgrade.yml index 438a70effe..2a3b5e4a8a 100644 --- a/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_upgrade.yml +++ b/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_upgrade.yml @@ -97,8 +97,7 @@ - type: entity id: CP14LumeraMindImproveImpact - categories: [ ForkFiltered ] - name: fese + categories: [ HideSpawnMenu ] parent: CP14BaseMagicImpact save: false components: diff --git a/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/generic.yml b/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/generic.yml index 39c3318f20..76c3f24cc6 100644 --- a/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/generic.yml +++ b/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/generic.yml @@ -24,7 +24,7 @@ - CP14ImpactEffectSphereOfLight - !type:CP14SpellTransferManaToGod amount: 20 - safe: false + safe: true - !type:CP14SpellSendMessageToGod - type: InstantAction sound: !type:SoundPathSpecifier diff --git a/Resources/Prototypes/_CP14/Entities/Mobs/Player/Demigods/gods.yml b/Resources/Prototypes/_CP14/Entities/Mobs/Player/Demigods/gods.yml index abe437ee0c..1cf05530eb 100644 --- a/Resources/Prototypes/_CP14/Entities/Mobs/Player/Demigods/gods.yml +++ b/Resources/Prototypes/_CP14/Entities/Mobs/Player/Demigods/gods.yml @@ -65,10 +65,6 @@ damagePerEnergy: types: CP14ManaDepletion: 1 - - type: CP14MagicEnergyDraw - energy: -1.5 - delay: 3 - safe: false - type: CP14SpellStorage grantAccessToSelf: true spells: diff --git a/Resources/Prototypes/_CP14/Skill/Demigods/lumera.yml b/Resources/Prototypes/_CP14/Skill/Demigods/lumera.yml index 5e2a31fcfb..0728186d9b 100644 --- a/Resources/Prototypes/_CP14/Skill/Demigods/lumera.yml +++ b/Resources/Prototypes/_CP14/Skill/Demigods/lumera.yml @@ -40,6 +40,24 @@ - !type:NeedPrerequisite prerequisite: LumeraT1 +- type: cp14Skill + id: LumeraMindScan + name: cp14-skill-lumera-mind-scan-name + desc: cp14-skill-lumera-mind-scan-desc + skillUiPosition: 0, 5 + tree: GodLumera + learnCost: 0.5 + icon: + sprite: _CP14/Actions/DemigodSpells/lumera.rsi + state: mind_scan + effects: + - !type:AddComponents + components: + - type: CP14SkillScanner + restrictions: + - !type:NeedPrerequisite + prerequisite: LumeraT1 + # T2 - type: cp14Skill diff --git a/Resources/Textures/_CP14/Actions/DemigodSpells/lumera.rsi/meta.json b/Resources/Textures/_CP14/Actions/DemigodSpells/lumera.rsi/meta.json index 2f53f3b097..8b7286b8a7 100644 --- a/Resources/Textures/_CP14/Actions/DemigodSpells/lumera.rsi/meta.json +++ b/Resources/Textures/_CP14/Actions/DemigodSpells/lumera.rsi/meta.json @@ -22,6 +22,9 @@ { "name": "mind_upgrade" }, + { + "name": "mind_scan" + }, { "name": "t1" }, diff --git a/Resources/Textures/_CP14/Actions/DemigodSpells/lumera.rsi/mind_scan.png b/Resources/Textures/_CP14/Actions/DemigodSpells/lumera.rsi/mind_scan.png new file mode 100644 index 0000000000..f8f2f9e13b Binary files /dev/null and b/Resources/Textures/_CP14/Actions/DemigodSpells/lumera.rsi/mind_scan.png differ