Telecrystals (and a bit more ECS) (#4775)

This commit is contained in:
Alex Evgrashin
2021-10-08 13:26:42 +03:00
committed by GitHub
parent cf8ec622fd
commit df3b766139
27 changed files with 426 additions and 262 deletions

View File

@@ -1,32 +1,16 @@
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
using System;
namespace Content.Shared.Traitor.Uplink
{
public class UplinkAccount
{
public event Action<UplinkAccount>? BalanceChanged;
public EntityUid AccountHolder;
private int _balance;
[ViewVariables]
public int Balance => _balance;
public readonly EntityUid? AccountHolder;
public int Balance;
public UplinkAccount(EntityUid uid, int startingBalance)
public UplinkAccount(int startingBalance, EntityUid? accountHolder = null)
{
AccountHolder = uid;
_balance = startingBalance;
}
public bool ModifyAccountBalance(int newBalance)
{
if (newBalance < 0)
{
return false;
}
_balance = newBalance;
BalanceChanged?.Invoke(this);
return true;
AccountHolder = accountHolder;
Balance = startingBalance;
}
}
}