2021-01-09 02:11:09 -03:00
|
|
|
using Content.Server.Cargo;
|
|
|
|
|
using Content.Server.GameObjects.EntitySystems;
|
2019-11-21 16:37:15 -08:00
|
|
|
using Content.Shared.GameObjects.Components.Cargo;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-02-18 09:09:07 +01:00
|
|
|
using Robust.Shared.Players;
|
2019-11-21 16:37:15 -08:00
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.Components.Cargo
|
|
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
public class CargoOrderDatabaseComponent : SharedCargoOrderDatabaseComponent
|
|
|
|
|
{
|
|
|
|
|
public CargoOrderDatabase Database { get; set; }
|
|
|
|
|
public bool ConnectedToDatabase => Database != null;
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
2019-12-19 11:35:17 -08:00
|
|
|
base.Initialize();
|
|
|
|
|
|
2021-01-09 02:11:09 -03:00
|
|
|
Database = EntitySystem.Get<CargoConsoleSystem>().StationOrderDatabase;
|
2019-11-21 16:37:15 -08:00
|
|
|
}
|
|
|
|
|
|
2021-02-18 09:09:07 +01:00
|
|
|
public override ComponentState GetComponentState(ICommonSession player)
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
|
|
|
|
if (!ConnectedToDatabase)
|
|
|
|
|
return new CargoOrderDatabaseState(null);
|
|
|
|
|
return new CargoOrderDatabaseState(Database.GetOrders());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|