parent
8111e46f8d
commit
0ca6bc101a
@ -40,7 +40,8 @@ for i in ipairs (butter_list) do
|
|||||||
},
|
},
|
||||||
floodable = true,
|
floodable = true,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local player_name = placer:get_player_name()
|
if not placer or not placer:is_player() then return itemstack end
|
||||||
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
local pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
|
|
||||||
if not minetest.is_protected(pos, player_name) and
|
if not minetest.is_protected(pos, player_name) and
|
||||||
@ -73,7 +74,8 @@ for i in ipairs (butter_list) do
|
|||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1},
|
||||||
floodable = true,
|
floodable = true,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local player_name = placer:get_player_name()
|
if not placer or not placer:is_player() then return itemstack end
|
||||||
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
local pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
|
|
||||||
if not minetest.is_protected(pos, player_name) and
|
if not minetest.is_protected(pos, player_name) and
|
||||||
|
@ -33,7 +33,7 @@ function cart_entity:on_rightclick(clicker)
|
|||||||
if not clicker or not clicker:is_player() then
|
if not clicker or not clicker:is_player() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local player_name = clicker:get_player_name()
|
local player_name = clicker and clicker:get_player_name() or ""
|
||||||
if self.driver and player_name == self.driver then
|
if self.driver and player_name == self.driver then
|
||||||
carts:manage_attachment(clicker, nil)
|
carts:manage_attachment(clicker, nil)
|
||||||
elseif not self.driver then
|
elseif not self.driver then
|
||||||
@ -67,7 +67,8 @@ end
|
|||||||
|
|
||||||
-- 0.5.x and later: When the driver leaves
|
-- 0.5.x and later: When the driver leaves
|
||||||
function cart_entity:on_detach_child(child)
|
function cart_entity:on_detach_child(child)
|
||||||
if child and child:get_player_name() == self.driver then
|
if not child or not child:is_player() then return end
|
||||||
|
if child:get_player_name() == self.driver then
|
||||||
-- Clean up eye height
|
-- Clean up eye height
|
||||||
carts:manage_attachment(child, nil)
|
carts:manage_attachment(child, nil)
|
||||||
self.driver = nil
|
self.driver = nil
|
||||||
@ -449,8 +450,9 @@ minetest.register_craftitem("carts:cart", {
|
|||||||
minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
|
minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
|
||||||
{pos = pointed_thing.above}, true)
|
{pos = pointed_thing.above}, true)
|
||||||
|
|
||||||
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
if not (creative and creative.is_enabled_for
|
if not (creative and creative.is_enabled_for
|
||||||
and creative.is_enabled_for(placer:get_player_name())) then
|
and creative.is_enabled_for(player_name)) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -1977,6 +1977,7 @@ minetest.register_node("default:sand_with_kelp", {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if not placer and not placer:is_player() then return itemstack end
|
||||||
-- Call on_rightclick if the pointed node defines it
|
-- Call on_rightclick if the pointed node defines it
|
||||||
if pointed_thing.type == "node" and placer and
|
if pointed_thing.type == "node" and placer and
|
||||||
not placer:get_player_control().sneak then
|
not placer:get_player_control().sneak then
|
||||||
@ -1997,7 +1998,7 @@ minetest.register_node("default:sand_with_kelp", {
|
|||||||
local pos_top = {x = pos.x, y = pos.y + height, z = pos.z}
|
local pos_top = {x = pos.x, y = pos.y + height, z = pos.z}
|
||||||
local node_top = minetest.get_node(pos_top)
|
local node_top = minetest.get_node(pos_top)
|
||||||
local def_top = minetest.registered_nodes[node_top.name]
|
local def_top = minetest.registered_nodes[node_top.name]
|
||||||
local player_name = placer:get_player_name()
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
|
|
||||||
if def_top and def_top.liquidtype == "source" and
|
if def_top and def_top.liquidtype == "source" and
|
||||||
minetest.get_item_group(node_top.name, "water") > 0 then
|
minetest.get_item_group(node_top.name, "water") > 0 then
|
||||||
@ -2029,11 +2030,11 @@ minetest.register_node("default:sand_with_kelp", {
|
|||||||
--
|
--
|
||||||
|
|
||||||
local function coral_on_place(itemstack, placer, pointed_thing)
|
local function coral_on_place(itemstack, placer, pointed_thing)
|
||||||
if pointed_thing.type ~= "node" or not placer then
|
if pointed_thing.type ~= "node" or not placer or not placer:is_player() then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local player_name = placer:get_player_name()
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
local pos_under = pointed_thing.under
|
local pos_under = pointed_thing.under
|
||||||
local pos_above = pointed_thing.above
|
local pos_above = pointed_thing.above
|
||||||
local node_under = minetest.get_node(pos_under)
|
local node_under = minetest.get_node(pos_under)
|
||||||
@ -2542,16 +2543,19 @@ minetest.register_node("default:bookshelf", {
|
|||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
if not player or not player:is_player() then return end
|
||||||
minetest.log("action", player:get_player_name() ..
|
minetest.log("action", player:get_player_name() ..
|
||||||
" moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
|
" moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
|
||||||
update_bookshelf(pos)
|
update_bookshelf(pos)
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
if not player or not player:is_player() then return end
|
||||||
minetest.log("action", player:get_player_name() ..
|
minetest.log("action", player:get_player_name() ..
|
||||||
" puts stuff to bookshelf at " .. minetest.pos_to_string(pos))
|
" puts stuff to bookshelf at " .. minetest.pos_to_string(pos))
|
||||||
update_bookshelf(pos)
|
update_bookshelf(pos)
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
if not player or not player:is_player() then return end
|
||||||
minetest.log("action", player:get_player_name() ..
|
minetest.log("action", player:get_player_name() ..
|
||||||
" takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
|
" takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
|
||||||
update_bookshelf(pos)
|
update_bookshelf(pos)
|
||||||
@ -2594,7 +2598,8 @@ local function register_sign(material, desc, def)
|
|||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
||||||
local player_name = sender:get_player_name()
|
if not sender or not sender:is_player() then return end
|
||||||
|
local player_name = sender:get_player_name() or ""
|
||||||
if minetest.is_protected(pos, player_name) then
|
if minetest.is_protected(pos, player_name) then
|
||||||
minetest.record_protection_violation(pos, player_name)
|
minetest.record_protection_violation(pos, player_name)
|
||||||
return
|
return
|
||||||
|
@ -626,7 +626,7 @@ function tnt.register_tnt(def)
|
|||||||
groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5},
|
groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
if placer:is_player() then
|
if placer and placer:is_player() then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user