1
0
mirror of https://codeberg.org/tenplus1/mobs_monster.git synced 2024-11-13 06:10:20 +01:00

code tidy

This commit is contained in:
tenplus1 2022-09-27 11:27:47 +01:00
parent 1ee293dae0
commit 84a9b630ce
11 changed files with 188 additions and 183 deletions

View File

@ -29,19 +29,19 @@ mobs:register_mob("mobs_monster:dirt_monster", {
mesh = "mobs_stone_monster.b3d",
textures = {
{"mobs_dirt_monster.png"},
{"mobs_dirt_monster2.png"},
{"mobs_dirt_monster2.png"}
},
blood_texture = "default_dirt.png",
makes_footstep_sound = true,
sounds = {
random = "mobs_dirtmonster",
random = "mobs_dirtmonster"
},
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
jump = true,
drops = {
{name = "default:dirt", chance = 1, min = 0, max = 2},
{name = "default:dirt", chance = 1, min = 0, max = 2}
},
water_damage = 1,
lava_damage = 5,
@ -57,7 +57,7 @@ mobs:register_mob("mobs_monster:dirt_monster", {
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
punch_end = 63
},
-- check surrounding nodes and spawn a specific monster
@ -89,16 +89,17 @@ mobs:register_mob("mobs_monster:dirt_monster", {
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:dirt_monster",
nodes = {"default:dirt_with_grass", "ethereal:gray_dirt", "ethereal:dry_dirt"},
min_light = 0,
max_light = 7,
chance = 6000,
active_object_count = 2,
min_height = 0,
day_toggle = false,
})
mobs:spawn({
name = "mobs_monster:dirt_monster",
nodes = {"default:dirt_with_grass", "ethereal:gray_dirt", "ethereal:dry_dirt"},
min_light = 0,
max_light = 7,
chance = 6000,
active_object_count = 2,
min_height = 0,
day_toggle = false
})
end

View File

@ -35,12 +35,12 @@ mobs:register_mob("mobs_monster:dungeon_master", {
textures = {
{"mobs_dungeon_master.png"},
{"mobs_dungeon_master2.png"},
{"mobs_dungeon_master3.png"},
{"mobs_dungeon_master3.png"}
},
makes_footstep_sound = true,
sounds = {
random = "mobs_dungeonmaster",
shoot_attack = "mobs_fireball",
shoot_attack = "mobs_fireball"
},
walk_velocity = 1,
run_velocity = 3,
@ -51,7 +51,7 @@ mobs:register_mob("mobs_monster:dungeon_master", {
{name = "mobs:leather", chance = 2, min = 0, max = 2},
{name = "default:mese_crystal", chance = 3, min = 0, max = 2},
{name = "default:diamond", chance = 4, min = 0, max = 1},
{name = "default:diamondblock", chance = 30, min = 0, max = 1},
{name = "default:diamondblock", chance = 30, min = 0, max = 1}
},
water_damage = 1,
lava_damage = 1,
@ -67,7 +67,7 @@ mobs:register_mob("mobs_monster:dungeon_master", {
shoot_start = 36,
shoot_end = 48,
speed_normal = 15,
speed_run = 15,
speed_run = 15
},
-- check surrounding nodes and spawn a specific monster
@ -99,14 +99,15 @@ mobs:register_mob("mobs_monster:dungeon_master", {
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:dungeon_master",
nodes = {"default:stone", "nether:rack", "nether:rack_deep"},
max_light = 5,
chance = 9000,
active_object_count = 1,
max_height = -70,
})
mobs:spawn({
name = "mobs_monster:dungeon_master",
nodes = {"default:stone", "nether:rack", "nether:rack_deep"},
max_light = 5,
chance = 9000,
active_object_count = 1,
max_height = -70
})
end
@ -149,7 +150,7 @@ mobs:register_arrow("mobs_monster:fireball", {
self.object:set_velocity({
x = dir.x * self.velocity,
y = dir.y * self.velocity,
z = dir.z * self.velocity,
z = dir.z * self.velocity
})
end
end
@ -159,14 +160,14 @@ mobs:register_arrow("mobs_monster:fireball", {
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
damage_groups = {fleshy = 8}
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
damage_groups = {fleshy = 8}
}, nil)
end,

View File

@ -82,16 +82,17 @@ mobs:register_mob("mobs_monster:fire_spirit", {
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:fire_spirit",
nodes = {"default:obsidian", "caverealms:hot_cobble"},
neighbors = {"group:fire"},
min_light = 12,
max_light = 15,
chance = 1500,
active_object_count = 1,
max_height = -150
})
mobs:spawn({
name = "mobs_monster:fire_spirit",
nodes = {"default:obsidian", "caverealms:hot_cobble"},
neighbors = {"group:fire"},
min_light = 12,
max_light = 15,
chance = 1500,
active_object_count = 1,
max_height = -150
})
end

View File

@ -2,8 +2,6 @@
-- Load support for intllib.
local path = minetest.get_modpath(minetest.get_current_modname()) .. "/"
local S
-- Check for translation method
local S
if minetest.get_translator ~= nil then
@ -12,11 +10,10 @@ else
if minetest.get_modpath("intllib") then
dofile(minetest.get_modpath("intllib") .. "/init.lua")
if intllib.make_gettext_pair then
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
S = intllib.make_gettext_pair() -- new gettext method
else
gettext = intllib.Getter() -- old text file method
S = intllib.Getter() -- old text file method
end
S = gettext
else -- boilerplate function
S = function(str, ...)
local args = {...}
@ -61,7 +58,9 @@ end
-- Lucky Blocks
dofile(path .. "lucky_block.lua")
if minetest.get_modpath("lucky_block") then
dofile(path .. "lucky_block.lua")
end
print ("[MOD] Mobs Redo Monsters loaded")

View File

@ -1,42 +1,37 @@
local web = {name = "mobs:cobweb"}
local web_trap = {
size = {x = 3, y = 3, z = 3},
data = {
web, web, web,
web, web, web,
web, web, web,
if minetest.get_modpath("lucky_block") then
web, web, web,
web, web, web,
web, web, web,
local web = {name = "mobs:cobweb"}
local web_trap = {
size = {x = 3, y = 3, z = 3},
data = {
web, web, web,
web, web, web,
web, web, web,
web, web, web,
web, web, web,
web, web, web,
web, web, web,
web, web, web,
web, web, web,
},
web, web, web,
web, web, web,
web, web, web
}
}
lucky_block:add_schematics({
{"webtrap", web_trap, {x = 1, y = 0, z = 1}},
})
lucky_block:add_schematics({
{"webtrap", web_trap, {x = 1, y = 0, z = 1}},
})
lucky_block:add_blocks({
{"sch", "webtrap", 1, true},
{"spw", "mobs:dungeon_master", 1, nil, nil, 3, "Billy"},
{"spw", "mobs:sand_monster", 3},
{"spw", "mobs:stone_monster", 3, nil, nil, 3, "Bob"},
{"spw", "mobs:dirt_monster", 3},
{"spw", "mobs:tree_monster", 3},
{"spw", "mobs:oerkki", 3},
{"exp"},
{"spw", "mobs:spider", 5},
{"spw", "mobs:mese_monster", 2},
{"spw", "mobs:lava_flan", 3},
{"nod", "default:chest", 0, {
{name = "mobs:lava_orb", max = 1}}},
})
end
lucky_block:add_blocks({
{"sch", "webtrap", 1, true},
{"spw", "mobs:dungeon_master", 1, nil, nil, 3, "Billy"},
{"spw", "mobs:sand_monster", 3},
{"spw", "mobs:stone_monster", 3, nil, nil, 3, "Bob"},
{"spw", "mobs:dirt_monster", 3},
{"spw", "mobs:tree_monster", 3},
{"spw", "mobs:oerkki", 3},
{"exp"},
{"spw", "mobs:spider", 5},
{"spw", "mobs:mese_monster", 2},
{"spw", "mobs:lava_flan", 3},
{"nod", "default:chest", 0, {
{name = "mobs:lava_orb", max = 1}}},
})

View File

@ -144,9 +144,9 @@ mobs:register_mob("mobs_monster:mese_monster", {
shoot_interval = 0.5,
arrow = "mobs_monster:mese_arrow",
shoot_offset = 0.75,
--arrow_override = function(self)
-- self.velocity = 20
--end,
-- arrow_override = function(self)
-- self.velocity = 20
-- end,
knock_back = true,
hp_min = 10,
hp_max = 25,
@ -296,14 +296,14 @@ mobs:register_arrow("mobs_monster:mese_arrow", {
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage},
damage_groups = {fleshy = self.damage}
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage},
damage_groups = {fleshy = self.damage}
}, nil)
end,
@ -313,14 +313,15 @@ mobs:register_arrow("mobs_monster:mese_arrow", {
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:mese_monster",
nodes = {"default:stone"},
max_light = 7,
chance = 5000,
active_object_count = 1,
max_height = -20
})
mobs:spawn({
name = "mobs_monster:mese_monster",
nodes = {"default:stone"},
max_light = 7,
chance = 5000,
active_object_count = 1,
max_height = -20
})
end

View File

@ -19,11 +19,11 @@ mobs:register_mob("mobs_monster:oerkki", {
textures = {
{"mobs_oerkki.png"},
{"mobs_oerkki2.png"},
{"mobs_oerkki3.png"},
{"mobs_oerkki3.png"}
},
makes_footstep_sound = false,
sounds = {
random = "mobs_oerkki",
random = "mobs_oerkki"
},
walk_velocity = 1,
run_velocity = 3,
@ -31,7 +31,7 @@ mobs:register_mob("mobs_monster:oerkki", {
jump = true,
drops = {
{name = "default:obsidian", chance = 3, min = 0, max = 2},
{name = "default:gold_lump", chance = 2, min = 0, max = 2},
{name = "default:gold_lump", chance = 2, min = 0, max = 2}
},
water_damage = 2,
lava_damage = 4,
@ -47,7 +47,7 @@ mobs:register_mob("mobs_monster:oerkki", {
punch_start = 37,
punch_end = 49,
speed_normal = 15,
speed_run = 15,
speed_run = 15
},
replace_rate = 5,
replace_what = {"default:torch"},
@ -55,19 +55,20 @@ mobs:register_mob("mobs_monster:oerkki", {
replace_offset = -1,
immune_to = {
{"default:sword_wood", 0}, -- no damage
{"default:gold_lump", -10}, -- heals by 10 points
{"default:gold_lump", -10} -- heals by 10 points
},
})
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:oerkki",
nodes = {"default:stone"},
max_light = 7,
chance = 7000,
max_height = -10,
})
mobs:spawn({
name = "mobs_monster:oerkki",
nodes = {"default:stone"},
max_light = 7,
chance = 7000,
max_height = -10
})
end

View File

@ -2,8 +2,7 @@
local S = mobs.intllib_monster
-- custom particle effects
local effect = function(
pos, amount, texture, min_size, max_size, radius, gravity, glow)
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
radius = radius or 2
min_size = min_size or 0.5
@ -25,7 +24,7 @@ local effect = function(
minsize = min_size,
maxsize = max_size,
texture = texture,
glow = glow,
glow = glow
})
end
@ -49,20 +48,20 @@ mobs:register_mob("mobs_monster:sand_monster", {
mesh = "mobs_sand_monster.b3d",
textures = {
{"mobs_sand_monster.png"},
{"mobs_sand_monster2.png"},
{"mobs_sand_monster2.png"}
},
blood_texture = "default_desert_sand.png",
makes_footstep_sound = true,
sounds = {
random = "mobs_sandmonster",
random = "mobs_sandmonster"
},
walk_velocity = 1.5,
run_velocity = 4,
view_range = 8, --15
view_range = 8,
jump = true,
floats = 0,
drops = {
{name = "default:desert_sand", chance = 1, min = 3, max = 5},
{name = "default:desert_sand", chance = 1, min = 3, max = 5}
},
water_damage = 3,
lava_damage = 4,
@ -78,7 +77,7 @@ mobs:register_mob("mobs_monster:sand_monster", {
run_start = 74,
run_end = 105,
punch_start = 74,
punch_end = 105,
punch_end = 105
},
immune_to = {
{"default:shovel_wood", 3}, -- shovels deal more damage to sand monster
@ -86,7 +85,7 @@ mobs:register_mob("mobs_monster:sand_monster", {
{"default:shovel_bronze", 4},
{"default:shovel_steel", 4},
{"default:shovel_mese", 5},
{"default:shovel_diamond", 7},
{"default:shovel_diamond", 7}
},
--[[
custom_attack = function(self, p)
@ -118,17 +117,19 @@ mobs:register_mob("mobs_monster:sand_monster", {
})
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:sand_monster",
nodes = {"default:desert_sand"},
chance = 7000,
active_object_count = 2,
min_height = 0,
})
mobs:spawn({
name = "mobs_monster:sand_monster",
nodes = {"default:desert_sand"},
chance = 7000,
active_object_count = 2,
min_height = 0
})
end
mobs:register_egg("mobs_monster:sand_monster", S("Sand Monster"), "default_desert_sand.png", 1)
mobs:register_egg("mobs_monster:sand_monster", S("Sand Monster"),
"default_desert_sand.png", 1)
mobs:alias_mob("mobs:sand_monster", "mobs_monster:sand_monster") -- compatibility

View File

@ -74,12 +74,12 @@ mobs:register_mob("mobs_monster:spider", {
{"mobs_spider_orange.png"},
{"mobs_spider_snowy.png"},
{"mobs_spider_grey.png"},
{"mobs_spider_crystal.png"},
{"mobs_spider_crystal.png"}
},
makes_footstep_sound = false,
sounds = {
random = "mobs_spider",
attack = "mobs_spider",
attack = "mobs_spider"
},
walk_velocity = 1,
run_velocity = 3,
@ -87,7 +87,7 @@ mobs:register_mob("mobs_monster:spider", {
view_range = 15,
floats = 0,
drops = {
{name = "farming:string", chance = 1, min = 0, max = 2},
{name = "farming:string", chance = 1, min = 0, max = 2}
},
water_damage = 5,
lava_damage = 5,
@ -102,7 +102,7 @@ mobs:register_mob("mobs_monster:spider", {
run_start = 1,
run_end = 21,
punch_start = 25,
punch_end = 45,
punch_end = 45
},
-- check surrounding nodes and spawn a specific spider
@ -224,32 +224,33 @@ mobs:register_mob("mobs_monster:spider", {
if not mobs.custom_spawn_monster then
-- above ground spawn
mobs:spawn({
name = "mobs_monster:spider",
nodes = {
"default:dirt_with_rainforest_litter", "default:snowblock",
"default:snow", "ethereal:crystal_dirt", "ethereal:cold_dirt"
},
min_light = 0,
max_light = 8,
chance = 7000,
active_object_count = 1,
min_height = 25,
max_height = 31000,
})
-- below ground spawn
mobs:spawn({
name = "mobs_monster:spider",
nodes = {"default:stone_with_mese", "default:mese", "default:stone"},
min_light = 0,
max_light = 7,
chance = 7000,
active_object_count = 1,
min_height = -31000,
max_height = -40,
})
-- above ground spawn
mobs:spawn({
name = "mobs_monster:spider",
nodes = {
"default:dirt_with_rainforest_litter", "default:snowblock",
"default:snow", "ethereal:crystal_dirt", "ethereal:cold_dirt"
},
min_light = 0,
max_light = 8,
chance = 7000,
active_object_count = 1,
min_height = 25,
max_height = 31000
})
-- below ground spawn
mobs:spawn({
name = "mobs_monster:spider",
nodes = {"default:stone_with_mese", "default:mese", "default:stone"},
min_light = 0,
max_light = 7,
chance = 7000,
active_object_count = 1,
min_height = -31000,
max_height = -40
})
end
@ -286,13 +287,15 @@ minetest.register_craft({
recipe = {
{"farming:string", "", "farming:string"},
{"", "farming:string", ""},
{"farming:string", "", "farming:string"},
{"farming:string", "", "farming:string"}
}
})
local web_place = function(pos)
if minetest.find_node_near(pos, 1, {"ignore"}) then return end
local pos2 = minetest.find_node_near(pos, 1, {"air", "group:leaves"}, true)
if pos2 then
@ -316,7 +319,7 @@ mobs:register_arrow("mobs_monster:cobweb", {
player:punch(self.object, 1.0, {
full_punch_interval = 2.0,
damage_groups = {fleshy = 3},
damage_groups = {fleshy = 3}
}, nil)
web_place(self.object:get_pos())
@ -330,7 +333,7 @@ mobs:register_arrow("mobs_monster:cobweb", {
player:punch(self.object, 1.0, {
full_punch_interval = 2.0,
damage_groups = {fleshy = 3},
damage_groups = {fleshy = 3}
}, nil)
end
})

View File

@ -31,11 +31,11 @@ mobs:register_mob("mobs_monster:stone_monster", {
mesh = "mobs_stone_monster.b3d",
textures = {
{"mobs_stone_monster.png"},
{"mobs_stone_monster2.png"}, -- by AMMOnym
{"mobs_stone_monster2.png"} -- by AMMOnym
},
makes_footstep_sound = true,
sounds = {
random = "mobs_stonemonster",
random = "mobs_stonemonster"
},
walk_velocity = 1,
run_velocity = 2,
@ -61,7 +61,7 @@ mobs:register_mob("mobs_monster:stone_monster", {
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
punch_end = 63
},
immune_to = {
{"default:pick_wood", 0}, -- wooden pick doesnt hurt stone monster
@ -69,7 +69,7 @@ mobs:register_mob("mobs_monster:stone_monster", {
{"default:pick_bronze", 5},
{"default:pick_steel", 5},
{"default:pick_mese", 6},
{"default:pick_diamond", 7},
{"default:pick_diamond", 7}
},
-- check surrounding nodes and spawn a specific spider
@ -101,13 +101,14 @@ mobs:register_mob("mobs_monster:stone_monster", {
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:stone_monster",
nodes = {"default:stone", "default:desert_stone", "default:sandstone"},
max_light = 7,
chance = 7000,
max_height = 0,
})
mobs:spawn({
name = "mobs_monster:stone_monster",
nodes = {"default:stone", "default:desert_stone", "default:sandstone"},
max_light = 7,
chance = 7000,
max_height = 0
})
end

View File

@ -9,7 +9,7 @@ local tree_types = {
{name = "default:stick", chance = 1, min = 1, max = 3},
{name = "ethereal:sakura_leaves", chance = 1, min = 1, max = 2},
{name = "ethereal:sakura_trunk", chance = 2, min = 1, max = 2},
{name = "ethereal:sakura_tree_sapling", chance = 2, min = 0, max = 2},
{name = "ethereal:sakura_tree_sapling", chance = 2, min = 0, max = 2}
}
},
@ -19,7 +19,7 @@ local tree_types = {
{name = "default:stick", chance = 1, min = 1, max = 3},
{name = "ethereal:frost_leaves", chance = 1, min = 1, max = 2},
{name = "ethereal:frost_tree", chance = 2, min = 1, max = 2},
{name = "ethereal:crystal_spike", chance = 4, min = 0, max = 2},
{name = "ethereal:crystal_spike", chance = 4, min = 0, max = 2}
}
},
@ -29,7 +29,7 @@ local tree_types = {
{name = "default:stick", chance = 1, min = 1, max = 3},
{name = "ethereal:yellowleaves", chance = 1, min = 1, max = 2},
{name = "ethereal:yellow_tree_sapling", chance = 2, min = 0, max = 2},
{name = "ethereal:golden_apple", chance = 3, min = 0, max = 2},
{name = "ethereal:golden_apple", chance = 3, min = 0, max = 2}
}
},
@ -41,7 +41,7 @@ local tree_types = {
{name = "default:coal_lump", chance = 3, min = 0, max = 3}
},
explode = true
},
}
}
@ -63,12 +63,12 @@ mobs:register_mob("mobs_monster:tree_monster", {
mesh = "mobs_tree_monster.b3d",
textures = {
{"mobs_tree_monster.png"},
{"mobs_tree_monster2.png"},
{"mobs_tree_monster2.png"}
},
blood_texture = "default_wood.png",
makes_footstep_sound = true,
sounds = {
random = "mobs_treemonster",
random = "mobs_treemonster"
},
walk_velocity = 1,
run_velocity = 3,
@ -78,7 +78,7 @@ mobs:register_mob("mobs_monster:tree_monster", {
{name = "default:stick", chance = 1, min = 0, max = 2},
{name = "default:sapling", chance = 2, min = 0, max = 2},
{name = "default:junglesapling", chance = 3, min = 0, max = 2},
{name = "default:apple", chance = 4, min = 1, max = 2},
{name = "default:apple", chance = 4, min = 1, max = 2}
},
water_damage = 0,
lava_damage = 0,
@ -105,7 +105,7 @@ mobs:register_mob("mobs_monster:tree_monster", {
run_start = 48,
run_end = 62,
punch_start = 48,
punch_end = 62,
punch_end = 62
},
-- check surrounding nodes and spawn a specific tree monster
@ -158,14 +158,15 @@ mobs:register_mob("mobs_monster:tree_monster", {
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:tree_monster",
nodes = {"group:leaves"}, --{"default:leaves", "default:jungleleaves"},
max_light = 7,
chance = 7000,
min_height = 0,
day_toggle = false,
})
mobs:spawn({
name = "mobs_monster:tree_monster",
nodes = {"group:leaves"},
max_light = 7,
chance = 7000,
min_height = 0,
day_toggle = false
})
end