Skip to content

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

Open
NukeAtty wants to merge 3 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 3 commits into
Phobos-developers:developfrom
NukeAtty:feature/vxl-turret-switch

Conversation

@NukeAtty

@NukeAtty NukeAtty commented Aug 5, 2026

Copy link
Copy Markdown

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.

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.
@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.

The PR author stated that they have an agent assisting them, so I only changed this little.
@NukeAtty

NukeAtty commented Aug 6, 2026

Copy link
Copy Markdown
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

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