Fix some stuff

This commit is contained in:
ElCeejo 2024-02-24 19:04:13 -08:00
parent 8408a73851
commit 20a59ddd30
4 changed files with 45 additions and 37 deletions

View file

@ -13,7 +13,7 @@ local function table_contains(tbl, val)
return false return false
end end
local common_spawn_chance = tonumber(minetest.settings:get("animalia_common_chance")) or 45000 local common_spawn_chance = tonumber(minetest.settings:get("animalia_common_chance")) or 60000
local ambient_spawn_chance = tonumber(minetest.settings:get("animalia_ambient_chance")) or 9000 local ambient_spawn_chance = tonumber(minetest.settings:get("animalia_ambient_chance")) or 9000
@ -56,13 +56,12 @@ creatura.register_abm_spawn("animalia:grizzly_bear", {
creatura.register_abm_spawn("animalia:chicken", { creatura.register_abm_spawn("animalia:chicken", {
chance = common_spawn_chance, chance = common_spawn_chance,
chance_on_load = 64,
spawn_active = true, spawn_active = true,
spawn_on_load = true,
min_height = 0, min_height = 0,
max_height = 1024, max_height = 1024,
min_group = 3, min_group = 3,
max_group = 5, max_group = 5,
spawn_cap = 3,
biomes = chicken_biomes, biomes = chicken_biomes,
nodes = {"group:soil"}, nodes = {"group:soil"},
}) })
@ -79,13 +78,12 @@ creatura.register_abm_spawn("animalia:cat", {
creatura.register_abm_spawn("animalia:cow", { creatura.register_abm_spawn("animalia:cow", {
chance = common_spawn_chance, chance = common_spawn_chance,
chance_on_load = 64,
spawn_active = true, spawn_active = true,
spawn_on_load = true,
min_height = 0, min_height = 0,
max_height = 1024, max_height = 1024,
min_group = 3, min_group = 3,
max_group = 4, max_group = 4,
spawn_cap = 3,
biomes = animalia.registered_biome_groups["grassland"].biomes, biomes = animalia.registered_biome_groups["grassland"].biomes,
nodes = {"group:soil"}, nodes = {"group:soil"},
neighbors = {"air", "group:grass", "group:flora"} neighbors = {"air", "group:grass", "group:flora"}
@ -103,13 +101,12 @@ creatura.register_abm_spawn("animalia:fox", {
creatura.register_abm_spawn("animalia:horse", { creatura.register_abm_spawn("animalia:horse", {
chance = common_spawn_chance, chance = common_spawn_chance,
chance_on_load = 64,
spawn_active = true, spawn_active = true,
spawn_on_load = true,
min_height = 0, min_height = 0,
max_height = 1024, max_height = 1024,
min_group = 3, min_group = 3,
max_group = 4, max_group = 4,
spawn_cap = 3,
biomes = animalia.registered_biome_groups["grassland"].biomes, biomes = animalia.registered_biome_groups["grassland"].biomes,
nodes = {"group:soil"}, nodes = {"group:soil"},
neighbors = {"air", "group:grass", "group:flora"} neighbors = {"air", "group:grass", "group:flora"}
@ -150,39 +147,36 @@ creatura.register_abm_spawn("animalia:opossum", {
creatura.register_abm_spawn("animalia:pig", { creatura.register_abm_spawn("animalia:pig", {
chance = common_spawn_chance, chance = common_spawn_chance,
chance_on_load = 64,
spawn_active = true, spawn_active = true,
spawn_on_load = true,
min_height = 0, min_height = 0,
max_height = 1024, max_height = 1024,
min_group = 2, min_group = 2,
max_group = 3, max_group = 3,
spawn_cap = 3,
biomes = pig_biomes, biomes = pig_biomes,
nodes = {"group:soil"}, nodes = {"group:soil"},
}) })
creatura.register_abm_spawn("animalia:reindeer", { creatura.register_abm_spawn("animalia:reindeer", {
chance = common_spawn_chance, chance = common_spawn_chance,
chance_on_load = 64,
spawn_active = true, spawn_active = true,
spawn_on_load = true,
min_height = 0, min_height = 0,
max_height = 1024, max_height = 1024,
min_group = 6, min_group = 6,
max_group = 8, max_group = 8,
spawn_cap = 3,
biomes = animalia.registered_biome_groups["boreal"].biomes, biomes = animalia.registered_biome_groups["boreal"].biomes,
nodes = {"group:soil"}, nodes = {"group:soil"},
}) })
creatura.register_abm_spawn("animalia:sheep", { creatura.register_abm_spawn("animalia:sheep", {
chance = common_spawn_chance, chance = common_spawn_chance,
chance_on_load = 64,
spawn_active = true, spawn_active = true,
spawn_on_load = true,
min_height = 0, min_height = 0,
max_height = 1024, max_height = 1024,
min_group = 3, min_group = 3,
max_group = 6, max_group = 6,
spawn_cap = 3,
biomes = animalia.registered_biome_groups["grassland"].biomes, biomes = animalia.registered_biome_groups["grassland"].biomes,
nodes = {"group:soil"}, nodes = {"group:soil"},
neighbors = {"air", "group:grass", "group:flora"} neighbors = {"air", "group:grass", "group:flora"}
@ -190,13 +184,12 @@ creatura.register_abm_spawn("animalia:sheep", {
creatura.register_abm_spawn("animalia:turkey", { creatura.register_abm_spawn("animalia:turkey", {
chance = common_spawn_chance, chance = common_spawn_chance,
chance_on_load = 64,
spawn_active = true, spawn_active = true,
spawn_on_load = true,
min_height = 0, min_height = 0,
max_height = 1024, max_height = 1024,
min_group = 3, min_group = 3,
max_group = 4, max_group = 4,
spawn_cap = 3,
biomes = animalia.registered_biome_groups["boreal"].biomes, biomes = animalia.registered_biome_groups["boreal"].biomes,
nodes = {"group:soil"}, nodes = {"group:soil"},
}) })
@ -345,7 +338,7 @@ minetest.register_abm({
action = function(pos, _, active_object_count) action = function(pos, _, active_object_count)
minetest.remove_node(pos) minetest.remove_node(pos)
if active_object_count > 8 then return end if active_object_count > 4 then return end
local spawnable_mobs = {} local spawnable_mobs = {}

View file

@ -512,7 +512,32 @@ minetest.register_craftitem("animalia:net", {
----------- -----------
if minetest.get_modpath("3d_armor") then if minetest.get_modpath("3d_armor") then
table.insert(armor.attributes, "heavy_pelt")
if armor
and armor.attributes then
table.insert(armor.attributes, "heavy_pelt")
minetest.register_on_punchplayer(function(player, hitter, _, _, _, damage)
local name = player:get_player_name()
if name
and (armor.def[name].heavy_pelt or 0) > 0 then
local hit_ip = hitter:is_player()
if hit_ip and minetest.is_protected(player:get_pos(), "") then
return
else
local player_pos = player:get_pos()
if not player_pos then return end
local biome_data = minetest.get_biome_data(player_pos)
if biome_data.heat < 50 then
player:set_hp(player:get_hp() - (damage / 1.5))
return true
end
end
end
end)
end
armor:register_armor("animalia:coat_bear_pelt", { armor:register_armor("animalia:coat_bear_pelt", {
description = "Bear Pelt Coat", description = "Bear Pelt Coat",
@ -521,26 +546,16 @@ if minetest.get_modpath("3d_armor") then
armor_groups = {fleshy = 5} armor_groups = {fleshy = 5}
}) })
minetest.register_on_punchplayer(function(player, hitter, _, _, _, damage)
local name = player:get_player_name()
if name
and (armor.def[name].heavy_pelt or 0) > 0 then
local hit_ip = hitter:is_player()
if hit_ip and minetest.is_protected(player:get_pos(), "") then
return
else
local player_pos = player:get_pos()
if not player_pos then return end
local biome_data = minetest.get_biome_data(player_pos)
if biome_data.heat < 50 then minetest.register_craft({
player:set_hp(player:get_hp() - (damage / 1.5)) output = "animalia:coat_bear_pelt",
return true recipe = {
end {"animalia:pelt_bear", "", "animalia:pelt_bear"},
end {"animalia:pelt_bear", "animalia:pelt_bear", "animalia:pelt_bear"},
end {"animalia:pelt_bear", "animalia:pelt_bear", "animalia:pelt_bear"}
end) }
})
end end
----------- -----------

View file

@ -371,7 +371,7 @@ creatura.register_mob("animalia:horse", {
local owner = self.owner local owner = self.owner
local name = clicker and clicker:get_player_name() local name = clicker and clicker:get_player_name()
if not owner or name ~= owner then return end if owner and name ~= owner then return end
if animalia.set_nametag(self, clicker) then if animalia.set_nametag(self, clicker) then
return return

View file

@ -1,6 +1,6 @@
name = animalia name = animalia
depends = creatura depends = creatura
optional_depends = default, mcl_player, farming optional_depends = default, mcl_player, farming, 3d_armor
description = Adds unique and consistantly designed Animals description = Adds unique and consistantly designed Animals
title = Animalia title = Animalia
author = ElCeejo author = ElCeejo