Skip to content

Commit

Permalink
mobs_sharks - use settings framework
Browse files Browse the repository at this point in the history
  • Loading branch information
mckaygerhard committed Apr 22, 2024
1 parent 1cb5b7a commit 791d55d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
1 change: 1 addition & 0 deletions mobs_sharks/License.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Model/Textures: CC-BY-SA 3.0
Author: Sapier

texture modification by: blert2112
Code by blert2112, mckaygerhard
8 changes: 0 additions & 8 deletions mobs_sharks/SETTINGS.txt

This file was deleted.

19 changes: 12 additions & 7 deletions mobs_sharks/init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

local shark_large = minetest.settings:get_bool("mobs_sharks.enable_large", true)
local shark_medium = minetest.settings:get_bool("mobs_sharks.enable_medium", true)
local shark_small = minetest.settings:get_bool("mobs_sharks.enable_small", true)
local shark_spawn_chance = 60000

if mobs.mod and mobs.mod == "redo" then

-- local variables
Expand All @@ -23,22 +28,22 @@ if mobs.mod and mobs.mod == "redo" then
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
local l_spawn_chance = shark_spawn_chance

-- load settings
dofile(minetest.get_modpath("mobs_sharks").."/SETTINGS.txt")
if not ENABLE_SHARK_LARGE then
if not shark_large then
l_spawn_chance = l_spawn_chance - 20000
end
if not ENABLE_SHARK_MEDIUM then
if not shark_medium then
l_spawn_chance = l_spawn_chance - 20000
end
if not ENABLE_SHARK_SMALL then
if not shark_small then
l_spawn_chance = l_spawn_chance - 20000
end

-- large
if ENABLE_SHARK_LARGE then
if shark_large then
mobs:register_mob("mobs_sharks:shark_lg", {
type = "monster",
attack_type = "dogfight",
Expand Down Expand Up @@ -91,7 +96,7 @@ if mobs.mod and mobs.mod == "redo" then
end

-- medium
if ENABLE_SHARK_MEDIUM then
if shark_medium then
mobs:register_mob("mobs_sharks:shark_md", {
type = "monster",
attack_type = "dogfight",
Expand Down Expand Up @@ -129,7 +134,7 @@ if mobs.mod and mobs.mod == "redo" then
end

-- small
if ENABLE_SHARK_SMALL then
if shark_small then
mobs:register_mob("mobs_sharks:shark_sm", {
type = "monster",
attack_type = "dogfight",
Expand Down
4 changes: 4 additions & 0 deletions mobs_sharks/mod.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name = mobs_sharks
depends = default, mobs
optional_depends =
description = Adds sharks into your world.
8 changes: 8 additions & 0 deletions mobs_sharks/settingtypes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Enable large shark
mobs_sharks.enable_large (Enable large shark) bool true

# Enable medium shark
mobs_sharks.enable_medium (Enable medium shark) bool true

# Enable small shark
mobs_sharks.enable_small (Enable small shark) bool true

0 comments on commit 791d55d

Please sign in to comment.