Files
crystall-punk-14/Content.Shared/_CP14/Skill/CP14SkillSystem.Admin.cs
Red 422a0c5e10 Gods and religions (#1405)
* basic religion vision

* block god interactions

* skill tree mob specify

* silvania setup??

* clustering shader optimization

* gods department & job

* random gods jobs

* Luxian god

* Update Nature.png

* Update sphere_of_light.yml

* god chat

* Update ChatSystem.cs

* OBSERVATION

* public observation and basic follower api

* shader tweaks

* improve shaders

* spawning and praying on altars

* altars ppvs override

* move pvs overridiation from altars to observers

* shader coloration

* spectral z mover

* god magic radius restricted

* guide how to believe in god

* sends messages to god when smoeone wanna become follower

* follower doAfter

* goodbye luxian, welcome lumera

* goodbye silvania, welcome merkas

* som polish and renamings

* gods fast travel

* Update altar.ftl

* some lumera sfx

* renouncing patrons!

* renounce followers

* followewr percentage calculation

* remove from player-facing

* fix

* Update sphere_of_light.yml

* Update base.yml
2025-06-13 14:15:48 +03:00

67 lines
1.9 KiB
C#

using System.Linq;
using Content.Shared._CP14.Skill.Components;
using Content.Shared._CP14.Skill.Prototypes;
using Content.Shared.Administration;
using Content.Shared.Administration.Managers;
using Content.Shared.FixedPoint;
using Content.Shared.Verbs;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared._CP14.Skill;
public abstract partial class CP14SharedSkillSystem
{
[Dependency] private readonly ISharedAdminManager _admin = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
private IEnumerable<CP14SkillPrototype>? _allSkills;
private IEnumerable<CP14SkillTreePrototype>? _allTrees;
private void InitializeAdmin()
{
SubscribeLocalEvent<CP14SkillStorageComponent, GetVerbsEvent<Verb>>(OnGetAdminVerbs);
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypeReloaded);
UpdateCachedSkill();
}
private void OnPrototypeReloaded(PrototypesReloadedEventArgs ev)
{
if (!ev.WasModified<CP14SkillPrototype>())
return;
UpdateCachedSkill();
}
private void UpdateCachedSkill()
{
_allSkills = _proto.EnumeratePrototypes<CP14SkillPrototype>();
_allTrees = _proto.EnumeratePrototypes<CP14SkillTreePrototype>();
}
private void OnGetAdminVerbs(Entity<CP14SkillStorageComponent> ent, ref GetVerbsEvent<Verb> args)
{
if (!_admin.HasAdminFlag(args.User, AdminFlags.Admin))
return;
if (_allSkills is null || _allTrees is null)
return;
var target = args.Target;
//Reset/Remove All Skills
args.Verbs.Add(new Verb
{
Text = "Reset skills",
Message = "Remove all learned skills",
Icon = new SpriteSpecifier.Rsi(new("/Textures/_CP14/Interface/Misc/reroll.rsi"), "reroll"),
Act = () =>
{
TryResetSkills(target);
},
});
}
}