mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2025-08-04 20:40:21 +02:00
Compare commits
40 Commits
seat_dig_f
...
0a93b0f8df
Author | SHA1 | Date | |
---|---|---|---|
0a93b0f8df | |||
8e189f01fa | |||
8f8552b77d | |||
15300a4413 | |||
0f8f31d5c8 | |||
78114b83cf | |||
6cd70d2759 | |||
3b98245930 | |||
d667e39851 | |||
680f8e8995 | |||
3d63271855 | |||
e0bc27c825 | |||
2814f672f0 | |||
2ba84b1e3c | |||
00d935de60 | |||
6700f2b935 | |||
6e973c3830 | |||
177a97eab3 | |||
a832b66977 | |||
df9e8aea4b | |||
99a01301a8 | |||
2ef259fa24 | |||
caaa963eaf | |||
e5866b7928 | |||
b6ecc0b95f | |||
320cd1d449 | |||
3675e9c266 | |||
3567b42c39 | |||
bd67ba2499 | |||
5612f4c884 | |||
7bcfbbca3a | |||
e372ccb4d8 | |||
5c6a994698 | |||
1eec6e3615 | |||
0753606eb0 | |||
778b5493c7 | |||
fb0ca9a15c | |||
1520d27a73 | |||
5d4c64d3b2 | |||
4eb9ffb088 |
@ -41,5 +41,4 @@ read_globals = {
|
||||
"doors",
|
||||
"i3",
|
||||
"xcompat",
|
||||
"player_monoids"
|
||||
}
|
@ -4,3 +4,6 @@ dofile(modpath.."/alias.lua")
|
||||
dofile(modpath.."/node_stairs.lua")
|
||||
dofile(modpath.."/others.lua")
|
||||
dofile(modpath.."/recipes.lua")
|
||||
|
||||
minetest.log("action", "[building_blocks] loaded.")
|
||||
|
||||
|
@ -360,3 +360,6 @@ minetest.register_lbm({
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.log("action", "[fake_fire] loaded.")
|
||||
|
@ -131,3 +131,6 @@ if minetest.get_modpath("doors") then
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
minetest.log("action", "[homedecor_3d_extra] loaded.")
|
||||
|
||||
|
@ -63,6 +63,6 @@ dofile(modpath.."/registration.lua")
|
||||
dofile(modpath.."/water_particles.lua")
|
||||
dofile(modpath.."/crafts.lua")
|
||||
|
||||
if minetest.settings:get_bool("log_mod") then
|
||||
if minetest.settings:get_bool("log_mods") then
|
||||
minetest.log("action", "[HomeDecor API] Loaded!")
|
||||
end
|
||||
|
@ -410,8 +410,8 @@ minetest.register_craft( {
|
||||
type = "shapeless",
|
||||
output = "homedecor:gate_half_door_closed 4",
|
||||
recipe = {
|
||||
"doors:homedecor_wood_plain",
|
||||
"doors:homedecor_wood_plain"
|
||||
"doors:homedecor_wood_plain_a",
|
||||
"doors:homedecor_wood_plain_a"
|
||||
},
|
||||
})
|
||||
|
||||
@ -419,8 +419,8 @@ minetest.register_craft( {
|
||||
type = "shapeless",
|
||||
output = "homedecor:gate_half_door_white_closed 4",
|
||||
recipe = {
|
||||
"doors:homedecor_basic_panel",
|
||||
"doors:homedecor_basic_panel"
|
||||
"doors:homedecor_bedroom_a",
|
||||
"doors:homedecor_bedroom_a"
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -128,3 +128,5 @@ function inbox.get_inbox_insert_formspec(pos)
|
||||
"listring[]"
|
||||
return formspec
|
||||
end
|
||||
|
||||
minetest.log("action", "[inbox] loaded.")
|
||||
|
@ -4,7 +4,7 @@ Refrigerator=Kühlschrank
|
||||
Oven=Backofen
|
||||
Oven (stainless steel)=Backofen (Edelstahl)
|
||||
Microwave Oven=Mikrowelle
|
||||
Dishwasher=Spülmaschine
|
||||
Dishwasher=Spülmachine
|
||||
granite=Granit
|
||||
marble=Marmor
|
||||
steel=Stahl
|
||||
|
@ -1934,3 +1934,5 @@ minetest.register_craft({
|
||||
{ "default:steel_ingot" },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.log("action", "[homedecor_lightning] loaded.")
|
||||
|
@ -183,4 +183,6 @@ minetest.register_alias("plasmascreen:screen6", "air")
|
||||
minetest.register_alias("plasmascreen:screen5", "homedecor:tv")
|
||||
minetest.register_alias("plasmascreen:stand", "homedecor:tv_stand")
|
||||
minetest.register_alias("plasmascreen:tv", "homedecor:tv")
|
||||
minetest.register_alias("plasmascreen:tv_off", "homedecor:tv_off")
|
||||
minetest.register_alias("plasmascreen:tv_off", "homedecor:tv_off")
|
||||
|
||||
minetest.log("action", "[plasmascreen] loaded.")
|
||||
|
@ -33,8 +33,7 @@ minetest.register_node(":lrfurn:armchair", {
|
||||
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
homedecor.register("armchair", {
|
||||
@ -60,8 +59,7 @@ homedecor.register("armchair", {
|
||||
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
-- crafts
|
||||
|
@ -78,62 +78,14 @@ function lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||
minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
|
||||
end
|
||||
|
||||
local seated_cache = {}
|
||||
|
||||
minetest.register_entity("homedecor_seating:seat", {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
--comment out the following when testing so you can see it
|
||||
textures = {"blank.png", "blank.png", "blank.png", "blank.png", "blank.png", "blank.png"},
|
||||
collisionbox = { -0.01, -0.01, -0.01, 0.01, 0.01, 0.01 },
|
||||
selectionbox = { -0.01, -0.01, -0.01, 0.01, 0.01, 0.01, rotate = false },
|
||||
static_save = false,
|
||||
},
|
||||
on_punch = function(self)
|
||||
self.object:remove()
|
||||
end,
|
||||
})
|
||||
|
||||
--we only care about 4 rotations, but just in case someone worldedits, etc - do something other than crash
|
||||
--radians are stupid, using degrees and then converting
|
||||
local p2r = {
|
||||
0*math.pi/180,
|
||||
0*math.pi/180, --correct
|
||||
180*math.pi/180, --correct
|
||||
90*math.pi/180, --correct
|
||||
270*math.pi/180, --correct
|
||||
0*math.pi/180,
|
||||
0*math.pi/180,
|
||||
0*math.pi/180,
|
||||
}
|
||||
p2r[0] = p2r[1]
|
||||
|
||||
local p2r_sofa = {
|
||||
0*math.pi/180,
|
||||
90*math.pi/180, --correct
|
||||
270*math.pi/180, --correct
|
||||
180*math.pi/180, --correct
|
||||
0*math.pi/180, --correct
|
||||
0*math.pi/180,
|
||||
0*math.pi/180,
|
||||
0*math.pi/180,
|
||||
}
|
||||
p2r_sofa[0] = p2r_sofa[1]
|
||||
|
||||
local p2r_facedir = {
|
||||
[0] = 180*math.pi/180,
|
||||
[1] = 90*math.pi/180,
|
||||
[2] = 0*math.pi/180,
|
||||
[3] = 270*math.pi/180,
|
||||
}
|
||||
local physics_cache = {}
|
||||
|
||||
function lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, seats)
|
||||
if not clicker:is_player() then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local name = clicker:get_player_name()
|
||||
if seated_cache[name] then --already sitting
|
||||
if physics_cache[clicker:get_player_name()] then
|
||||
lrfurn.stand(clicker)
|
||||
return itemstack
|
||||
end
|
||||
@ -171,64 +123,34 @@ function lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, seats)
|
||||
if not pstatus then sit_pos = spos end
|
||||
end
|
||||
if not sit_pos then
|
||||
minetest.chat_send_player(name, "sorry, this seat is currently occupied")
|
||||
minetest.chat_send_player(clicker:get_player_name(), "sorry, this seat is currently occupied")
|
||||
return itemstack
|
||||
end
|
||||
|
||||
--seat the player
|
||||
clicker:set_pos(sit_pos)
|
||||
|
||||
local entity = minetest.add_entity(sit_pos, "homedecor_seating:seat")
|
||||
if not entity then return itemstack end --catch for when the entity fails to spawn just in case
|
||||
|
||||
clicker:set_attach(entity, "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}, true)
|
||||
local nodedef = minetest.registered_nodes[node.name]
|
||||
if nodedef.paramtype2 == "facedir" then
|
||||
entity:set_rotation({x = 0, y = p2r_facedir[node.param2 % 4], z = 0})
|
||||
elseif string.find(node.name, "sofa") then
|
||||
entity:set_rotation({x = 0, y = p2r_sofa[node.param2 % 8], z = 0})
|
||||
else
|
||||
entity:set_rotation({x = 0, y = p2r[node.param2 % 8], z = 0})
|
||||
end
|
||||
|
||||
xcompat.player.player_attached[name] = true
|
||||
xcompat.player.player_attached[clicker:get_player_name()] = true
|
||||
xcompat.player.set_animation(clicker, "sit", 0)
|
||||
seated_cache[name] = minetest.hash_node_position(pos)
|
||||
physics_cache[clicker:get_player_name()] = table.copy(clicker:get_physics_override())
|
||||
clicker:set_physics_override({speed = 0, jump = 0, gravity = 0})
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
function lrfurn.stand(clicker)
|
||||
local name = clicker:get_player_name()
|
||||
xcompat.player.player_attached[name] = false
|
||||
if seated_cache[name] then
|
||||
local attached_to = clicker:get_attach()
|
||||
if attached_to then --check, a stupid clearobjects might have been called, etc
|
||||
attached_to:remove() --removing also detaches
|
||||
end
|
||||
seated_cache[name] = nil
|
||||
xcompat.player.player_attached[clicker:get_player_name()] = false
|
||||
if physics_cache[clicker:get_player_name()] then
|
||||
clicker:set_physics_override(physics_cache[clicker:get_player_name()])
|
||||
physics_cache[clicker:get_player_name()] = nil
|
||||
else --in case this is called and the cache is empty
|
||||
clicker:set_physics_override({speed = 1, jump = 1, gravity = 1})
|
||||
end
|
||||
end
|
||||
|
||||
function lrfurn.on_seat_destruct(pos) --called when a seat is destroyed
|
||||
for name, seatpos in pairs(seated_cache) do
|
||||
if seatpos == minetest.hash_node_position(pos) then
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
lrfurn.stand(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--if the player gets killed in the seat, handle it
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
if seated_cache[player:get_player_name()] then
|
||||
lrfurn.stand(player)
|
||||
end
|
||||
end)
|
||||
|
||||
dofile(modpath.."/longsofas.lua")
|
||||
dofile(modpath.."/sofas.lua")
|
||||
dofile(modpath.."/armchairs.lua")
|
||||
dofile(modpath.."/misc.lua")
|
||||
|
||||
minetest.log("action", "[homedecor_seating] loaded.")
|
||||
|
@ -47,8 +47,7 @@ minetest.register_node(":lrfurn:longsofa", {
|
||||
on_dig = unifieddyes.on_dig,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 3)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -22,8 +22,7 @@ homedecor.register("deckchair", {
|
||||
on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_alias("homedecor:deckchair_foot", "homedecor:deckchair")
|
||||
@ -43,8 +42,7 @@ homedecor.register("deckchair_striped_blue", {
|
||||
on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
homedecor.register("simple_bench", {
|
||||
@ -64,8 +62,7 @@ homedecor.register("simple_bench", {
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
local bl1_sbox = {
|
||||
@ -157,8 +154,7 @@ homedecor.register("kitchen_chair_wood", {
|
||||
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
homedecor.register("kitchen_chair_padded", {
|
||||
@ -184,8 +180,7 @@ homedecor.register("kitchen_chair_padded", {
|
||||
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
local ofchairs_sbox = {
|
||||
@ -224,8 +219,7 @@ for _, c in pairs(chairs) do
|
||||
on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -47,8 +47,7 @@ minetest.register_node(":lrfurn:sofa", {
|
||||
on_dig = unifieddyes.on_dig,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 2)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -96,6 +96,10 @@ local update_item = function(pos, node)
|
||||
pos.z = pos.z + posad.z * 6.5 / 16
|
||||
elseif node.name == "itemframes:pedestal" then
|
||||
pos.y = pos.y + 12 / 16 + 0.33
|
||||
local n = meta:get_string("item")
|
||||
if string.match(n, "spears:spear_") then
|
||||
pos.y = pos.y + 0.2
|
||||
end
|
||||
end
|
||||
tmp.nodename = node.name
|
||||
tmp.texture = ItemStack(meta:get_string("item")):get_name()
|
||||
@ -338,3 +342,4 @@ if minetest.get_modpath("mesecons_mvps") then
|
||||
mesecon.register_mvps_stopper("itemframes:pedestal")
|
||||
end
|
||||
|
||||
minetest.log("action", "[itemframes] loaded.")
|
||||
|
Reference in New Issue
Block a user