revenant cleanup (#10662)
This commit is contained in:
@@ -1,54 +0,0 @@
|
|||||||
using Content.Shared.Revenant;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Client.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Revenant.Ui;
|
|
||||||
|
|
||||||
[UsedImplicitly]
|
|
||||||
public sealed class RevenantBoundUserInterface : BoundUserInterface
|
|
||||||
{
|
|
||||||
private RevenantMenu? _menu;
|
|
||||||
|
|
||||||
public RevenantBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Open()
|
|
||||||
{
|
|
||||||
_menu = new();
|
|
||||||
_menu.OpenCentered();
|
|
||||||
_menu.OnClose += Close;
|
|
||||||
|
|
||||||
_menu.OnListingButtonPressed += (_, listing) =>
|
|
||||||
{
|
|
||||||
SendMessage(new RevenantBuyListingMessage(listing));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UpdateState(BoundUserInterfaceState state)
|
|
||||||
{
|
|
||||||
base.UpdateState(state);
|
|
||||||
|
|
||||||
if (_menu == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case RevenantUpdateState msg:
|
|
||||||
_menu.UpdateEssence(msg.Essence);
|
|
||||||
_menu.UpdateListing(msg.Listings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
base.Dispose(disposing);
|
|
||||||
if (!disposing)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_menu?.Close();
|
|
||||||
_menu?.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<Control xmlns="https://spacestation14.io">
|
|
||||||
<BoxContainer Margin="8,8,8,8" Orientation="Vertical">
|
|
||||||
<BoxContainer Orientation="Horizontal">
|
|
||||||
<Label Name="RevenantItemName" HorizontalExpand="True" />
|
|
||||||
<Button
|
|
||||||
Name="RevenantItemBuyButton"
|
|
||||||
MinWidth="64"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Access="Public" />
|
|
||||||
</BoxContainer>
|
|
||||||
<PanelContainer StyleClasses="HighDivider" />
|
|
||||||
<BoxContainer HorizontalExpand="True" Orientation="Horizontal">
|
|
||||||
<TextureRect
|
|
||||||
Name="RevenantItemTexture"
|
|
||||||
Margin="0,0,4,0"
|
|
||||||
MinSize="48 48"
|
|
||||||
Stretch="KeepAspectCentered" />
|
|
||||||
<RichTextLabel Name="RevenantItemDescription" />
|
|
||||||
</BoxContainer>
|
|
||||||
</BoxContainer>
|
|
||||||
</Control>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using Robust.Client.AutoGenerated;
|
|
||||||
using Robust.Client.Graphics;
|
|
||||||
using Robust.Client.UserInterface;
|
|
||||||
using Robust.Client.UserInterface.Controls;
|
|
||||||
using Robust.Client.UserInterface.XAML;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
|
|
||||||
namespace Content.Client.Revenant.Ui;
|
|
||||||
|
|
||||||
[GenerateTypedNameReferences]
|
|
||||||
public sealed partial class RevenantListingControl : Control
|
|
||||||
{
|
|
||||||
public RevenantListingControl(string itemName, string itemDescription,
|
|
||||||
int itemPrice, bool canBuy, Texture? texture = null)
|
|
||||||
{
|
|
||||||
RobustXamlLoader.Load(this);
|
|
||||||
|
|
||||||
RevenantItemName.Text = itemName;
|
|
||||||
RevenantItemDescription.SetMessage(itemDescription);
|
|
||||||
|
|
||||||
RevenantItemBuyButton.Text = Loc.GetString("revenant-user-interface-cost", ("price", itemPrice));
|
|
||||||
RevenantItemBuyButton.Disabled = !canBuy;
|
|
||||||
|
|
||||||
RevenantItemTexture.Texture = texture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
<DefaultWindow
|
|
||||||
xmlns="https://spacestation14.io"
|
|
||||||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
|
|
||||||
Title="{Loc 'revenant-user-interface-title'}"
|
|
||||||
MinSize="512 512"
|
|
||||||
SetSize="512 512">
|
|
||||||
<BoxContainer Orientation="Vertical">
|
|
||||||
<BoxContainer Orientation="Vertical" VerticalExpand="True">
|
|
||||||
<BoxContainer Margin="4,4,4,4" Orientation="Horizontal">
|
|
||||||
<RichTextLabel
|
|
||||||
Name="BalanceInfo"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Access="Public"
|
|
||||||
HorizontalExpand="True" />
|
|
||||||
</BoxContainer>
|
|
||||||
<PanelContainer VerticalExpand="True">
|
|
||||||
<PanelContainer.PanelOverride>
|
|
||||||
<gfx:StyleBoxFlat BackgroundColor="#000000FF" />
|
|
||||||
</PanelContainer.PanelOverride>
|
|
||||||
<BoxContainer Orientation="Horizontal" VerticalExpand="True">
|
|
||||||
<ScrollContainer
|
|
||||||
Name="RevenantListingsScroll"
|
|
||||||
HScrollEnabled="False"
|
|
||||||
HorizontalExpand="True"
|
|
||||||
MinSize="100 256"
|
|
||||||
SizeFlagsStretchRatio="2"
|
|
||||||
VerticalExpand="True">
|
|
||||||
<BoxContainer
|
|
||||||
Name="RevenantListingsContainer"
|
|
||||||
MinSize="100 256"
|
|
||||||
Orientation="Vertical"
|
|
||||||
SizeFlagsStretchRatio="2"
|
|
||||||
VerticalExpand="True">
|
|
||||||
<!-- Listings are added here by code -->
|
|
||||||
</BoxContainer>
|
|
||||||
</ScrollContainer>
|
|
||||||
</BoxContainer>
|
|
||||||
</PanelContainer>
|
|
||||||
</BoxContainer>
|
|
||||||
</BoxContainer>
|
|
||||||
</DefaultWindow>
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
using Content.Client.Message;
|
|
||||||
using Content.Shared.FixedPoint;
|
|
||||||
using Content.Shared.Revenant;
|
|
||||||
using Robust.Client.AutoGenerated;
|
|
||||||
using Robust.Client.UserInterface.Controls;
|
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
|
||||||
using Robust.Client.UserInterface.XAML;
|
|
||||||
using Robust.Client.Utility;
|
|
||||||
|
|
||||||
namespace Content.Client.Revenant.Ui;
|
|
||||||
|
|
||||||
[GenerateTypedNameReferences]
|
|
||||||
public sealed partial class RevenantMenu : DefaultWindow
|
|
||||||
{
|
|
||||||
private FixedPoint2 _essence = 0f;
|
|
||||||
|
|
||||||
public event Action<BaseButton.ButtonEventArgs, RevenantStoreListingPrototype>? OnListingButtonPressed;
|
|
||||||
|
|
||||||
public RevenantMenu()
|
|
||||||
{
|
|
||||||
RobustXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateEssence(float essence)
|
|
||||||
{
|
|
||||||
// update balance label
|
|
||||||
_essence = essence;
|
|
||||||
var balanceStr = Loc.GetString("revenant-user-interface-essence-amount", ("amount", Math.Round(_essence.Float())));
|
|
||||||
BalanceInfo.SetMarkup(balanceStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateListing(List<RevenantStoreListingPrototype> listings)
|
|
||||||
{
|
|
||||||
// should probably chunk these out instead. to-do if this clogs the internet tubes.
|
|
||||||
// maybe read clients prototypes instead?
|
|
||||||
ClearListings();
|
|
||||||
foreach (var item in listings)
|
|
||||||
{
|
|
||||||
AddListingGui(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddListingGui(RevenantStoreListingPrototype listing)
|
|
||||||
{
|
|
||||||
var listingName = listing.ListingName;
|
|
||||||
var listingDesc = listing.Description;
|
|
||||||
var listingPrice = listing.Price;
|
|
||||||
var canBuy = _essence > listing.Price;
|
|
||||||
var texture = listing.Icon?.Frame0();
|
|
||||||
|
|
||||||
var newListing = new RevenantListingControl(listingName, listingDesc, listingPrice, canBuy, texture);
|
|
||||||
newListing.RevenantItemBuyButton.OnButtonDown += args
|
|
||||||
=> OnListingButtonPressed?.Invoke(args, listing);
|
|
||||||
|
|
||||||
RevenantListingsContainer.AddChild(newListing);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClearListings()
|
|
||||||
{
|
|
||||||
RevenantListingsContainer.Children.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,9 @@ using Content.Shared.MobState;
|
|||||||
using Content.Server.Explosion.EntitySystems;
|
using Content.Server.Explosion.EntitySystems;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Emag;
|
using Content.Server.Emag;
|
||||||
|
using Content.Server.Store.Components;
|
||||||
using Content.Shared.CharacterAppearance.Components;
|
using Content.Shared.CharacterAppearance.Components;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.Revenant.EntitySystems;
|
namespace Content.Server.Revenant.EntitySystems;
|
||||||
@@ -177,7 +179,9 @@ public sealed partial class RevenantSystem : EntitySystem
|
|||||||
|
|
||||||
essence.Harvested = true;
|
essence.Harvested = true;
|
||||||
ChangeEssenceAmount(uid, essence.EssenceAmount, component);
|
ChangeEssenceAmount(uid, essence.EssenceAmount, component);
|
||||||
component.StolenEssence += essence.EssenceAmount;
|
if (TryComp<StoreComponent>(uid, out var store))
|
||||||
|
_store.TryAddCurrency(new Dictionary<string, FixedPoint2>()
|
||||||
|
{ {component.StolenEssenceCurrencyPrototype, essence.EssenceAmount} }, store);
|
||||||
|
|
||||||
if (!TryComp<MobStateComponent>(args.Target, out var mobstate))
|
if (!TryComp<MobStateComponent>(args.Target, out var mobstate))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using Content.Shared.Revenant;
|
|
||||||
using Content.Server.UserInterface;
|
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Server.Player;
|
|
||||||
using Content.Shared.Actions.ActionTypes;
|
|
||||||
|
|
||||||
namespace Content.Server.Revenant.EntitySystems;
|
|
||||||
|
|
||||||
// TODO: Delete and replace all of this with StoreSystem once that's merged
|
|
||||||
// i'm sorry, but i'm not ultra-optimizing something that's getting deleted in a week.
|
|
||||||
// 8/7/22 -emo (bully me if this exists in the future)
|
|
||||||
public sealed partial class RevenantSystem : EntitySystem
|
|
||||||
{
|
|
||||||
private void InitializeShop()
|
|
||||||
{
|
|
||||||
SubscribeLocalEvent<RevenantComponent, RevenantShopActionEvent>(OnShop);
|
|
||||||
SubscribeLocalEvent<RevenantComponent, RevenantBuyListingMessage>(OnBuy);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnShop(EntityUid uid, RevenantComponent component, RevenantShopActionEvent args)
|
|
||||||
{
|
|
||||||
if (!TryComp<ActorComponent>(uid, out var actor))
|
|
||||||
return;
|
|
||||||
ToggleUi(component, actor.PlayerSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnBuy(EntityUid uid, RevenantComponent component, RevenantBuyListingMessage ev)
|
|
||||||
{
|
|
||||||
RevenantStoreListingPrototype? targetListing = null;
|
|
||||||
foreach (var listing in component.Listings)
|
|
||||||
{
|
|
||||||
if (listing.Key.ID == ev.Listing.ID)
|
|
||||||
targetListing = listing.Key;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetListing == null)
|
|
||||||
return;
|
|
||||||
component.Listings[targetListing] = false;
|
|
||||||
|
|
||||||
if (component.StolenEssence < ev.Listing.Price)
|
|
||||||
return;
|
|
||||||
component.StolenEssence -= ev.Listing.Price;
|
|
||||||
|
|
||||||
if (_proto.TryIndex<InstantActionPrototype>(ev.Listing.ActionId, out var action))
|
|
||||||
_action.AddAction(uid, new InstantAction(action), null);
|
|
||||||
|
|
||||||
UpdateUserInterface(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ToggleUi(RevenantComponent component, IPlayerSession session)
|
|
||||||
{
|
|
||||||
var ui = component.Owner.GetUIOrNull(RevenantUiKey.Key);
|
|
||||||
ui?.Toggle(session);
|
|
||||||
|
|
||||||
UpdateUserInterface(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateUserInterface(RevenantComponent component)
|
|
||||||
{
|
|
||||||
var ui = component.Owner.GetUIOrNull(RevenantUiKey.Key);
|
|
||||||
if (ui == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var filterlistings = (from e in component.Listings where e.Value select e.Key).ToList();
|
|
||||||
|
|
||||||
ui.SetState(new RevenantUpdateState(component.StolenEssence.Float(), filterlistings));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,6 +16,8 @@ using Robust.Shared.Prototypes;
|
|||||||
using Content.Shared.Actions.ActionTypes;
|
using Content.Shared.Actions.ActionTypes;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Content.Server.Polymorph.Systems;
|
using Content.Server.Polymorph.Systems;
|
||||||
|
using Content.Server.Store.Components;
|
||||||
|
using Content.Server.Store.Systems;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Content.Shared.Movement.Systems;
|
using Content.Shared.Movement.Systems;
|
||||||
@@ -42,6 +44,7 @@ public sealed partial class RevenantSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedStunSystem _stun = default!;
|
[Dependency] private readonly SharedStunSystem _stun = default!;
|
||||||
[Dependency] private readonly TagSystem _tag = default!;
|
[Dependency] private readonly TagSystem _tag = default!;
|
||||||
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
||||||
|
[Dependency] private readonly StoreSystem _store = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -49,13 +52,13 @@ public sealed partial class RevenantSystem : EntitySystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<RevenantComponent, ComponentStartup>(OnStartup);
|
SubscribeLocalEvent<RevenantComponent, ComponentStartup>(OnStartup);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<RevenantComponent, RevenantShopActionEvent>(OnShop);
|
||||||
SubscribeLocalEvent<RevenantComponent, DamageChangedEvent>(OnDamage);
|
SubscribeLocalEvent<RevenantComponent, DamageChangedEvent>(OnDamage);
|
||||||
SubscribeLocalEvent<RevenantComponent, ExaminedEvent>(OnExamine);
|
SubscribeLocalEvent<RevenantComponent, ExaminedEvent>(OnExamine);
|
||||||
SubscribeLocalEvent<RevenantComponent, StatusEffectAddedEvent>(OnStatusAdded);
|
SubscribeLocalEvent<RevenantComponent, StatusEffectAddedEvent>(OnStatusAdded);
|
||||||
SubscribeLocalEvent<RevenantComponent, StatusEffectEndedEvent>(OnStatusEnded);
|
SubscribeLocalEvent<RevenantComponent, StatusEffectEndedEvent>(OnStatusEnded);
|
||||||
|
|
||||||
InitializeAbilities();
|
InitializeAbilities();
|
||||||
InitializeShop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStartup(EntityUid uid, RevenantComponent component, ComponentStartup args)
|
private void OnStartup(EntityUid uid, RevenantComponent component, ComponentStartup args)
|
||||||
@@ -72,10 +75,6 @@ public sealed partial class RevenantSystem : EntitySystem
|
|||||||
if (TryComp(component.Owner, out EyeComponent? eye))
|
if (TryComp(component.Owner, out EyeComponent? eye))
|
||||||
eye.VisibilityMask |= (uint) (VisibilityFlags.Ghost);
|
eye.VisibilityMask |= (uint) (VisibilityFlags.Ghost);
|
||||||
|
|
||||||
//get all the abilities
|
|
||||||
foreach (var listing in _proto.EnumeratePrototypes<RevenantStoreListingPrototype>())
|
|
||||||
component.Listings.Add(listing, true);
|
|
||||||
|
|
||||||
var shopaction = new InstantAction(_proto.Index<InstantActionPrototype>("RevenantShop"));
|
var shopaction = new InstantAction(_proto.Index<InstantActionPrototype>("RevenantShop"));
|
||||||
_action.AddAction(uid, shopaction, null);
|
_action.AddAction(uid, shopaction, null);
|
||||||
}
|
}
|
||||||
@@ -133,7 +132,8 @@ public sealed partial class RevenantSystem : EntitySystem
|
|||||||
_polymorphable.PolymorphEntity(uid, "Ectoplasm");
|
_polymorphable.PolymorphEntity(uid, "Ectoplasm");
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateUserInterface(component);
|
if (TryComp<StoreComponent>(uid, out var store))
|
||||||
|
_store.UpdateUserInterface(uid, store);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,6 +163,13 @@ public sealed partial class RevenantSystem : EntitySystem
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnShop(EntityUid uid, RevenantComponent component, RevenantShopActionEvent args)
|
||||||
|
{
|
||||||
|
if (!TryComp<StoreComponent>(uid, out var store))
|
||||||
|
return;
|
||||||
|
_store.ToggleUi(uid, store);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Robust.Shared.Prototypes;
|
|||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
|
using Content.Shared.Store;
|
||||||
|
|
||||||
namespace Content.Server.Revenant;
|
namespace Content.Server.Revenant;
|
||||||
|
|
||||||
@@ -17,11 +18,8 @@ public sealed class RevenantComponent : SharedRevenantComponent
|
|||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public FixedPoint2 Essence = 75;
|
public FixedPoint2 Essence = 75;
|
||||||
|
|
||||||
/// <summary>
|
[DataField("stolenEssenceCurrencyPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<CurrencyPrototype>))]
|
||||||
/// Used for purchasing shop items.
|
public string StolenEssenceCurrencyPrototype = "StolenEssence";
|
||||||
/// </summary>
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public FixedPoint2 StolenEssence = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The entity's current max amount of essence. Can be increased
|
/// The entity's current max amount of essence. Can be increased
|
||||||
@@ -189,12 +187,6 @@ public sealed class RevenantComponent : SharedRevenantComponent
|
|||||||
[ViewVariables(VVAccess.ReadWrite), DataField("malfunctionRadius")]
|
[ViewVariables(VVAccess.ReadWrite), DataField("malfunctionRadius")]
|
||||||
public float MalfunctionRadius = 3.5f;
|
public float MalfunctionRadius = 3.5f;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stores all of the currently unlockable abilities in the shop.
|
|
||||||
/// </summary>
|
|
||||||
[ViewVariables]
|
|
||||||
public Dictionary<RevenantStoreListingPrototype, bool> Listings = new ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class SoulSearchDoAfterComplete : EntityEventArgs
|
public sealed class SoulSearchDoAfterComplete : EntityEventArgs
|
||||||
|
|||||||
@@ -60,15 +60,13 @@ public sealed partial class StoreSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
ui = component.Owner.GetUIOrNull(StoreUiKey.Key);
|
ui = component.Owner.GetUIOrNull(StoreUiKey.Key);
|
||||||
if (ui == null)
|
if (ui == null)
|
||||||
{
|
|
||||||
Logger.Error("No Ui key.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//if we haven't opened it before, initialize the shit
|
//if we haven't opened it before, initialize the shit
|
||||||
if (!component.Opened)
|
if (!component.Opened)
|
||||||
{
|
{
|
||||||
|
RefreshAllListings(component);
|
||||||
InitializeFromPreset(component.Preset, component);
|
InitializeFromPreset(component.Preset, component);
|
||||||
component.Opened = true;
|
component.Opened = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ public sealed partial class StoreSystem : EntitySystem
|
|||||||
/// <param name="component">The store being initialized</param>
|
/// <param name="component">The store being initialized</param>
|
||||||
public void InitializeFromPreset(StorePresetPrototype preset, StoreComponent component)
|
public void InitializeFromPreset(StorePresetPrototype preset, StoreComponent component)
|
||||||
{
|
{
|
||||||
RefreshAllListings(component);
|
|
||||||
component.Preset = preset.ID;
|
component.Preset = preset.ID;
|
||||||
component.CurrencyWhitelist.UnionWith(preset.CurrencyWhitelist);
|
component.CurrencyWhitelist.UnionWith(preset.CurrencyWhitelist);
|
||||||
component.Categories.UnionWith(preset.Categories);
|
component.Categories.UnionWith(preset.Categories);
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
using Content.Shared.Actions.ActionTypes;
|
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
||||||
using Robust.Shared.Utility;
|
|
||||||
|
|
||||||
namespace Content.Shared.Revenant;
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
[Prototype("revenantListing")]
|
|
||||||
public sealed class RevenantStoreListingPrototype : IPrototype
|
|
||||||
{
|
|
||||||
[ViewVariables]
|
|
||||||
[IdDataField]
|
|
||||||
public string ID { get; } = default!;
|
|
||||||
|
|
||||||
[DataField("actionId", customTypeSerializer:typeof(PrototypeIdSerializer<InstantActionPrototype>))]
|
|
||||||
public string ActionId { get; } = string.Empty;
|
|
||||||
|
|
||||||
[DataField("price")]
|
|
||||||
public int Price { get; } = 5;
|
|
||||||
|
|
||||||
[DataField("description")]
|
|
||||||
public string Description { get; } = string.Empty;
|
|
||||||
|
|
||||||
[DataField("listingName")]
|
|
||||||
public string ListingName { get; } = string.Empty;
|
|
||||||
|
|
||||||
[DataField("icon")]
|
|
||||||
public SpriteSpecifier? Icon { get; } = null;
|
|
||||||
}
|
|
||||||
@@ -16,34 +16,3 @@ public enum RevenantVisuals : byte
|
|||||||
Stunned,
|
Stunned,
|
||||||
Harvesting,
|
Harvesting,
|
||||||
}
|
}
|
||||||
|
|
||||||
[NetSerializable, Serializable]
|
|
||||||
public enum RevenantUiKey : byte
|
|
||||||
{
|
|
||||||
Key
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public sealed class RevenantUpdateState : BoundUserInterfaceState
|
|
||||||
{
|
|
||||||
public float Essence;
|
|
||||||
|
|
||||||
public readonly List<RevenantStoreListingPrototype> Listings;
|
|
||||||
|
|
||||||
public RevenantUpdateState(float essence, List<RevenantStoreListingPrototype> listings)
|
|
||||||
{
|
|
||||||
Essence = essence;
|
|
||||||
Listings = listings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public sealed class RevenantBuyListingMessage : BoundUserInterfaceMessage
|
|
||||||
{
|
|
||||||
public RevenantStoreListingPrototype Listing;
|
|
||||||
|
|
||||||
public RevenantBuyListingMessage (RevenantStoreListingPrototype listing)
|
|
||||||
{
|
|
||||||
Listing = listing;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,3 +9,6 @@ store-currency-price-display-debugdollar = {$amount ->
|
|||||||
|
|
||||||
store-currency-balance-display-telecrystal = TC: {$amount}
|
store-currency-balance-display-telecrystal = TC: {$amount}
|
||||||
store-currency-price-display-telecrystal = {$amount} TC
|
store-currency-price-display-telecrystal = {$amount} TC
|
||||||
|
|
||||||
|
store-currency-balance-display-stolen-essence = Stolen Essence: {$amount}
|
||||||
|
store-currency-price-display-stolen-essence = {$amount} Stolen Essence
|
||||||
@@ -1,32 +1,51 @@
|
|||||||
#TODO: generic shop system
|
- type: listing
|
||||||
- type: revenantListing
|
id: RevenantDefile
|
||||||
id: Defile
|
name: Defile
|
||||||
actionId: RevenantDefile
|
description: Defiles the surrounding area, ripping up floors, damaging windows, opening containers, and throwing items. Using it leaves you vulnerable to attacks for a short period of time.
|
||||||
listingName: Defile
|
productAction: RevenantDefile
|
||||||
description: Costs 30 Essence per use. Defiles the surrounding area, ripping up floors, damaging windows, opening containers, and throwing items. Using it leaves you vulnerable to attacks for a short period of time.
|
cost:
|
||||||
icon: Interface/Actions/defile.png
|
StolenEssence: 10
|
||||||
price: 10
|
categories:
|
||||||
|
- RevenantAbilities
|
||||||
|
conditions:
|
||||||
|
- !type:ListingLimitedStockCondition
|
||||||
|
stock: 1
|
||||||
|
|
||||||
- type: revenantListing
|
- type: listing
|
||||||
id: OverloadLights
|
id: RevenantOverloadLights
|
||||||
actionId: RevenantOverloadLights
|
name: Overload Lights
|
||||||
listingName: Overload Lights
|
description: Overloads all nearby lights, causing the bulbs to shatter and sending out damaging sparks. Using it leaves you vulnerable to attacks for a long period of time.
|
||||||
description: Costs 40 Essence per use. Overloads all nearby lights, causing the bulbs to shatter and sending out damaging sparks. Using it leaves you vulnerable to attacks for a long period of time.
|
productAction: RevenantOverloadLights
|
||||||
icon: Interface/Actions/overloadlight.png
|
cost:
|
||||||
price: 25
|
StolenEssence: 25
|
||||||
|
categories:
|
||||||
|
- RevenantAbilities
|
||||||
|
conditions:
|
||||||
|
- !type:ListingLimitedStockCondition
|
||||||
|
stock: 1
|
||||||
|
|
||||||
- type: revenantListing
|
- type: listing
|
||||||
id: Blight
|
id: RevenantBlight
|
||||||
actionId: RevenantBlight
|
name: Blight
|
||||||
listingName: Blight
|
description: Infects all nearby organisms with an infectious disease that causes toxic buildup and tiredness. Using it leaves you vulnerable to attacks for a medium period of time.
|
||||||
description: Costs 50 Essence per use. Infects all nearby organisms with an infectious disease that causes poison and tiredness. Using it leaves you vulnerable to attacks for a medium period of time.
|
productAction: RevenantBlight
|
||||||
icon: Interface/Actions/blight.png
|
cost:
|
||||||
price: 75
|
StolenEssence: 75
|
||||||
|
categories:
|
||||||
|
- RevenantAbilities
|
||||||
|
conditions:
|
||||||
|
- !type:ListingLimitedStockCondition
|
||||||
|
stock: 1
|
||||||
|
|
||||||
- type: revenantListing
|
- type: listing
|
||||||
id: Malfunction
|
id: RevenantMalfunction
|
||||||
actionId: RevenantMalfunction
|
name: Malfunction
|
||||||
listingName: Malfunction
|
description: Makes nearby electronics stop working properly. Using it leaves you vulnerable to attacks for a long period of time.
|
||||||
description: Costs 60 Essence per use. Makes most nearby electronics stop working properly. Using it leaves you vulnerable to attacks for a long period of time.
|
productAction: RevenantMalfunction
|
||||||
icon: Interface/Actions/malfunction.png
|
cost:
|
||||||
price: 125
|
StolenEssence: 125
|
||||||
|
categories:
|
||||||
|
- RevenantAbilities
|
||||||
|
conditions:
|
||||||
|
- !type:ListingLimitedStockCondition
|
||||||
|
stock: 1
|
||||||
|
|||||||
@@ -60,11 +60,16 @@
|
|||||||
softness: 0.75
|
softness: 0.75
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.RevenantUiKey.Key
|
- key: enum.StoreUiKey.Key
|
||||||
type: RevenantBoundUserInterface
|
type: StoreBoundUserInterface
|
||||||
- type: MobState
|
- type: MobState
|
||||||
- type: Visibility
|
- type: Visibility
|
||||||
layer: 2 #ghost vis layer
|
layer: 2 #ghost vis layer
|
||||||
|
- type: Store
|
||||||
|
categories:
|
||||||
|
- RevenantAbilities
|
||||||
|
currencyWhitelist:
|
||||||
|
- StolenEssence
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: BaseItem
|
parent: BaseItem
|
||||||
|
|||||||
@@ -58,3 +58,8 @@
|
|||||||
name: Pointless
|
name: Pointless
|
||||||
priority: 9
|
priority: 9
|
||||||
|
|
||||||
|
#revenant
|
||||||
|
- type: storeCategory
|
||||||
|
id: RevenantAbilities
|
||||||
|
name: Abilities
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,12 @@
|
|||||||
entityId: Telecrystal1
|
entityId: Telecrystal1
|
||||||
canWithdraw: true
|
canWithdraw: true
|
||||||
|
|
||||||
|
- type: currency
|
||||||
|
id: StolenEssence
|
||||||
|
balanceDisplay: store-currency-balance-display-stolen-essence
|
||||||
|
priceDisplay: store-currency-price-display-stolen-essence
|
||||||
|
canWithdraw: false
|
||||||
|
|
||||||
#debug
|
#debug
|
||||||
- type: currency
|
- type: currency
|
||||||
id: DebugDollar
|
id: DebugDollar
|
||||||
|
|||||||
Reference in New Issue
Block a user