From 2661e900e7bab4aaa0d39b1b2d6db542d8d3eae9 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sun, 13 Aug 2023 11:02:47 +0100 Subject: [PATCH] tidy code --- dirt_monster.lua | 4 ++-- dungeon_master.lua | 4 ++-- fire_spirit.lua | 4 ++-- init.lua | 19 +++---------------- land_guard.lua | 5 ++--- lava_flan.lua | 4 ++-- mese_monster.lua | 3 ++- mod.conf | 3 ++- oerkki.lua | 4 ++-- sand_monster.lua | 4 ++-- spider.lua | 4 ++-- stone_monster.lua | 4 ++-- tree_monster.lua | 4 ++-- 13 files changed, 27 insertions(+), 39 deletions(-) diff --git a/dirt_monster.lua b/dirt_monster.lua index d0f4947..7f26efb 100644 --- a/dirt_monster.lua +++ b/dirt_monster.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") local dirt_types = { diff --git a/dungeon_master.lua b/dungeon_master.lua index 39c754e..b1cdbba 100644 --- a/dungeon_master.lua +++ b/dungeon_master.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") local master_types = { diff --git a/fire_spirit.lua b/fire_spirit.lua index 5a799bf..b6b62ce 100644 --- a/fire_spirit.lua +++ b/fire_spirit.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") local mob_drops = { {name = "fireflies:firefly", chance = 1, min = 1, max = 1} diff --git a/init.lua b/init.lua index c42be25..01dc580 100644 --- a/init.lua +++ b/init.lua @@ -2,21 +2,8 @@ -- Load support for intllib. local path = minetest.get_modpath(minetest.get_current_modname()) .. "/" --- Check for translation method -local S -if minetest.get_translator then - S = minetest.get_translator("mobs_monster") -- 5.x translation function -else -- boilerplate function - S = function(str, ...) - local args = {...} - return str:gsub("@%d+", function(match) - return args[tonumber(match:sub(2))] - end) - end -end - -mobs.intllib_monster = S - +-- Translation support +local S = minetest.get_translator("mobs_monster") -- Check for custom mob spawn file local input = io.open(path .. "spawn.lua", "r") @@ -65,4 +52,4 @@ if minetest.get_modpath("lucky_block") then end -print ("[MOD] Mobs Redo Monsters loaded") +print ("[MOD] Mobs Monster loaded") diff --git a/land_guard.lua b/land_guard.lua index 5199463..3e9ce2c 100644 --- a/land_guard.lua +++ b/land_guard.lua @@ -1,6 +1,5 @@ - -local S = mobs.intllib_monster - +-- Translation support +local S = minetest.get_translator("mobs_monster") local guard_types = { diff --git a/lava_flan.lua b/lava_flan.lua index 441efac..7d78973 100644 --- a/lava_flan.lua +++ b/lava_flan.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") -- Lava Flan by Zeg9 (additional textures by JurajVajda) diff --git a/mese_monster.lua b/mese_monster.lua index 237efda..2ad1a2e 100644 --- a/mese_monster.lua +++ b/mese_monster.lua @@ -1,4 +1,5 @@ -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") local mese_monster_types = { diff --git a/mod.conf b/mod.conf index c7dc111..6a784d8 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,5 @@ name = mobs_monster +description = Add many different monsters into your world. depends = mobs optional_depends = default, lucky_block, toolranks -description = Adds many types of monsters. +min_minetest_version = 5.0 diff --git a/oerkki.lua b/oerkki.lua index fe76c70..e8d02df 100644 --- a/oerkki.lua +++ b/oerkki.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") -- Oerkki by PilzAdam diff --git a/sand_monster.lua b/sand_monster.lua index 27618d9..3a7fb01 100644 --- a/sand_monster.lua +++ b/sand_monster.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") -- custom particle effects local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow) diff --git a/spider.lua b/spider.lua index 27c48e9..d6db1a9 100644 --- a/spider.lua +++ b/spider.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") local get_velocity = function(self) diff --git a/stone_monster.lua b/stone_monster.lua index 43e6e30..e3d47ec 100644 --- a/stone_monster.lua +++ b/stone_monster.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") local stone_types = { diff --git a/tree_monster.lua b/tree_monster.lua index 682c8d0..e28b8b5 100644 --- a/tree_monster.lua +++ b/tree_monster.lua @@ -1,5 +1,5 @@ - -local S = mobs.intllib_monster +-- Translation support +local S = minetest.get_translator("mobs_monster") local tree_types = {