Phobos icon indicating copy to clipboard operation
Phobos copied to clipboard

Unit & infantry auto-conversion on ammo change

Open FS-21 opened this issue 7 months ago • 7 comments

  • Units/infantry can now be converted into another unit/infantry by ammo count.
  • Ammo.AutoConvertMinimumAmount determines the minimal number of ammo at which a unit converts automatically.
  • Ammo.AutoConvertMaximumAmount determines the maximum number of ammo at which a unit converts automatically.
  • Ammo.AutoConvertType specify the new techno after the conversion. This unit must be of the same type of the original (vehicle -> vehicle or infantry -> infantry).
  • Setting a negative number will disable ammo count check.

In rulesmd.ini:

[SOMETECHNO]                      ; InfantryType or VehicleType
Ammo.AutoConvertMinimumAmount=-1  ; integer
Ammo.AutoConvertMaximumAmount=-1  ; integer
Ammo.AutoConvertType=             ; InfantryType or VehicleType
  • Tested in online games.
  • This auto-conversion feature requires Ares.
  • Based / Inspired in Frione's work for "vehicle auto-deploy / deploy block on ammo change".

FS-21 avatar May 05 '25 21:05 FS-21

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

github-actions[bot] avatar May 05 '25 21:05 github-actions[bot]

Think it's still better to batch these conditional conversion and AutoDeath in a same condition group, so it has the following benefits:

  • use same condition calculation logic, so more consistent
  • more conditions can be naturally supported by this system

see https://github.com/Phobos-developers/Phobos/pull/1346

Coronia avatar May 06 '25 03:05 Coronia

Two concerns:

  1. Why are the AircraftTypes excluded?
  2. The behavior of checking during the techno update does not match the description in the document (on ammo change). I think you should check it when the ammo changes or clarify the actual checking timing in the document.

TaranDahl avatar May 08 '25 04:05 TaranDahl

Two concerns:

  1. Why are the AircraftTypes excluded?
  2. The behavior of checking during the techno update does not match the description in the document (on ammo change). I think you should check it when the ammo changes or clarify the actual checking timing in the document.
  1. [SOMETECHNO] ; InfantryType or VehicleType <--- do you mean this in the docs? I never tested what happens in AircraftTypes but since it uses the Ares conversion logic is the same case of any aircraft (again, I never tested it on this kind of unit), only infantry & vehicles that was the initial scope of the feature (the additional types are welcome if they are supported without additional code changes).
  2. Probably docs confussion but I don't see too much the difference. Modders shouldn't know that the check process is during an internal check done every frame in every techno and is more clear that it happens after the ammo changed the value. Do you have any better idea for changing this text for clarifying the possible confussion?

FS-21 avatar May 19 '25 05:05 FS-21

Think it's still better to batch these conditional conversion and AutoDeath in a same condition group, so it has the following benefits:

  • use same condition calculation logic, so more consistent
  • more conditions can be naturally supported by this system

see #1346

We can re-think the code after the merge into develop of #1346 but for now I need this feature for my mod and I share the current implementation :-D

FS-21 avatar May 19 '25 05:05 FS-21

Probably docs confussion but I don't see too much the difference. Modders shouldn't know that the check process is during an internal check done every frame in every techno and is more clear that it happens after the ammo changed the value. Do you have any better idea for changing this text for clarifying the possible confussion?

There is not much difference indeed. I think you just need to additionally explain the actual check process in the document.

TaranDahl avatar May 19 '25 06:05 TaranDahl

[SOMETECHNO] ; InfantryType or VehicleType <--- do you mean this in the docs? I never tested what happens in AircraftTypes but since it uses the Ares conversion logic is the same case of any aircraft (again, I never tested it on this kind of unit), only infantry & vehicles that was the initial scope of the feature (the additional types are welcome if they are supported without additional code changes).

You don't need to worry about ConvertToType. If the conversion can not be processed, it will exit safely.

TaranDahl avatar May 19 '25 06:05 TaranDahl