@@ -136,15 +136,11 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
136
136
137
137
// Self-destruction must be enabled
138
138
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 )];
143
139
144
140
// Death if no ammo
145
141
if (pType->Ammo > 0 && pThis->Ammo <= 0 && pTypeExt->AutoDeath_OnAmmoDepletion )
146
142
{
147
- TechnoExt::KillSelf (pThis, howToDie, pVanishAnim , isInLimbo);
143
+ TechnoExt::KillSelf (pThis, howToDie, pTypeExt-> AutoDeath_VanishAnimation , isInLimbo);
148
144
return true ;
149
145
}
150
146
@@ -157,7 +153,7 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
157
153
}
158
154
else if (this ->AutoDeathTimer .Completed ())
159
155
{
160
- TechnoExt::KillSelf (pThis, howToDie, pVanishAnim , isInLimbo);
156
+ TechnoExt::KillSelf (pThis, howToDie, pTypeExt-> AutoDeath_VanishAnimation , isInLimbo);
161
157
return true ;
162
158
}
163
159
}
@@ -186,7 +182,7 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
186
182
{
187
183
if (!existTechnoTypes (pTypeExt->AutoDeath_TechnosDontExist , pTypeExt->AutoDeath_TechnosDontExist_Houses , !pTypeExt->AutoDeath_TechnosDontExist_Any , pTypeExt->AutoDeath_TechnosDontExist_AllowLimboed ))
188
184
{
189
- TechnoExt::KillSelf (pThis, howToDie, pVanishAnim , isInLimbo);
185
+ TechnoExt::KillSelf (pThis, howToDie, pTypeExt-> AutoDeath_VanishAnimation , isInLimbo);
190
186
191
187
return true ;
192
188
}
@@ -197,7 +193,7 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
197
193
{
198
194
if (existTechnoTypes (pTypeExt->AutoDeath_TechnosExist , pTypeExt->AutoDeath_TechnosExist_Houses , pTypeExt->AutoDeath_TechnosExist_Any , pTypeExt->AutoDeath_TechnosExist_AllowLimboed ))
199
195
{
200
- TechnoExt::KillSelf (pThis, howToDie, pVanishAnim , isInLimbo);
196
+ TechnoExt::KillSelf (pThis, howToDie, pTypeExt-> AutoDeath_VanishAnimation , isInLimbo);
201
197
202
198
return true ;
203
199
}
@@ -286,17 +282,7 @@ void TechnoExt::ExtData::EatPassengers()
286
282
if (pDelType->ReportSound >= 0 )
287
283
VocClass::PlayAt (pDelType->ReportSound .Get (), pThis->GetCoords (), nullptr );
288
284
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);
300
286
301
287
// Check if there is money refund
302
288
if (pDelType->Soylent &&
@@ -694,7 +680,7 @@ void TechnoExt::ApplyMindControlRangeLimit(TechnoClass* pThis)
694
680
}
695
681
}
696
682
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)
698
684
{
699
685
if (isInLimbo)
700
686
{
@@ -715,15 +701,7 @@ void TechnoExt::KillSelf(TechnoClass* pThis, AutoDeathBehavior deathOption, Anim
715
701
716
702
case AutoDeathBehavior::Vanish:
717
703
{
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 );
727
705
728
706
pThis->KillPassengers (pThis);
729
707
pThis->Stun ();
0 commit comments