diff options
author | Eugen Wesseloh <codexp@users.noreply.github.com> | 2018-04-10 09:25:08 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2018-04-10 09:25:08 +0200 |
commit | a97cccd2a15347bed0d78c599d83e72dc0b99c65 (patch) | |
tree | 5b000fcfd24865db7b182ee9f39c1541912fa2dc | |
parent | 3322ef90c4f868731119f399314aab73f029c389 (diff) |
Disable worldedit_brush mod instead of throwing error (#156)
-rw-r--r-- | worldedit_brush/init.lua | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/worldedit_brush/init.lua b/worldedit_brush/init.lua index b73a402..21de630 100644 --- a/worldedit_brush/init.lua +++ b/worldedit_brush/init.lua @@ -1,10 +1,27 @@ +local modname = minetest.get_current_modname() + +-- check compatibility if minetest.raycast == nil then - error( - "================================\n".. - "This mod requires a suitable version of 0.4.16-dev/0.5.0-dev\n".. - "that includes support for minetest.raycast() [since 7th July 2017]\n".. - "================================\n" - ) + function log_unavailable_error() + minetest.log("error", + "[MOD] " .. modname .. " is not compatible with current game version, " .. + "you can disable it in the game settings!" + ) + minetest.log("verbose", + "[MOD] " .. modname .. " requires a suitable version of 0.4.16-dev or higher, " .. + "that includes support for minetest.raycast() [since 7th July 2017]" + ) + end + + if minetest.is_singleplayer() then + -- delay message until player is connected + minetest.register_on_joinplayer(log_unavailable_error) + else + log_unavailable_error() + end + + -- exit here / do not load this mod + return end local BRUSH_MAX_DIST = 150 |