-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Добавление системы сразу изученных спелов (возможно работает и для др…
…угих actions. Не тестил) (#313) # Описание PR Данный ПР добавляет систему изученных кастов. По сути оно сделано через костыли, ибо я не знаю как работать со списком при actions Ограничения - 10 спелов за раз ## Проверки - [x] Этот запрос был полностью завершён и мне **не** нужна помощь чтобы его закончить. - [x] Я запускал локальный сервер со своими изменениями и внимательно всё протестировал. - [x] Я внимательно просмотрел все свои изменения и багов в них не нашёл. - [x] Я добавил скриншот/видео демонстрации PR в игре, **или** этот PR этого не требует. ## Медиа ![image](/attachments/c3dea7a2-bb2d-48de-bd45-b2d125795f8e) ![image](/attachments/9572e689-5c60-47ae-8118-78d8efa4d651) ## Изменения No CL for players Reviewed-on: https://codeberg.org/Sirena/SS14-Sirena/pulls/313 Co-authored-by: Neko_Dar <[email protected]> Co-committed-by: Neko_Dar <[email protected]>
- Loading branch information
1 parent
f61e759
commit 7407774
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Content.Server/Sirena/LearnedSpells/LearnedSpellsComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; | ||
|
||
namespace Content.Server.Sirena.LearnedSpells; | ||
|
||
[RegisterComponent] | ||
public sealed partial class LearnedSpellsComponent : Component | ||
{ | ||
// Я и без вас знаю что это пиздец ебучий. Найдёте способ сделать динам. массивом - пинганите (by NekoDar) | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell1; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell2; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell3; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell4; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell5; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell6; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell7; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell8; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell9; | ||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] public string? Spell10; | ||
|
||
[DataField] public EntityUid? SpellContainer1; | ||
[DataField] public EntityUid? SpellContainer2; | ||
[DataField] public EntityUid? SpellContainer3; | ||
[DataField] public EntityUid? SpellContainer4; | ||
[DataField] public EntityUid? SpellContainer5; | ||
[DataField] public EntityUid? SpellContainer6; | ||
[DataField] public EntityUid? SpellContainer7; | ||
[DataField] public EntityUid? SpellContainer8; | ||
[DataField] public EntityUid? SpellContainer9; | ||
[DataField] public EntityUid? SpellContainer10; | ||
} |
48 changes: 48 additions & 0 deletions
48
Content.Server/Sirena/LearnedSpells/LearnedSpellsSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Content.Shared.Actions; | ||
|
||
namespace Content.Server.Sirena.LearnedSpells; | ||
|
||
public sealed class LearnedSpellsSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<LearnedSpellsComponent, ComponentInit>(OnComponentInit); | ||
} | ||
|
||
private void OnComponentInit(EntityUid uid, LearnedSpellsComponent component, ComponentInit args) | ||
{ | ||
// Я и без вас знаю что это пиздец ебучий. Найдёте способ сделать динам. массивом - пинганите (by NekoDar) | ||
if (component.Spell1 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer1, component.Spell1); | ||
|
||
if (component.Spell2 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer2, component.Spell2); | ||
|
||
if (component.Spell3 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer3, component.Spell3); | ||
|
||
if (component.Spell4 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer4, component.Spell4); | ||
|
||
if (component.Spell5 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer5, component.Spell5); | ||
|
||
if (component.Spell6 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer6, component.Spell6); | ||
|
||
if (component.Spell7 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer7, component.Spell7); | ||
|
||
if (component.Spell8 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer8, component.Spell8); | ||
|
||
if (component.Spell9 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer9, component.Spell9); | ||
|
||
if (component.Spell10 != null) | ||
_actionsSystem.AddAction(uid, ref component.SpellContainer10, component.Spell10); | ||
} | ||
} |