
Now I finally decided to actually do it:

https://github.com/12Me21/place_rotated ... master.zip
So... right after I write 300 lines of code to calculate selection boxes and handle facedir and all that, I learn that there's a new feature being added in minetest 0.5 that does exactly what I need...
Version 0.5 change log:
-now uses Raycast
-no longer supporting minetest versions before 0.5
-removed wires since those are a separate mod now
-fixed all known bugs in the core functions
Version 0.4 change log:
-added wire demo
-fixed connected hitbox detection (hopefully)
Version 0.3 change log:
-slab placement now (hopefully) works on ALL surfaces!!! (except selection boxes that extend past 0.5)
-moved items into separate file
-added tool for checking node rotation
Version 0.2 change log:
-renamed
-added log placement function (more reliable than the default version)
-slab placement now works on all surfaces, except:
--nodes with more than one selection box
--nodes with the "connected" selection box type
--parts of the selection box that extend past +-0.5 (the upper half of doors, for example) (this is not possible to fix)
-(log placement should work on all surfaces)
-on_place functions now return the itemstack
Planned:
-placing slabs "inside" other slabs of the same type to get a full block
-stair placement(?) (I tried adding this, and just it didn't feel right...)
Items:
place_rotated:test_slab - example slab
place_rotated:test_tree - example log
place_rotated:test_diagram - node with a texture showing the different slab placement areas
place_rotated:level - tool for checking node rotation ...
Functions:
place_rotated.slab - on_place function for slabs
place_rotated.log - on_place function for logs/"wall mounted" nodes
These call and return the output of the default on_place function (minetest.item_place), with the param2 override set, so there shouldn't be any problems with violating protected nodes/duplicating items.
You should set node_placement_prediction = "" when using these functions.
place_rotated.get_point(placer) - returns the exact location within a node that the player is pointing at