Small usage changes for air and ignore items (#7305)
* Remove “you hacker you!” from node description * Prevent placement of ignore in builtin * Prevent giving of "unknown" explicitly
This commit is contained in:
parent
122eed7a34
commit
6d6b894c7a
@ -557,8 +557,11 @@ local function handle_give_command(cmd, giver, receiver, stackstring)
|
|||||||
local itemstack = ItemStack(stackstring)
|
local itemstack = ItemStack(stackstring)
|
||||||
if itemstack:is_empty() then
|
if itemstack:is_empty() then
|
||||||
return false, "Cannot give an empty item"
|
return false, "Cannot give an empty item"
|
||||||
elseif not itemstack:is_known() then
|
elseif (not itemstack:is_known()) or (itemstack:get_name() == "unknown") then
|
||||||
return false, "Cannot give an unknown item"
|
return false, "Cannot give an unknown item"
|
||||||
|
-- Forbid giving 'ignore' due to unwanted side effects
|
||||||
|
elseif itemstack:get_name() == "ignore" then
|
||||||
|
return false, "Giving 'ignore' is not allowed"
|
||||||
end
|
end
|
||||||
local receiverref = core.get_player_by_name(receiver)
|
local receiverref = core.get_player_by_name(receiver)
|
||||||
if receiverref == nil then
|
if receiverref == nil then
|
||||||
@ -577,13 +580,13 @@ local function handle_give_command(cmd, giver, receiver, stackstring)
|
|||||||
-- entered (e.g. big numbers are always interpreted as 2^16-1).
|
-- entered (e.g. big numbers are always interpreted as 2^16-1).
|
||||||
stackstring = itemstack:to_string()
|
stackstring = itemstack:to_string()
|
||||||
if giver == receiver then
|
if giver == receiver then
|
||||||
return true, ("%q %sadded to inventory.")
|
local msg = "%q %sadded to inventory."
|
||||||
:format(stackstring, partiality)
|
return true, msg:format(stackstring, partiality)
|
||||||
else
|
else
|
||||||
core.chat_send_player(receiver, ("%q %sadded to inventory.")
|
core.chat_send_player(receiver, ("%q %sadded to inventory.")
|
||||||
:format(stackstring, partiality))
|
:format(stackstring, partiality))
|
||||||
return true, ("%q %sadded to %s's inventory.")
|
local msg = "%q %sadded to %s's inventory."
|
||||||
:format(stackstring, partiality, receiver)
|
return true, msg:format(stackstring, partiality, receiver)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ core.register_item(":unknown", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
core.register_node(":air", {
|
core.register_node(":air", {
|
||||||
description = "Air (you hacker you!)",
|
description = "Air",
|
||||||
inventory_image = "air.png",
|
inventory_image = "air.png",
|
||||||
wield_image = "air.png",
|
wield_image = "air.png",
|
||||||
drawtype = "airlike",
|
drawtype = "airlike",
|
||||||
@ -355,7 +355,7 @@ core.register_node(":air", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
core.register_node(":ignore", {
|
core.register_node(":ignore", {
|
||||||
description = "Ignore (you hacker you!)",
|
description = "Ignore",
|
||||||
inventory_image = "ignore.png",
|
inventory_image = "ignore.png",
|
||||||
wield_image = "ignore.png",
|
wield_image = "ignore.png",
|
||||||
drawtype = "airlike",
|
drawtype = "airlike",
|
||||||
@ -368,6 +368,13 @@ core.register_node(":ignore", {
|
|||||||
air_equivalent = true,
|
air_equivalent = true,
|
||||||
drop = "",
|
drop = "",
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
minetest.chat_send_player(
|
||||||
|
placer:get_player_name(),
|
||||||
|
minetest.colorize("#FF0000",
|
||||||
|
"You can't place 'ignore' nodes!"))
|
||||||
|
return ""
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- The hand (bare definition)
|
-- The hand (bare definition)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user