From 580bd436724415155111f4cb11a6def9c499eb2c Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Tue, 2 Mar 2021 08:01:28 +0000 Subject: [PATCH] update license files and tidy code --- mobs_crocs/License.txt | 1 + mobs_crocs/init.lua | 80 ++++++++++++++----------- mobs_fish/License.txt | 1 + mobs_fish/init.lua | 78 +++++++++++++----------- mobs_jellyfish/License.txt | 2 +- mobs_jellyfish/init.lua | 11 ++-- mobs_sharks/License.txt | 1 + mobs_sharks/init.lua | 118 +++++++++++++++++++++---------------- mobs_turtles/License.txt | 1 + mobs_turtles/init.lua | 89 ++++++++++++++++------------ 10 files changed, 213 insertions(+), 169 deletions(-) diff --git a/mobs_crocs/License.txt b/mobs_crocs/License.txt index eb859b6..6025dea 100644 --- a/mobs_crocs/License.txt +++ b/mobs_crocs/License.txt @@ -1,4 +1,5 @@ Licenses +Code: MIT Model/Textures: GPL v3 Author: Team NPX diff --git a/mobs_crocs/init.lua b/mobs_crocs/init.lua index 61fb5c9..14a993a 100644 --- a/mobs_crocs/init.lua +++ b/mobs_crocs/init.lua @@ -1,26 +1,5 @@ -if minetest.get_modpath("mobs") and not mobs.mod and mobs.mod ~= "redo" then - minetest.log("error", "[mobs_crocs] mobs redo API not found!") - return -end - -- local variables -local l_skins = { - {"croco.png"}, - {"croco2.png"} -} - -local l_anims = { - speed_normal = 24, speed_run = 24, - stand_start = 0, stand_end = 80, - walk_start = 81, walk_end = 170, - run_start = 81, run_end = 170, - punch_start = 205, punch_end = 220 -} - -local l_model = "crocodile.x" -local l_sounds = {random = "croco"} -local l_egg_texture = "default_grass.png" local l_spawn_chance = 60000 -- load settings @@ -31,9 +10,11 @@ local ENABLE_SWIMMERS = minetest.settings:get_bool("mobs_crocs.enable_swimmers", if not ENABLE_WALKERS then l_spawn_chance = l_spawn_chance - 20000 end + if not ENABLE_FLOATERS then l_spawn_chance = l_spawn_chance - 20000 end + if not ENABLE_SWIMMERS then l_spawn_chance = l_spawn_chance - 20000 end @@ -52,10 +33,13 @@ if ENABLE_WALKERS then collisionbox = {-0.85, -0.30, -0.85, 0.85, 1.5, 0.85}, drawtype = "front", visual = "mesh", - mesh = l_model, - textures = l_skins, + mesh = "crocodile.x", + textures = { + {"croco.png"}, + {"croco2.png"} + }, visual_size = {x = 4, y = 4}, - sounds = l_sounds, + sounds = {random = "croco"}, fly = false, floats = 0, stepheight = 1, @@ -63,7 +47,13 @@ if ENABLE_WALKERS then water_damage = 0, lava_damage = 10, light_damage = 0, - animation = l_anims, + animation = { + speed_normal = 24, speed_run = 24, + stand_start = 0, stand_end = 80, + walk_start = 81, walk_end = 170, + run_start = 81, run_end = 170, + punch_start = 205, punch_end = 220 + }, drops = { {name = "mobs:meat_raw", chance = 1, min = 1, max = 3}, {name = "mobs:leather", chance = 1, min = 0, max = 2}, @@ -86,7 +76,7 @@ if ENABLE_WALKERS then max_height = 10, }) - mobs:register_egg("mobs_crocs:crocodile", "Crocodile", l_egg_texture, 1) + mobs:register_egg("mobs_crocs:crocodile", "Crocodile", "default_grass.png", 1) end -- float @@ -103,17 +93,26 @@ if ENABLE_FLOATERS then collisionbox = {-0.638, -0.23, -0.638, 0.638, 1.13, 0.638}, drawtype = "front", visual = "mesh", - mesh = l_model, - textures = l_skins, + mesh = "crocodile.x", + textures = { + {"croco.png"}, + {"croco2.png"} + }, visual_size = {x = 3, y = 3}, - sounds = l_sounds, + sounds = {random = "croco"}, fly = false, stepheight = 1, view_range = 10, water_damage = 0, lava_damage = 10, light_damage = 0, - animation = l_anims, + animation = { + speed_normal = 24, speed_run = 24, + stand_start = 0, stand_end = 80, + walk_start = 81, walk_end = 170, + run_start = 81, run_end = 170, + punch_start = 205, punch_end = 220 + }, drops = { {name = "mobs:meat_raw", chance = 1, min = 1, max = 3}, {name = "mobs:leather", chance = 1, min = 0, max = 2}, @@ -135,7 +134,7 @@ if ENABLE_FLOATERS then }) mobs:register_egg("mobs_crocs:crocodile_float", "Crocodile (floater)", - l_egg_texture, 1) + "default_grass.png", 1) end -- swim @@ -152,10 +151,13 @@ if ENABLE_SWIMMERS then collisionbox = {-0.425, -0.15, -0.425, 0.425, 0.75, 0.425}, drawtype = "front", visual = "mesh", - mesh = l_model, - textures = l_skins, + mesh = "crocodile.x", + textures = { + {"croco.png"}, + {"croco2.png"} + }, visual_size = {x = 2, y = 2}, - sounds = l_sounds, + sounds = {random = "croco"}, fly = true, fly_in = "default:water_source", fall_speed = -1, @@ -164,7 +166,13 @@ if ENABLE_SWIMMERS then water_damage = 0, lava_damage = 10, light_damage = 0, - animation = l_anims, + animation = { + speed_normal = 24, speed_run = 24, + stand_start = 0, stand_end = 80, + walk_start = 81, walk_end = 170, + run_start = 81, run_end = 170, + punch_start = 205, punch_end = 220 + }, drops = { {name = "mobs:meat_raw", chance = 1, min = 1, max = 3}, {name = "mobs:leather", chance = 1, min = 0, max = 2}, @@ -182,5 +190,5 @@ if ENABLE_SWIMMERS then }) mobs:register_egg("mobs_crocs:crocodile_swim", "Crocodile (swimmer)", - l_egg_texture, 1) + "default_grass.png", 1) end diff --git a/mobs_fish/License.txt b/mobs_fish/License.txt index 76852f6..e1b8def 100644 --- a/mobs_fish/License.txt +++ b/mobs_fish/License.txt @@ -1,5 +1,6 @@ Licenses +Code: MIT Model/Textures: CC-BY-SA 3.0 Author: Sapier diff --git a/mobs_fish/init.lua b/mobs_fish/init.lua index ede688c..11643e9 100644 --- a/mobs_fish/init.lua +++ b/mobs_fish/init.lua @@ -1,33 +1,9 @@ -if minetest.get_modpath("mobs") and not mobs.mod and mobs.mod ~= "redo" then - minetest.log("error", "[mobs_fish] mobs redo API not found!") - return -end - -local SPRITE_VERSION = false -- set to true to use upright sprites instead of meshes +local SPRITE_VERSION = false -- set to true to use upright sprites instead of meshes -- local variables -local l_spawn_in = { - "default:water_source", "default:water_flowing", - "default:river_water_source", "default:river_water_flowing" -} -local l_spawn_near = { - "default:sand","default:dirt","group:seaplants","group:seacoral" -} local l_spawn_chance = 10000 -local l_cc_hand = 25 -local l_cc_net = 80 local l_water_level = minetest.settings:get("water_level") - 1 -local l_anims = { - speed_normal = 24, - speed_run = 24, - stand_start = 1, - stand_end = 80, - walk_start = 81, - walk_end = 155, - run_start = 81, - run_end = 155 -} local l_visual = "mesh" local l_visual_size = {x = .75, y = .75} local l_clown_mesh = "animal_clownfish.b3d" @@ -71,14 +47,25 @@ mobs:register_mob("mobs_fish:clownfish", { fall_speed = 0, view_range = 8, water_damage = 0, - air_damage = 1, + air_damage = 0, lava_damage = 5, light_damage = 0, - animation = l_anims, + animation = { + speed_normal = 24, + speed_run = 24, + stand_start = 1, + stand_end = 80, + walk_start = 81, + walk_end = 155, + run_start = 81, + run_end = 155 + }, + on_rightclick = function(self, clicker) - mobs:capture_mob(self, clicker, l_cc_hand, l_cc_net, 0, true, + mobs:capture_mob(self, clicker, 25, 80, 0, true, "mobs_fish:clownfish") end, + on_flop = function(self) -- print("=== am on land, help!", self.state) @@ -97,8 +84,13 @@ mobs:register_mob("mobs_fish:clownfish", { mobs:spawn({ name = "mobs_fish:clownfish", - nodes = l_spawn_in, - neighbors = l_spawn_near, + nodes = { + "default:water_source", "default:water_flowing", + "default:river_water_source", "default:river_water_flowing" + }, + neighbors = { + "default:sand","default:dirt","group:seaplants","group:seacoral" + }, min_light = 5, interval = 30, chance = l_spawn_chance, @@ -131,12 +123,23 @@ mobs:register_mob("mobs_fish:tropical", { water_damage = 0, lava_damage = 5, light_damage = 0, - air_damage = 1, - animation = l_anims, + air_damage = 0, + animation = { + speed_normal = 24, + speed_run = 24, + stand_start = 1, + stand_end = 80, + walk_start = 81, + walk_end = 155, + run_start = 81, + run_end = 155 + }, + on_rightclick = function(self, clicker) - mobs:capture_mob(self, clicker, l_cc_hand, l_cc_net, 0, true, + mobs:capture_mob(self, clicker, 25, 80, 0, true, "mobs_fish:tropical") end, + on_flop = function(self) -- print("=== am on land, help!", self.state) @@ -155,8 +158,13 @@ mobs:register_mob("mobs_fish:tropical", { mobs:spawn({ name = "mobs_fish:tropical", - nodes = l_spawn_in, - neighbors = l_spawn_near, + nodes = { + "default:water_source", "default:water_flowing", + "default:river_water_source", "default:river_water_flowing" + }, + neighbors = { + "default:sand","default:dirt","group:seaplants","group:seacoral" + }, min_light = 5, interval = 30, chance = l_spawn_chance, diff --git a/mobs_jellyfish/License.txt b/mobs_jellyfish/License.txt index f10d72f..680a3c7 100644 --- a/mobs_jellyfish/License.txt +++ b/mobs_jellyfish/License.txt @@ -1,5 +1,6 @@ Licenses +Code: MIT Model/Textures: WTFPL Author: blert2112 @@ -18,4 +19,3 @@ Author: blert2112 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. - \ No newline at end of file diff --git a/mobs_jellyfish/init.lua b/mobs_jellyfish/init.lua index c7f6c13..f1e5617 100644 --- a/mobs_jellyfish/init.lua +++ b/mobs_jellyfish/init.lua @@ -1,18 +1,14 @@ -if minetest.get_modpath("mobs") and not mobs.mod and mobs.mod ~= "redo" then - minetest.log("error", "[mobs_jellyfish] mobs redo API not found!") - return -end - mobs:register_mob("mobs_jellyfish:jellyfish", { type = "animal", attack_type = "dogfight", + passive = false, damage = 5, reach = 1, hp_min = 5, hp_max = 10, armor = 100, - collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, + collisionbox = {-0.1, -0.25, -0.1, 0.1, 0.25, 0.1}, visual = "mesh", mesh = "jellyfish.b3d", textures = { @@ -28,6 +24,7 @@ mobs:register_mob("mobs_jellyfish:jellyfish", { water_damage = 0, lava_damage = 5, light_damage = 0, + on_rightclick = function(self, clicker) mobs:capture_mob(self, clicker, 80, 100, 0, true, "mobs_jellyfish:jellyfish") @@ -37,7 +34,7 @@ mobs:register_mob("mobs_jellyfish:jellyfish", { mobs:spawn({ name = "mobs_jellyfish:jellyfish", nodes = {"default:water_source"}, - neighbors = {"default:water_flowing","default:water_source"}, + neighbors = {"default:water_flowing", "default:water_source"}, min_light = 5, interval = 30, chance = 10000, diff --git a/mobs_sharks/License.txt b/mobs_sharks/License.txt index 0ce650a..40cbb01 100644 --- a/mobs_sharks/License.txt +++ b/mobs_sharks/License.txt @@ -1,5 +1,6 @@ Licenses +Code: MIT Model/Textures: CC-BY-SA 3.0 http://creativecommons.org/licenses/by-sa/3.0/de/legalcode Author: Sapier diff --git a/mobs_sharks/init.lua b/mobs_sharks/init.lua index 0021956..1f73efc 100644 --- a/mobs_sharks/init.lua +++ b/mobs_sharks/init.lua @@ -1,64 +1,41 @@ - -if minetest.get_modpath("mobs") and not mobs.mod and mobs.mod ~= "redo" then - minetest.log("error", "[mobs_sharks] mobs redo API not found!") - return -end - -- local variables -local l_colors = { - "#604000:175", --brown - "#ffffff:150", --white - "#404040:150", --dark_grey - "#a0a0a0:150" --grey -} local l_skins = { { - "(shark_first.png^[colorize:" .. l_colors[3] - .. ")^(shark_second.png^[colorize:" .. l_colors[4] + "(shark_first.png^[colorize:#404040:150" -- dark grey + .. ")^(shark_second.png^[colorize:#a0a0a0:150" -- grey .. ")^shark_third.png" }, { - "(shark_first.png^[colorize:" .. l_colors[1] - .. ")^(shark_second.png^[colorize:" .. l_colors[2] + "(shark_first.png^[colorize:#604000:175" -- brown + .. ")^(shark_second.png^[colorize:#ffffff:150" -- white ..")^shark_third.png" }, { - "(shark_first.png^[colorize:" .. l_colors[4] - .. ")^(shark_second.png^[colorize:" .. l_colors[2] + "(shark_first.png^[colorize:#a0a0a0:150" -- grey + .. ")^(shark_second.png^[colorize:#ffffff:150" -- white .. ")^shark_third.png" } } -local l_anims = { - speed_normal = 24, - speed_run = 24, - stand_start = 1, - stand_end = 80, - walk_start = 80, - walk_end = 160, - run_start = 80, - run_end = 160 -} -local l_model = "mob_shark.b3d" -local l_egg_texture = "mob_shark_shark_item.png" -local l_spawn_in = {"default:water_flowing","default:water_source"} -local l_spawn_near = { - "default:water_flowing", "default:water_source", - "seawrecks:woodship", "seawrecks:uboot" -} + + local l_spawn_chance = 60000 -- load settings -dofile(minetest.get_modpath("mobs_sharks").."/SETTINGS.txt") +dofile(minetest.get_modpath("mobs_sharks") .. "/SETTINGS.txt") + if not ENABLE_SHARK_LARGE then l_spawn_chance = l_spawn_chance - 20000 end + if not ENABLE_SHARK_MEDIUM then l_spawn_chance = l_spawn_chance - 20000 end + if not ENABLE_SHARK_SMALL then l_spawn_chance = l_spawn_chance - 20000 end + -- large if ENABLE_SHARK_LARGE then @@ -72,7 +49,7 @@ if ENABLE_SHARK_LARGE then armor = 150, collisionbox = {-0.75, -0.5, -0.75, 0.75, 0.5, 0.75}, visual = "mesh", - mesh = l_model, + mesh = "mob_shark.b3d", textures = l_skins, makes_footstep_sound = false, walk_velocity = 4, @@ -85,7 +62,16 @@ if ENABLE_SHARK_LARGE then water_damage = 0, lava_damage = 10, light_damage = 0, - animation = l_anims, + animation = { + speed_normal = 24, + speed_run = 24, + stand_start = 1, + stand_end = 80, + walk_start = 80, + walk_end = 160, + run_start = 80, + run_end = 160 + }, jump = false, stepheight = 0, drops = { @@ -95,14 +81,18 @@ if ENABLE_SHARK_LARGE then mobs:spawn({ name = "mobs_sharks:shark_lg", - nodes = l_spawn_in, - neighbors = l_spawn_near, + nodes = {"default:water_flowing","default:water_source"}, + neighbors = { + "default:water_flowing", "default:water_source", + "seawrecks:woodship", "seawrecks:uboot" + }, interval = 30, chance = l_spawn_chance, max_height = 0, }) - mobs:register_egg("mobs_sharks:shark_lg", "Shark (large)", l_egg_texture, 0) + mobs:register_egg("mobs_sharks:shark_lg", "Shark (large)", + "mob_shark_shark_item.png", 0) end -- medium @@ -119,7 +109,7 @@ if ENABLE_SHARK_MEDIUM then collisionbox = {-0.57, -0.38, -0.57, 0.57, 0.38, 0.57}, visual = "mesh", visual_size = {x = 0.75, y = 0.75}, - mesh = l_model, + mesh = "mob_shark.b3d", textures = l_skins, makes_footstep_sound = false, walk_velocity = 2, @@ -132,7 +122,16 @@ if ENABLE_SHARK_MEDIUM then water_damage = 0, lava_damage = 10, light_damage = 0, - animation = l_anims, + animation = { + speed_normal = 24, + speed_run = 24, + stand_start = 1, + stand_end = 80, + walk_start = 80, + walk_end = 160, + run_start = 80, + run_end = 160 + }, jump = false, stepheight = 0, drops = { @@ -142,14 +141,18 @@ if ENABLE_SHARK_MEDIUM then mobs:spawn({ name = "mobs_sharks:shark_md", - nodes = l_spawn_in, - neighbors = l_spawn_near, + nodes = {"default:water_flowing","default:water_source"}, + neighbors = { + "default:water_flowing", "default:water_source", + "seawrecks:woodship", "seawrecks:uboot" + }, interval = 30, chance = l_spawn_chance, max_height = 0, }) - mobs:register_egg("mobs_sharks:shark_md", "Shark (medium)", l_egg_texture, 0) + mobs:register_egg("mobs_sharks:shark_md", "Shark (medium)", + "mob_shark_shark_item.png", 0) end -- small @@ -166,7 +169,7 @@ if ENABLE_SHARK_SMALL then collisionbox = {-0.38, -0.25, -0.38, 0.38, 0.25, 0.38}, visual = "mesh", visual_size = {x = 0.5, y = 0.5}, - mesh = l_model, + mesh = "mob_shark.b3d", textures = l_skins, makes_footstep_sound = false, walk_velocity = 2, @@ -179,7 +182,16 @@ if ENABLE_SHARK_SMALL then water_damage = 0, lava_damage = 10, light_damage = 0, - animation = l_anims, + animation = { + speed_normal = 24, + speed_run = 24, + stand_start = 1, + stand_end = 80, + walk_start = 80, + walk_end = 160, + run_start = 80, + run_end = 160 + }, jump = false, stepheight = 0, drops = { @@ -189,12 +201,16 @@ if ENABLE_SHARK_SMALL then mobs:spawn({ name = "mobs_sharks:shark_sm", - nodes = l_spawn_in, - neighbors = l_spawn_near, + nodes = {"default:water_flowing","default:water_source"}, + neighbors = { + "default:water_flowing", "default:water_source", + "seawrecks:woodship", "seawrecks:uboot" + }, interval = 30, chance = l_spawn_chance, max_height = 0, }) - mobs:register_egg("mobs_sharks:shark_sm", "Shark (small)", l_egg_texture, 0) + mobs:register_egg("mobs_sharks:shark_sm", "Shark (small)", + "mob_shark_shark_item.png", 0) end diff --git a/mobs_turtles/License.txt b/mobs_turtles/License.txt index 2b26bff..066c04d 100644 --- a/mobs_turtles/License.txt +++ b/mobs_turtles/License.txt @@ -1,4 +1,5 @@ Licenses +Code: MIT Model/textures: unknown Author: AspireMint diff --git a/mobs_turtles/init.lua b/mobs_turtles/init.lua index b8443b2..5740939 100644 --- a/mobs_turtles/init.lua +++ b/mobs_turtles/init.lua @@ -1,40 +1,14 @@ -if minetest.get_modpath("mobs") and not mobs.mod and mobs.mod ~= "redo" then - minetest.log("error", "[mobs_turtles] mobs redo API not found!") - return -end - -local l_colors = { - "#604000:175", --brown - "#604000:100", --brown2 - "#ffffff:150", --white - "#404040:150", --dark_grey - "#a0a0a0:150", --grey - "#808000:150", --olive - "#ff0000:150" --red -} local l_skins = { {"turtle1.png^turtle2.png^turtle3.png^turtle4.png" .. "^turtle5.png^turtle6.png^turtle7.png"}, - {"turtle1.png^(turtle2.png^[colorize:" .. l_colors[5] - .. ")^(turtle3.png^[colorize:" .. l_colors[4] - .. ")^(turtle4.png^[colorize:" .. l_colors[1] - .. ")^(turtle5.png^[colorize:" .. l_colors[2] - .. ")^(turtle6.png^[colorize:" .. l_colors[6] .. ")^turtle7.png"} + {"turtle1.png^(turtle2.png^[colorize:#a0a0a0:150" -- grey + .. ")^(turtle3.png^[colorize:#404040:150" -- dark grey + .. ")^(turtle4.png^[colorize:#604000:175" -- brown + .. ")^(turtle5.png^[colorize:#604000:100" -- brown 2 + .. ")^(turtle6.png^[colorize:#808000:150" .. ")^turtle7.png"} -- olive } -local l_anims = { - speed_normal = 24, - speed_run = 24, - stand_start = 1, - stand_end = 50, - walk_start = 60, - walk_end = 90, - run_start = 60, - run_end = 90, - hide_start = 95, - hide_end = 100 -} -local l_model = "mobf_turtle.x" + local l_spawn_chance = 30000 -- land turtle @@ -46,7 +20,7 @@ mobs:register_mob("mobs_turtles:turtle", { armor = 200, collisionbox = {-0.4, 0.0, -0.4, 0.4, 0.35, 0.4}, visual = "mesh", - mesh = l_model, + mesh = "mobf_turtle.x", textures = l_skins, makes_footstep_sound = false, view_range = 8, @@ -60,21 +34,47 @@ mobs:register_mob("mobs_turtles:turtle", { lava_damage = 5, light_damage = 0, fall_damage = 1, - animation = l_anims, + animation = { + speed_normal = 24, + speed_run = 24, + stand_start = 1, + stand_end = 50, + walk_start = 60, + walk_end = 90, + run_start = 60, + run_end = 90, + hide_start = 95, + hide_end = 100 + }, drops = { {name = "mobs:meat_raw", chance = 1, min = 1, max = 3}, }, follow = "farming:carrot", + on_rightclick = function(self, clicker) - self.state = "" + + self.state = "hide" -- was "" + mobs:set_velocity(self, 0) + self.object:set_animation( {x = self.animation.hide_start, y = self.animation.hide_end}, self.animation.speed_normal, 0) + minetest.after(5, function() - self.state = "stand" + if self and self.object then + self.state = "stand" + end end) + mobs:capture_mob(self, clicker, 0, 80, 100, true, nil) + end, + + do_custom = function(self, dtime) + + if self.state == "hide" then + mobs:set_velocity(self, 0) + end end }) @@ -108,7 +108,7 @@ mobs:register_mob("mobs_turtles:seaturtle", { collisionbox = {-0.8, 0.0, -0.8, 0.8, 0.7, 0.8}, visual = "mesh", visual_size = {x = 2, y = 2}, - mesh = l_model, + mesh = "mobf_turtle.x", textures = l_skins, makes_footstep_sound = false, view_range = 10, @@ -125,7 +125,18 @@ mobs:register_mob("mobs_turtles:seaturtle", { lava_damage = 5, light_damage = 0, fall_damage = 0, - animation = l_anims, + animation = { + speed_normal = 24, + speed_run = 24, + stand_start = 1, + stand_end = 50, + walk_start = 60, + walk_end = 90, + run_start = 60, + run_end = 90, + hide_start = 95, + hide_end = 100 + }, drops = { {name = "mobs:meat_raw", chance = 1, min = 1, max = 3}, }, @@ -139,7 +150,7 @@ mobs:spawn({ nodes = {"default:water_flowing","default:water_source"}, neighbors = { "default:water_flowing", "default:water_source", "group:seaplants", - "seawrecks:woodship", "seawrecks:uboot" + "seawrecks:woodship", "seawrecks:uboot" }, min_light = 5, interval = 30,