Skill scanning + bugfixes (#1424)
This commit is contained in:
@@ -159,20 +159,20 @@ public sealed partial class CP14ReligionGodSystem : CP14SharedReligionGodSystem
|
||||
|
||||
public FixedPoint2 GetFollowerPercentage(Entity<CP14ReligionEntityComponent> 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<CP14ReligionFollowerComponent>(human.Comp.CurrentEntity, out var relFollower))
|
||||
continue;
|
||||
if (relFollower.Religion != god.Comp.Religion)
|
||||
continue;
|
||||
|
||||
followers++;
|
||||
followers += 1;
|
||||
}
|
||||
|
||||
if (total == 0)
|
||||
|
||||
@@ -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<InventoryComponent, CP14MagicEssenceScanEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, CP14CalculateManacostEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, CP14SkillScanEvent>(RelayInventoryEvent);
|
||||
//CP14 End
|
||||
|
||||
SubscribeLocalEvent<InventoryComponent, DamageModifyEvent>(RelayInventoryEvent);
|
||||
|
||||
@@ -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<CP14SkillScannerComponent, CP14SkillScanEvent>(OnSkillScan);
|
||||
SubscribeLocalEvent<CP14SkillScannerComponent, InventoryRelayedEvent<CP14SkillScanEvent>>((e, c, ev) => OnSkillScan(e, c, ev.Args));
|
||||
|
||||
SubscribeLocalEvent<CP14SkillStorageComponent, GetVerbsEvent<ExamineVerb>>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnExamined(Entity<CP14SkillStorageComponent> ent, ref GetVerbsEvent<ExamineVerb> 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<CP14SkillStorageComponent> 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared._CP14.Skill.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to see what skills the creature possesses
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class CP14SkillScannerComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
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.
|
||||
@@ -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}
|
||||
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:
|
||||
@@ -1,3 +1,6 @@
|
||||
cp14-skill-lumera-t1-name = Истоки тайной ночи
|
||||
cp14-skill-lumera-t2-name = Растущая луна
|
||||
cp14-skill-lumera-t3-name = Полнолуние Лумеры
|
||||
cp14-skill-lumera-t3-name = Полнолуние Лумеры
|
||||
|
||||
cp14-skill-lumera-mind-scan-name = Изучение разумов
|
||||
cp14-skill-lumera-mind-scan-desc = Вы способны узнавать какими навыками владеют смертные. Видеть, какие заклинания им подвластны, и на что они способны.
|
||||
@@ -16,4 +16,7 @@ cp14-research-craft = Исследовать
|
||||
cp14-skill-desc-add-mana = Увеличивает объем маны вашего персонажа на {$mana}.
|
||||
cp14-skill-desc-unlock-recipes = Открывает возможность создания:
|
||||
|
||||
cp14-skill-popup-added-points = Границы вашего сознания расширяются. Новых очков памяти: {$count}
|
||||
cp14-skill-popup-added-points = Границы вашего сознания расширяются. Новых очков памяти: {$count}
|
||||
|
||||
cp14-skill-examine-verb = Изучить навыки персонажа
|
||||
cp14-skill-examine-title = Этот персонаж владеет следующими навыками:
|
||||
@@ -88,6 +88,7 @@
|
||||
#- type: WirelessNetworkConnection
|
||||
# range: 500
|
||||
#- type: StationLimitedNetwork
|
||||
- type: CP14SkillScanner
|
||||
- type: Thieving
|
||||
stripTimeReduction: 9999
|
||||
stealthy: true
|
||||
|
||||
@@ -97,8 +97,7 @@
|
||||
|
||||
- type: entity
|
||||
id: CP14LumeraMindImproveImpact
|
||||
categories: [ ForkFiltered ]
|
||||
name: fese
|
||||
categories: [ HideSpawnMenu ]
|
||||
parent: CP14BaseMagicImpact
|
||||
save: false
|
||||
components:
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
- CP14ImpactEffectSphereOfLight
|
||||
- !type:CP14SpellTransferManaToGod
|
||||
amount: 20
|
||||
safe: false
|
||||
safe: true
|
||||
- !type:CP14SpellSendMessageToGod
|
||||
- type: InstantAction
|
||||
sound: !type:SoundPathSpecifier
|
||||
|
||||
@@ -65,10 +65,6 @@
|
||||
damagePerEnergy:
|
||||
types:
|
||||
CP14ManaDepletion: 1
|
||||
- type: CP14MagicEnergyDraw
|
||||
energy: -1.5
|
||||
delay: 3
|
||||
safe: false
|
||||
- type: CP14SpellStorage
|
||||
grantAccessToSelf: true
|
||||
spells:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
{
|
||||
"name": "mind_upgrade"
|
||||
},
|
||||
{
|
||||
"name": "mind_scan"
|
||||
},
|
||||
{
|
||||
"name": "t1"
|
||||
},
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 507 B |
Reference in New Issue
Block a user