diff --git a/_archive/formspec_key_workaround/init.lua b/_archive/formspec_key_workaround/init.lua index e4d3ba4..ec78e3d 100644 --- a/_archive/formspec_key_workaround/init.lua +++ b/_archive/formspec_key_workaround/init.lua @@ -1,87 +1,87 @@ -- twi_mods/formspec_key_workaround/init.lua -- Fix ${key} in formspecs --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] local RADIUS = 10 local INTERVAL = 0.5 -local F = minetest.formspec_escape +local F = core.formspec_escape local function replace_formspec(formspec, meta) return string.gsub(formspec, "%${(%C+)}", function(key) local value = meta:get_string(key) if value == "${" .. key .. "}" then return "" end return value end) end local function fix_node(pos) - local meta = minetest.get_meta(pos) + local meta = core.get_meta(pos) local formspec = meta:get_string("formspec") if formspec == "" then return end local work_formspec local old_formspec = meta:get_string("old_formspec") if old_formspec == formspec then -- Mod did not modify the formspec, work on the original formspec work_formspec = meta:get_string("orig_formspec") else -- Mod modified the formspec, work on the normal fomrpsec meta:set_string("orig_formspec", formspec) work_formspec = formspec end local new_formspec = replace_formspec(work_formspec, meta) meta:set_string("formspec", new_formspec) meta:set_string("old_formspec", new_formspec) end local dtime_total = 0 -minetest.register_globalstep(function(dtime) +core.register_globalstep(function(dtime) dtime_total = dtime_total + dtime if dtime_total < INTERVAL then return end dtime_total = 0 local processed = {} - for _, player in ipairs(minetest.get_connected_players()) do + for _, player in ipairs(core.get_connected_players()) do local pos = vector.round(player:get_pos()) for x = pos.x - RADIUS, pos.x + RADIUS do for y = pos.y - RADIUS, pos.y + RADIUS do for z = pos.z - RADIUS, pos.z + RADIUS do local work_pos = vector.new(x,y,z) - local hash = minetest.hash_node_position(work_pos) + local hash = core.hash_node_position(work_pos) if not processed[hash] then processed[hash] = true fix_node(work_pos) end end end end end end) \ No newline at end of file diff --git a/_archive/mobile_tips/init.lua b/_archive/mobile_tips/init.lua index a6f8e7a..4f819c8 100644 --- a/_archive/mobile_tips/init.lua +++ b/_archive/mobile_tips/init.lua @@ -1,63 +1,63 @@ -- twi_mods/mobile_tips/init.lua -- Tips for mobile devices --[[ The MIT License (MIT) Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local S = minetest.get_translator("mobile_tips") +local S = core.get_translator("mobile_tips") local function is_mobile(name) - local player_info = minetest.get_player_information(name) - local window_info = minetest.get_player_window_information(name) + local player_info = core.get_player_information(name) + local window_info = core.get_player_window_information(name) if player_info.formspec_version <= 4 and player_info.protocol_version <= 39 then -- These are values of MultiCraft 2.0.6 -- Though not 100% MultiCraft or mobile, we have no way to detect return true end if window_info and window_info.touch_controls then -- This is only `true` on 5.9.0 or later, but anyway use this to detect return true end return false end local msg = table.concat({ S("Seems like you are playing on a mobile phone."), S("Tap to place node, and long press to dig node."), S("If other players mention \"right-click\" or \"left-click\", they mean \"tap\" and \"long press\"."), S("Tap the \"chat box\" logo on the right-top corner if you need help."), }, "\n") -minetest.register_on_joinplayer(function(player) +core.register_on_joinplayer(function(player) local name = player:get_player_name() if is_mobile(name) then - minetest.after(1, function() - if minetest.get_player_by_name(name) then - minetest.chat_send_player(name, msg) + core.after(1, function() + if core.get_player_by_name(name) then + core.chat_send_player(name, msg) end end) end end) diff --git a/_archive/mod_travelnet/init.lua b/_archive/mod_travelnet/init.lua index 2c20bf0..75921c3 100644 --- a/_archive/mod_travelnet/init.lua +++ b/_archive/mod_travelnet/init.lua @@ -1,28 +1,28 @@ -- twi_mods/mod_travelnet/init.lua -- Modify travelnet --[[ Copyright (C) 2024 1F616EMO This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ]] -- Hide elevators - Use realistic elevator instead plz -minetest.clear_craft({ +core.clear_craft({ output = "travelnet:elevator" }) -local elevator_groups = table.copy(minetest.registered_nodes["travelnet:elevator"].groups) +local elevator_groups = table.copy(core.registered_nodes["travelnet:elevator"].groups) elevator_groups.not_in_craft_guide = 1 -minetest.override_item("travelnet:elevator", { +core.override_item("travelnet:elevator", { groups = elevator_groups }) diff --git a/_archive/prejoin_msg/init.lua b/_archive/prejoin_msg/init.lua index 631a4b5..55805cf 100644 --- a/_archive/prejoin_msg/init.lua +++ b/_archive/prejoin_msg/init.lua @@ -1,33 +1,33 @@ -- twi_mods/prejoin_msg/init.lua -- Send message to moderators on prejoin player --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] local auth -minetest.register_on_prejoinplayer(function(name) - auth = auth or minetest.get_auth_handler() +core.register_on_prejoinplayer(function(name) + auth = auth or core.get_auth_handler() if not auth.get_auth(name) then twi_fx.chat_send_moderators("New player " .. name .. " is trying to join") else twi_fx.chat_send_moderators("Player " .. name .. " is trying to join") end end) diff --git a/_archive/restore_formspec_key_workaround/init.lua b/_archive/restore_formspec_key_workaround/init.lua index 60b48d7..4e9b9d4 100644 --- a/_archive/restore_formspec_key_workaround/init.lua +++ b/_archive/restore_formspec_key_workaround/init.lua @@ -1,63 +1,63 @@ -- twi_mods/restore_formspec_key_workaround/init.lua -- Revert Fix ${key} in formspecs --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] local RADIUS = 10 local INTERVAL = 0.5 local function fix_node(pos) - local meta = minetest.get_meta(pos) + local meta = core.get_meta(pos) local orig = meta:get_string("orig_formspec") if orig ~= "" then meta:set_string("formspec", orig) meta:set_string("old_formspec", "") meta:set_string("orig_formspec", "") end end local dtime_total = 0 -minetest.register_globalstep(function(dtime) +core.register_globalstep(function(dtime) dtime_total = dtime_total + dtime if dtime_total < INTERVAL then return end dtime_total = 0 local processed = {} - for _, player in ipairs(minetest.get_connected_players()) do + for _, player in ipairs(core.get_connected_players()) do local pos = vector.round(player:get_pos()) for x = pos.x - RADIUS, pos.x + RADIUS do for y = pos.y - RADIUS, pos.y + RADIUS do for z = pos.z - RADIUS, pos.z + RADIUS do local work_pos = vector.new(x,y,z) - local hash = minetest.hash_node_position(work_pos) + local hash = core.hash_node_position(work_pos) if not processed[hash] then processed[hash] = true fix_node(work_pos) end end end end end end) \ No newline at end of file diff --git a/_wip/digilines_mod/init.lua b/_wip/digilines_mod/init.lua index e3b3761..a7739ce 100644 --- a/_wip/digilines_mod/init.lua +++ b/_wip/digilines_mod/init.lua @@ -1,12 +1,12 @@ -- twi_mods/digilines_mod/init.lua -- modify digilines -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-only local new_tiles = {} -for i, tile in ipairs(minetest.registered_nodes["digilines:chest"].tiles) do +for i, tile in ipairs(core.registered_nodes["digilines:chest"].tiles) do new_tiles[i] = tile .. "^digilines_mod_chest_overlay.png" end -minetest.override_item("digilines:chest", { +core.override_item("digilines:chest", { tiles = new_tiles }) diff --git a/advtrains_train_jre231_mod/init.lua b/advtrains_train_jre231_mod/init.lua index f0f7eb6..96b92b8 100644 --- a/advtrains_train_jre231_mod/init.lua +++ b/advtrains_train_jre231_mod/init.lua @@ -1,14 +1,14 @@ -- twi_mods/advtrains_train_jre231_mod/init.lua -- Modify advtrains_train_jre231 -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: AGPL-3.0-or-later for _, name in ipairs({ "KuHa_E231", "MoHa_E231", "SaHa_E231", "MoHa_E230", }) do - minetest.registered_entities["advtrains:" .. name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED + core.registered_entities["advtrains:" .. name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED advtrains.wagon_prototypes["advtrains:" .. name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED end diff --git a/advtrains_train_track_mod/init.lua b/advtrains_train_track_mod/init.lua index 497bff4..928a922 100644 --- a/advtrains_train_track_mod/init.lua +++ b/advtrains_train_track_mod/init.lua @@ -1,13 +1,13 @@ -- twi_mods/advtrains_train_track_mod/init.lua -- Modify Advtrains tracks -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: AGPL-3.0-or-later for _, suffix in ipairs({ "vst1", "vst2", "vst31", "vst32", "vst33", }) do - minetest.override_item("advtrains:dtrack_" .. suffix, { + core.override_item("advtrains:dtrack_" .. suffix, { sounds = xcompat.sounds.node_sound_gravel_defaults() }) end diff --git a/alternode_mod/init.lua b/alternode_mod/init.lua index 1d0625c..d3c9521 100644 --- a/alternode_mod/init.lua +++ b/alternode_mod/init.lua @@ -1,37 +1,37 @@ -- twi_mods/alternode_mod/init.lua -- modification of alternode --[[ The MIT License (MIT) Copyright © 2021 Jordan Irwin (AntumDeluge) Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -- Disable key and pencil for _, name in ipairs({ alternode.modname .. ":pencil", alternode.modname .. ":key" }) do - minetest.clear_craft({ + core.clear_craft({ output = name, }) - minetest.unregister_item(name) + core.unregister_item(name) end diff --git a/animalia_mod/init.lua b/animalia_mod/init.lua index 1d35cd7..893cb47 100644 --- a/animalia_mod/init.lua +++ b/animalia_mod/init.lua @@ -1,39 +1,39 @@ -- twi_mods/animalia_mod/init.lua -- modification of animalia --[[ MIT License Copyright (c) 2022 ElCeejo Copyright (c) 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -minetest.override_item("animalia:nest_song_bird", { +core.override_item("animalia:nest_song_bird", { buildable_to = true, floodable = true, }) twi_fx.override_group("animalia:poultry_raw", { food_chicken_raw = 1 }) twi_fx.override_group("animalia:poultry_cooked", { food_chicken = 1 }) diff --git a/basic_materials_mod/init.lua b/basic_materials_mod/init.lua index e24a9f6..1e2c732 100644 --- a/basic_materials_mod/init.lua +++ b/basic_materials_mod/init.lua @@ -1,101 +1,101 @@ -- twi_mods/basic_materials_mod/init.lua -- Basic Materials Modifications --[[ Copyright (C) 2024 1F616EMO This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ]] -local S = minetest.get_translator("basic_materials_mod") +local S = core.get_translator("basic_materials_mod") -- Eliminate the need of padlocks, use steel ingot instead -minetest.register_alias_force("basic_materials:padlock", "default:steel_ingot") -minetest.clear_craft({ +core.register_alias_force("basic_materials:padlock", "default:steel_ingot") +core.clear_craft({ recipe = { { "basic_materials:steel_bar" }, { "default:steel_ingot" }, { "default:steel_ingot" }, }, }) -minetest.override_item("basic_materials:oil_extract", { +core.override_item("basic_materials:oil_extract", { inventory_image = "twi_oil_extract.png", -- From pipeworks not homedecor }) -- Remove the intermediate process of oil -> paraffin -> plastic -minetest.register_alias_force("basic_materials:paraffin", "basic_materials:plastic_sheet") -minetest.clear_craft({ +core.register_alias_force("basic_materials:paraffin", "basic_materials:plastic_sheet") +core.clear_craft({ type = "cooking", recipe = "basic_materials:paraffin", }) -minetest.clear_craft({ +core.clear_craft({ type = "cooking", output = "basic_materials:paraffin", }) -minetest.register_craft({ +core.register_craft({ type = "cooking", output = "basic_materials:plastic_sheet", recipe = "basic_materials:oil_extract", cooktime = 6, -- Double the original }) -minetest.override_item("basic_materials:oil_extract", { +core.override_item("basic_materials:oil_extract", { _doc_items_longdesc = S("Oil extracted from leaves."), _doc_items_usagehelp = S("Crafted from 6 leaves. This can be processed into plastic by smelting.") }) -minetest.override_item("basic_materials:plastic_sheet", { +core.override_item("basic_materials:plastic_sheet", { _doc_items_longdesc = S("Plastic for machine crafting."), _doc_items_usagehelp = S("Produced by smelting oil extracts. This is useful in crafting high-tech items.") }) -- Remove the need of wire spool local wire_ingot_pair = { -- default ["basic_materials:steel_wire"] = "default:steel_ingot", ["basic_materials:copper_wire"] = "default:copper_ingot", ["basic_materials:gold_wire"] = "default:gold_ingot", -- technic ["basic_materials:stainless_steel_wire"] = "technic:stainless_steel_ingot", -- moreores ["basic_materials:silver_wire"] = "moreores:silver_ingot", } -minetest.clear_craft({ +core.clear_craft({ recipe = { { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, { "", "basic_materials:plastic_sheet", "" }, { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } }, }) for wire, ingot in pairs(wire_ingot_pair) do - minetest.register_alias_force(wire, ingot) - minetest.clear_craft({ + core.register_alias_force(wire, ingot) + core.clear_craft({ type = "shapeless", recipe = { ingot, "basic_materials:empty_spool", "basic_materials:empty_spool", }, }) end -minetest.register_alias_force("basic_materials:empty_spool", "") +core.register_alias_force("basic_materials:empty_spool", "") -- Replace simple Energy Crystal with torch -minetest.clear_craft({ +core.clear_craft({ recipe = { { "default:mese_crystal_fragment", "default:torch", "default:mese_crystal_fragment" }, { "default:diamond", "default:gold_ingot", "default:diamond" } }, }) -minetest.register_alias_force("basic_materials:energy_crystal_simple", "default:torch") +core.register_alias_force("basic_materials:energy_crystal_simple", "default:torch") diff --git a/bonemeal_mod/init.lua b/bonemeal_mod/init.lua index 7d8467a..0e8fd19 100644 --- a/bonemeal_mod/init.lua +++ b/bonemeal_mod/init.lua @@ -1,63 +1,63 @@ -- twi_mods/bonemeal_mod/init.lua -- Modify bonemeal mod --[[ The MIT License (MIT) Copyright (c) 2016 TenPlus1 Copyright (c) 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -- 1. Remove shaped recipies and replace them with shapeless one --- 1a. Mulch from one tree and 8 leaves -minetest.clear_craft({ +core.clear_craft({ recipe = { { "group:tree", "group:leaves", "group:leaves" }, { "group:leaves", "group:leaves", "group:leaves" }, { "group:leaves", "group:leaves", "group:leaves" } } }) -minetest.register_craft({ +core.register_craft({ type = "shapeless", output = "bonemeal:mulch 4", recipe = { "group:tree", "group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves" } }) --- 1b. Fertiliser from both type of bonemeal -minetest.clear_craft({ +core.clear_craft({ recipe = { { "bonemeal:bonemeal", "bonemeal:mulch" } } }) -minetest.register_craft({ +core.register_craft({ type = "shapeless", output = "bonemeal:fertiliser 2", recipe = { "bonemeal:bonemeal", "bonemeal:mulch" }, }) -- 2. Add craft recipe for bonemeal -minetest.register_craft({ +core.register_craft({ type = "shapeless", output = "bonemeal:bonemeal 2", recipe = { "group:bone" } }) diff --git a/builtin_mods/init.lua b/builtin_mods/init.lua index a802dcf..319753d 100644 --- a/builtin_mods/init.lua +++ b/builtin_mods/init.lua @@ -1,19 +1,19 @@ -- twi_mods/builtin_mods/init.lua -- modifiy builtin -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-2.1-or-later -minetest.registered_chatcommands.ban.description = - "[Do not use] " .. minetest.registered_chatcommands.ban.description -minetest.registered_chatcommands.ban.privs = { server = true } +core.registered_chatcommands.ban.description = + "[Do not use] " .. core.registered_chatcommands.ban.description +core.registered_chatcommands.ban.privs = { server = true } -minetest.registered_chatcommands.unban.description = - "[Do not use] " .. minetest.registered_chatcommands.unban.description -minetest.registered_chatcommands.unban.privs = { server = true } +core.registered_chatcommands.unban.description = + "[Do not use] " .. core.registered_chatcommands.unban.description +core.registered_chatcommands.unban.privs = { server = true } -- Remove rollback commands if enable_rollback_recording == false -if not minetest.settings:get_bool("enable_rollback_recording") then - minetest.unregister_chatcommand("rollback_check") - minetest.unregister_chatcommand("rollback") +if not core.settings:get_bool("enable_rollback_recording") then + core.unregister_chatcommand("rollback_check") + core.unregister_chatcommand("rollback") core.registered_privileges.rollback = nil end diff --git a/chatroom_tutorial/init.lua b/chatroom_tutorial/init.lua index 4c087b0..a9c439f 100644 --- a/chatroom_tutorial/init.lua +++ b/chatroom_tutorial/init.lua @@ -1,59 +1,59 @@ -- twi_mods/chatroom_tutorial/init.lua -- Tutorial of how to open chat, and hud message -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later -local S = minetest.get_translator("chatroom_tutorial") +local S = core.get_translator("chatroom_tutorial") local hud = mhud.init() teacher.register_turorial("chatroom_tutorial:chatroom", { title = S("How to find help?"), { texture = "chat_grant_interact_teacher_1.jpg", text = { S("If you need help in non-English languages, type in the chatroom with your mother language, " .. "or use a translator (e.g. Google Translate) to communicate."), S("To seek help, use the chatroom. To start chatting:"), S("On Mobile Phones or iPads: Look at the top right corner of your screen. " .. "Tap the chat box icon."), S("On PC or Mac: Press the \"T\" key on your keyboard to open the chat box."), } }, }) local function show_to(name) - local player = minetest.get_player_by_name(name) + local player = core.get_player_by_name(name) if player then teacher.unlock_and_show(player, "chatroom_tutorial:chatroom", nil) end end -minetest.register_on_newplayer(function(player) +core.register_on_newplayer(function(player) player:get_meta():set_int("chatroom_tutorial_show_msg", 1) - minetest.after(-1, show_to, player:get_player_name()) + core.after(-1, show_to, player:get_player_name()) end) -minetest.register_on_joinplayer(function(player) +core.register_on_joinplayer(function(player) if player:get_meta():get_int("chatroom_tutorial_show_msg") ~= 0 then hud:add(player, "chatroom_tutorial_show_msg", { hud_elem_type = "text", position = { x = 0.5, y = 0.5 }, offset = { x = 0, y = 42 }, text = S("Click on the top-right speech bubble icon to get help. (T on PC)"), text_scale = 1, color = 0xFFD700, }) end end) twi_fx.register_on_chat_message(function(name, message) if string.sub(message, 1, 1) == "/" then return end - local player = minetest.get_player_by_name(name) + local player = core.get_player_by_name(name) if not player then return end if hud:exists(player, "chatroom_tutorial_show_msg") then player:get_meta():set_int("chatroom_tutorial_show_msg", 0) hud:remove(player, "chatroom_tutorial_show_msg") end end) diff --git a/cmd_admin/init.lua b/cmd_admin/init.lua index a4a6a55..6118451 100644 --- a/cmd_admin/init.lua +++ b/cmd_admin/init.lua @@ -1,36 +1,36 @@ -- twi_mods/cmd_admin/init.lua -- Override /admin command --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local S = minetest.get_translator("cmd_admin") +local S = core.get_translator("cmd_admin") local msg = table.concat({ S("The administrator of this server is 1F616EMO."), S("To contact the moderation team, type /report in the chatroom.") }, "\n") -minetest.override_chatcommand("admin", { +core.override_chatcommand("admin", { func = function(name, param) return true, msg end }) diff --git a/cmd_alias/init.lua b/cmd_alias/init.lua index 34d8de8..01fd87a 100644 --- a/cmd_alias/init.lua +++ b/cmd_alias/init.lua @@ -1,47 +1,47 @@ -- twi_mods/cmd_alias/init.lua -- Register command alias --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local S = minetest.get_translator("cmd_alias") +local S = core.get_translator("cmd_alias") local cmd_alias = { doc = "helpform", snp = "snippets", tp = "teleport", lua = "/lua", t = "tutorial", p1 = "area_pos1", p2 = "area_pos2", pt = "protect", h = "help", ["?"] = "tutorial", } for from, to in pairs(cmd_alias) do - if minetest.registered_chatcommands[to] then - local def = table.copy(minetest.registered_chatcommands[to]) + if core.registered_chatcommands[to] then + local def = table.copy(core.registered_chatcommands[to]) def.description = S("Alias of /@1: @2", to, def.description or "") - minetest.register_chatcommand(from, def) + core.register_chatcommand(from, def) end end diff --git a/crash_workaround/init.lua b/crash_workaround/init.lua index 1723036..61f4fc3 100644 --- a/crash_workaround/init.lua +++ b/crash_workaround/init.lua @@ -1,52 +1,52 @@ -- twi_mods/crash_workaround/init.lua -- Avoid the cause of segfault --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -- Autocrafter psudo-item -- For unknwon reason this is identical to flux's, but trust me, I wrote this without his -- https://discord.com/channels/369122544273588224/369123275877384192/1193075939903553669 -local ndef = minetest.registered_nodes["pipeworks:autocrafter"] +local ndef = core.registered_nodes["pipeworks:autocrafter"] local old_allow_metadata_inventory_put = ndef.allow_metadata_inventory_put local old_allow_metadata_inventory_take = ndef.allow_metadata_inventory_take local old_allow_metadata_inventory_move = ndef.allow_metadata_inventory_move -minetest.override_item("pipeworks:autocrafter", { +core.override_item("pipeworks:autocrafter", { allow_metadata_inventory_put = function(pos, listname, index, stack, player) if listname == "output" then return 0 end return old_allow_metadata_inventory_put(pos, listname, index, stack, player) end, allow_metadata_inventory_take = function(pos, listname, index, stack, player) if listname == "output" then return 0 end return old_allow_metadata_inventory_take(pos, listname, index, stack, player) end, allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) if from_list == "output" or to_list == "output" then return 0 end return old_allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) end, }) -minetest.log("action", "[crash_workaround] Autocrafter workaround loaded") +core.log("action", "[crash_workaround] Autocrafter workaround loaded") diff --git a/currency_mod/init.lua b/currency_mod/init.lua index 58c049a..1f1827f 100644 --- a/currency_mod/init.lua +++ b/currency_mod/init.lua @@ -1,18 +1,18 @@ -- twi_mods/chatroom_tutorial/init.lua -- Tutorial of how to open chat, and hud message -- Copyright (C) 2014-2024 currency developers -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later -- Remove bundle recipe and refund -minetest.clear_craft({ +core.clear_craft({ output = "currency:minegeld_bundle", }) -minetest.register_craft({ +core.register_craft({ output = "currency:minegeld 9", recipe = { { "currency:minegeld_bundle" } }, }) twi_fx.override_group("currency:minegeld_bundle", { not_in_creative_inventory = 1, not_in_craft_guide = 1, }) diff --git a/default_mod/init.lua b/default_mod/init.lua index 3146a78..3f42eee 100644 --- a/default_mod/init.lua +++ b/default_mod/init.lua @@ -1,66 +1,66 @@ -- twi_mods/default_mod/init.lua -- modification of default --[[ Copyright (C) 2010-2012 celeron55, Perttu Ahola Copyright (C) 2024 1F616EMO This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ]] -- Coral group for _, name in ipairs({ "default:coral_green", "default:coral_pink", "default:coral_cyan", "default:coral_brown", "default:coral_orange", -- "default:coral_skeleton", }) do - local groups = table.copy(minetest.registered_nodes[name].groups or {}) + local groups = table.copy(core.registered_nodes[name].groups or {}) groups.coral = 1 - minetest.override_item(name, { + core.override_item(name, { groups = groups }) end -- Spread default:dry_dirt_with_dry_grass to default:dry_dirt -minetest.register_abm({ +core.register_abm({ label = "Dry Grass Dirt spread", nodenames = { "default:dry_dirt" }, neighbors = { "default:dry_dirt_with_dry_grass", }, interval = 6, chance = 50, catch_up = false, action = function(pos, node) -- Check for darkness: night, shadow or under a light-blocking node -- Returns if ignore above local above = { x = pos.x, y = pos.y + 1, z = pos.z } - if (minetest.get_node_light(above) or 0) < 13 then + if (core.get_node_light(above) or 0) < 13 then return end - minetest.set_node(pos, { name = "default:dry_dirt_with_dry_grass" }) + core.set_node(pos, { name = "default:dry_dirt_with_dry_grass" }) end }) -- Craft two wood into one apple wood -minetest.register_craft({ +core.register_craft({ output = "default:wood 2", recipe = { { "group:wood" }, { "group:wood" }, } }) diff --git a/dlxtrains_diesel_locomotives_mod/init.lua b/dlxtrains_diesel_locomotives_mod/init.lua index b7878f8..b639d02 100644 --- a/dlxtrains_diesel_locomotives_mod/init.lua +++ b/dlxtrains_diesel_locomotives_mod/init.lua @@ -1,13 +1,13 @@ -- twi_mods/dlxtrains_diesel_locomotives_mod/init.lua -- Modify dlxtrains_diesel_locomotives -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: AGPL-3.0-or-later for _, name in ipairs({ "dlxtrains_diesel_locomotives:locomotive_type1", "dlxtrains_diesel_locomotives:locomotive_type2", "dlxtrains_diesel_locomotives:locomotive_type3", }) do - minetest.registered_entities[name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED + core.registered_entities[name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED advtrains.wagon_prototypes[name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED end diff --git a/dummy_entity/init.lua b/dummy_entity/init.lua index 6edb634..090d033 100644 --- a/dummy_entity/init.lua +++ b/dummy_entity/init.lua @@ -1,25 +1,25 @@ -- twi_mods/dummy_entity/init.lua -- Entities with no function, to be used with /snippets --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -minetest.register_entity("dummy_entity:dummy_entity", {}) +core.register_entity("dummy_entity:dummy_entity", {}) diff --git a/elevator_mod/init.lua b/elevator_mod/init.lua index 44cba88..453c9d1 100644 --- a/elevator_mod/init.lua +++ b/elevator_mod/init.lua @@ -1,35 +1,35 @@ -- twi_mods/elevator_mod/init.lua -- Modify elevator --[[ ISC License Copyright (c) 2017 Beha Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ]] for _, name in ipairs({ "elevator:motor", "elevator:elevator_box", "elevator:elevator_on" }) do - local tiles = table.copy(minetest.registered_nodes[name].tiles or {}) + local tiles = table.copy(core.registered_nodes[name].tiles or {}) for i, texture in ipairs(tiles) do if texture == "default_steel_block.png" then tiles[i] = "technic_wrought_iron_block.png" end end - minetest.override_item(name, { + core.override_item(name, { tiles = tiles, }) end diff --git a/ethereal_mod/init.lua b/ethereal_mod/init.lua index 10de6de..b9f327d 100644 --- a/ethereal_mod/init.lua +++ b/ethereal_mod/init.lua @@ -1,110 +1,110 @@ -- twi_mods/ethereal_mod/init.lua -- Ethereal modifications --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local S = minetest.get_translator("ethereal_mod") +local S = core.get_translator("ethereal_mod") -- place_param2 = 0 local node_list = { "ethereal:basandra_wood", "ethereal:sakura_wood", "ethereal:willow_wood", "ethereal:redwood_wood", "ethereal:frost_wood", "ethereal:yellow_wood", "ethereal:palm_wood", "ethereal:banana_wood", "ethereal:birch_wood", "ethereal:olive_wood", } for _, name in ipairs(node_list) do - minetest.override_item(name, { + core.override_item(name, { place_param2 = 0 }) end -- Coral group for _, prefix in ipairs({ "coral2", "coral3", "coral4", "coral5" }) do for _, var in ipairs({ "", "_rooted" }) do local name = "ethereal:" .. prefix .. var - local groups = table.copy(minetest.registered_nodes[name].groups or {}) + local groups = table.copy(core.registered_nodes[name].groups or {}) groups.coral = 1 - minetest.override_item(name, { + core.override_item(name, { groups = groups }) end end -- Remove flight potion -minetest.override_item("ethereal:flight_potion", { +core.override_item("ethereal:flight_potion", { on_use = function(itemstack, user, pointed_thing) if user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("The flight potion is disabled.")) + core.chat_send_player(user:get_player_name(), S("The flight potion is disabled.")) end return itemstack end }) -minetest.clear_craft({ +core.clear_craft({ output = "ethereal:flight_potion", }) -- Stairsplus for mosses for _, name in ipairs({ "crystal", "mushroom", "fiery", "gray", "green", }) do twi_fx.register_all_stairsplus("ethereal", name .. "_moss") end -- alloying recipe of crystal ingots technic.register_alloy_recipe({ input = {"ethereal:crystal_spike", "default:mese_crystal"}, output = "ethereal:crystal_ingot", }) -- Reduce selection box height of fern -minetest.override_item("ethereal:fern", { +core.override_item("ethereal:fern", { selection_box = { type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 7 / 16, 5 / 16} } }) -- Allow crafting oil extract from bush and mushroom top for _, name in ipairs({ "ethereal:bush", "ethereal:bush2", "ethereal:bush3", "ethereal:mushroom_pore", "ethereal:mushroom", "ethereal:mushroom_brown", }) do twi_fx.override_group(name, { leaves = 1, }) end diff --git a/farming_mod/init.lua b/farming_mod/init.lua index 1f02c9d..e0dd1dd 100644 --- a/farming_mod/init.lua +++ b/farming_mod/init.lua @@ -1,92 +1,92 @@ -- twi_mods/farming_mod/init.lua -- Handle framing redo changes --[[ The MIT License (MIT) Copyright (c) 2016 TenPlus1 Copyright (c) 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] if farming.mod ~= "redo" then error("[twi_mods/farming_mod] Only works with Farming Redo") end -- Tomato red dye -minetest.register_craft({ +core.register_craft({ output = farming.recipe_items.dye_red, recipe = { { "group:food_tomato" } } }) -- Allow planting pineapple -minetest.override_item("farming:pineapple", { +core.override_item("farming:pineapple", { on_place = function(itemstack, placer, pointed_thing) - local under_pos = minetest.get_pointed_thing_position(pointed_thing) + local under_pos = core.get_pointed_thing_position(pointed_thing) if not under_pos then - return minetest.item_place(itemstack, placer, pointed_thing) + return core.item_place(itemstack, placer, pointed_thing) end - local under_name = minetest.get_node(under_pos).name + local under_name = core.get_node(under_pos).name if under_name == "farming:pineapple_1" or under_name == "farming:pineapple_2" or under_name == "farming:pineapple_3" or under_name == "farming:pineapple_4" or under_name == "farming:pineapple_5" or under_name == "farming:pineapple_6" or under_name == "farming:pineapple_7" or under_name == "farming:pineapple_8" then return itemstack - elseif minetest.get_item_group(under_name, "soil") < 2 then - return minetest.item_place(itemstack, placer, pointed_thing) + elseif core.get_item_group(under_name, "soil") < 2 then + return core.item_place(itemstack, placer, pointed_thing) end local old_count = itemstack:get_count() local itemstack2 = farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1") if not itemstack2 then return itemstack end local consumed = old_count - itemstack2:get_count() if consumed > 0 then local ring_stack = ItemStack({ name = "farming:pineapple_ring", count = consumed * 5 }) if placer:is_player() then local inv = placer:get_inventory() ring_stack = inv:add_item("main", ring_stack) end - local pos = minetest.get_pointed_thing_position(pointed_thing, true) or placer:get_pos() - minetest.add_item(pos, ring_stack) + local pos = core.get_pointed_thing_position(pointed_thing, true) or placer:get_pos() + core.add_item(pos, ring_stack) end return itemstack2 end, }) -- Temporary remove max light limit on rhubarb farming.registered_plants["farming:rhubarb"].maxlight = nil for _, stage in ipairs({ 1, 2, 3 }) do - minetest.override_item("farming:rhubarb_" .. stage, { - maxlight = minetest.LIGHT_MAX, + core.override_item("farming:rhubarb_" .. stage, { + maxlight = core.LIGHT_MAX, }) end -- Slice melons and pumkins on harvest -minetest.override_item("farming:pumpkin_8", { +core.override_item("farming:pumpkin_8", { drop = "farming:pumpkin_slice 4", }) -minetest.override_item("farming:melon_8", { +core.override_item("farming:melon_8", { drop = "farming:melon_slice 4", }) diff --git a/func_areas/init.lua b/func_areas/init.lua index 2d2055a..ce74ef3 100644 --- a/func_areas/init.lua +++ b/func_areas/init.lua @@ -1,44 +1,44 @@ -- twi_mods/func_areas/init.lua -- 1F616EMO_func owned areas --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] func_areas = {} local func_account = "1F616EMO_func" function func_areas.is_in_func_area(pos, id) local area = areas.areas[id] if not area then return false end if area.owner ~= func_account then return end return pos.x >= area.pos1.x and pos.y >= area.pos1.y and pos.z >= area.pos1.z and pos.x <= area.pos2.x and pos.y <= area.pos2.y and pos.z <= area.pos2.z end -minetest.register_on_prejoinplayer(function(name) +core.register_on_prejoinplayer(function(name) if name == func_account then return "This username is reserved." end end) diff --git a/func_areas_limitations/init.lua b/func_areas_limitations/init.lua index 51ce211..3329f29 100644 --- a/func_areas_limitations/init.lua +++ b/func_areas_limitations/init.lua @@ -1,124 +1,124 @@ -- twi_mods/func_areas_limitations/init.lua -- func area limitations --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local S = minetest.get_translator("func_areas_limitations") +local S = core.get_translator("func_areas_limitations") -minetest.register_privilege("public_farm", { +core.register_privilege("public_farm", { description = S("Can use public farms"), give_to_singleplayer = true, }) -minetest.register_on_newplayer(function(player) +core.register_on_newplayer(function(player) -- Assume new players have privs properly set local meta = player:get_meta() meta:set_int("func_areas_limitations_public_farm", 1) end) -minetest.register_on_joinplayer(function(player) +core.register_on_joinplayer(function(player) local meta = player:get_meta() if meta:get_int("func_areas_limitations_public_farm") == 1 then return end local name = player:get_player_name() - local privs = minetest.get_player_privs(name) + local privs = core.get_player_privs(name) if not privs.public_farm then privs.public_farm = true - minetest.set_player_privs(name, privs) + core.set_player_privs(name, privs) end meta:set_int("func_areas_limitations_public_farm", 1) end) local function is_seed(item_name) if item_name == "farming:beanpole" or item_name == "farming:trellis" - or minetest.get_item_group(item_name, "seed") ~= 0 then + or core.get_item_group(item_name, "seed") ~= 0 then return true end return false end local function is_in_public_farm(pos) return func_areas.is_in_func_area(pos, 13) -- Spawn Public Farm or func_areas.is_in_func_area(pos, 92) -- SCL Jail Farm or func_areas.is_in_func_area(pos, 496) -- Eastern SmushyVille Public Farm or func_areas.is_in_func_area(pos, 548) -- Great SmushyVille Public Farm -- or func_areas.is_in_func_area(pos, 400) -- cycle's Public Farm end -local old_is_protected = minetest.is_protected -function minetest.is_protected(pos, name) - if is_in_public_farm(pos) and not minetest.check_player_privs(name, { public_farm = true }) then +local old_is_protected = core.is_protected +function core.is_protected(pos, name) + if is_in_public_farm(pos) and not core.check_player_privs(name, { public_farm = true }) then return true end return old_is_protected(pos, name) end -minetest.register_on_protection_violation(function(pos, name) - if is_in_public_farm(pos) and not minetest.check_player_privs(name, { public_farm = true }) then - if minetest.get_player_by_name(name) then - minetest.chat_send_player(name, S("You are banned from using Public Farms. " .. +core.register_on_protection_violation(function(pos, name) + if is_in_public_farm(pos) and not core.check_player_privs(name, { public_farm = true }) then + if core.get_player_by_name(name) then + core.chat_send_player(name, S("You are banned from using Public Farms. " .. "Contact moderators for more information.")) end end end) local old_item_place_node_is_protected = extended_protection.item_place_node_is_protected function extended_protection.item_place_node_is_protected(itemstack, placer, pointed_thing) if not placer:is_player() then return end local name = placer:get_player_name() local item_name = itemstack:get_name() local pos = extended_protection.pointed_thing_to_pos(pointed_thing) if not pos then return end if func_areas.is_in_func_area(pos, 41) then return true elseif func_areas.is_in_func_area(pos, 225) and item_name ~= "default:sapling" then return true elseif is_in_public_farm(pos) and not is_seed(item_name) then return true elseif func_areas.is_in_func_area(pos, 136) then return true end return old_item_place_node_is_protected(itemstack, placer, pointed_thing) end extended_protection.register_on_item_place_node_protection_violation(function(itemstack, placer, pointed_thing) if not placer:is_player() then return end local name = placer:get_player_name() local item_name = itemstack:get_name() local pos = extended_protection.pointed_thing_to_pos(pointed_thing) if not pos then return end if func_areas.is_in_func_area(pos, 41) then - minetest.chat_send_player(name, S("You can only place down apple tree saplings in the Public Tree Farm.")) + core.chat_send_player(name, S("You can only place down apple tree saplings in the Public Tree Farm.")) elseif func_areas.is_in_func_area(pos, 225) and item_name ~= "default:sapling" then - minetest.chat_send_player(name, S("You can only place down apple tree saplings in the Public Tree Farm.")) + core.chat_send_player(name, S("You can only place down apple tree saplings in the Public Tree Farm.")) elseif is_in_public_farm(pos) and not is_seed(item_name) then - minetest.chat_send_player(name, S("You can only place down plant seeds in the Public Farm.")) + core.chat_send_player(name, S("You can only place down plant seeds in the Public Farm.")) elseif func_areas.is_in_func_area(pos, 136) then - minetest.chat_send_player(name, S("You are not allowed to place blocks in the Public Cactus Farm.")) + core.chat_send_player(name, S("You are not allowed to place blocks in the Public Cactus Farm.")) end end) diff --git a/initial_stuff/init.lua b/initial_stuff/init.lua index 9701cc3..acdcf22 100644 --- a/initial_stuff/init.lua +++ b/initial_stuff/init.lua @@ -1,42 +1,42 @@ -- twi_mods/initial_stuff/init.lua -- Give initial stuffs to new players --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] local stuffs_list = { "default:pick_steel", "default:shovel_steel", "default:axe_steel", "default:sword_steel", "default:torch 99", "animalia:beef_cooked 50" } -minetest.register_on_newplayer(function(player) +core.register_on_newplayer(function(player) local name = player:get_player_name() local inv = player:get_inventory() for _, item in ipairs(stuffs_list) do inv:add_item("main", ItemStack(item)) end unified_money.add_balance_safe(name, 30) end) diff --git a/list_moderators/init.lua b/list_moderators/init.lua index 2dc81cb..b49e269 100644 --- a/list_moderators/init.lua +++ b/list_moderators/init.lua @@ -1,135 +1,135 @@ -- twi_mods/list_moderators/init.lua -- Send list of moderators after join --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local S = minetest.get_translator("list_moderators") +local S = core.get_translator("list_moderators") local function is_afk() return false end -if minetest.global_exists("afk_indicator") then +if core.global_exists("afk_indicator") then is_afk = function(name) local duration = afk_indicator.get(name) return duration and duration > 5 * 60 or false end end -local color = minetest.get_color_escape_sequence("DarkOrange") -local alt_color = minetest.get_color_escape_sequence("DarkCyan") +local color = core.get_color_escape_sequence("DarkOrange") +local alt_color = core.get_color_escape_sequence("DarkCyan") local busy_mods = {} local function get_chat_string(name) local list_moderators = {} local list_helpers = {} for _, player in pairs(core.get_connected_players()) do local player_name = player:get_player_name() - local privs = minetest.get_player_privs(player_name) + local privs = core.get_player_privs(player_name) local list if privs.ban == true then list = list_moderators elseif privs.role_helper == true then list = list_helpers end if list then local display = player_name local flags = {} if name == player_name then flags[#flags + 1] = S("You") end if privs.server then flags[#flags + 1] = S("Admin") end if is_afk(player_name) then flags[#flags + 1] = S("AFK") end if busy_mods[player_name] then flags[#flags + 1] = S("Busy") end if #flags > 0 then display = display .. " " .. alt_color .. "(" .. table.concat(flags, ", ") .. ")" .. color end list[#list + 1] = display end end local rtn if #list_moderators > 0 then rtn = color .. S("List of moderators online: @1", table.concat(list_moderators, ", ")) else rtn = color .. S("No moderators online. Seek help by typing /report in the chatroom.") end if #list_helpers > 0 then rtn = rtn .. "\n" .. color .. S("List of helpers online: @1", table.concat(list_helpers, ", ")) end return rtn end -minetest.register_on_joinplayer(function(player) +core.register_on_joinplayer(function(player) local name = player:get_player_name() - minetest.after(0.5, function() - if minetest.get_player_by_name(name) then - minetest.chat_send_player(name, get_chat_string(name)) + core.after(0.5, function() + if core.get_player_by_name(name) then + core.chat_send_player(name, get_chat_string(name)) end end) end) -minetest.register_on_leaveplayer(function(player) +core.register_on_leaveplayer(function(player) local name = player:get_player_name() busy_mods[name] = nil end) -minetest.register_on_priv_revoke(function(name, _, priv) - local privs = minetest.get_player_privs(name) +core.register_on_priv_revoke(function(name, _, priv) + local privs = core.get_player_privs(name) if priv == "ban" and not privs.role_helper or privs == "role_helper" and not privs.ban then busy_mods[name] = nil end end) -minetest.register_chatcommand("mods_busy", { +core.register_chatcommand("mods_busy", { description = S("Set yourself as busy on the moderator list"), func = function(name) - local privs = minetest.get_player_privs(name) + local privs = core.get_player_privs(name) if not (privs.ban or privs.role_helper) then return false, S("Insufficant privileges!") end local prev_status = busy_mods[name] busy_mods[name] = prev_status == nil and true or nil return true, prev_status and S("Set to normal.") or S("Set to busy.") end, }) -minetest.register_chatcommand("list_mods", { +core.register_chatcommand("list_mods", { description = S("List all moderators and helpers"), func = function(name) return true, get_chat_string(name) end, }) diff --git a/mailbox_mod/init.lua b/mailbox_mod/init.lua index e225c32..e6cfea3 100644 --- a/mailbox_mod/init.lua +++ b/mailbox_mod/init.lua @@ -1,91 +1,91 @@ -- twi_mods/mailbox_mod/init.lua -- Modify mailbox -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: GPL-3.0-or-later -local minetest, mailbox, func_areas, areas = minetest, mailbox, func_areas, areas +local minetest, mailbox, func_areas, areas = core, mailbox, func_areas, areas local S = minetest.get_translator("mailbox_mod") local MANAGED_AREA = 1017 local AREAS = { [0] = { 1018, 1019 }, -- A B C D E [1] = { 1020, 1021 }, -- F G H I J [2] = { 1022, 1023 }, -- K L M N O [3] = { 1024, 1025 }, -- P Q R S T [4] = { 1026, 1027 }, -- U V W X Y Z [5] = { 1028, 1029 }, -- All others } local AREAS_INDEX = { A = 0, B = 0, C = 0, D = 0, E = 0, F = 1, G = 1, H = 1, I = 1, J = 1, K = 2, L = 2, M = 2, N = 2, O = 2, P = 3, Q = 3, R = 3, S = 3, T = 3, U = 4, V = 4, W = 4, X = 4, Y = 4, Z = 4, } local old_rent_mailbox = mailbox.rent_mailbox function mailbox.rent_mailbox(pos, player) if func_areas.is_in_func_area(pos, MANAGED_AREA) then local pname = player:get_player_name() local first = string.upper(string.sub(pname, 1, 1)) local areas_index = AREAS_INDEX[first] or 5 local allowed_areas = AREAS[areas_index] if func_areas.is_in_func_area(pos, allowed_areas[1]) or func_areas.is_in_func_area(pos, allowed_areas[2]) then for _, id in ipairs(allowed_areas) do local area = areas.areas[id] for x = area.pos1.x, area.pos2.x do for y = area.pos1.y, area.pos2.y do for z = area.pos1.z, area.pos2.z do local npos = { x = x, y = y, z = z } local nnode = minetest.get_node(npos) if nnode.name == "mailbox:mailbox" or nnode.name == "mailbox:letterbox" then local nmeta = minetest.get_meta(npos) if nmeta:get_string("owner") == pname then minetest.chat_send_player(pname, S("You can't rent more than one mailboxes! Another one found at @1", minetest.pos_to_string(npos))) return end end end end end end else minetest.chat_send_player(pname, S("This mailbox is not for you! Please go to @1/F.", areas_index == 0 and "G" or tostring(areas_index))) return end end return old_rent_mailbox(pos, player) end diff --git a/moreblocks_mod/init.lua b/moreblocks_mod/init.lua index 4e47ec5..5bc2c3f 100644 --- a/moreblocks_mod/init.lua +++ b/moreblocks_mod/init.lua @@ -1,62 +1,62 @@ -- twi_mods/moreblocks_mod/init.lua -- Moreblocks modifications --[[ This code is licensed under the zlib license; see ./LICENSE.md for more information. ]] -- Adopt the linuxforks way of crafting stone tiles -minetest.clear_craft({ +core.clear_craft({ recipe = { { "default:cobble", "default:cobble", "default:cobble" }, { "default:cobble", "default:stone", "default:cobble" }, { "default:cobble", "default:cobble", "default:cobble" }, } }) -minetest.register_craft({ +core.register_craft({ output = "moreblocks:stone_tile 4", recipe = { { "default:cobble", "default:cobble" }, { "default:cobble", "default:cobble" }, } }) -minetest.register_craft({ +core.register_craft({ output = "moreblocks:stone_tile 36", recipe = { { "moreblocks:cobble_compressed", "moreblocks:cobble_compressed" }, { "moreblocks:cobble_compressed", "moreblocks:cobble_compressed" }, } }) -- Allow compressed cobbles to be smelt into stone/grind into gravel -minetest.register_craft({ +core.register_craft({ type = "cooking", output = "default:stone 9", recipe = "moreblocks:cobble_compressed", cooktime = 3 * 8, }) technic.register_grinder_recipe({ input = { "moreblocks:cobble_compressed" }, time = 3 * 8, output = "default:gravel 9" }) -- Hide deprecated nodes from crafting recipies local nodes = { "moreblocks:wood_tile_flipped", "moreblocks:wood_tile_down", "moreblocks:wood_tile_left", "moreblocks:wood_tile_right", } for _, name in ipairs(nodes) do - local groups = table.copy(minetest.registered_nodes[name].groups or {}) + local groups = table.copy(core.registered_nodes[name].groups or {}) groups.not_in_creative_inventory = 1 groups.not_in_craft_guide = 1 - minetest.override_item(name, { + core.override_item(name, { groups = groups }) end diff --git a/moretrains_mod/init.lua b/moretrains_mod/init.lua index 3c3076a..b6709cf 100644 --- a/moretrains_mod/init.lua +++ b/moretrains_mod/init.lua @@ -1,27 +1,27 @@ -- twi_mods/moretrains_mod_mod/init.lua -- Modify moretrains_mod -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: AGPL-3.0-or-later for _, name in ipairs({ "moretrains_nightline_couchette", "moretrains_nightline_seat_car", "moretrains_wagon_gondola", "moretrains_wagon_gondola_mese", "moretrains_wagon_gondola_cobble", "moretrains_wagon_gondola_toiletpaper", "moretrains_wagon_gondola_rails", "moretrains_wagon_tank", "moretrains_wagon_tank2", "moretrains_wagon_wood", "moretrains_wagon_wood_loaded", "moretrains_wagon_wood_acacia", "moretrains_wagon_wood_jungle", "moretrains_wagon_wood_pine", "moretrains_wagon_wood_aspen", "moretrains_wagon_box", "moretrains_railroad_car", }) do - minetest.registered_entities["advtrains:" .. name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED + core.registered_entities["advtrains:" .. name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED advtrains.wagon_prototypes["advtrains:" .. name].max_speed = twi_fx.ADVTRAINS_MAX_TRAIN_SPEED end diff --git a/newcomer_tips/init.lua b/newcomer_tips/init.lua index 450123a..b97572d 100644 --- a/newcomer_tips/init.lua +++ b/newcomer_tips/init.lua @@ -1,108 +1,108 @@ -- twi_mods/newcomer_tips/init.lua -- Tips for newcomers --[[ The MIT License (MIT) Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local S = minetest.get_translator("newcomer_tips") -local C = minetest.colorize +local S = core.get_translator("newcomer_tips") +local C = core.colorize local time_joined = {} local msg = table.concat({ S("Welcome to 1F616EMO Survival Server!"), S("Read the rules at @1, or TL;DR: respect others.", "https://wiki-twi.1f616emo.xyz/wiki/Project:Rules"), S("You can ask for help in the chatroom. Type \"/report\" if you want to contact the moderation team."), S("Have fun!"), }, "\n") -minetest.register_on_newplayer(function(player) +core.register_on_newplayer(function(player) local meta = player:get_meta() meta:set_int("newcomer_tips_send", 1) end) -minetest.register_on_joinplayer(function(player) +core.register_on_joinplayer(function(player) local name = player:get_player_name() local meta = player:get_meta() if meta:get_int("newcomer_tips_send") == 1 then time_joined[name] = os.time() - minetest.after(0.5, function() - if minetest.get_player_by_name(name) then - minetest.chat_send_all(C("yellow", S("Welcome our new player, @1!", name))) - minetest.chat_send_player(name, msg) + core.after(0.5, function() + if core.get_player_by_name(name) then + core.chat_send_all(C("yellow", S("Welcome our new player, @1!", name))) + core.chat_send_player(name, msg) end end) end end) local TIME_NEEDED = 2 * 60 -minetest.register_on_leaveplayer(function(player) +core.register_on_leaveplayer(function(player) local name = player:get_player_name() if time_joined[name] and os.time() - time_joined[name] > TIME_NEEDED then local meta = player:get_meta() meta:set_int("newcomer_tips_send", 0) end time_joined[name] = nil end) local function loop() local now = os.time() for name, time in pairs(time_joined) do if now - time > TIME_NEEDED then - local player = minetest.get_player_by_name(name) + local player = core.get_player_by_name(name) local meta = player:get_meta() meta:set_int("newcomer_tips_send", 0) time_joined[name] = nil end end - minetest.after(30, loop) + core.after(30, loop) end -minetest.after(5, loop) +core.after(5, loop) twi_fx.register_on_chat_message(function(name, message) - local player = minetest.get_player_by_name(name) - local spawn_pos = minetest.setting_get_pos("static_spawnpoint") + local player = core.get_player_by_name(name) + local spawn_pos = core.setting_get_pos("static_spawnpoint") if not (player and spawn_pos) then return end local meta = player:get_meta() if meta:get_int("newcomer_tips_send") ~= 1 then return end message = string.lower(message) if string.find(message, "spawn") then - minetest.after(0, function() - if minetest.get_player_by_name(name) then - minetest.chat_send_player(name, minetest.colorize("orange", + core.after(0, function() + if core.get_player_by_name(name) then + core.chat_send_player(name, core.colorize("orange", S("Tip! Type \"/spawn\" (without the quotes but with the slash) to get back tp the spawnpoint."))) end end) elseif string.find(message, "escape") or string.find(message, "stuck") then - minetest.after(0, function() - if minetest.get_player_by_name(name) then - minetest.chat_send_player(name, minetest.colorize("orange", + core.after(0, function() + if core.get_player_by_name(name) then + core.chat_send_player(name, core.colorize("orange", S("Tip! Type \"/spawn\" (without the quotes but with the slash) to escape."))) end end) end end) diff --git a/random_tips/init.lua b/random_tips/init.lua index cd6e424..76afedd 100644 --- a/random_tips/init.lua +++ b/random_tips/init.lua @@ -1,103 +1,103 @@ -- twi_mods/random_tips/init.lua -- Tips for 1F616EMO Server --[[ Copyright (C) 2024 1F616EMO This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ]] -local S = minetest.get_translator("random_tips") +local S = core.get_translator("random_tips") --[[ Chinese translations guidelines: 1. Use TA (pinyin of 他/她) when translating gender-neutral third-person pronouns. Spaces are not required on both sides of TA. Use 你 (gender-neutral/male/traditional) when translating gender-neutral second-person pronouns, as using NI seems odd. 2. Use 「」 for Traditional Chinese, and “” for Simplified, as pointed out by y5nw in minetest-mods/areas#71. ]] random_messages_api.from_table({ -- Community S("Do you know we have a Discord server? Join it at @1", "https://discord.gg/bFhZuwQxDX"), S("Get and contribute information aboout the server on our Wiki: @1", "https://wiki-twi.1f616emo.xyz/"), -- teleport commands S("Stuck in a hollow? Type /spawn in the chatroom to get teleported out."), S("Type in /spawn to go back to the spawn point, where you can access numerous useful locations and facilities."), S("Type in /sethome at where you want to set up your home coordinates, and then type in /home to go back."), S("To request teleporting to another player's location, type in /tpr ."), -- Communications S("To seek help, click the top-right speech bubble icon to open the chatroom. On PC, press T."), S("Type in /mail to open the mail dialog, where you can communicate with other players without them being online."), S("Type in /report if you want to contact our moderation team to report misbehavior or suggest changes."), -- In-game POI S("The public farm at Spawn provides an early-game food source. " .. "Remember to replant the crops after harvesting them."), S("The public tree farm at Spawn can be an easy way to get wood. " .. "Don't forget to plant the saplings after chopping down wood."), S("Visit Spawn South via train or by walk from Spawn for places to settle down."), -- Chests and storage S("Use locked or protected chests instead of normal chests to keep your items from griefers' touch."), S("Pack your numerous items into one inventory slot with baskets."), S("Running out of storage space? Use gold chests!"), S("Tired of managing your storage room? Set up a drawers network! " .. "See @1 for an in-depth tutorial.", "https://wiki-twi.1f616emo.xyz/s/5"), -- Advtrains S("Do not walk on tracks. The damage from a running train is deadly."), S("Right-click a train with an opened door to go onto it."), -- Technic S("Using machines from the technic mod speeds up your crafting workflows."), S("Visit a technic station to use machines from the technic mod without crafting them yourself."), S("Tools from the technic mod may require charging. Place them in the \"charging\" slot of a battery box."), S("Crafting a mining drill can be very helpful in bulk digging tasks."), S("Use a chainsaw to chop down an entire tree at once."), -- Pipeworks S("Autocrafters are useful in freeing your hand from repeated crafting tasks."), S("Item ejectors take items from a container into the pneumatic tube system."), S("Connect containers to a pneumatic tube system for items to flow in."), S("Always add trash cans at the end of pneumatic tube systems having the risk of overflowing " .. "to avoid breaking them."), -- Digtron S("The digtron mod is for constructing automated tunnel-boring machines. " .. "They are very useful in mining or building repeating patterns."), -- Farming S("Punch a grown crop with a mithril scythe to re-plant it while obtaining its drops."), S("Punch a dirt block with a hoe to turn it into farmlands. Do so near water for the farmland to work."), S("Discover different crops around the world, and plant them in farmlands by right-clicking."), -- Bonemeal S("Bones are dropped by chance when digging dirt blocks. " .. "They can be ground into bone meal for fertilizing crops and plants."), S("Using bonemeal on dirt blocks to obtain flowers and grasses naturally found on that type of dirt."), -- Economy (smartshop/atm/wtt) S("Click on the selling items icon of a smart shop interface to buy them."), S("Right-click an ATM to withdraw or deposit money."), S("Right-click a wire transfer terminal to start a digital transaction. " .. "The receiver will be notified via in-game mail."), -- For Sale Sign S("Vacant plots are indicated by a \"SALE\" sign. Right-click it to buy the plot."), }) diff --git a/rubber_cherrypick/init.lua b/rubber_cherrypick/init.lua index ba79987..36bd589 100644 --- a/rubber_cherrypick/init.lua +++ b/rubber_cherrypick/init.lua @@ -1,191 +1,191 @@ -- twi_mods/rubber_cherrypick/init.lua -- Cherry-pick rubber tree from moretrees -- Copyright (C) 2013 Vanessa Ezekowitz -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later -- Textures: -- Copyright (C) 2013 Vanessa Ezekowitz -- CC BY-SA 4.0 -local S = minetest.get_translator("rubber_cherrypick") +local S = core.get_translator("rubber_cherrypick") -minetest.override_item("moretrees:rubber_tree_trunk", { +core.override_item("moretrees:rubber_tree_trunk", { description = S("Rubber Tree Trunk"), tiles = { "moretrees_rubber_tree_trunk_top.png", "moretrees_rubber_tree_trunk_top.png", "technic_rubber_tree_full.png" }, paramtype2 = "facedir", is_ground_content = false, - on_place = minetest.rotate_node, + on_place = core.rotate_node, }) twi_fx.override_group("moretrees:rubber_tree_trunk", { rubber_tree = 1, }) -minetest.override_item("moretrees:rubber_tree_trunk_empty", { +core.override_item("moretrees:rubber_tree_trunk_empty", { description = S("Rubber Tree Trunk (Empty)"), tiles = { "moretrees_rubber_tree_trunk_top.png", "moretrees_rubber_tree_trunk_top.png", "technic_rubber_tree_empty.png" }, paramtype2 = "facedir", is_ground_content = false, - on_place = minetest.rotate_node, + on_place = core.rotate_node, }) twi_fx.override_group("moretrees:rubber_tree_trunk_empty", { rubber_tree = 1, }) -minetest.override_item("moretrees:rubber_tree_leaves", { +core.override_item("moretrees:rubber_tree_leaves", { description = S("Rubber Tree Leaves"), drop = { max_items = 1, items = { { items = { "moretrees:rubber_tree_sapling" }, rarity = 100 }, { items = { "moretrees:rubber_tree_leaves" } } } }, }) -minetest.override_item("moretrees:rubber_tree_sapling", { +core.override_item("moretrees:rubber_tree_sapling", { description = S("Rubber Tree Sapling"), on_place = function(itemstack, placer, pointed_thing) return default.sapling_on_place(itemstack, placer, pointed_thing, "moretrees:rubber_tree_sapling", -- minp, maxp to be checked, relative to sapling pos -- minp_relative.y = 1 because sapling pos has been checked { x = -3, y = 1, z = -3 }, { x = 3, y = 6, z = 3 }, -- maximum interval of interior volume check 4) end, selection_box = { type = "fixed", fixed = { -4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16 } }, }) -minetest.register_node(":moretrees:rubber_tree_planks", { +core.register_node(":moretrees:rubber_tree_planks", { description = S("Rubber Tree Planks"), tiles = { "moretrees_rubber_tree_wood.png" }, is_ground_content = false, groups = { snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1 }, sounds = xcompat.sounds.node_sound_wood_defaults(), }) -minetest.register_craft({ +core.register_craft({ type = "shapeless", output = "moretrees:rubber_tree_planks 4", recipe = { "moretrees:rubber_tree_trunk" } }) local planks_name = "moretrees:rubber_tree_planks" local planks_tile = "moretrees_rubber_tree_wood.png" default.register_fence(":moretrees:rubber_tree_fence", { description = S("Rubber Tree Fence"), texture = planks_tile, inventory_image = "default_fence_overlay.png^" .. planks_tile .. "^default_fence_overlay.png^[makealpha:255,126,126", wield_image = "default_fence_overlay.png^" .. planks_tile .. "^default_fence_overlay.png^[makealpha:255,126,126", material = planks_name, groups = { choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 }, sounds = xcompat.sounds.node_sound_wood_defaults() }) default.register_fence_rail(":moretrees:rubber_tree_fence_rail", { description = S("Rubber Tree Fence Rail"), texture = planks_tile, inventory_image = "default_fence_rail_overlay.png^" .. planks_tile .. "^default_fence_rail_overlay.png^[makealpha:255,126,126", wield_image = "default_fence_rail_overlay.png^" .. planks_tile .. "^default_fence_rail_overlay.png^[makealpha:255,126,126", material = planks_name, groups = { choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 }, sounds = xcompat.sounds.node_sound_wood_defaults() }) doors.register_fencegate("moretrees:rubber_tree_gate", { description = S("Rubber Tree Fence Gate"), texture = planks_tile, material = planks_name, groups = { choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 } }) -minetest.register_alias(":moretrees:rubber_tree_gate_closed", "moretrees:rubber_tree_gate_closed") -minetest.register_alias(":moretrees:rubber_tree_gate_open", "moretrees:rubber_tree_gate_open") +core.register_alias(":moretrees:rubber_tree_gate_closed", "moretrees:rubber_tree_gate_closed") +core.register_alias(":moretrees:rubber_tree_gate_open", "moretrees:rubber_tree_gate_open") stairsplus:register_all( "moretrees", "rubber_tree_trunk", "moretrees:rubber_tree_trunk", { groups = { snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2 }, tiles = { "moretrees_rubber_tree_trunk_top.png", "moretrees_rubber_tree_trunk_top.png", "technic_rubber_tree_full.png" }, description = S("Rubber Tree Trunk"), drop = "rubber_tree_trunk", } ) stairsplus:register_all( "moretrees", "rubber_tree_planks", "moretrees:rubber_tree_planks", { groups = { snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3 }, tiles = { "moretrees_rubber_tree_wood.png" }, description = S("Rubber Tree Planks"), drop = "rubber_tree_planks", } ) -minetest.register_node(":moretrees_all_faces:all_faces_rubber_tree_trunk", { +core.register_node(":moretrees_all_faces:all_faces_rubber_tree_trunk", { description = S("All-faces Rubber Tree Trunk"), tiles = { "moretrees_rubber_tree_trunk_top.png" }, groups = { tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 1 }, sounds = xcompat.sounds.node_sound_wood_defaults(), }) -minetest.register_craft({ +core.register_craft({ output = "moretrees_all_faces:all_faces_rubber_tree_trunk 8", recipe = { { "group:rubber_tree", "group:rubber_tree", "group:rubber_tree" }, { "group:rubber_tree", "", "group:rubber_tree" }, { "group:rubber_tree", "group:rubber_tree", "group:rubber_tree" } } }) stairsplus:register_all( "moretrees_all_faces", "all_faces_rubber_tree_trunk", "moretrees_all_faces:all_faces_rubber_tree_trunk", { description = S("All-faces Rubber Tree Trunk"), tiles = { "moretrees_rubber_tree_trunk_top.png" }, groups = { tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 1 }, sounds = xcompat.sounds.node_sound_wood_defaults(), }) choppy.api.register_tree("moretrees:rubber", { shape = { type = "box", box = vector.new(17, 13, 17) }, nodes = { ["moretrees:rubber_tree_trunk"] = "trunk", ["moretrees:rubber_tree_trunk_empty"] = "trunk", ["moretrees:rubber_tree_leaves"] = "leaves", }, }) -if minetest.get_modpath("logspikes") then +if core.get_modpath("logspikes") then logspikes.register_log_spike("logspikes:moretrees_rubber_spike", "moretrees:rubber_tree_trunk") end -if minetest.get_modpath("banisters") then +if core.get_modpath("banisters") then banisters.register("banisters", "rubber_tree", "moretrees:rubber_tree_planks") end diff --git a/signs_lib_mod/init.lua b/signs_lib_mod/init.lua index 150b750..f185028 100644 --- a/signs_lib_mod/init.lua +++ b/signs_lib_mod/init.lua @@ -1,58 +1,58 @@ -- twi_mods/signs_lib_mod/init.lua -- Signs Lib Modifications --[[ Copyright (C) 2018-2024 VannessaE and contributors Copyright (C) 2024 1F616EMO This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ]] signs_lib.glow_item = "default:torch" -- If locked, signs can be modified by both area owner (if protected) and the sign owner local old_can_modify = signs_lib.can_modify function signs_lib.can_modify(pos, player) - local meta = minetest.get_meta(pos) + local meta = core.get_meta(pos) local owner = meta:get_string("owner") if owner ~= "" then -- That means there is a owner local playername if type(player) == "userdata" then playername = player:get_player_name() elseif type(player) == "string" then playername = player else playername = "" end if playername == owner then return true end - if minetest.is_protected(pos, "") then + if core.is_protected(pos, "") then -- The area is protected, let the owner to edit - if not minetest.is_protected(pos, playername) then + if not core.is_protected(pos, playername) then return true end end return false end return old_can_modify(pos, player) end \ No newline at end of file diff --git a/smartshop_mod/init.lua b/smartshop_mod/init.lua index 60ded4f..1c54f4c 100644 --- a/smartshop_mod/init.lua +++ b/smartshop_mod/init.lua @@ -1,21 +1,21 @@ -- twi_mods/smartshop_mod/init.lua -- Modify smartshop -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later -- Do not use unlimited inventory unless in creative mode local old_initialize_metadata = smartshop.shop_class.initialize_metadata function smartshop.shop_class:initialize_metadata(player) old_initialize_metadata(self, player) local player_name if type(player) == "string" then player_name = player else player_name = player:get_player_name() end - if not minetest.is_creative_enabled(player_name) then + if not core.is_creative_enabled(player_name) then self:set_unlimited(false) end end diff --git a/spam_kick/init.lua b/spam_kick/init.lua index c5de05c..79a3be6 100644 --- a/spam_kick/init.lua +++ b/spam_kick/init.lua @@ -1,13 +1,13 @@ -- twi_mods/spam_kick/init.lua -- Kick spammers -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later twi_fx.register_on_chat_message(function(name, message) if string.sub(message, 1, 1) == "/" then return end - if string.find(message, "ronwyatt%.com") and minetest.get_player_by_name(name) then - minetest.chat_send_player(name, "Spam keyword matched. (#14)") + if string.find(message, "ronwyatt%.com") and core.get_player_by_name(name) then + core.chat_send_player(name, "Spam keyword matched. (#14)") return true end end) \ No newline at end of file diff --git a/static_spawn/init.lua b/static_spawn/init.lua index f4a0208..f649d34 100644 --- a/static_spawn/init.lua +++ b/static_spawn/init.lua @@ -1,71 +1,71 @@ -- twi_mods/static_spawn/init.lua --[[ Copyright (C) 2014-2021 AndrejIT, spfar, mightyjoe781 Copyright (C) 2024 1F616EMO This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ]] -S = minetest.get_translator("spawn") +S = core.get_translator("spawn") -minetest.register_chatcommand("spawn", { +core.register_chatcommand("spawn", { description = S("Teleport to spawnpoint"), privs = { home = true }, func = function(name) - local player = minetest.get_player_by_name(name) + local player = core.get_player_by_name(name) if not player then return false, S("Player object not found.") end - local spawn_pos = minetest.setting_get_pos("static_spawnpoint") + local spawn_pos = core.setting_get_pos("static_spawnpoint") if not spawn_pos then return false, S("Spawn point not set. Consult moderators to set a proper static spawnpoint.") end player:set_pos(spawn_pos) background_music.set_start_play_gap(name, 2) background_music.decide_and_play(player, true) return true, S("Teleported to Spawn!") end }) -minetest.register_chatcommand("setspawn", { +core.register_chatcommand("setspawn", { description = S("Override the static spawnpoint"), privs = { server = true }, param = "[]", func = function(name, param) if param == "" then - local player = minetest.get_player_by_name(name) + local player = core.get_player_by_name(name) if not player then return false, S("Player object not found.") end - param = minetest.pos_to_string(player:get_pos(), 0) + param = core.pos_to_string(player:get_pos(), 0) else local pos = core.string_to_pos(param) if not pos then return false, S("Invalid position given.") end - param = minetest.pos_to_string(pos) + param = core.pos_to_string(pos) end - minetest.settings:set("static_spawnpoint", param) + core.settings:set("static_spawnpoint", param) return true, S("Static spawnpoint set to @1.", param) end }) diff --git a/teacher_tutorial_post_buying_plot/init.lua b/teacher_tutorial_post_buying_plot/init.lua index 13a889c..d270aec 100644 --- a/teacher_tutorial_post_buying_plot/init.lua +++ b/teacher_tutorial_post_buying_plot/init.lua @@ -1,55 +1,55 @@ -- twi_mods/teacher_tutorial_post_buying_plot/init.lua -- Tutorials shown after buying first plot --[[ Copyright (C) 2024 1F616EMO This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . ]] -local S = minetest.get_translator("teacher_tutorial_post_buying_plot") +local S = core.get_translator("teacher_tutorial_post_buying_plot") teacher.register_turorial("teacher_tutorial_post_buying_plot:post_buy", { title = S("After buying a plot..."), show_on_unlock = true, { texture = "teacher_tutorial_post_buying_plot_1.jpg", text = S("Congratulations! You bought your first plot on the 1F616EMO Survival Server! " .. "You can build your dream house here.") .. "\n\n" .. S("You should start your construction in 4 days, and make it feel like a building in 30 days.") }, { texture = "teacher_tutorial_post_buying_plot_2.jpg", text = S("To start building, chop down the tree on your plot's land. " .. "Craft the tree trunks into wood planks in your inventory.") }, { texture = "teacher_tutorial_post_buying_plot_3.jpg", text = S("If you want more wood, visit the public tree farm next to the Spawnpoint. " .. "Don't forget to replant the saplings!") .. "\n\n" .. S("For more variants, step on the teleport pad next to the entrance of the public tree farm.") }, }) um_area_forsale.register_on_area_tx(function(original_owner, new_owner, price, pos, list_areas, description) - minetest.after(1, function() - local player = minetest.get_player_by_name(new_owner) + core.after(1, function() + local player = core.get_player_by_name(new_owner) if player then teacher.unlock_entry_for_player(player, "teacher_tutorial_post_buying_plot:post_buy") end end) end) diff --git a/teacher_tutorial_protection_violation/init.lua b/teacher_tutorial_protection_violation/init.lua index 5ec31b9..42ac6f4 100644 --- a/teacher_tutorial_protection_violation/init.lua +++ b/teacher_tutorial_protection_violation/init.lua @@ -1,41 +1,41 @@ -- twi_mods/teacher_tutorial_protection_violation/init.lua -- Tutorial on protection violation -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later -local S = minetest.get_translator("teacher_tutorial_protection_violation") +local S = core.get_translator("teacher_tutorial_protection_violation") teacher.register_turorial("teacher_tutorial_protection_violation:on_violation", { title = S("Position is protected..."), show_on_unlock = true, show_disallow_close = true, { texture = "teacher_tutorial_protection_violation_1.jpg", text = S("You can't dig or build here in a protected area. " .. "Area protections keep unauthorized players from modifying blocks within the area.") }, { texture = "teacher_tutorial_protection_violation_2.jpg", text = S("Follow the \"Are you new?\" signs from the spawn point to go to a place where you can build. " .. "Type /spawn to go back to the spawn point.") }, { texture = "teacher_tutorial_protection_violation_3.jpg", text = S("To check whether you can build or place, check the bottom-left corner. " .. "If the bracket of all lines say a player name that is not you, " .. "where you are is protected.") .. "\n\n" .. S("However, if you see \"@1\" after the player's name, you can build or place blocks here, " .. "but you can't claim the area as yours. This usually happens in public farms and public tree farms.", - minetest.translate("areas", ":open")) + core.translate("areas", ":open")) }, }) -minetest.register_on_protection_violation(function(_, name) - local player = minetest.get_player_by_name(name) +core.register_on_protection_violation(function(_, name) + local player = core.get_player_by_name(name) if player then teacher.unlock_entry_for_player(player, "teacher_tutorial_protection_violation:on_violation") end end) diff --git a/teacher_tutorial_public_mine/init.lua b/teacher_tutorial_public_mine/init.lua index 115902c..b10cecb 100644 --- a/teacher_tutorial_public_mine/init.lua +++ b/teacher_tutorial_public_mine/init.lua @@ -1,74 +1,74 @@ -- twi_mods/teacher_tutorial_public_mine/init.lua -- Tutorial on the Public Mine -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later -local S = minetest.get_translator("teacher_tutorial_public_mine") +local S = core.get_translator("teacher_tutorial_public_mine") teacher.register_turorial("teacher_tutorial_public_mine:public_mine", { title = S("The Public Mine"), { texture = "teacher_tutorial_public_mine_1.jpg", text = S("Are you struggling to find iron and diamond ores? You can use the public mine, " .. "located 3 km below sea level. For most minerals, the deeper you go, the more you get.") }, { texture = "teacher_tutorial_public_mine_2.jpg", text = S("To access the public mine, go to the spawn point by typing /spawn in the chatroom. " .. "Then, turn left and follow the sign reading \"Public Mine\". " .. "Right-click or tap on the travelnet box and select a destination.") }, }) local stone_counter = {} -local old_on_dig = minetest.registered_nodes["default:stone"].on_dig or minetest.node_dig +local old_on_dig = core.registered_nodes["default:stone"].on_dig or core.node_dig -minetest.override_item("default:stone", { +core.override_item("default:stone", { on_dig = function(pos, node, player) if old_on_dig(pos, node, player) == false then return false elseif not player or not player:is_player() or player.is_fake_player then return true end local name = player:get_player_name() if pos.y < -200 then teacher.unlock_entry_for_player(player, "teacher_tutorial_public_mine:public_mine") stone_counter[name] = false return true elseif stone_counter[name] == false then return true elseif stone_counter[name] == nil then stone_counter[name] = {1, os.time()} elseif stone_counter[name][1] > 50 then teacher.unlock_entry_for_player(player, "teacher_tutorial_public_mine:public_mine") teacher.simple_show(player, "teacher_tutorial_public_mine:public_mine") stone_counter[name] = false else stone_counter[name][1] = stone_counter[name][1] + 1 stone_counter[name][2] = os.time() end return true end, }) -minetest.register_on_joinplayer(function(player) +core.register_on_joinplayer(function(player) local data = teacher.get_player_data(player) if data["teacher_tutorial_public_mine:public_mine"] then stone_counter[player:get_player_name()] = false end end) -minetest.register_on_leaveplayer(function(player) +core.register_on_leaveplayer(function(player) stone_counter[player:get_player_name()] = nil end) modlib.minetest.register_globalstep(31, function() local now = os.time() for name, data in pairs(stone_counter) do if data ~= false and now - data[2] > 60 then stone_counter[name] = nil end end end) \ No newline at end of file diff --git a/technic_mod/init.lua b/technic_mod/init.lua index a6a0165..29ef5bd 100644 --- a/technic_mod/init.lua +++ b/technic_mod/init.lua @@ -1,29 +1,29 @@ -- twi_mods/technic_mod/init.lua -- Modifications on technic mods --[[ Copyright (C) 2012-2024 Technic contributors Copyright (C) 2024 1F616EMO This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ]] -- Disable technic:music_player -minetest.clear_craft({ +core.clear_craft({ output = "technic:music_player", }) twi_fx.override_group("technic:music_player", { not_in_creative_inventory = 1, not_in_craft_guide = 1, }) diff --git a/twi_bgm/init.lua b/twi_bgm/init.lua index 3da2840..584c5a6 100644 --- a/twi_bgm/init.lua +++ b/twi_bgm/init.lua @@ -1,137 +1,137 @@ -- twi_mods/twi_bgm/init.lua -- Make background musics by area -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later -local MP = minetest.get_modpath("twi_bgm") +local MP = core.get_modpath("twi_bgm") -- Songs played around Spawnpoint in daytime background_music.register_music("twi_bgm:spawn_day", { -- Sun Cave Village -- Soundworlds Histories: Chasing the Leviathan (John Oestmann) -- License: CC0 { file = MP .. "/bgms/john_leviathan_03.ogg", gain = 0.4, resend_time = 198.4, }, -- Inca Pan Flute hip hop -- Tom Peter -- https://opengameart.org/content/inca-pan-flute-hip-hop -- License: CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0/ { file = MP .. "/bgms/tom_inca_pan_flute.ogg", gain = 0.4, resend_time = 146.4, }, -- Fluffy style -- Totraf -- https://opengameart.org/content/fluffy-style -- License: CC BY 3.0 https://creativecommons.org/licenses/by/3.0/ { file = MP .. "/bgms/tom_fluffy_style.ogg", gain = 0.4, resend_time = 161.9, }, -- Town Themne -- Pixelsphere OST? (cynicmusic) -- https://opengameart.org/content/town-theme-rpg -- License: CC0 { file = MP .. "/bgms/cynicmusic_town_theme.ogg", gain = 0.4, resend_time = 97.5, }, -- Yuri, the Travelling Shoppe -- Soundworlds Histories: Duskfire (John Oestmann) -- License: CC0 { file = MP .. "/bgms/john_duskfire_07.ogg", gain = 0.4, resend_time = 100.2, }, -- Stepping Pebbles (No Drums) -- Matthew Pablo -- https://opengameart.org/content/stepping-stones -- License: CC BY 3.0 https://creativecommons.org/licenses/by/3.0/ { file = MP .. "/bgms/pablo_stepping_pebbles_nodrums.ogg", gain = 0.4, resend_time = 64.4, }, -- Little Town [TODO] -- bart (remix: 1F616EMO) -- https://opengameart.org/content/little-town -- License: CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0/ -- { -- file = MP .. "/bgms/1f616emo_little_town", -- }, }) -- Songs played around Spawnpoint at night background_music.register_music("twi_bgm:spawn_night", { -- Del Erad -- Radakan OST (Janne Hanhisuanto for Radakan) -- https://opengameart.org/content/radakan-del-erad -- License: CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0/ { file = MP .. "/bgms/radakan_del_erad.ogg", gain = 0.4, resend_time = 300.8, }, -- Never Grow Up -- Diminixed -- License:CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0/ { file = MP .. "/bgms/diminixed_nevergrowup.ogg", gain = 0.4, resend_time = 71.4, }, -- A New Town (RPG Theme) -- Pixelsphere OST (cynicmusic) -- https://pixelsphere.org/ -- License: CC0 { file = MP .. "/bgms/pixelsphere_25_new_town.ogg", gain = 0.4, resend_time = 62.3, }, -- Deadlands Forest Shrine -- Soundworlds Datapedia: Ardune Ambient (John Oestmann) -- License: CC0 { file = MP .. "/bgms/john_ardune_07.ogg", gain = 0.4, resend_time = 193.5, }, -- Path to Lake Land -- Alexandr Zhelanov -- License: CC-BY 3.0 https://creativecommons.org/licenses/by/3.0/ { file = MP .. "/bgms/zhelanov_path_lake_land.ogg", gain = 0.4, resend_time = 254.8, }, }) background_music.register_on_decide_music(function(player) local ppos = player:get_pos() - local timeofday = minetest.get_timeofday() + local timeofday = core.get_timeofday() -- 0.23 < day < 0.78 local now_day = timeofday > 0.23 and timeofday < 0.78 if func_areas.is_in_func_area(ppos, 497) then -- Spawn Island return now_day and "twi_bgm:spawn_day" or "twi_bgm:spawn_night" end end) diff --git a/twi_cmds/init.lua b/twi_cmds/init.lua index 8cdd9dc..cb33726 100644 --- a/twi_cmds/init.lua +++ b/twi_cmds/init.lua @@ -1,21 +1,21 @@ -- twi_mods/twi_cmds/init.lua -- commands -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-3.0-or-later -local S = minetest.get_translator("twi_cmds") +local S = core.get_translator("twi_cmds") -minetest.register_chatcommand("day", { +core.register_chatcommand("day", { privs = { ban = true }, description = S("Set time to day"), func = function() - minetest.set_timeofday(0.3125) - for _, player in ipairs(minetest.get_connected_players()) do + core.set_timeofday(0.3125) + for _, player in ipairs(core.get_connected_players()) do local name = player:get_player_name() background_music.set_start_play_gap(name, 2) background_music.decide_and_play(player, true) end - minetest.sound_play("ui_morning", { gain = 1.0 }) + core.sound_play("ui_morning", { gain = 1.0 }) return true, S("Successfully set time to day.") end, }) diff --git a/twi_fx/init.lua b/twi_fx/init.lua index 7457d23..38076de 100644 --- a/twi_fx/init.lua +++ b/twi_fx/init.lua @@ -1,53 +1,53 @@ -- twi_mods/twi_fx/init.lua -- Common functions --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] twi_fx = {} function twi_fx.register_all_stairsplus(modname, name) local nodename = modname .. ":" .. name - local def = table.copy(minetest.registered_nodes[nodename]) + local def = table.copy(core.registered_nodes[nodename]) def.is_ground_content = false def.sunlight_propagates = true stairsplus:register_all(modname, name, nodename, def) end function twi_fx.override_group(name, new_groups) - local groups = table.copy(minetest.registered_items[name].groups or {}) + local groups = table.copy(core.registered_items[name].groups or {}) for k, v in pairs(new_groups) do groups[k] = v == 0 and nil or v end - minetest.override_item(name, { + core.override_item(name, { groups = groups, }) end twi_fx.register_on_chat_message = - minetest.global_exists("beerchat") + core.global_exists("beerchat") and beerchat.register_on_chat_message - or minetest.register_on_chat_message + or core.register_on_chat_message -- Limit that out hardware can bear twi_fx.ADVTRAINS_MAX_TRAIN_SPEED = 30 diff --git a/twi_shops/init.lua b/twi_shops/init.lua index cf70653..59b9678 100644 --- a/twi_shops/init.lua +++ b/twi_shops/init.lua @@ -1,50 +1,50 @@ -- twi_mods/twi_shops/init.lua -- Shop dialogs -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-2.1-or-later -local S = minetest.get_translator("twi_shops") +local S = core.get_translator("twi_shops") local function check_atlatc(name) - if minetest.check_player_privs(name, { atlatc = true }) then + if core.check_player_privs(name, { atlatc = true }) then return 99 end return 0 end shop_dialog.register_dialog("twi_shops:advtrains", { title = S("Advanced Trains Admin Shop"), entries = { { item = ItemStack("advtrains_luaautomation:dtrack_placer"), description = S("For LuaATC operators only. Advtrains track that runs LuaATC code."), cost = 5, max_amount = check_atlatc, }, { item = ItemStack("advtrains_luaautomation:mesecon_controller0000"), description = S("For LuaATC operators only. Luacontroller that runs LuaATC code."), cost = 5, max_amount = check_atlatc, }, { item = ItemStack("advtrains_luaautomation:oppanel"), description = S("For LuaATC operators only. Punch-operatable panel that runs LuaATC code."), cost = 5, max_amount = check_atlatc, }, { item = ItemStack("advtrains_luaautomation:pcnaming"), description = S("For LuaATC operators only. Name passive components."), cost = 10, max_amount = check_atlatc, }, { item = ItemStack("linetrack:watertrack_lua_placer"), description = S("For LuaATC operators only. Advtrains boat track that runs LuaATC code."), cost = 5, max_amount = check_atlatc, }, } }) \ No newline at end of file diff --git a/twi_tips/init.lua b/twi_tips/init.lua index 8a4c43f..d2c2aae 100644 --- a/twi_tips/init.lua +++ b/twi_tips/init.lua @@ -1,71 +1,71 @@ -- twi_mods/twi_tips/init.lua -- Tips --[[ Copyright © 2024 1F616EMO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local S = minetest.get_translator("twi_tips") +local S = core.get_translator("twi_tips") -- /sethome on area sale tips.register_tips("twi_tips:sethome", S("Type /sethome into the chatroom while staying in your home to allow teleporting back by typing /home.")) um_area_forsale.register_on_area_tx(function(original_owner, new_owner, price, pos, list_areas, description) tips.unlock_tips(new_owner, "twi_tips:sethome") end) -- Public farm replant [13] tips.register_tips("twi_tips:public_farm", S("Welcome to the Public Farm! After harvesting, don't forget to plant some seeds back for the sake of other players.")) -- Public Tree Farm [20] tips.register_tips("twi_tips:public_tree_farm", S("Welcome to the Public Tree Farm! Don't forget to place down some saplings after chopping down wood.")) -- SPN Station [224] tips.register_tips("twi_tips:train", S("Right-click on a train to board or leave the train. Do not walk on tracks as running trains are deadly.")) do local function loop() - for _, player in ipairs(minetest.get_connected_players()) do + for _, player in ipairs(core.get_connected_players()) do local pos = player:get_pos() local name = player:get_player_name() -- Public farm replant [13] if func_areas.is_in_func_area(pos, 13) then tips.unlock_tips(name, "twi_tips:public_farm") end -- Public Tree Farm [20] if func_areas.is_in_func_area(pos, 20) then tips.unlock_tips(name, "twi_tips:public_tree_farm") end -- SPN Station [224] if func_areas.is_in_func_area(pos, 224) then tips.unlock_tips(name, "twi_tips:train") end end - minetest.after(3, loop) + core.after(3, loop) end - minetest.after(1, loop) + core.after(1, loop) end diff --git a/username_restrictions/init.lua b/username_restrictions/init.lua index c4b4f29..05d490c 100644 --- a/username_restrictions/init.lua +++ b/username_restrictions/init.lua @@ -1,37 +1,37 @@ -- twi_mods/username_restrictions/init.lua -- Ban some usernames -- Copyright (C) 2024 1F616EMO -- SPDX-License-Identifier: LGPL-2.1-or-later local banned_parts = {} for _, part in ipairs({ "admin", "moderator", "nigger", "fuck", }) do banned_parts[part] = antispoof.normalize(part) end local auth -minetest.register_on_prejoinplayer(function(name) - if name == "singleplayer" or name == minetest.settings:get("name") then return end - auth = auth or minetest.get_auth_handler() +core.register_on_prejoinplayer(function(name) + if name == "singleplayer" or name == core.settings:get("name") then return end + auth = auth or core.get_auth_handler() if not auth.get_auth(name) then if string.find(name, "L+O+L+") then -- As unclear as possible yet give some useful message return "This username is banned." end local normalized_name = antispoof.normalize(name) for orig_part, norm_part in pairs(banned_parts) do if string.find(normalized_name, norm_part) then return string.format( "Invalid username %s: Username cannt conain \"%s\"", name, orig_part ) end end end end) \ No newline at end of file