@@ -136,15 +136,11 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
136136
137137 // Self-destruction must be enabled
138138 const auto howToDie = pTypeExt->AutoDeath_Behavior .Get ();
139- AnimTypeClass* pVanishAnim = nullptr ;
140-
141- if (!pTypeExt->AutoDeath_VanishAnimation .empty ())
142- pVanishAnim = pTypeExt->AutoDeath_VanishAnimation [ScenarioClass::Instance->Random .RandomRanged (0 , pTypeExt->AutoDeath_VanishAnimation .size () - 1 )];
143139
144140 // Death if no ammo
145141 if (pType->Ammo > 0 && pThis->Ammo <= 0 && pTypeExt->AutoDeath_OnAmmoDepletion )
146142 {
147- TechnoExt::KillSelf (pThis, howToDie, pVanishAnim , isInLimbo);
143+ TechnoExt::KillSelf (pThis, howToDie, pTypeExt-> AutoDeath_VanishAnimation , isInLimbo);
148144 return true ;
149145 }
150146
@@ -157,7 +153,7 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
157153 }
158154 else if (this ->AutoDeathTimer .Completed ())
159155 {
160- TechnoExt::KillSelf (pThis, howToDie, pVanishAnim , isInLimbo);
156+ TechnoExt::KillSelf (pThis, howToDie, pTypeExt-> AutoDeath_VanishAnimation , isInLimbo);
161157 return true ;
162158 }
163159 }
@@ -186,7 +182,7 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
186182 {
187183 if (!existTechnoTypes (pTypeExt->AutoDeath_TechnosDontExist , pTypeExt->AutoDeath_TechnosDontExist_Houses , !pTypeExt->AutoDeath_TechnosDontExist_Any , pTypeExt->AutoDeath_TechnosDontExist_AllowLimboed ))
188184 {
189- TechnoExt::KillSelf (pThis, howToDie, pVanishAnim , isInLimbo);
185+ TechnoExt::KillSelf (pThis, howToDie, pTypeExt-> AutoDeath_VanishAnimation , isInLimbo);
190186
191187 return true ;
192188 }
@@ -197,7 +193,7 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
197193 {
198194 if (existTechnoTypes (pTypeExt->AutoDeath_TechnosExist , pTypeExt->AutoDeath_TechnosExist_Houses , pTypeExt->AutoDeath_TechnosExist_Any , pTypeExt->AutoDeath_TechnosExist_AllowLimboed ))
199195 {
200- TechnoExt::KillSelf (pThis, howToDie, pVanishAnim , isInLimbo);
196+ TechnoExt::KillSelf (pThis, howToDie, pTypeExt-> AutoDeath_VanishAnimation , isInLimbo);
201197
202198 return true ;
203199 }
@@ -286,17 +282,7 @@ void TechnoExt::ExtData::EatPassengers()
286282 if (pDelType->ReportSound >= 0 )
287283 VocClass::PlayAt (pDelType->ReportSound .Get (), pThis->GetCoords (), nullptr );
288284
289- if (!pDelType->Anim .empty ())
290- {
291- if (auto const pAnimType = pDelType->Anim [ScenarioClass::Instance->Random .RandomRanged (0 , pDelType->Anim .size () - 1 )])
292- {
293- if (auto const pAnim = GameCreate<AnimClass>(pAnimType, pThis->Location ))
294- {
295- pAnim->SetOwnerObject (pThis);
296- pAnim->Owner = pThis->Owner ;
297- }
298- }
299- }
285+ AnimExt::CreateRandomAnim (pDelType->Anim , pThis->Location , pThis);
300286
301287 // Check if there is money refund
302288 if (pDelType->Soylent &&
@@ -694,7 +680,7 @@ void TechnoExt::ApplyMindControlRangeLimit(TechnoClass* pThis)
694680 }
695681}
696682
697- void TechnoExt::KillSelf (TechnoClass* pThis, AutoDeathBehavior deathOption, AnimTypeClass* pVanishAnimation, bool isInLimbo)
683+ void TechnoExt::KillSelf (TechnoClass* pThis, AutoDeathBehavior deathOption, std::vector< AnimTypeClass*> pVanishAnimation, bool isInLimbo)
698684{
699685 if (isInLimbo)
700686 {
@@ -715,15 +701,7 @@ void TechnoExt::KillSelf(TechnoClass* pThis, AutoDeathBehavior deathOption, Anim
715701
716702 case AutoDeathBehavior::Vanish:
717703 {
718- if (pVanishAnimation)
719- {
720- if (auto const pAnim = GameCreate<AnimClass>(pVanishAnimation, pThis->GetCoords ()))
721- {
722- auto const pAnimExt = AnimExt::ExtMap.Find (pAnim);
723- pAnim->Owner = pThis->Owner ;
724- pAnimExt->SetInvoker (pThis);
725- }
726- }
704+ AnimExt::CreateRandomAnim (pVanishAnimation, pThis->GetCoords (), pThis, nullptr , true );
727705
728706 pThis->KillPassengers (pThis);
729707 pThis->Stun ();
0 commit comments