I think I know how to make the perfect sprinkler system.
1. Build some sort of castle underwater
2. Make sure it's dry and has at least 5 sets of walls on every side to resist water
3. Add torches and a fireplace
4. When fire place fails, dig through the roof to let the water in
5. When the castle is flooded and there's no fire, add five walls to the hole
6. Enjoy a nice, fire-free castle.