Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
31f657e94c |
@ -1,2 +1,2 @@
|
|||||||
# Get Biome Data
|
# Get Biome Data
|
||||||
Get the biome data available from minetest.get_biome_data() at a given node's position, using the Biome Data Wand (itemstring `get_biome_data:wand`)
|
Get the biome data available from minetest.get_biome_data() at a given node's position, using the Biome Data Wand (itemstring `get_biome_data:wand`) or chatcommand `/get_biome_data` (`debug` privilege required).
|
||||||
|
33
init.lua
33
init.lua
@ -1,18 +1,33 @@
|
|||||||
|
local function get_data(name, pos)
|
||||||
|
local biomedata = core.get_biome_data(pos)
|
||||||
|
|
||||||
core.register_craftitem("get_biome_data:wand", {
|
core.chat_send_player(
|
||||||
description = "Biome Data Wand\n(right-click to get biome data in node's position)",
|
name,
|
||||||
inventory_image = "get_biome_data_wand.png",
|
|
||||||
groups = {tool = 1},
|
|
||||||
on_place = function(itemstack, player, pointed_thing)
|
|
||||||
local biomedata = core.get_biome_data(pointed_thing.under)
|
|
||||||
|
|
||||||
local str =
|
|
||||||
core.colorize("#aaa", "Biome: ")
|
core.colorize("#aaa", "Biome: ")
|
||||||
.. core.colorize("#0f0", core.get_biome_name(biomedata.biome))
|
.. core.colorize("#0f0", core.get_biome_name(biomedata.biome))
|
||||||
.. " ( heat: " .. core.colorize("#f00", biomedata.heat) .. ", humidity: " .. core.colorize("#55f", biomedata.humidity) .. ")"
|
.. " ( heat: " .. core.colorize("#f00", biomedata.heat) .. ", humidity: " .. core.colorize("#55f", biomedata.humidity) .. ")"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
core.chat_send_player(player:get_player_name(), str)
|
core.register_tool("get_biome_data:wand", {
|
||||||
|
description = "Biome Data Wand\n(right-click to get biome data in node's position)",
|
||||||
|
inventory_image = "get_biome_data_wand.png",
|
||||||
|
on_place = function(itemstack, player, pointed_thing)
|
||||||
|
get_data(player:get_player_name(), pointed_thing.under)
|
||||||
|
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
core.register_chatcommand("get_biome_data", {
|
||||||
|
description = "Get biome data in current position",
|
||||||
|
privs = {
|
||||||
|
debug = true,
|
||||||
|
},
|
||||||
|
func = function(name, params)
|
||||||
|
get_data(
|
||||||
|
name,
|
||||||
|
core.get_player_by_name(name):get_pos()
|
||||||
|
)
|
||||||
|
end
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user