Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Oct 22, 2023
1 parent 2928ecf commit 1aa69f2
Show file tree
Hide file tree
Showing 30 changed files with 628 additions and 524 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ protected override void Draw(in OverlayDrawArgs args)
var rotationMatrix = Matrix3.CreateRotation(-rotation);
handle.UseShader(_shader);

foreach (var (thresholds, mob, dmg) in _entManager.EntityQuery<MobThresholdsComponent, MobStateComponent, DamageableComponent>(true))
var q = _entManager.AllEntityQueryEnumerator<MobThresholdsComponent, MobStateComponent, DamageableComponent>();
while (q.MoveNext(out var owner, out var thresholds, out var mob, out var dmg))
{
if (!xformQuery.TryGetComponent(mob.Owner, out var xform) ||
if (!xformQuery.TryGetComponent(owner, out var xform) ||
xform.MapID != args.MapId)
{
continue;
Expand All @@ -72,7 +73,7 @@ protected override void Draw(in OverlayDrawArgs args)
handle.SetTransform(matty);

float yOffset;
if (spriteQuery.TryGetComponent(mob.Owner, out var sprite))
if (spriteQuery.TryGetComponent(owner, out var sprite))
{
yOffset = sprite.Bounds.Height + 15f;
}
Expand All @@ -88,7 +89,7 @@ protected override void Draw(in OverlayDrawArgs args)
handle.DrawTexture(_barTexture, position);

// we are all progressing towards death every day
(float ratio, bool inCrit) deathProgress = CalcProgress(mob.Owner, mob, dmg, thresholds);
(float ratio, bool inCrit) deathProgress = CalcProgress(owner, mob, dmg, thresholds);

var color = GetProgressColor(deathProgress.ratio, deathProgress.inCrit);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Content.Shared.Backmen.EntityHealthBar;
using Content.Shared.Backmen.EntityHealthBar;
using Content.Shared.GameTicking;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ namespace Content.Server.Backmen.Abilities.Psionics;

public sealed class PsionicRegenerationPowerSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedPsionicAbilitiesSystem _psionics = default!;
Expand Down Expand Up @@ -75,7 +73,7 @@ private void OnPowerUsed(EntityUid uid, PsionicRegenerationPowerComponent compon
true,
PopupType.Medium);

_audioSystem.PlayPvs(component.SoundUse, component.Owner, AudioParams.Default.WithVolume(8f).WithMaxDistance(1.5f).WithRolloffFactor(3.5f));
_audioSystem.PlayPvs(component.SoundUse, uid, AudioParams.Default.WithVolume(8f).WithMaxDistance(1.5f).WithRolloffFactor(3.5f));
_psionics.LogPowerUsed(uid, "psionic regeneration");
args.Handled = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)

var bankManagerSystem = _entityManager.System<BankManagerSystem>();

BankAccountComponent? account = null;
Entity<BankAccountComponent>? account = null;

if (args.Length >= 2 && !bankManagerSystem.TryGetBankAccount(args[1], out var accountOwner, out account))
if (args.Length >= 2 && !bankManagerSystem.TryGetBankAccount(args[1], out account))
{
shell.WriteError("Банковский аккаунт не существует");
return;
Expand All @@ -54,16 +54,16 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

(accountOwner, account) = playerBank.Value;
account = playerBank.Value;

if (args.Length >= 3 && int.TryParse(args[2], out var banalce) && banalce != 0)
{
bankManagerSystem.TryInsertToBankAccount(accountOwner,
new KeyValuePair<string, FixedPoint2>(account.CurrencyType, FixedPoint2.New(banalce)), account);
bankManagerSystem.TryInsertToBankAccount(account,
new KeyValuePair<string, FixedPoint2>(account.Value.Comp.CurrencyType, FixedPoint2.New(banalce)));
}

_adminLogger.Add(LogType.AdminMessage, LogImpact.Extreme,
$"Admin {(shell.Player != null ? shell.Player.Name : "An administrator")} AddBankAcсount {_entityManager.ToPrettyString(targetUid)} #{account!.AccountNumber} balance: {account.Balance}");
$"Admin {(shell.Player != null ? shell.Player.Name : "An administrator")} AddBankAcсount {_entityManager.ToPrettyString(targetUid)} #{account!.Value.Comp.AccountNumber} balance: {account.Value.Comp.Balance}");
}

public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
Expand All @@ -74,7 +74,7 @@ public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
"Персонаж с кпк"),
2 => CompletionResult.FromHintOptions(
_entityManager.System<BankManagerSystem>().ActiveBankAccounts
.Select(x => new CompletionOption(x.Value.account.AccountNumber, x.Value.account.AccountName))
.Select(x => new CompletionOption(x.Value.Comp.AccountNumber, x.Value.Comp.AccountName+$" ({x.Value.Owner})"))
, "Аккаунт №"),
_ => CompletionResult.Empty
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

if (!bankManagerSystem.TryGetBankAccount(args[0], out var bankAccountOwner, out var bankAccount))
if (!bankManagerSystem.TryGetBankAccount(args[0], out var bankAccount))
{
shell.WriteError("Банковский счет не найден!");
return;
}

if (args.Length == 1)
{
shell.WriteLine($"Банковский баланс({bankAccount.AccountName}): {bankAccount.Balance} {bankAccount.CurrencyType}");
shell.WriteLine($"Банковский баланс({bankAccount.Value.Comp.AccountName}): {bankAccount.Value.Comp.Balance} {bankAccount.Value.Comp.CurrencyType}");
return;
}

Expand All @@ -51,33 +51,33 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
case > 0:
{
if (!bankManagerSystem.TryInsertToBankAccount(bankAccountOwner,
new KeyValuePair<string, FixedPoint2>(bankAccount.CurrencyType, FixedPoint2.New(balance)), bankAccount))
if (!bankManagerSystem.TryInsertToBankAccount(bankAccount,
new KeyValuePair<string, FixedPoint2>(bankAccount.Value.Comp.CurrencyType, FixedPoint2.New(balance))))
{
shell.WriteError($"Добавить на счет не удалось! Баланс аккаунта: {bankAccount.Balance}");
shell.WriteError($"Добавить на счет не удалось! Баланс аккаунта: {bankAccount.Value.Comp.Balance}");
return;
}

break;
}
case < 0:
{
if (!bankManagerSystem.TryWithdrawFromBankAccount(bankAccountOwner,
new KeyValuePair<string, FixedPoint2>(bankAccount.CurrencyType, FixedPoint2.New(Math.Abs(balance))), bankAccount))
if (!bankManagerSystem.TryWithdrawFromBankAccount(bankAccount,
new KeyValuePair<string, FixedPoint2>(bankAccount.Value.Comp.CurrencyType, FixedPoint2.New(Math.Abs(balance)))))
{
shell.WriteError($"Списать со счета не удалось! Баланс аккаунта: {bankAccount.Balance}");
shell.WriteError($"Списать со счета не удалось! Баланс аккаунта: {bankAccount.Value.Comp.Balance}");
return;
}

break;
}
default:
bankManagerSystem.TrySetBalance(bankAccountOwner,balance);
bankManagerSystem.TrySetBalance(bankAccount.Value,balance);
return;
}

_adminLogger.Add(LogType.AdminMessage, LogImpact.Extreme,
$"Admin {(shell.Player != null ? shell.Player.Name : "An administrator")} SetBankCurrency {bankAccount.AccountName} #{bankAccount.AccountNumber} changed by: {balance}, new balance: {bankAccount.Balance}");
$"Admin {(shell.Player != null ? shell.Player.Name : "An administrator")} SetBankCurrency {bankAccount.Value.Comp.AccountName} #{bankAccount.Value.Comp.AccountNumber} changed by: {balance}, new balance: {bankAccount.Value.Comp.Balance}");
}

public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
Expand All @@ -86,7 +86,7 @@ public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
1 => CompletionResult.FromHintOptions(
_entityManager.System<BankManagerSystem>().ActiveBankAccounts
.Select(x => new CompletionOption(x.Value.account.AccountNumber, x.Value.account.AccountName))
.Select(x => new CompletionOption(x.Value.Comp.AccountNumber, x.Value.Comp.AccountName))
, "Аккаунт №"),
_ => CompletionResult.Empty
};
Expand Down
Loading

0 comments on commit 1aa69f2

Please sign in to comment.