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:
parent
94e25c2192
commit
b571050d57
@ -35,6 +35,7 @@ minetest.register_node(":lrfurn:armchair", {
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
homedecor.register("armchair", {
|
||||
@ -62,6 +63,7 @@ homedecor.register("armchair", {
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
-- crafts
|
||||
|
@ -221,6 +221,20 @@ function lrfurn.on_seat_destruct(pos) --called when a seat is destroyed
|
||||
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
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
if seated_cache[player:get_player_name()] then
|
||||
|
@ -49,6 +49,7 @@ minetest.register_node(":lrfurn:longsofa", {
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 3)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -24,6 +24,7 @@ homedecor.register("deckchair", {
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
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)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
homedecor.register("simple_bench", {
|
||||
@ -66,6 +68,7 @@ homedecor.register("simple_bench", {
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
local bl1_sbox = {
|
||||
@ -159,6 +162,7 @@ homedecor.register("kitchen_chair_wood", {
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
homedecor.register("kitchen_chair_padded", {
|
||||
@ -186,6 +190,7 @@ homedecor.register("kitchen_chair_padded", {
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
local ofchairs_sbox = {
|
||||
@ -226,6 +231,7 @@ for _, c in pairs(chairs) do
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -49,6 +49,7 @@ minetest.register_node(":lrfurn:sofa", {
|
||||
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 2)
|
||||
end,
|
||||
on_destruct = lrfurn.on_seat_destruct,
|
||||
on_movenode = lrfurn.on_seat_movenode,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
Loading…
Reference in New Issue
Block a user