Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salvage Rewards #53

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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