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

Fining Revamp - getting scanned with illegal cargo gets you a new hail panel + more #6376

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

quyykk
Copy link
Member

@quyykk quyykk commented Nov 28, 2021

Feature Details

This PR introduces the following features:

  • Fines now stack.
  • If you're in space and a ship scanned you and found illegal cargo, you'll have several options like fleeing, paying the fine, or trying to bribe the ship.
  • A new attribute for governments to specify the percentage of a fine it accepts as bribe ("bribe factor")
  • A new attribute for custom text when a governments finds that you have illegal stuff and if they can be bribed.

UI Screenshots

fine-revamp-illegal-cargo

Usage Examples

government Gov
    "bribe factor" <val#>       # Percentage of fine that this gov wants as bribe. Defaults to 0.
    "interdiction" <msg>        # Custom message shown when this gov find illegal stuff in space.
    "interdiction bribe" <msg>  # Custom message shown if this gov can be bribed.

Testing Done

Tested getting fined in space with various illegal outfits and cargo.

Performance Impact

Negligible.

@Amazinite Amazinite added the enhancement A suggestion for new content or functionality that requires code changes label Nov 29, 2021
@Ferociousfeind
Copy link
Contributor

Quick thought(s)-
(also, poor merge conflicts)
any chance we could get the ability to surrender some of our cargo, instead of all of it? Assuming that, when prompted, you would dump only the illegal stuff. I would imagine once you click "surrender cargo" you get the extra options- dump all, dump illegal, and dump some or similar.

I'm very excited for government-specific legalities getting into the game ASAP, it would open up lots of opportunities for strict regions or apathy in law.

@quyykk
Copy link
Member Author

quyykk commented Apr 25, 2022

any chance we could get the ability to surrender some of our cargo, instead of all of it?

You're only surrendering your illegal cargo. I don't really see a reason for the player to choose to surrender everything though.

@Ferociousfeind
Copy link
Contributor

Ferociousfeind commented Apr 25, 2022

shrug
It may be standard practice to dump all your cargo. But, in that case, let me slightly amend my request-

Would it be possible to, when confronted by authorities, give the player the option to refuse surrender, or surrender all their illegal cargo, or surrender only a portion of their illegal cargo? A way to still make a buck, if the coppers don't realize you aren't being honest. There's a chance they didn't pick up some of that cargo, and betraying your whole hand is costly. It might be worth it to risk hostilities for a little extra profit. A game of limited information.

@quyykk
Copy link
Member Author

quyykk commented Apr 25, 2022

It's already possible to refuse to surrender, in which case you provoke the gov and they start attacking you. For the other request, idk maybe.

@@ -116,6 +118,8 @@ void Government::Load(const DataNode &node)
bribe = child.Value(1);
else if(child.Token(0) == "fine" && child.Size() >= 2)
fine = child.Value(1);
else if(child.Token(0) == "bribe factor" && child.Size() >= 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect to also see a "reputation hit" factor when the player flees. (Not a large factor for most governments, but fleeing should have a little bit longer-term effects.)

@petervdmeer
Copy link
Member

Would it be possible to, when confronted by authorities, give the player the option to refuse surrender, or surrender all their illegal cargo, or surrender only a portion of their illegal cargo? A way to still make a buck, if the coppers don't realize you aren't being honest. There's a chance they didn't pick up some of that cargo, and betraying your whole hand is costly. It might be worth it to risk hostilities for a little extra profit. A game of limited information.

For this PR I would suggest to just focus on surrendering all illegal cargo and to keep those ideas for a possible follow-up PR. (I would assume the authorities in most cases to board the offending ship and take the illegal cargo directly btw).

@petervdmeer petervdmeer added the waiting on OP The OP needs to provide something, e.g, making requested changes, posting assets, etc. label May 1, 2022
@petervdmeer
Copy link
Member

"Waiting on OP" due to the open merge-conflicts.

@Galaucus
Copy link
Contributor

Galaucus commented May 1, 2022

I prefer an all or nothing approach when it comes to surrendering cargo. It keeps things simple and straightforward.

@petervdmeer
Copy link
Member

A related PR contains a nice comment about allow fines to both have a "once once discovered" and a "per item when discovered" fine part. I feel that such an approach would also be nice here.

source/IllegalHailPanel.cpp Outdated Show resolved Hide resolved
source/IllegalHailPanel.h Outdated Show resolved Hide resolved
source/PlayerHailPanel.cpp Outdated Show resolved Hide resolved
source/PlayerHailPanel.h Outdated Show resolved Hide resolved
@Amazinite
Copy link
Collaborator

@quyykk Please address the conflicts and outstanding reviews on this PR, or we'll have to close it.

@quyykk quyykk removed the waiting on OP The OP needs to provide something, e.g, making requested changes, posting assets, etc. label Jan 8, 2023
@Hurleveur
Copy link
Member

Hurleveur commented Jan 11, 2023

The illegal tests need to be changed a bit to account for the new panel, idk what changes happened to it.

edit: I think that changing line 321 of tests_illegal_atrocity.txt should do it. Not sure what should happen, but previously clicking done was all, maybe now you need to input "escape" instead?

Copy link
Member

@Hurleveur Hurleveur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looked at the parsing for now

@@ -602,15 +601,15 @@ int CargoHold::IllegalCargoFine(const Government *government) const
return -1;
if(fine < 0)
return fine;
totalFine = max(totalFine, fine / 2);
totalFine += (fine / 2) * it.second;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to make the fines stack but maybe use a sqrt or smth?
Or maybe we should just rebalancr fines afterwards, but 450M caus of nerve gas is going to hurt (which is good), possibly too much

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah definitely

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot about this?

source/Government.cpp Outdated Show resolved Hide resolved
source/Government.cpp Outdated Show resolved Hide resolved
source/Government.cpp Outdated Show resolved Hide resolved
source/Government.cpp Outdated Show resolved Hide resolved
@Hurleveur
Copy link
Member

Phone github... I didnt click aprove xD

@Hurleveur Hurleveur self-requested a review January 16, 2023 07:33
@Hecter94 Hecter94 added the waiting on OP The OP needs to provide something, e.g, making requested changes, posting assets, etc. label Feb 6, 2023
Update warp-core changes for HailPanel in PlayerHailPanel (cpp and h) for endless-sky#8360

Updated changes from endless-sky#8236 across moved code for `Format::CreditString`.
- IllegalHailPanel.cpp
- PlayerHailPanel.cpp
@quyykk quyykk removed the waiting on OP The OP needs to provide something, e.g, making requested changes, posting assets, etc. label Mar 29, 2023
@Saugia Saugia added the waiting on OP The OP needs to provide something, e.g, making requested changes, posting assets, etc. label Jun 30, 2023
@quyykk quyykk removed the waiting on OP The OP needs to provide something, e.g, making requested changes, posting assets, etc. label Aug 28, 2023
Copy link
Member

@Hurleveur Hurleveur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things to consider

I hope this can be the beginning of a more dynamic hail system for npcs where they can eventually give you missions and the like

anyway I didnt look at all of it but this should give you some work already, code looks good and I'll be testing this at some point to make sure all's working fine

@@ -602,15 +601,15 @@ int CargoHold::IllegalCargoFine(const Government *government) const
return -1;
if(fine < 0)
return fine;
totalFine = max(totalFine, fine / 2);
totalFine += (fine / 2) * it.second;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot about this?

bribeFactor = add ? bribeFactor + child.Value(valueIndex) : child.Value(valueIndex);
else if(key == "interdiction" || key == "interdiction bribe")
{
const bool isInterdiction = key == "interdiction";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt we check this earlier so we use it in the if just above too? mb we can even set it in the if idk

string &text = isInterdiction ? interdiction : interdictionBribe;
bool &seen = isInterdiction ? hasInterdiction : hasInterdictionBribe;

if(!seen)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comment for what seen is?
isnt this just for a reset of it when redefined - in which case it should be above? idk I'm a bit confused by this


static const std::string defaultMessage
= "You've been detected carrying illegal <type> and have been issued a fine of <fine>."
" \n\tDump your cargo immediately or we'll be forced to disable and board your ship.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" \n\tDump your cargo immediately or we'll be forced to disable and board your ship.";
" \n\tDump your cargo immediately or we'll be forced to open fire.";

seems better as a default to me?

// is automatically removed since the missions are failed.
for(const auto &pair : scannedShip.Cargo().Outfits())
if(pair.first->Get("illegal") || pair.first->Get("atrocity") > 0.)
scannedShip.Jettison(pair.first, pair.second, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

say you have illegal cargo, but also atrocities, but they've only discovered one
should you be forced to dump all of it?
or is it always discover all/nothing?


player.Accounts().AddCredits(-bribe);
Messages::Add("You bribed a " + hailingShip.GetGovernment()->GetName() + " ship "
+ Format::CreditString(bribe) + " to avoid paying a fine today."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just find it weird you can bribe them to avoid the fine lol, one would just take the lowest cost option without much consequences? also more generic caus it could be to ignore the atrocity (or not?)

Suggested change
+ Format::CreditString(bribe) + " to avoid paying a fine today."
+ Format::CreditString(bribe) + " to leave you alone."

else
header = ship->DisplayModelName() + " (" + gov->GetName() + "): ";
// Drones are always unpiloted, so they never respond to hails.
bool isMute = ship->GetPersonality().IsMute() || (ship->Attributes().Category() == "Drone");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now, ik you didnt write this but I think we should change it eventually given the new CanSendHail method and the possibility for aliens with unknown languages to say smth more interesting than you dont recognize stuff

else if(gov->IsEnemy())
{
// Enemy ships always show hostile messages.
// They either show bribing messages,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's on me ig but that's not the case anymore they can show normal msgs now instead of the bribing all the time


// Do nothing if there is nothing to fine for or the target ship has already been fined today.
if(!punishment.HasPunishment() || fined.count(ship.GetGovernment()))
return {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt we have a const static empty for this?

@bene-dictator bene-dictator added the waiting on OP The OP needs to provide something, e.g, making requested changes, posting assets, etc. label Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A suggestion for new content or functionality that requires code changes waiting on OP The OP needs to provide something, e.g, making requested changes, posting assets, etc.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet