This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local function run(user_mod_code) | |
| local env = table.copy(_G) | |
| local user_function, message = loadstring(user_mod_code) | |
| if not user_function then return nil, message end | |
| setfenv(user_function, env) | |
| return pcall(user_function) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local new_env = {} | |
| for k, v in pairs(_G) do new_env[k] = v end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| core.register_chatcommand("test_pr", { | |
| func = function(name, _) | |
| local player = core.get_player_by_name(name) | |
| local pos = player:getpos() | |
| pos = {x = math.floor(pos.x+0.5),y=math.floor(pos.y+0.5),z=math.floor(pos.z+0.5)} | |
| print("pos:" .. dump(pos)) | |
| print("test1:" .. dump(minetest.find_node_near(pos, 4, "default:water_source", true))) | |
| print("test2:" .. dump(minetest.find_node_near(pos, 4, "default:water_source", false))) | |
| print("test3:" .. dump(minetest.find_node_near(pos, 4, "default:water_source"))) | |
| end, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| core.register_on_receiving_chat_messages(function(message) | |
| core.display_chat_message(core.strip_colors(message)) | |
| return true | |
| end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local ESCAPE_CHAR = string.char(0x1b) | |
| core = {} | |
| function core.get_color_escape_sequence(color) | |
| return ESCAPE_CHAR .. "(c@" .. color .. ")" | |
| end | |
| function core.get_background_escape_sequence(color) | |
| return ESCAPE_CHAR .. "(b@" .. color .. ")" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find_node_near | |
| string_to_pos | |
| get_node_level | |
| override_chatcommand | |
| get_day_count | |
| get_mod_storage | |
| get_node_max_level | |
| pos_to_string | |
| splittext | |
| string_to_area |