From 0841a4f42360e666bb2bd839f860b0e5f7f701cc Mon Sep 17 00:00:00 2001 From: pacable Date: Sun, 10 Nov 2024 09:06:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D0=B4=D0=BE=20=D1=80=D0=B5=D1=88?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D1=87=D0=B5=20=D1=81=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=D1=80=D0=BA=D0=B0=D0=BC=D0=B8=20=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pacable --- Content.Server/Content.Server.csproj | 3 ++ .../CentCom/CentComCargoConsoleSystem.cs | 17 ++++++++++ .../CentCom/CentComGiftsTableComponent.cs | 13 ++++++++ .../CentCom/CentComCargoConsoleComponent.cs | 2 +- .../Prototypes/GameRules/cargo_gifts.yml | 4 +-- .../Machines/Computers/computers.yml | 31 +++++++++++-------- 6 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 Content.Server/_Sunrise/CentCom/CentComGiftsTableComponent.cs diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index 3547b4f2043..b1cb9407cd3 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -27,5 +27,8 @@ + + + diff --git a/Content.Server/_Sunrise/CentCom/CentComCargoConsoleSystem.cs b/Content.Server/_Sunrise/CentCom/CentComCargoConsoleSystem.cs index c49553bfe2a..a7b311157b6 100644 --- a/Content.Server/_Sunrise/CentCom/CentComCargoConsoleSystem.cs +++ b/Content.Server/_Sunrise/CentCom/CentComCargoConsoleSystem.cs @@ -1,8 +1,11 @@ using Content.Server._Sunrise.StationCentComm; using Content.Server.GameTicking; using Content.Server.Station.Systems; +using Content.Server.StationEvents.Components; using Content.Shared._Sunrise.CentCom; using Content.Shared._Sunrise.CentCom.BUIStates; +using Content.Shared.EntityTable; +using Content.Shared.EntityTable.EntitySelectors; using Robust.Server.GameObjects; using Robust.Shared.Prototypes; @@ -15,6 +18,8 @@ public sealed class CentComCargoConsoleSystem : EntitySystem [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly IPrototypeManager _prototypeMan = default!; [Dependency] private readonly GameTicker _ticker = default!; + [Dependency] private readonly EntityTableSystem _entityTable = default!; + /// public override void Initialize() { @@ -25,7 +30,19 @@ public override void Initialize() private void OnCargoInit(EntityUid uid, CentComCargoConsoleComponent component, ComponentInit args) { + // Init gifts + if (component.Gifts.Count != 0) // используют кастомные подарки + return; + + var proto = _prototypeMan.Index("CargoGiftsTable"); + foreach (var entProtoId in _entityTable.GetSpawns(proto.Table)) + { + var i = _prototypeMan.Index(entProtoId); + + var pr = _prototypeMan.GetPrototypeData(i); + var name = pr["name"].ToString(); + } } private void OnSendGift(EntityUid uid, CentComCargoConsoleComponent component, CentComCargoSendGiftMessage args) diff --git a/Content.Server/_Sunrise/CentCom/CentComGiftsTableComponent.cs b/Content.Server/_Sunrise/CentCom/CentComGiftsTableComponent.cs new file mode 100644 index 00000000000..f234fe1f776 --- /dev/null +++ b/Content.Server/_Sunrise/CentCom/CentComGiftsTableComponent.cs @@ -0,0 +1,13 @@ +using Robust.Shared.Prototypes; + +namespace Content.Server._Sunrise.CentCom; + +/// +/// This is used for... +/// +[RegisterComponent] +public sealed partial class CentComGiftsTableComponent : Component +{ + [DataField] + public List> Gifts; +} diff --git a/Content.Shared/_Sunrise/CentCom/CentComCargoConsoleComponent.cs b/Content.Shared/_Sunrise/CentCom/CentComCargoConsoleComponent.cs index 97186299de8..c06b663d7d2 100644 --- a/Content.Shared/_Sunrise/CentCom/CentComCargoConsoleComponent.cs +++ b/Content.Shared/_Sunrise/CentCom/CentComCargoConsoleComponent.cs @@ -23,5 +23,5 @@ public sealed partial class CentComCargoConsoleComponent : Component public CargoLinkedStation? LinkedStation; [DataField] - public List Gifts; + public List Gifts = []; } diff --git a/Resources/Prototypes/GameRules/cargo_gifts.yml b/Resources/Prototypes/GameRules/cargo_gifts.yml index f4e4a5bf8fc..18a4641fe81 100644 --- a/Resources/Prototypes/GameRules/cargo_gifts.yml +++ b/Resources/Prototypes/GameRules/cargo_gifts.yml @@ -11,12 +11,12 @@ - id: GiftsPizzaPartyLarge - id: GiftsPizzaPartySmall - id: GiftsSecurityGuns - - id: GiftsSecurityRiot + - id: GiftsSecurityRiot+ - id: GiftsSpacingSupplies - id: GiftsVendingRestock # Game Rules - + - type: entity id: CargoGiftsBase parent: BaseGameRule diff --git a/Resources/Prototypes/_Sunrise/Entities/Structures/Machines/Computers/computers.yml b/Resources/Prototypes/_Sunrise/Entities/Structures/Machines/Computers/computers.yml index da98fe1492a..87b6099640b 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Structures/Machines/Computers/computers.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Structures/Machines/Computers/computers.yml @@ -89,21 +89,26 @@ enum.WiresUiKey.Key: type: WiresBoundUserInterface - type: CentComCargoConsole - gifts: - - title: TEST TITLE - description: TEST DESCRIPTION - contents: - - Some contents - - Some other contents - - Some contents - - Some other contents - - Some contents - - Some other contents - - Some contents - - Some other contents - event: GiftsEngineering + targetTable: CargoGiftsTable # TODO: gifts +- type: entity + abstract: true + id: CentComGiftsTable + components: + - type: CentComGiftsTable + gifts: + - id: GiftsEngineering + - id: GiftsFireProtection + - id: GiftsJanitor + - id: GiftsMedical + - id: GiftsPizzaPartyLarge + - id: GiftsPizzaPartySmall + - id: GiftsSecurityGuns + - id: GiftsSecurityRiot + - id: GiftsSpacingSupplies + - id: GiftsVendingRestock + - type: entity parent: BaseComputerShuttle id: ComputerShuttleCentComm