added item drop pickup mod as submodule, fixed "Deprecated call to "get_entity_name" error spam, increased sussy imposter spawning rate but decreased chance of spawn on each iteration

This commit is contained in:
Looki2000 2023-02-16 00:49:24 +01:00
parent a17a49bbfd
commit 0a7f3829f3
3 changed files with 11 additions and 3 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "mods/item_drop"]
path = mods/item_drop
url = https://github.com/minetest-mods/item_drop.git

View File

@ -540,8 +540,8 @@ minetest.register_abm({
label = "Spawn Imposter",
nodenames = {"air"},
neighbors = {"group:stone"},
interval = 30,
chance = 60,
interval = 5,
chance = 500,
action = function(pos)
-- avoid spawning inside liquids
if minetest.registered_nodes[minetest.get_node(pos).name].liquidtype == "none" then
@ -552,7 +552,11 @@ minetest.register_abm({
local entities = minetest.get_objects_inside_radius(pos, 20)
local bat_count = 0
for _, entity in pairs(entities) do
if entity:get_entity_name() == "amogus_entities:sussy_imposter" then
-- get name while handling .name indexing error caused by get_luaentity() returning nil
-- i cant use get_entity_name() because its deprecated and spams logs
local name = entity:get_luaentity() and entity:get_luaentity().name or ""
if name == "amogus_entities:sussy_imposter" then
bat_count = bat_count + 1
if bat_count >= 3 then
return

1
mods/item_drop Submodule

@ -0,0 +1 @@
Subproject commit 8bebf6324efa4bdb3f99c77300f3ef328b849e83