Skip to content

[Vanilla Enhancement] 2 customizeble of DiskLaser#2243

Open
NetsuNegi wants to merge 3 commits into
Phobos-developers:developfrom
NetsuNegi:feature/improve_disk_laser
Open

[Vanilla Enhancement] 2 customizeble of DiskLaser#2243
NetsuNegi wants to merge 3 commits into
Phobos-developers:developfrom
NetsuNegi:feature/improve_disk_laser

Conversation

@NetsuNegi

@NetsuNegi NetsuNegi commented Jun 6, 2026

Copy link
Copy Markdown
Contributor
  • DiskLaser.SimulateFire determines whether a DiskLaser=true weapon simulates firing, avoiding the limitations of the original hardcoded kill method.
  • DiskLaser.ChargeUp customizes the charge‑up sound for DiskLaser=true weapons.

In rulesmd.ini:

[SOMEWEAPON]                  ; WeaponType, with DiskLaser=yes
DiskLaser.SimulateFire=false  ; boolean
DiskLaser.ChargeUp=           ; sound entry, default to [AudioVisual] -> DiskLaserChargeUp

@NetsuNegi NetsuNegi added Needs testing ⚙️T1 T1 maintainer review is sufficient ❓Unhardcoding / Customization Make something more tweakable labels Jun 6, 2026
@github-actions

github-actions Bot commented Jun 6, 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.

@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/555/1

Comment on lines +99 to +130
DEFINE_HOOK(0x4A7696, DiskLaserClass_AI_SimulateFiring, 0x6)
{
enum { ReturnFromFunction = 0x4A76F4 };

GET(DiskLaserClass*, pDiskLaser, ESI);
const auto pWeapon = pDiskLaser->Weapon;
const auto pWeaponExt = WeaponTypeExt::ExtMap.Find(pWeapon);

if (!pWeaponExt->DiskLaser_SimulateFire)
return 0;

REF_STACK(CoordStruct, targetCoords, STACK_OFFSET(0x50, -0x18));
REF_STACK(CoordStruct, fireCoords, STACK_OFFSET(0x50, -0x24));
const CoordStruct targetCoords2D { targetCoords.X, targetCoords.Y, 0 };
const CoordStruct fireCoords2D { fireCoords.X, fireCoords.Y, 0 };

int bulletSpeed = pWeapon->GetSpeed(static_cast<int>(fireCoords2D.DistanceFrom(targetCoords2D)));

const auto pOwner = pDiskLaser->Owner;
const auto pData = DiskLaserTemp::DataMap.get_or_default(pDiskLaser);
const int damage = static_cast<int>(pDiskLaser->Damage * pData->FirepowerMultiplier);

if (const auto pBullet = pWeapon->Projectile->CreateBullet(pDiskLaser->Target, pOwner, damage, pWeapon->Warhead, bulletSpeed, pWeapon->Bright))
{
BulletExt::ExtMap.Find(pBullet)->FirepowerMult = pData->FirepowerMultiplier;
BulletExt::SimulatedFiringUnlimbo(pBullet, pOwner->Owner, pWeapon, fireCoords, false);
BulletExt::SimulatedFiringEffects(pBullet, pOwner->Owner, pOwner, true, false);
}

pDiskLaser->unknown_30 = static_cast<DWORD>(-1); // Restrore overriden instruction and skip Ares's hook here
return ReturnFromFunction;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since you want to simulate firing, why not directly call TechnoClass::Fire when DiskLaser fires (and skip the processing for the DiskLaser part)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe the rof part either

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't want too many unnecessary operations mixed in; And calling the Fire() function directly will use the current Owner's firepower multiplier, which is an incorrect behavior. If a hook is added for this, why call Fire()? The current one is already sufficient

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Metadorius what do you think?

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

Labels

Needs testing ⚙️T1 T1 maintainer review is sufficient ❓Unhardcoding / Customization Make something more tweakable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants