1
Programming / Re: How to force a blaster explosion?
« on: August 22, 2019, 04:30:46 pm »
Thanks for answering. I've copied the necessary code and it worked, now the damaged units which should have died, died. However i forgot to tell in the opening post, that the explode() also do not trigger the chain explosions until end of turn. I've found checkForExplosions() and applied and that worked too.
However in the meantime i figured it out, that if i give no item, unit and tile to ExplosionBState and i use statePushNext() instead of statePushFront() then the explosion works normally. However, it's power is always 120, because if i try to create a blaster item and use it, then it does not explode.
So, instead of futile tryings, i modified the ExplosionBState class to be able to accept a new param (forcedPower) which overwrites the wired-in 120. (But i had set its' default to 120, to preserve backward compatibility.) I also modified the tile and itemless explosion's default radius (6), to divide the given power by 20. (Which is 120, so the default radius is still 6, but now it's dynamic.)
Patch is here: http://oscomp.hu/depot/ExplosionBState.patch
And with that, i was able to add the new function to debug mode, to create custom explosions. I made it configurable (debugBlast in options.cfg) and i added two more hotkeys (Ctrl + KP_PLUS/Ctrl + KP_MINUS), to be able to increase/decrease this value ingame. The step is also configurable. (debugBlastStep)
Patch for this is here: http://oscomp.hu/depot/DebugBlast.patch
However in the meantime i figured it out, that if i give no item, unit and tile to ExplosionBState and i use statePushNext() instead of statePushFront() then the explosion works normally. However, it's power is always 120, because if i try to create a blaster item and use it, then it does not explode.
So, instead of futile tryings, i modified the ExplosionBState class to be able to accept a new param (forcedPower) which overwrites the wired-in 120. (But i had set its' default to 120, to preserve backward compatibility.) I also modified the tile and itemless explosion's default radius (6), to divide the given power by 20. (Which is 120, so the default radius is still 6, but now it's dynamic.)
Patch is here: http://oscomp.hu/depot/ExplosionBState.patch
And with that, i was able to add the new function to debug mode, to create custom explosions. I made it configurable (debugBlast in options.cfg) and i added two more hotkeys (Ctrl + KP_PLUS/Ctrl + KP_MINUS), to be able to increase/decrease this value ingame. The step is also configurable. (debugBlastStep)
Patch for this is here: http://oscomp.hu/depot/DebugBlast.patch