Skip to content

Commit

Permalink
Merge pull request SerbiaStrong-220#292 from TheArturZh/hotfixes
Browse files Browse the repository at this point in the history
Hotfixes
  • Loading branch information
TheArturZh authored Aug 30, 2023
2 parents 414c8e7 + ae91155 commit c896c97
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 22 additions & 8 deletions Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private void InitializeShuttle()
SubscribeLocalEvent<CargoShuttleComponent, FTLTagEvent>(OnCargoFTLTag);

SubscribeLocalEvent<CargoShuttleConsoleComponent, ComponentStartup>(OnCargoShuttleConsoleStartup);
SubscribeLocalEvent<CargoShuttleComponent, ComponentInit>(OnCargoShuttleInit);

SubscribeLocalEvent<CargoPalletConsoleComponent, CargoPalletSellMessage>(OnPalletSale);
SubscribeLocalEvent<CargoPalletConsoleComponent, CargoPalletAppraiseMessage>(OnPalletAppraise);
Expand All @@ -49,6 +50,12 @@ private void ShutdownShuttle()
_cfgManager.UnsubValueChanged(CCVars.GridFill, SetGridFill);
}

private void OnCargoShuttleInit(EntityUid uid, CargoShuttleComponent cargo, ComponentInit args)
{
if (_cfgManager.GetCVar(CCVars.GridFill))
SetupCargoShuttle();
}

private void SetGridFill(bool obj)
{
if (obj)
Expand Down Expand Up @@ -372,8 +379,12 @@ private void OnRoundRestart(RoundRestartCleanupEvent ev)
Reset();
CleanupCargoShuttle();

/*
if (_cfgManager.GetCVar(CCVars.GridFill))
{
SetupCargoShuttle();
}
*/
}

private void CleanupCargoShuttle()
Expand Down Expand Up @@ -404,15 +415,20 @@ private void CleanupCargoShuttle()

private void SetupCargoShuttle()
{
if (CargoMap != null && _mapManager.MapExists(CargoMap.Value))
EntityUid mapUid;
if (CargoMap == null || !_mapManager.MapExists(CargoMap.Value))
{
return;
// It gets mapinit which is okay... buuutt we still want it paused to avoid power draining.
CargoMap = _mapManager.CreateMap();
mapUid = _mapManager.GetMapEntityId(CargoMap.Value);
_metaSystem.SetEntityName(mapUid, $"Trading post {_random.Next(1000):000}");
}
else
{
mapUid = _mapManager.GetMapEntityId(CargoMap.Value);
}

// It gets mapinit which is okay... buuutt we still want it paused to avoid power draining.
CargoMap = _mapManager.CreateMap();
var mapUid = _mapManager.GetMapEntityId(CargoMap.Value);
var ftl = EnsureComp<FTLDestinationComponent>(_mapManager.GetMapEntityId(CargoMap.Value));
var ftl = EnsureComp<FTLDestinationComponent>(mapUid);
ftl.Whitelist = new EntityWhitelist()
{
Components = new[]
Expand All @@ -421,8 +437,6 @@ private void SetupCargoShuttle()
}
};

_metaSystem.SetEntityName(mapUid, $"Trading post {_random.Next(1000):000}");

_console.RefreshShuttleConsoles();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/SS220/Maps/frankenstein.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
id: Frankenstein
mapName: 'NSS Frankenstein'
mapPath: /Maps/ss220-box.yml
minPlayers: 50
minPlayers: 0
stations:
Boxstation:
stationProto: StandardNanotrasenStation
Expand Down

0 comments on commit c896c97

Please sign in to comment.