Telecrystals (and a bit more ECS) (#4775)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace Content.Shared.Traitor.Uplink
|
||||
[Serializable, NetSerializable]
|
||||
public class UplinkListingData : ComponentState, IEquatable<UplinkListingData>
|
||||
{
|
||||
public string ItemId;
|
||||
public int Price;
|
||||
public UplinkCategory Category;
|
||||
public string Description;
|
||||
public string ListingName;
|
||||
public readonly string ItemId;
|
||||
public readonly int Price;
|
||||
public readonly UplinkCategory Category;
|
||||
public readonly string Description;
|
||||
public readonly string ListingName;
|
||||
|
||||
public UplinkListingData(string listingName, string itemId,
|
||||
int price, UplinkCategory category,
|
||||
|
||||
Reference in New Issue
Block a user