mirror of
https://github.com/minetest/minetest.git
synced 2025-06-30 23:20:22 +02:00
Add paramtype2s for 4 horizontal rotations and 64 colors (#11431)
4dir is like facedir, but only for 4 horizontal directions: NESW. It is identical in behavior to facedir otherwise. The reason why game makers would want to use this over facedir is 1) simplicity and 2) you get 6 free bits. It can be used for things like chests and furnaces and you don't need or want them to "flip them on the side" (like you could with facedir). color4dir is like colorfacedir, but you get 64 colors instead of only 8.
This commit is contained in:
@ -3462,7 +3462,9 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
|
||||
param2 = dir.Z < 0 ? 5 : 4;
|
||||
}
|
||||
} else if (predicted_f.param_type_2 == CPT2_FACEDIR ||
|
||||
predicted_f.param_type_2 == CPT2_COLORED_FACEDIR) {
|
||||
predicted_f.param_type_2 == CPT2_COLORED_FACEDIR ||
|
||||
predicted_f.param_type_2 == CPT2_4DIR ||
|
||||
predicted_f.param_type_2 == CPT2_COLORED_4DIR) {
|
||||
v3s16 dir = nodepos - floatToInt(client->getEnv().getLocalPlayer()->getPosition(), BS);
|
||||
|
||||
if (abs(dir.X) > abs(dir.Z)) {
|
||||
@ -3501,6 +3503,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
|
||||
// Apply color
|
||||
if (!place_param2 && (predicted_f.param_type_2 == CPT2_COLOR
|
||||
|| predicted_f.param_type_2 == CPT2_COLORED_FACEDIR
|
||||
|| predicted_f.param_type_2 == CPT2_COLORED_4DIR
|
||||
|| predicted_f.param_type_2 == CPT2_COLORED_WALLMOUNTED)) {
|
||||
const auto &indexstr = selected_item.metadata.
|
||||
getString("palette_index", 0);
|
||||
@ -3514,6 +3517,9 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
|
||||
} else if (predicted_f.param_type_2 == CPT2_COLORED_FACEDIR) {
|
||||
// param2 = pure palette index + other
|
||||
param2 = (index & 0xe0) | (param2 & 0x1f);
|
||||
} else if (predicted_f.param_type_2 == CPT2_COLORED_4DIR) {
|
||||
// param2 = pure palette index + other
|
||||
param2 = (index & 0xfc) | (param2 & 0x03);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user