Skip to content

Add per-weapon VXL turret switching for MultiWeapon units - #2328

Open
NukeAtty wants to merge 2 commits into
Phobos-developers:developfrom
NukeAtty:feature/vxl-turret-switch
Open

Add per-weapon VXL turret switching for MultiWeapon units#2328
NukeAtty wants to merge 2 commits into
Phobos-developers:developfrom
NukeAtty:feature/vxl-turret-switch

Conversation

@NukeAtty

@NukeAtty NukeAtty commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Adds support for swapping VXL turret and barrel models per weapon index for units using MultiWeapon=yes together with TurretCount>0.

Summary

  • Units with MultiWeapon=yes + TurretCount>0 now swap their VXL turret and barrel based on the currently selected weapon.
  • Extra models are loaded by naming convention (<ImageFile>turN.vxl / <ImageFile>barlN.vxl); no artmd.ini changes required.
  • The number of effective turrets is the smaller of WeaponCount and TurretCount; weapons beyond that range fall back to the default turret.
  • Elite weapons follow the same per-index rule.
  • Turret and barrel shadows are drawn as usual when UseTurretShadow=yes.

Implementation

  • UnitTypeExt loads the extra VXL/HVA pairs (LoadMultiWeaponTurrets) and frees them on destruction.
  • UnitClass_AI sets CurrentTurretNumber from SelectWeapon.
  • Draw (0x73BA12) and shadow (0x73C47A) hooks route the turret/barrel voxel per weapon index, bypassing the voxel cache for custom turrets.
  • Defensive skip in the charge turret hook (0x6FA540).

Notes

  • Does not apply to units with IsChargeTurret=yes, IsGattling=yes or Gunner=yes.

@TaranDahl

Copy link
Copy Markdown
Contributor

The unit will lose its target when you issue an order with a mouse click, so I suspect this will lead to very strange in‑game behavior.
What specific use case are you trying to achieve with it?

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

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.

@NukeAtty

NukeAtty commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

The unit will lose its target when you issue an order with a mouse click, so I suspect this will lead to very strange in‑game behavior. What specific use case are you trying to achieve with it?

e.g. Use AA turret when firing AA weapon.
swap-turret

@TaranDahl

Copy link
Copy Markdown
Contributor

I think a timer could be set so that the turret remains active for a period of time after the unit loses its target.
Looking forward to other maintainers' opinions about the whole design.

Units with MultiWeapon=yes and TurretCount>0 now swap their VXL turret and
barrel per weapon index. Extra turrets are loaded by naming convention
(<ImageFile>turN.vxl / <ImageFile>barlN.vxl) with no art changes; weapons
beyond min(WeaponCount, TurretCount) fall back to the default turret.
@NukeAtty
NukeAtty force-pushed the feature/vxl-turret-switch branch from ac147ab to fe77bd2 Compare August 13, 2026 11:48
Comment thread docs/Whats-New.md
- `PassengerDeletion.SoylentMultiplier`: `0.0` -> `1.0`
- `PassengerDeletion.SoylentAllowedHouses`: `none` -> `enemies`
- `PassengerDeletion.DisplaySoylentOffset`: `none` -> `all`
- VXL vehicles can now swap their turret and barrel models per weapon index by using `MultiWeapon` together with `TurretCount`. (by Nuke)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changelog position is incorrect.

This is essentially designed to restore multi-turrets in RA1, not to help you make a Zantos. Therefore, features like different turrets using different weapons/targeting separately/calculating cooldown separately/having separate health are not within the scope of this function. Please use techno attachment for such requirements.
```

### Switch Voxel Turret Depends on MultiWeapon

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If it does not require any new statements and is used in conjunction with MultiWeapon, then it is best to merge it into the paragraph where the MultiWeapon feature resides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants