Phobos icon indicating copy to clipboard operation
Phobos copied to clipboard

Automatic passenger deletion additions & fixes

Open Starkku opened this issue 3 years ago • 15 comments

  • Added an option to base deletion interval on passenger cost instead of size, house filters, ability to toggle off recording kills to the transport as well as FlyingString display for refund.
  • Gunner=true transports now correctly change their turret & weapon on deletion of a passenger.
  • Previously if passenger had no explicitly set Soylent value, nothing would be refunded. The refund amount is now calculated in exactly same way as Grinding=true buildings do it.

In addition, the documentation has been updated to be more elaborate.


  • Transports can erase passengers over time. Passengers are deleted in order of entering the transport, from first to last.
    • PassengerDeletion.Rate determines the interval in game frames that it takes to erase a single passenger.
      • If PassengerDeletion.Rate.SizeMultiply is set to true, this time interval is multiplied by the passenger's Size.
    • PassengerDeletion.UseCostAsRate, if set to true, changes the time interval for erasing a passenger to be based on the passenger's Cost. This does not factor in modifiers like FactoryPlant.
      • PassengerDeletion.CostMultiplier can be used to modify the cost-based time interval.
      • PassengerDeletion.CostRateCap can be used to set a cap to the cost-based time interval.
    • PassengerDeletion.AllowedHouses determines which houses passengers can belong to be eligible for deletion.
    • PassengerDeletion.DontScore, if set to true, makes it so that the deleted passengers are not counted as having been killed by the transport (no experience, not recorded towards owning house's score etc).
    • If PassengerDeletion.Soylent is set to true, an amount of credits is refunded to the owner of the transport. The exact amount refunded is determined by the passengers Soylent, or if not set, its Cost (this is affected by modifiers such as FactoryPlant).
      • PassengerDeletion.SoylentMultiplier is a direct multiplier applied to the refunded amount of credits.
      • PassengerDeletion.SoylentAllowedHouses determines which houses passengers can belong to be eligible for refunding.
      • PassengerDeletion.DisplaySoylent can be set to true to display the amount of credits refunded on the transport. PassengerDeletion.DisplaySoylentToHouses determines which houses can see this and PassengerDeletion.DisplaySoylentOffset can be used to adjust the display offset.
    • PassengerDeletion.ReportSound and PassengerDeletion.Anim can be used to specify a sound and animation to play when a passenger is erased, respectively.

In rulesmd.ini:

[SOMETECHNO]                                    ; TechnoType
PassengerDeletion.Rate=0                        ; integer, game frames
PassengerDeletion.Rate.SizeMultiply=true        ; boolean
PassengerDeletion.UseCostAsRate=false           ; boolean
PassengerDeletion.CostMultiplier=1.0            ; floating point value, percents or absolute
PassengerDeletion.CostRateCap=                  ; integer, game frames
PassengerDeletion.AllowedHouses=all             ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
PassengerDeletion.DontScore=false               ; boolean
PassengerDeletion.Soylent=false                 ; boolean
PassengerDeletion.SoylentMultiplier=1.0         ; float, percents or absolute
PassengerDeletion.SoylentAllowedHouses=enemies  ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
PassengerDeletion.DisplaySoylent=false          ; boolean
PassengerDeletion.DisplaySoylentToHouses=All    ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
PassengerDeletion.DisplaySoylentOffset=0,0      ; X,Y, pixels relative to default
PassengerDeletion.ReportSound=                  ; Sound
PassengerDeletion.Anim=                         ; Animation

Starkku avatar May 26 '22 17:05 Starkku

Nightly build for this pull request:

github-actions[bot] avatar May 26 '22 17:05 github-actions[bot]

I tested these new tags in a PassengerDeletion's unit I created for the initial implementation of this logic:

PassengerDeletion.DisplaySoylent= -> works as expected PassengerDeletion.DisplaySoylentOffset= -> using the default 0,0 as the center unit coordinates: positive X values draws to the right and in the left if negative values are used. Positive Y values draws to lower coordinates and negative values go up. PassengerDeletion.UseCostAsRate= -> Works as expected PassengerDeletion.CostMultiplier= -> Works as expected, it tested instant deletions with 0.01 and eternal deletions like 100.0, also tested the default 100% (1.0) and the 50% equivalent (0.5) PassengerDeletion.DisplaySoylentToHouses= -> I tested this in Online multiplayer and 2 VM computers and it seems that it works as expected. I tested the next values: (default value) All, none, owner, allies, enemies

I suggest a new tag for multiplying the Soylent value (this "grinder" unit could be more efficient or worse than a Yuri Grinder structure). a tag like PassengerDeletion.SoylentMultiplier or similar name.

FS-21 avatar Jun 01 '22 17:06 FS-21

Fixed the issues and added PassengerDeletion.SoylentMultiplier.

Starkku avatar Jun 03 '22 18:06 Starkku

I went ahead and tested this logic. Works for the most part for me, though there were parts I could not get to work and am not sure why. PassengerDeletion.ReportSound works as intended. PassengerDeletion.Anim works as intended. PassengerDeletion.Rate works as intended. PassengerDeletion.Soylent, PassengerDeletion.SoylentMultiplier, PassengerDeletion.SoylentFriendlies, PassengerDeletion.DisplaySoylent all work as intended. PassengerDeletion.Rate.SizeMultiply works as intended. PassengerDeletion.DisplaySoylentOffset works as intended. PassengerDeletion.UseCostAsRate does not work. PassegnerDeletion.CostMultiplier does not work. PassengerDeletion.DisplaySoylenyToHouses works as intended.

PassengerDeletion.UseCostAsRate I set to true and PassengerDeletion.UseCostAsRate I set to 100.0 and set to the Allied Landing Craft. I used the Battlefortress, Grizzly Tanks, and GIs as deletion subjects. Mainly the latter two, and found they just about always at the same time no matter what numbers I put in. Not sure If I did something wrong.

MaxLenarc avatar Jul 27 '22 21:07 MaxLenarc

Can you please cherry pick the fixes from new feature additions into a new PR so we include it into 0.3?

Metadorius avatar Aug 04 '22 10:08 Metadorius

PassengerDeletion.UseCostAsRate I set to true and PassengerDeletion.UseCostAsRate I set to 100.0 and set to the Allied Landing Craft. I used the Battlefortress, Grizzly Tanks, and GIs as deletion subjects. Mainly the latter two, and found they just about always at the same time no matter what numbers I put in. Not sure If I did something wrong.

Are you sure you did not disregard this bit from the documentation when it comes to PassengerDeletion.UseCostAsRate?

If PassengerDeletion.Rate is also set to a value higher than 0, it serves as a maximum cap for the time interval.

Starkku avatar Aug 07 '22 16:08 Starkku

Been a long since I tried it out initially that I don't remember. I will test it again tomorrow.

MaxLenarc avatar Aug 07 '22 22:08 MaxLenarc

You are correct it was an error on my part. I had PassengerDeletion.Rate=50 and PassengerDeletion.CostMultiplier=100.0. Will test again when able.

MaxLenarc avatar Aug 08 '22 23:08 MaxLenarc

I tested it out again and nothing worked still. Here is how the code looks. Did I mess up on anything? PassengerDeletion.Rate=200 ; integer, game frames PassengerDeletion.Rate.SizeMultiply=false ; boolean PassengerDeletion.UseCostAsRate=true ; boolean PassengerDeletion.CostMultiplier=2.0 ; float, percents or absolute PassengerDeletion.Soylent=true ; boolean PassengerDeletion.SoylentMultiplier=10.0 ; float, percents or absolute PassengerDeletion.SoylentFriendlies=true ; boolean PassengerDeletion.DisplaySoylent=true ; boolean PassengerDeletion.DisplaySoylentToHouses=All ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all) PassengerDeletion.DisplaySoylentOffset=100,10 ; X,Y, pixels relative to default PassengerDeletion.ReportSound=GIAttack ; sound PassengerDeletion.Anim=UCFLASH ; animation

MaxLenarc avatar Aug 09 '22 00:08 MaxLenarc

I tested it out again and nothing worked still. Here is how the code looks. Did I mess up on anything?

Try with PassengerDeletion.Rate=0 or leave omitted, or a much higher value than 200. In this case the duration of the deletion is capped to 200 frames regardless of cost, so anything that costs more than 100 credits (accounting for the multiplier) gets deleted in same time as $100 items.

Perhaps decoupling the cap from the Rate is a good idea since it seems like a potential source of confusion.

Starkku avatar Aug 09 '22 10:08 Starkku

I already tried setting PassengerDeletion.Rate to 0. But all that did was shut off the whole unit deletion thing. Okay I got it to work. I set the PassengerDeletionRate to 20000 and then started seeing differences in time for units to get deleted. Well seems like it is good to go to me. Thanks for your help!

MaxLenarc avatar Aug 10 '22 21:08 MaxLenarc

Fixed a bug that caused PassengerDeletion.UseCostAsRate to not work if PassengerDeletion.Rate was 0 or below and added separate PassengerDeletion.CostRateCap instead of reusing PassengerDeletion.Rate to prevent potential confusion.

Starkku avatar Aug 11 '22 10:08 Starkku

Can you please cherry pick the fixes from new feature additions into a new PR so we include it into 0.3?

Still waiting on response on that one.

Metadorius avatar Aug 12 '22 09:08 Metadorius

Can you please cherry pick the fixes from new feature additions into a new PR so we include it into 0.3?

Still waiting on response on that one.

I can but given that there's more fixes than new features, which mind you have been more or less tested at this point, I do wonder if there's any point. But yeah sure I can do that if that's how we're gonna roll.

Starkku avatar Aug 12 '22 19:08 Starkku

Applied changes based on feedback, as well as the following:

  • Set passenger deletion timer based on first passenger entered (the passenger to be deleted) rather than last
  • Add PassengerDeletion.(Soylent)AllowedHouses to control which houses passengers can belong to be eligible for deletion and/or refunding.
    • PassengerDeletion.SoylentFriendlies has been deprecated as a result.
  • Add PassengerDeletion.DontScore to control whether or not deleted passengers are counted as killed by the transport.

Starkku avatar Aug 19 '22 14:08 Starkku

Almost a year. Are you still planning to do any further modifications?

Nah

Starkku avatar Mar 06 '23 10:03 Starkku