Pipes and tanks are destroyed by incompatible fluids. Of course you can't put molten iron in an iron pipe.
With this mod, you will have acid-resistant plastic pipes and (if space age is enabled) heat-resistant refractory pipes, which must be used for some particularly dangerous fluids. Other mods can define their own pipe and fluid types via the API.
If this mod is added to an existing save, it will not change the behavior of existing pipes. It only affects pipes that are built while the mod is running.
To play with unsupported mods, you can put the names of new fluids in the "Inert fluids" mod setting. It expects the game engine's name for fluids as a comma-separated list like aether,caloric,phlogiston
. Fluids in this list will be compatible with normal pipes.
Modding API
The mod associates each fluid type with a fluid category (such as "inert" or "acid"), which represents the fluid's properties. Each pipe, underground pipe, tank, or pump type has a set of fluid categories that it can handle without damage. Call the API to register information in on_init
and on_configuration_changed
.
To define a fluid category: remote.call("call-plumber", "register_fluid_category", {category=category_name})
To associate a fluid with a category: remote.call("call-plumber", "register_fluid", {fluid=fluid_name, category=category_name, spill_action=action})
where fluid_name
is the name of the fluid prototype. The optional parameter spill_action
determines what happens when a pipe contains incompatible fluid.
To associate an entity with a category: remote.call("call-plumber", "register_entity_compatibility", entity_name, list_of_category_names)
where entity_name is the name of the entity (e.g., pipe) prototype.
When a fluid is registered, it can also be given an action to perform on incompatible pipes. The default action drains some fluid and destroys the entity. The spill action {type="acid-cloud", min_amount=20}
makes a corrosive cloud of leaking fluid, if the entity had at least min_amount units of fluid.
If an entity is not registered then the mod does not change its behavior.
The predefined rules can be disabled with the setting call-plumber-scripting-only
.
Contributions
Graphics for refractory pipe were contributed by Keysivi.
Hyratel has provided a compatibility mod for using Call a Plumber with some other mods.