Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environmental explosions ignore all effects #200

Open
bountygiver opened this issue Mar 12, 2017 · 4 comments
Open

Environmental explosions ignore all effects #200

bountygiver opened this issue Mar 12, 2017 · 4 comments

Comments

@bountygiver
Copy link

bountygiver commented Mar 12, 2017

Environmental explosions currently just damage the affected unit for a set amount, ignoring all effects except armor and shields. This is due to damage reductions/immunities are only checked in X2Effect_ApplyWeaponDamage but not in XCOmGameState_Unit.TakeDamage, causing units with fortress to still take damage from exploding cars/gas canisters.

Fix: Instead of calling TakeDamage() directly, apply a X2Effect_ApplyWeaponDamage effect instead, dynamically generate an x2effect right before dealing damage should be OK as without references from template managers it should be garbage collected, otherwise extend the effect with a new effect that takes in the destructible source. The code is in Explode() function of XComGameState_DestructionSphere

code to apply effects without triggering ability can be found in EverVigilantTurnEndListener in XComGameState_Ability

@bountygiver
Copy link
Author

OK I had the idea of using game state override of making this a separate mod, end up scraping it because of privatewrite variables, so basically this can only be done in highlander

@robojumper
Copy link
Member

Are you sure the source is XComGameState_DestructionSphere? The unit damage should be triggered by XComDestructibleActor_Action_RadialDamage, which is native code unfortunately.

XComGameState_DestructionSphere seems like a leftover thing where units could trigger explosions by using an ability (see X2TargetingMethod_ExplosiveDeviceDetonate, 'ExplosiveDeviceDetonate').

A simple Script Trace should clear that up.

@bountygiver
Copy link
Author

bountygiver commented Mar 15, 2017

the thing is XComDestructibleActor_Action_RadialDamage is not really called by anything really, there's just a visualization code and 2 more places which called it is silence destruction which also sets the damage to 0. While XComGameState_DestructionSphere does have proper activation code from XComDestructionSphere which is a proper placable (which means it can be added by maps not just scripts), and it is also still actively used by explodeit cheat code

@bountygiver
Copy link
Author

I will run a test with my scrapped mod project to trace which one is the actual one called

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

No branches or pull requests

2 participants