Fixed the bounding boxes, bug with player seat positions, added inv images for washbasin, wall cabinet and set

This commit is contained in:
Andrey2470T 2023-08-25 16:36:35 +03:00
parent 023d3676c4
commit 0f67f02f19
37 changed files with 91 additions and 34 deletions

View File

@ -13,22 +13,6 @@
}
]]
local default_on_construct = function(pos)
minetest.get_meta(pos):set_string("is_busy", "")
end
local default_on_destruct = function(pos)
multidecor.sitting.standup_player(minetest.get_player_by_name(minetest.get_meta(pos):get_string("is_busy")), pos)
end
local default_on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local bool = multidecor.sitting.sit_player(clicker, pos)
if not bool then
multidecor.sitting.standup_player(clicker, pos)
end
end
function multidecor.register.register_seat(name, base_def, add_def, craft_def)
local def = table.copy(base_def)
@ -44,17 +28,23 @@ function multidecor.register.register_seat(name, base_def, add_def, craft_def)
end
end
if def.callbacks then
def.callbacks.on_construct = def.callbacks.on_construct or default_on_construct
def.callbacks.on_destruct = def.callbacks.on_destruct or default_on_destruct
def.callbacks.on_rightclick = def.callbacks.on_rightclick or default_on_rightclick
def.callbacks = def.callbacks or {}
def.callbacks.on_construct = def.callbacks.on_construct or multidecor.sitting.default_on_construct
def.callbacks.on_destruct = def.callbacks.on_destruct or multidecor.sitting.default_on_destruct
def.callbacks.on_rightclick = def.callbacks.on_rightclick or multidecor.sitting.default_on_rightclick
--[[if def.callbacks then
def.callbacks.on_construct = def.callbacks.on_construct or multidecor.sitting.default_on_construct
def.callbacks.on_destruct = def.callbacks.on_destruct or multidecor.sitting.default_on_destruct
def.callbacks.on_rightclick = def.callbacks.on_rightclick or multidecor.sitting.default_on_rightclick
else
def.callbacks = {
on_construct = default_on_construct,
on_destruct = default_on_destruct,
on_rightclick = default_on_rightclick
}
end
end]]
multidecor.register.register_furniture_unit(name, def, craft_def)

View File

@ -96,8 +96,11 @@ function multidecor.sitting.sit_player(player, node_pos)
player:get_meta():set_string("previous_player_data", minetest.serialize(prev_pdata))
local dir_rot = vector.dir_to_rotation(minetest.facedir_to_dir(node.param2))
local rot_seat_pos = vector.rotate_around_axis(
multidecor.helpers.rotate_to_node_dir(node_pos, seat_data.pos), vector.new(0, 1, 0), math.pi)
multidecor.sitting.attach_player_to_node(player, {
pos = vector.add(node_pos, seat_data.pos),
pos = vector.add(node_pos, rot_seat_pos),
rot = vector.add(dir_rot, seat_data.rot),
model = seat_data.model,
anim = rand_anim
@ -146,3 +149,19 @@ player_api.register_model(multidecor.sitting.standard_model, {
}
}
})
multidecor.sitting.default_on_construct = function(pos)
minetest.get_meta(pos):set_string("is_busy", "")
end
multidecor.sitting.default_on_destruct = function(pos)
multidecor.sitting.standup_player(minetest.get_player_by_name(minetest.get_meta(pos):get_string("is_busy")), pos)
end
multidecor.sitting.default_on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local bool = multidecor.sitting.sit_player(clicker, pos)
if not bool then
multidecor.sitting.standup_player(clicker, pos)
end
end

View File

@ -89,6 +89,7 @@ for _, tile in ipairs(ceramic_tiles) do
description = "Bathroom Washbasin With " .. upper_tile .. " Doors",
mesh = "multidecor_bathroom_washbasin.b3d",
visual_scale = 0.5,
inventory_image = "multidecor_bathroom_" .. tile .. "_washbasin_inv.png",
tiles = {
"multidecor_marble_material.png",
"multidecor_metal_material.png",
@ -145,8 +146,9 @@ for _, tile in ipairs(ceramic_tiles) do
mesh = "multidecor_bathroom_wall_cabinet.b3d",
visual_scale = 0.5,
tiles = {"multidecor_white_pine_wood.png"},
inventory_image = "multidecor_bathroom_" .. tile .. "_wall_cabinet_inv.png",
bounding_boxes = {
{-0.5, -0.5, 0.0, 0.5, 0.5, 0.5}
{-0.5, -0.5, -0.1, 0.5, 0.5, 0.5}
},
callbacks = {
on_construct = function(pos)
@ -188,7 +190,8 @@ for _, tile in ipairs(ceramic_tiles) do
"multidecor_bathroom_set.png",
"multidecor_shred.png"
},
bounding_boxes = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}},
inventory_image = "multidecor_bathroom_" .. tile .. "_wall_set_with_mirror_inv.png",
bounding_boxes = {{-0.5, -1.0, -0.125, 0.5, 0.5, 0.5}},
callbacks = {
on_construct = function(pos)
multidecor.shelves.set_shelves(pos)
@ -226,7 +229,7 @@ multidecor.register.register_furniture_unit("bathroom_fluffy_rug", {
tiles = {
"multidecor_fluff_material.png"
},
bounding_boxes = {{-0.4, -0.5, -0.3, 0.4, -0.35, 0.3}}
bounding_boxes = {{-0.45, -0.5, -0.3, 0.45, -0.4, 0.3}}
})
multidecor.register.register_furniture_unit("bathroom_sink", {
@ -243,11 +246,16 @@ multidecor.register.register_furniture_unit("bathroom_sink", {
"multidecor_coarse_metal_material.png",
"multidecor_bathroom_leakage.png"
},
bounding_boxes = {{-0.5, -0.4, -0.4, 0.5, 0.5, 0.5}}
bounding_boxes = {
{-0.5, -0.5, -0.4, 0.5, 0.25, 0.5},
{-0.5, 0.25, -0.4, -0.4, 0.5, 0.5}, -- left
{0.4, 0.25, -0.4, 0.5, 0.5, 0.5}, -- right
{-0.4, 0.25, -0.4, 0.4, 0.5, -0.3}, -- front
{-0.4, 0.25, 0.4, 0.3, 0.5, 0.5} -- back
}
})
multidecor.register.register_furniture_unit("toilet", {
type = "decoration",
multidecor.register.register_seat("toilet", {
style = "modern",
material = "stone",
visual_scale = 0.5,
@ -259,10 +267,50 @@ multidecor.register.register_furniture_unit("toilet", {
"multidecor_water.png"
},
bounding_boxes = {
{-0.35, -0.5, -0.4, 0.35, -0.1, 0.5},
{-0.35, -0.1, 0.4, 0.35, 0.5, 0.5}
{-0.3, -0.5, -0.4, 0.3, -0.4, 0.5}, -- down
{-0.3, -0.4, -0.4, -0.2, -0.1, 0.3}, -- left
{0.2, -0.4, -0.4, 0.3, -0.1, 0.3}, -- right
{-0.2, -0.4, -0.4, 0.2, -0.1, -0.3}, -- front
{-0.3, -0.1, 0.3, 0.3, 0.475, 0.5} -- back
},
callbacks = {
on_punch = function(pos, node, puncher)
local dir = multidecor.helpers.get_dir(pos)
local rel_pos_min = multidecor.helpers.rotate_to_node_dir(pos, vector.new(-0.125, -0.2, 0.05))
local rel_pos_max = multidecor.helpers.rotate_to_node_dir(pos, vector.new(0.125, -0.2, -0.175))
minetest.add_particlespawner({
amount = 40,
time = 0.1,
minexptime = 3,
maxexptime = 5,
collisiondetection = true,
object_collision = true,
collision_removal = true,
texture = "multidecor_water_drop.png",
minpos = pos+rel_pos_min,
maxpos = pos+rel_pos_max,
minvel = dir*0.5,
maxvel = dir*0.5,
minacc = vector.new(0, -9.8, 0),
maxacc = vector.new(0, -9.8, 0),
minsize = 0.8,
maxsize = 1.5
})
minetest.sound_play("multidecor_toilet_flush", {gain=1.0, pitch=1.0, pos=pos, max_hear_distance=15})
end
}
})
},
{
seat_data = {
pos = {x=0.0, y=-0.1, z=0.0},
rot = {x=0, y=0, z=0},
model = multidecor.sitting.standard_model,
anims = {"sit1"}
}
}
)
multidecor.register.register_curtain("bathroom_curtain", {
style = "modern",
@ -329,7 +377,7 @@ multidecor.register.register_furniture_unit("bathroom_tap_with_cap_flap", {
description = "Bathroom Tap With Cap Flap",
mesh = "multidecor_bathroom_tap_with_cap_flap.b3d",
tiles = {"multidecor_metal_material.png"},
bounding_boxes = {{-0.4, -0.2, 0.0, 0.4, 0.2, 0.5}},
bounding_boxes = {{-0.3, -0.1, 0.0, 0.3, 0.2, 0.5}},
callbacks = {
on_construct = function(pos)
multidecor.tap.register_water_stream(pos, {x=0.0, y=-0.2, z=0.0}, 30, 2, "multidecor_tap", true)
@ -362,7 +410,7 @@ multidecor.register.register_furniture_unit("bathroom_tap_with_side_flaps", {
description = "Bathroom Tap With Side Flaps",
mesh = "multidecor_bathroom_tap_with_side_flaps.b3d",
tiles = {"multidecor_metal_material.png"},
bounding_boxes = {{-0.4, -0.2, 0.0, 0.4, 0.2, 0.5}},
bounding_boxes = {{-0.3, -0.2, 0.0, 0.3, 0.1, 0.5}},
callbacks = {
on_construct = function(pos)
multidecor.tap.register_water_stream(pos, {x=0.0, y=-0.3, z=0.0}, 30, 2, "multidecor_tap", true)
@ -439,7 +487,7 @@ minetest.register_entity("modern:bathroom_wall_set_with_mirror_door", {
use_texture_alpha = true,
physical = false,
backface_culling = false,
selectionbox = {-0.5, -0.18, 0, 0, 1.03, 0.075},
selectionbox = {-0.5, -0.8, 0, 0, 0.7, 0.075},
static_save = true,
on_activate = multidecor.shelves.default_on_activate,
on_rightclick = multidecor.shelves.default_on_rightclick,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB