diff --git a/func_areas/init.lua b/func_areas/init.lua new file mode 100644 index 0000000..4d5f3e1 --- /dev/null +++ b/func_areas/init.lua @@ -0,0 +1,39 @@ +-- 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 vector.in_area(pos, area.pos1, area.pos2) +end + +minetest.register_on_prejoinplayer(function(name) + if name == func_account then + return "This username is reserved." + end +end) diff --git a/func_areas/mod.conf b/func_areas/mod.conf new file mode 100644 index 0000000..312ce8c --- /dev/null +++ b/func_areas/mod.conf @@ -0,0 +1,2 @@ +name = func_areas +depends = areas \ No newline at end of file diff --git a/func_areas_limitations/init.lua b/func_areas_limitations/init.lua new file mode 100644 index 0000000..78b7dd3 --- /dev/null +++ b/func_areas_limitations/init.lua @@ -0,0 +1,55 @@ +-- 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") + +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) + if not placer:is_player() then return end + local name = placer:get_player_name() + local item_name = itemstack:get_name() + + -- Public Tree farm top [41] + if func_areas.is_in_func_area(pos, 41) then + minetest.remove_node(pos) + minetest.chat_send_player(name, + S("You can only place down apple tree saplings in the Public Tree Farm.")) + return true + end + + -- Public Tree farm bottom [225] + if func_areas.is_in_func_area(pos, 225) and item_name ~= "default:sapling" then + minetest.remove_node(pos) + minetest.chat_send_player(name, + S("You can only place down apple tree saplings in the Public Tree Farm.")) + return true + end + + -- Public farm [13] + if func_areas.is_in_func_area(pos, 13) and minetest.get_item_group(item_name, "seed") == 0 then + minetest.remove_node(pos) + minetest.chat_send_player(name, + S("You can only place down plant seeds in the Public Farm.")) + return true + end +end) diff --git a/func_areas_limitations/mod.conf b/func_areas_limitations/mod.conf new file mode 100644 index 0000000..c643d30 --- /dev/null +++ b/func_areas_limitations/mod.conf @@ -0,0 +1,2 @@ +name = func_areas_limitations +depends = func_areas \ No newline at end of file diff --git a/twi_tips/init.lua b/twi_tips/init.lua new file mode 100644 index 0000000..8a4c43f --- /dev/null +++ b/twi_tips/init.lua @@ -0,0 +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") + +-- /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 + 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) + end + minetest.after(1, loop) +end diff --git a/twi_tips/mod.conf b/twi_tips/mod.conf new file mode 100644 index 0000000..858324e --- /dev/null +++ b/twi_tips/mod.conf @@ -0,0 +1,2 @@ +name = twi_tips +depends = tips, um_area_forsale, func_areas \ No newline at end of file