1
Programming / How to force a blaster explosion?
« on: August 21, 2019, 04:32:00 pm »
I'm trying to add a new hotkey in debug mode for creating a blaster explosion. However, it does not want to work.
The explode() call what is commented out, works, but only makes the terrain changes and do the damage to items and units. I could live without the animation and sound of the explosion, but the so-damaged-they-should-die units only die after the end of turn.
I tried to copy the ExplosionBState calls, but i am missing something.
Any ideas?
Code: [Select]
// B - create blaster bomb explosion
else if (_save->getDebugMode() && action->getDetails()->key.keysym.sym == SDLK_b && (SDL_GetModState() & KMOD_CTRL) != 0)
{
debug("Blast it!");
Position newPos;
_map->getSelectorPosition(&newPos);
newPos.x *= 16;
newPos.y *= 16;
newPos.z *= 24;
if (newPos.x >= 0)
{
//_save->getTileEngine()->explode(newPos, 320, DT_HE, 16, _save->getSelectedUnit());
_battleGame->statePushFront(new ExplosionBState(_battleGame, newPos, new BattleItem(new RuleItem("STR_HWP_FUSION_BOMB"), _save->getCurrentItemId()), _save->getSelectedUnit()));
}
}
The explode() call what is commented out, works, but only makes the terrain changes and do the damage to items and units. I could live without the animation and sound of the explosion, but the so-damaged-they-should-die units only die after the end of turn.
I tried to copy the ExplosionBState calls, but i am missing something.
Any ideas?