Skip to content

Commit

Permalink
надо решить че с подарками делать
Browse files Browse the repository at this point in the history
Signed-off-by: pacable <[email protected]>
  • Loading branch information
pxc1984 committed Nov 10, 2024
1 parent 78c0277 commit 0841a4f
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 16 deletions.
3 changes: 3 additions & 0 deletions Content.Server/Content.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj" />
<ProjectReference Include="..\Sunrise\Content.Sunrise.Interfaces.Server\Content.Sunrise.Interfaces.Server.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="_Sunrise\Administration\Commands\" />
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
</Project>
17 changes: 17 additions & 0 deletions Content.Server/_Sunrise/CentCom/CentComCargoConsoleSystem.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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!;

/// <inheritdoc/>
public override void Initialize()
{
Expand All @@ -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<EntityTablePrototype>("CargoGiftsTable");
foreach (var entProtoId in _entityTable.GetSpawns(proto.Table))
{
var i = _prototypeMan.Index<EntityPrototype>(entProtoId);

var pr = _prototypeMan.GetPrototypeData(i);

var name = pr["name"].ToString();
}
}

private void OnSendGift(EntityUid uid, CentComCargoConsoleComponent component, CentComCargoSendGiftMessage args)
Expand Down
13 changes: 13 additions & 0 deletions Content.Server/_Sunrise/CentCom/CentComGiftsTableComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Robust.Shared.Prototypes;

namespace Content.Server._Sunrise.CentCom;

/// <summary>
/// This is used for...
/// </summary>
[RegisterComponent]
public sealed partial class CentComGiftsTableComponent : Component
{
[DataField]
public List<ProtoId<EntityPrototype>> Gifts;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ public sealed partial class CentComCargoConsoleComponent : Component
public CargoLinkedStation? LinkedStation;

[DataField]
public List<CentComGift> Gifts;
public List<CentComGift> Gifts = [];
}
4 changes: 2 additions & 2 deletions Resources/Prototypes/GameRules/cargo_gifts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0841a4f

Please sign in to comment.