sbrl / Minetest-WorldEditAdditions

Extra tools and commands to extend WorldEdit for Minetest
https://worldeditadditions.mooncarrot.space/
Mozilla Public License 2.0
16 stars 3 forks source link

//replacesimilar #63

Open VorTechnix opened 3 years ago

VorTechnix commented 3 years ago

Would replace all nodes made of material a with similar nodes made of materiel b. For example //replacesimilar cobble glass would replace cobble blocks with glass blocks, cobble stairs with glass stairs, cobble slabs with glass slabs etc. Rotation properties would be preserved and all that. Syntax: //replacesimilar <search_material> <replace_material> Alias: //rplsim

sbrl commented 3 years ago

Oooh, could be cool! Though the logic behind working out which block to replace with could quite easily be wildly complicated.

VorTechnix commented 3 years ago

Why would the logic be complicated? isn't there a function to copy attributes from a node and apply them? (digtron does this with it's node placer).

sbrl commented 3 years ago

Yeah, but if you're talking about specifying e.g. replace glass with cobble and replacing all variants, the naming scheme isn't completely uniform across all mods.

VorTechnix commented 3 years ago

So if there is no variant of the replace node that matches the target node then that node should be skipped.

VorTechnix commented 3 years ago

Also we could maybe add a function to register variants with mismatched naming schemes so users and mod devs can ensure compatibility.

sbrl commented 3 years ago

Hrm. I think some more research is required here. Another example here is that some mods prefix node names with stair_, and others postfix. Some omit the underscore, and others don't.

While providing an API to register variants would be a good idea, I'm not sure it's fair to put the burden on the authors of other mods to ensure compatibility with WorldEditAdditions. In all likelihood they may not have even used it before.

Perhaps a better way to do it would be to have offer a generic find-and-replace feature, where it operates on the names of the nodes in question.

VorTechnix commented 3 years ago

I'm not sure it's fair to put the burden on the authors of other mods to ensure compatibility with WorldEditAdditions.

I've been modding since 2018 on another game and the responsibility is always on devs to ensure compatibility with other mods (unless otherwise coordinated with another dev).

That said it would be nice to be able to filter nodes by geometry to avoid having to use names for anything other that identifying what material the node belongs too.