1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-01-22 06:00:23 +01:00

psuedo code for jump drive support

This commit is contained in:
wsor4035 2024-11-08 11:07:50 -05:00
parent 94e25c2192
commit b571050d57
5 changed files with 24 additions and 0 deletions

View File

@ -35,6 +35,7 @@ minetest.register_node(":lrfurn:armchair", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
homedecor.register("armchair", { homedecor.register("armchair", {
@ -62,6 +63,7 @@ homedecor.register("armchair", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
-- crafts -- crafts

View File

@ -221,6 +221,20 @@ function lrfurn.on_seat_destruct(pos) --called when a seat is destroyed
end end
end end
function lrfurn.on_seat_movenode(from_pos, to_pos)
for name, seatpos in pairs(seated_cache) do
if seatpos == minetest.hash_node_position(from_pos) then
local player = minetest.get_player_by_name(name)
if player then
local attached_to = player:get_attach()
if attached_to then --check, a stupid clearobjects might have been called, etc
attached_to:set_pos(to_pos)
end
end
end
end
end
--if the player gets killed in the seat, handle it --if the player gets killed in the seat, handle it
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(function(player)
if seated_cache[player:get_player_name()] then if seated_cache[player:get_player_name()] then

View File

@ -49,6 +49,7 @@ minetest.register_node(":lrfurn:longsofa", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 3) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 3)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -24,6 +24,7 @@ homedecor.register("deckchair", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
minetest.register_alias("homedecor:deckchair_foot", "homedecor:deckchair") minetest.register_alias("homedecor:deckchair_foot", "homedecor:deckchair")
@ -45,6 +46,7 @@ homedecor.register("deckchair_striped_blue", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
homedecor.register("simple_bench", { homedecor.register("simple_bench", {
@ -66,6 +68,7 @@ homedecor.register("simple_bench", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
local bl1_sbox = { local bl1_sbox = {
@ -159,6 +162,7 @@ homedecor.register("kitchen_chair_wood", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
homedecor.register("kitchen_chair_padded", { homedecor.register("kitchen_chair_padded", {
@ -186,6 +190,7 @@ homedecor.register("kitchen_chair_padded", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
local ofchairs_sbox = { local ofchairs_sbox = {
@ -226,6 +231,7 @@ for _, c in pairs(chairs) do
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
end end

View File

@ -49,6 +49,7 @@ minetest.register_node(":lrfurn:sofa", {
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 2) return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 2)
end, end,
on_destruct = lrfurn.on_seat_destruct, on_destruct = lrfurn.on_seat_destruct,
on_movenode = lrfurn.on_seat_movenode,
}) })
minetest.register_craft({ minetest.register_craft({