croc code rebased and re-licensed

This commit is contained in:
tenplus1 2022-11-22 10:36:24 +00:00
parent 919696be2e
commit a08f13d118
3 changed files with 88 additions and 166 deletions

View File

@ -1,5 +1,5 @@
Licenses Licenses
Code: MIT Code: MIT (code re-based)
Model/Textures: GPL v3 Model/Textures: GPL v3
Author: Team NPX Author: Team NPX

View File

@ -1,70 +1,68 @@
-- local variables
local l_spawn_chance = 60000
-- load settings -- load settings
local ENABLE_WALKERS = minetest.settings:get_bool("mobs_crocs.enable_walkers", true) local croc_walkers = minetest.settings:get_bool("mobs_crocs.enable_walkers", true)
local ENABLE_FLOATERS = minetest.settings:get_bool("mobs_crocs.enable_floaters", true) local croc_floaters = minetest.settings:get_bool("mobs_crocs.enable_floaters", true)
local ENABLE_SWIMMERS = minetest.settings:get_bool("mobs_crocs.enable_swimmers", true) local croc_swimmers = minetest.settings:get_bool("mobs_crocs.enable_swimmers", true)
local croc_spawn_chance = 60000
if not ENABLE_WALKERS then -- tweak croc spawn chance depending on which one's are enabled
l_spawn_chance = l_spawn_chance - 20000 croc_spawn_chance = croc_spawn_chance - (croc_walkers and 0 or 20000)
end croc_spawn_chance = croc_spawn_chance - (croc_floaters and 0 or 20000)
croc_spawn_chance = croc_spawn_chance - (croc_swimmers and 0 or 20000)
if not ENABLE_FLOATERS then -- crocodile mob definition
l_spawn_chance = l_spawn_chance - 20000 local croc_def = {
end type = "monster",
attack_type = "dogfight",
if not ENABLE_SWIMMERS then damage = 8,
l_spawn_chance = l_spawn_chance - 20000 reach = 3,
end hp_min = 20,
hp_max = 25,
armor = 200,
collisionbox = {-0.85, -0.30, -0.85, 0.85, 1.5, 0.85},
drawtype = "front",
visual = "mesh",
mesh = "crocodile.x",
textures = {
{"croco.png"},
{"croco2.png"}
},
visual_size = {x = 4, y = 4},
sounds = {
random = "croco"
},
fly = false,
floats = 0,
stepheight = 1,
view_range = 10,
water_damage = 0,
lava_damage = 10,
light_damage = 0,
animation = {
speed_normal = 24,
speed_run = 24,
stand_start = 0,
stand_end = 80,
walk_start = 81,
walk_end = 170,
fly_start = 81,
fly_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}
}
}
-- no float if croc_walkers then
if ENABLE_WALKERS then
mobs:register_mob("mobs_crocs:crocodile", { mobs:register_mob("mobs_crocs:crocodile", table.copy(croc_def))
type = "monster",
attack_type = "dogfight", mobs:register_egg("mobs_crocs:crocodile", "Crocodile (walk)", "default_grass.png", 1)
damage = 8,
reach = 3,
hp_min = 20,
hp_max = 25,
armor = 200,
collisionbox = {-0.85, -0.30, -0.85, 0.85, 1.5, 0.85},
drawtype = "front",
visual = "mesh",
mesh = "crocodile.x",
textures = {
{"croco.png"},
{"croco2.png"}
},
visual_size = {x = 4, y = 4},
sounds = {random = "croco"},
fly = false,
floats = 0,
stepheight = 1,
view_range = 10,
water_damage = 0,
lava_damage = 10,
light_damage = 0,
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}
}
})
mobs:spawn({ mobs:spawn({
name = "mobs_crocs:crocodile", name = "mobs_crocs:crocodile",
@ -77,59 +75,23 @@ if ENABLE_WALKERS then
"default:papyrus", "dryplants:juncus", "dryplants:reedmace" "default:papyrus", "dryplants:juncus", "dryplants:reedmace"
}, },
interval = 30, interval = 30,
chance = l_spawn_chance, chance = croc_spawn_chance,
min_height = 0, min_height = 0,
max_height = 10 max_height = 10
}) })
mobs:register_egg("mobs_crocs:crocodile", "Crocodile", "default_grass.png", 1)
end end
-- float if croc_floaters then
if ENABLE_FLOATERS then
mobs:register_mob("mobs_crocs:crocodile_float", { croc_def.reach = 2
type = "monster", croc_def.collisionbox = {-0.638, -0.23, -0.638, 0.638, 1.13, 0.638}
attack_type = "dogfight", croc_def.visual_size = {x = 3, y = 3}
damage = 8, croc_def.floats = 1
reach = 2,
hp_min = 20, mobs:register_mob("mobs_crocs:crocodile_float", table.copy(croc_def))
hp_max = 25,
armor = 200, mobs:register_egg("mobs_crocs:crocodile_float", "Crocodile (float)", "default_grass.png", 1)
collisionbox = {-0.638, -0.23, -0.638, 0.638, 1.13, 0.638},
drawtype = "front",
visual = "mesh",
mesh = "crocodile.x",
textures = {
{"croco.png"},
{"croco2.png"}
},
visual_size = {x = 3, y = 3},
sounds = {random = "croco"},
fly = false,
stepheight = 1,
view_range = 10,
water_damage = 0,
lava_damage = 10,
light_damage = 0,
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}
}
})
mobs:spawn({ mobs:spawn({
name = "mobs_crocs:crocodile_float", name = "mobs_crocs:crocodile_float",
@ -140,75 +102,34 @@ if ENABLE_FLOATERS then
"dryplants:juncus", "dryplants:reedmace" "dryplants:juncus", "dryplants:reedmace"
}, },
interval = 30, interval = 30,
chance = l_spawn_chance, chance = croc_spawn_chance,
min_height = -3, min_height = -3,
max_height = 10 max_height = 10
}) })
mobs:register_egg("mobs_crocs:crocodile_float", "Crocodile (floater)",
"default_grass.png", 1)
end end
-- swim if croc_swimmers then
if ENABLE_SWIMMERS then
mobs:register_mob("mobs_crocs:crocodile_swim", { croc_def.reach = 1
type = "monster", croc_def.collisionbox = {-0.425, -0.15, -0.425, 0.425, 0.75, 0.425}
attack_type = "dogfight", croc_def.visual_size = {x = 2, y = 2}
damage = 8, croc_def.fly = true
reach = 1, croc_def.fly_in = "default:water_source"
hp_min = 20, croc_def.fall_speed = -1
hp_max = 25, croc_def.floats = 0
armor = 200,
collisionbox = {-0.425, -0.15, -0.425, 0.425, 0.75, 0.425}, mobs:register_mob("mobs_crocs:crocodile_swim", table.copy(croc_def))
drawtype = "front",
visual = "mesh", mobs:register_egg("mobs_crocs:crocodile_swim", "Crocodile (swim)", "default_grass.png", 1)
mesh = "crocodile.x",
textures = {
{"croco.png"},
{"croco2.png"}
},
visual_size = {x = 2, y = 2},
sounds = {random = "croco"},
fly = true,
fly_in = "default:water_source",
fall_speed = -1,
floats = 0,
view_range = 10,
water_damage = 0,
lava_damage = 10,
light_damage = 0,
animation = {
speed_normal = 24,
speed_run = 24,
stand_start = 0,
stand_end = 80,
walk_start = 81,
walk_end = 170,
fly_start = 81,
fly_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}
},
})
mobs:spawn({ mobs:spawn({
name = "mobs_crocs:crocodile_swim", name = "mobs_crocs:crocodile_swim",
nodes = {"default:water_flowing","default:water_source"}, nodes = {"default:water_flowing", "default:water_source"},
neighbors = {"default:sand","default:dirt","group:seaplants"}, neighbors = {"default:sand", "default:dirt", "group:seaplants"},
interval = 30, interval = 30,
chance = l_spawn_chance, chance = croc_spawn_chance,
min_height = -8, min_height = -8,
max_height = 10 max_height = 10
}) })
mobs:register_egg("mobs_crocs:crocodile_swim", "Crocodile (swimmer)",
"default_grass.png", 1)
end end

View File

@ -1,5 +1,6 @@
Licenses Licenses
Code: MIT Code: MIT
Model/textures: unknown Model/Textures: CC-BY-SA 3.0
http://creativecommons.org/licenses/by-sa/3.0/de/legalcode
Author: AspireMint Author: AspireMint