Page Menu
Home
1F616EMO Bugtracker
Search
Configure Global Search
Log In
Files
F171567
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/mobile_tips/init.lua b/mobile_tips/init.lua
new file mode 100644
index 0000000..fd4b4d8
--- /dev/null
+++ b/mobile_tips/init.lua
@@ -0,0 +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_translatr("mobile_tips")
+
+local function is_mobile(name)
+ local player_info = minetest.get_player_information(name)
+ local window_info = minetest.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)
+ 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)
+ end
+ end)
+ end
+end)
diff --git a/mobile_tips/mod.conf b/mobile_tips/mod.conf
new file mode 100644
index 0000000..42d0de4
--- /dev/null
+++ b/mobile_tips/mod.conf
@@ -0,0 +1 @@
+name = mobile_tips
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Apr 12, 7:01 PM (6 d, 23 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6e/9c/2314a661422c4c73327b4f3baf82
Default Alt Text
(2 KB)
Attached To
Mode
rTWIMODS Survival Server Custom Modifications
Attached
Detach File
Event Timeline
Log In to Comment