-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
какой то щит код, которы можно было заменить офофским.
- Loading branch information
Showing
5 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
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,29 @@ | ||
using Content.Shared.ADT.Addiction.Components; | ||
using Content.Server.ADT.Addiction.EntityEffects; | ||
using Content.Shared.Popups; | ||
using Robust.Shared.Random; | ||
using Robust.Shared.Timing; | ||
namespace Content.Server.ADT.Addiction; | ||
|
||
public sealed partial class AddictionSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedPopupSystem _popup = default!; | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly IGameTiming _timing = default!; | ||
|
||
public override void Update(float frameTime) | ||
{ | ||
base.Update(frameTime); | ||
var query = EntityQueryEnumerator<AddictedComponent>(); | ||
while (query.MoveNext(out var uid, out var comp)) | ||
{ | ||
if (_timing.CurTime < comp.NextPopup) | ||
continue; | ||
if (comp.PopupMessages.Count <= 0) | ||
continue; | ||
var selfMessage = Loc.GetString(_random.Pick(comp.PopupMessages)); | ||
_popup.PopupEntity(selfMessage, uid, uid); | ||
comp.NextPopup = _timing.CurTime + TimeSpan.FromSeconds(10); | ||
} | ||
} | ||
} |
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,37 @@ | ||
using Content.Shared.ADT.Addiction.Components; | ||
using Content.Shared.StatusEffect; | ||
using Content.Shared.EntityEffects; | ||
using Robust.Shared.Prototypes; | ||
namespace Content.Server.ADT.Addiction.EntityEffects; | ||
public sealed partial class AddictionEffect : EntityEffect | ||
{ | ||
[DataField(required: true)] | ||
public List<LocId> PopupMessages = new(); | ||
|
||
|
||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) | ||
{ | ||
return Loc.GetString("reagent-effect-addiction",("chance", Probability)); | ||
} | ||
|
||
public override void Effect(EntityEffectBaseArgs ev) | ||
{ | ||
if (ev is not EntityEffectReagentArgs args) | ||
return; | ||
|
||
if (args.EntityManager.TryGetComponent<AddictedComponent>(args.TargetEntity, out var comp)) | ||
{ | ||
foreach (var item in PopupMessages) | ||
{ | ||
if (comp.PopupMessages.Contains(item)) | ||
continue; | ||
comp.PopupMessages.Add(item); | ||
} | ||
} | ||
else | ||
{ | ||
var comp1 = args.EntityManager.EnsureComponent<AddictedComponent>(args.TargetEntity); | ||
comp1.PopupMessages.AddRange(PopupMessages); | ||
} | ||
} | ||
} |
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,11 @@ | ||
namespace Content.Shared.ADT.Addiction.Components; | ||
|
||
/// <summary> | ||
/// Кароче, это не компонент как я понял, а затычка, для хранения данных. Нихуя не делает, добавлять никуда не нужно. используется для системы курения. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class AddictedComponent : Component | ||
{ | ||
public List<LocId> PopupMessages = new(); | ||
public TimeSpan NextPopup = TimeSpan.Zero; | ||
} |
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,6 @@ | ||
addictionEffect-message-1 = Вы чувсвуете привязанность к этому. | ||
addictionEffect-message-2 = Вы чувсвуете себя более спокойно. | ||
addictionEffect-message-3 = Вы чувсвуете себя более расслабленным. | ||
addictionEffect-message-4 = Вы привыкаете к этому. | ||
addictionEffect-message-5 = Вы чувсвуете себя удовлетворенно. | ||
addictionEffect-message-6 = У вас сформировывается зависимость к этому. |
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