--- Rotates the given param2 value of the given type by the given COMPILED list of rotations.
-- In other words, reorients a given param2 value of a given param2_type (aka paramtype2 in the Minetest engine but the Minetest engine naming scheme is dumb in this case) according to a given COMPILED rotation list.
-- @param param2 number The param2 value to rotate.
-- @param param2_type string The type of param2 value we're talking about here. Currently, only a value of `facedir` is supported.
-- @param rotlist_c Vector3[] The list of vector rotations to apply to param2. Call `worldeditadditions_core.rotation.rotlist_compile` on a rotation list to get this value. Each one is iteratively applied using the `rotate` argument to Vector3.rotate3d.
-- @returns number? Returns the rotated param2 value, or nil if an invalid param2_type value was passed.
localfunctionorient(param2,param2_type,rotlist_c)
localdir=param2_to_dir(param2,param2_type)
ifdir==nilthenreturnnilend
localorigin=Vector3.new(0,0,0)
for_i,rotinipairs(rotlist_c)do
dir=Vector3.rotate3d(origin,dir,rot)
end
dir=dir:round()-- Deal with floating-point rounding errors ref https://en.wikipedia.org/wiki/Round-off_error
-- TODO may need to do this every iteration in the above for loop un the unlikely event we have issues here