squidy5 / cargo_ships

factorio mod that adds cargo ships and other content to the game
25 stars 39 forks source link

Fix compatibility with Multiple Unit Train Control #25

Closed robot256 closed 5 years ago

robot256 commented 5 years ago

Latest version of Multiple Unit Train Control causes Cargo Ships to crash because MUTC deletes (and replaces) a player-built locomotive entity before Cargo Ships has a chance to process it in the next tick. See https://mods.factorio.com/mod/MultipleUnitTrainControl/discussion/5cae30b834ec86000b58234c

This pull request adds handling of the case where entries in global.check_entity_placement become invalid before they are removed from the queue, and adds handlers for script_raised_built and script_raised_destroy events, so that all of MUTC's train deletion and creation are properly processed by Cargo Ships.