squidy5 / cargo_ships

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

Simplify surface detection in onTileBuild #53

Closed robot256 closed 3 years ago

robot256 commented 3 years ago
squidy5 commented 3 years ago

You removed the robot specific code (line 118), did you test for valid behaviour when placing landfill with robots ontop of existing waterways? I can't remember the exact reason why i added that piece of code, but i remember that it was added out of necessity at the time.

robot256 commented 3 years ago

I did test that the event for robots placing landfill included surface_index. Didn't think to test placing it on top of water ways specifically. It wouldn't hurt to check the robot's surface I suppose, but I was very suspicious of the code that defaults to Nauvis instead of erroring/giving up.

robot256 commented 3 years ago

I tested just now and confirmed that this code does correctly prevent building landfill on waterways, both on Nauvis and on other surfaces. on_robot_built_tile does include surface_index in all cases.

squidy5 commented 3 years ago

thanks for the thorough testing!

robot256 commented 3 years ago

You're welcome! Thanks for maintaining the mod.

On a different topic, would you be open to a feature that allows other mods to add new boats and ships? I could probably work out a remote interface so they could be added to your build checking code.