Skip to content

Commit

Permalink
Merge pull request #53 from new-frontiers-14/salvage_rewards
Browse files Browse the repository at this point in the history
Salvage Rewards
  • Loading branch information
Cheackraze authored Jul 19, 2023
2 parents e78caf9 + ba1f8d2 commit 96f5305
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions Content.Server/Salvage/SalvageSystem.Expeditions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
using System.Linq;
using System.Threading;
using Content.Server.Shuttles.Systems;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Coordinates;
using Content.Shared.Salvage.Expeditions;
using Robust.Shared.GameStates;
using Robust.Shared.Random;

namespace Content.Server.Salvage;

Expand Down Expand Up @@ -293,18 +296,22 @@ private void OnStructureExamine(EntityUid uid, SalvageStructureComponent compone

private void GiveRewards(SalvageExpeditionComponent comp)
{
// send it to cargo, no rewards otherwise.
if (!TryComp<StationCargoOrderDatabaseComponent>(comp.Station, out var cargoDb))
var palletList = new List<EntityUid>();
var pallets = EntityQueryEnumerator<CargoPalletComponent>();
while (pallets.MoveNext(out var pallet, out var palletComp))
{
return;
if (_stationSystem.GetOwningStation(pallet) == comp.Station)
{
palletList.Add(pallet);
}
}

if (!(palletList.Count > 0))
return;

foreach (var reward in comp.Rewards)
{
var sender = Loc.GetString("cargo-gift-default-sender");
var desc = Loc.GetString("salvage-expedition-reward-description");
var dest = Loc.GetString("cargo-gift-default-dest");
_cargo.AddAndApproveOrder(cargoDb, reward, 0, 1, sender, desc, dest);
Spawn(reward, (_random.Pick(palletList)).ToCoordinates());
}
}
}
2 changes: 1 addition & 1 deletion Content.Server/Salvage/SpawnSalvageMissionJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected override async Task<bool> Process()
if (shuttleUid is { Valid : true } vesselUid)
{
var shuttle = _entManager.GetComponent<ShuttleComponent>(vesselUid);
_shuttle.FTLTravel(vesselUid, shuttle, new EntityCoordinates(mapUid, Vector2.Zero), 8f, 50f);
_shuttle.FTLTravel(vesselUid, shuttle, new EntityCoordinates(mapUid, Vector2.Zero), 5.5f, 50f);
}

var landingPadRadius = 38; //we go a liiitle bigger for the shipses
Expand Down

0 comments on commit 96f5305

Please sign in to comment.