Add: [Script] Include number of victims in ScriptEventVehicleCrashed (#12861)

This commit is contained in:
Loïc Guilloux
2024-07-16 21:28:29 +02:00
committed by GitHub
parent eeed824329
commit d67963e616
8 changed files with 47 additions and 32 deletions

View File

@@ -990,11 +990,11 @@ static void GetTileDesc_Water(TileIndex tile, TileDesc *td)
*/
static void FloodVehicle(Vehicle *v)
{
uint pass = v->Crash(true);
uint victims = v->Crash(true);
AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, ScriptEventVehicleCrashed::CRASH_FLOODED));
Game::NewEvent(new ScriptEventVehicleCrashed(v->index, v->tile, ScriptEventVehicleCrashed::CRASH_FLOODED));
SetDParam(0, pass);
AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, ScriptEventVehicleCrashed::CRASH_FLOODED, victims));
Game::NewEvent(new ScriptEventVehicleCrashed(v->index, v->tile, ScriptEventVehicleCrashed::CRASH_FLOODED, victims));
SetDParam(0, victims);
AddTileNewsItem(STR_NEWS_DISASTER_FLOOD_VEHICLE, NT_ACCIDENT, v->tile);
CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
if (_settings_client.sound.disaster) SndPlayVehicleFx(SND_12_EXPLOSION, v);