-
Notifications
You must be signed in to change notification settings - Fork 401
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
Fixed Cargo Bounties #1010
Closed
Closed
Fixed Cargo Bounties #1010
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
54e3f4e
Bounties work, but aren't removed and replaced
blueDev2 6e8ff2c
Slight format fix
blueDev2 a849177
Removed debug logging
blueDev2 7b31de4
Merge branch 'Bounty-Fix' of https://github.com/blueDev2/Delta-v into…
blueDev2 af832ca
Removed "station" check for emiting a EntitySoldEvent
blueDev2 03fa9d9
Merge branch 'master' into Bounty-Fix
blueDev2 079c289
Mirroring PR changes
blueDev2 0df52ab
Removal of unneeded imports
blueDev2 00fef72
Missed one
blueDev2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,7 @@ | |||||
using Content.Server.Labels; | ||||||
using Content.Server.NameIdentifier; | ||||||
using Content.Server.Paper; | ||||||
using Content.Server.Station.Systems; | ||||||
using Content.Shared.Cargo; | ||||||
using Content.Shared.Cargo.Components; | ||||||
using Content.Shared.Cargo.Prototypes; | ||||||
|
@@ -65,16 +66,17 @@ private void OnPrintLabelMessage(EntityUid uid, CargoBountyConsoleComponent comp | |||||
|
||||||
var label = Spawn(component.BountyLabelId, Transform(uid).Coordinates); | ||||||
component.NextPrintTime = _timing.CurTime + component.PrintDelay; | ||||||
SetupBountyLabel(label, bounty.Value); | ||||||
SetupBountyLabel(label, station, bounty.Value); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
_audio.PlayPvs(component.PrintSound, uid); | ||||||
} | ||||||
|
||||||
public void SetupBountyLabel(EntityUid uid, CargoBountyData bounty, PaperComponent? paper = null, CargoBountyLabelComponent? label = null) | ||||||
public void SetupBountyLabel(EntityUid uid, EntityUid stationId, CargoBountyData bounty, PaperComponent? paper = null, CargoBountyLabelComponent? label = null) | ||||||
{ | ||||||
if (!Resolve(uid, ref paper, ref label) || !_protoMan.TryIndex<CargoBountyPrototype>(bounty.Bounty, out var prototype)) | ||||||
return; | ||||||
|
||||||
label.Id = bounty.Id; | ||||||
label.AssociatedStationId = stationId; | ||||||
var msg = new FormattedMessage(); | ||||||
msg.AddText(Loc.GetString("bounty-manifest-header", ("id", bounty.Id))); | ||||||
msg.PushNewline(); | ||||||
|
@@ -103,7 +105,7 @@ private void OnGetBountyPrice(EntityUid uid, CargoBountyLabelComponent component | |||||
if (!_container.TryGetContainingContainer(uid, out var container) || container.ID != LabelSystem.ContainerName) | ||||||
return; | ||||||
|
||||||
if (_station.GetOwningStation(uid) is not { } station || !TryComp<StationCargoBountyDatabaseComponent>(station, out var database)) | ||||||
if (component.AssociatedStationId is not { } station || !TryComp<StationCargoBountyDatabaseComponent>(station, out var database)) | ||||||
return; | ||||||
|
||||||
if (database.CheckedBounties.Contains(component.Id)) | ||||||
|
@@ -131,14 +133,18 @@ private void OnSold(ref EntitySoldEvent args) | |||||
if (!TryGetBountyLabel(sold, out _, out var component)) | ||||||
continue; | ||||||
|
||||||
if (!TryGetBountyFromId(args.Station, component.Id, out var bounty)) | ||||||
if (component.AssociatedStationId is not { } station || !TryGetBountyFromId(station, component.Id, out var bounty)) | ||||||
{ | ||||||
continue; | ||||||
} | ||||||
|
||||||
if (!IsBountyComplete(sold, bounty.Value)) | ||||||
{ | ||||||
continue; | ||||||
} | ||||||
|
||||||
TryRemoveBounty(args.Station, bounty.Value); | ||||||
FillBountyDatabase(args.Station); | ||||||
TryRemoveBounty(station, bounty.Value); | ||||||
FillBountyDatabase(station); | ||||||
_adminLogger.Add(LogType.Action, LogImpact.Low, $"Bounty \"{bounty.Value.Bounty}\" (id:{bounty.Value.Id}) was fulfilled"); | ||||||
} | ||||||
} | ||||||
|
@@ -204,7 +210,7 @@ public bool IsBountyComplete(EntityUid container, EntityUid? station, out HashSe | |||||
return false; | ||||||
} | ||||||
|
||||||
station ??= _station.GetOwningStation(container); | ||||||
station ??= component.AssociatedStationId; | ||||||
if (station == null) | ||||||
{ | ||||||
bountyEntities = new(); | ||||||
|
@@ -225,7 +231,7 @@ public bool IsBountyComplete(EntityUid container, CargoBountyData data) | |||||
return IsBountyComplete(container, data, out _); | ||||||
} | ||||||
|
||||||
public bool IsBountyComplete(EntityUid container, CargoBountyData data, out HashSet<EntityUid> bountyEntities) | ||||||
public bool IsBountyComplete(EntityUid container, CargoBountyData data, out HashSet<EntityUid> bountyEntities) | ||||||
{ | ||||||
if (!_protoMan.TryIndex(data.Bounty, out var proto)) | ||||||
{ | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.