Page MenuHome1F616EMO Bugtracker

No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/teacher_tutorial_public_mine/init.lua b/teacher_tutorial_public_mine/init.lua
new file mode 100644
index 0000000..4b407fb
--- /dev/null
+++ b/teacher_tutorial_public_mine/init.lua
@@ -0,0 +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")
+
+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
+
+minetest.override_item("default:stone", {
+ on_dig = function(pos, node, player)
+ if old_on_dig(pos, node, player) == false then
+ return false
+ elseif 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)
+ 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)
+ 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/teacher_tutorial_public_mine/mod.conf b/teacher_tutorial_public_mine/mod.conf
new file mode 100644
index 0000000..5e5c900
--- /dev/null
+++ b/teacher_tutorial_public_mine/mod.conf
@@ -0,0 +1,2 @@
+name = teacher_tutorial_public_mine
+depends = default, teacher_core, modlib
diff --git a/teacher_tutorial_public_mine/textures/teacher_tutorial_public_mine_1.jpg b/teacher_tutorial_public_mine/textures/teacher_tutorial_public_mine_1.jpg
new file mode 100644
index 0000000..4387ac9
Binary files /dev/null and b/teacher_tutorial_public_mine/textures/teacher_tutorial_public_mine_1.jpg differ
diff --git a/teacher_tutorial_public_mine/textures/teacher_tutorial_public_mine_2.jpg b/teacher_tutorial_public_mine/textures/teacher_tutorial_public_mine_2.jpg
new file mode 100644
index 0000000..a1396d7
Binary files /dev/null and b/teacher_tutorial_public_mine/textures/teacher_tutorial_public_mine_2.jpg differ

File Metadata

Mime Type
text/x-diff
Expires
Sun, Apr 5, 3:02 AM (2 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
89/ac/d2cee6f60548030f77f4788e6c31
Default Alt Text
(3 KB)

Event Timeline