diff --git a/api.lua b/api.lua index db592ed..515985e 100644 --- a/api.lua +++ b/api.lua @@ -18,7 +18,7 @@ end -- global table mobs = { - mod = "redo", version = "20250405", + mod = "redo", version = "20250408", spawning_mobs = {}, translate = S, node_snow = has(minetest.registered_aliases["mapgen_snow"]) or has("mcl_core:snow") or has("default:snow") or "air", @@ -363,10 +363,6 @@ function mob_class:set_yaw(yaw, delay) return self.target_yaw end -function mobs:yaw(entity, yaw, delay) -- [deprecated] - mob_class.set_yaw(entity, yaw, delay) -end - -- set defined animation function mob_class:set_animation(anim, force) @@ -407,10 +403,6 @@ function mob_class:set_animation(anim, force) 0, self.animation[anim .. "_loop"] ~= false) end -function mobs:set_animation(entity, anim) -- [deprecated] - entity.set_animation(entity, anim) -end - -- check line of sight using raycasting (thx Astrobe) function mob_class:line_of_sight(pos1, pos2) @@ -435,10 +427,6 @@ function mob_class:line_of_sight(pos1, pos2) return true end -function mobs:line_of_sight(entity, pos1, pos2) -- [deprecated] - return entity:line_of_sight(pos1, pos2) -end - -- if not flying in set medium, find some nearby to move to function mob_class:attempt_flight_correction(override) @@ -502,10 +490,6 @@ function mob_class:yaw_to_pos(target, rot) return self:set_yaw(yaw, rot) end -function mobs:yaw_to_pos(self, target, rot) -- [deprecated] - return self:yaw_to_pos(target, rot) -end - -- look for stay_near nodes and move towards them function mob_class:do_stay_near() @@ -3323,7 +3307,6 @@ function mobs:register_mob(name, def) explosion_timer = def.explosion_timer, allow_fuse_reset = def.allow_fuse_reset, stop_to_explode = def.stop_to_explode, - double_melee_attack = def.double_melee_attack, dogshoot_switch = def.dogshoot_switch, dogshoot_count_max = def.dogshoot_count_max, dogshoot_count2_max = def.dogshoot_count2_max or def.dogshoot_count_max, @@ -3759,15 +3742,6 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter end end --- compatibility with older mob registration [DEPRECATED] - -function mobs:register_spawn(name, nodes, max_light, min_light, chance, - active_object_count, max_height, day_toggle) - - mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, - chance, active_object_count, -31000, max_height, day_toggle) -end - -- MarkBu's newer spawn function (USE this one please modders) function mobs:spawn(def) @@ -3981,10 +3955,6 @@ function mobs:boom(self, pos, node_damage_radius, entity_radius, texture) end end -function mobs:explosion(pos, radius) -- [deprecated] compatibility function - mobs:boom({sounds = {explode = "tnt_explode"}}, pos, radius, radius, "tnt_smoke.png") -end - -- Register spawn eggs - This also introduces the “spawn_egg” group: -- * spawn_egg=1: generic mob, no metadata -- * spawn_egg=2: captured/tamed mob, metadata @@ -4449,8 +4419,7 @@ function mobs:alias_mob(old_name, new_name) minetest.register_alias(old_name, new_name) -- spawn egg - -- entity - minetest.register_entity(":" .. old_name, { + minetest.register_entity(":" .. old_name, { -- entity initial_properties = {physical = false, static_save = false}, diff --git a/api.txt b/api.txt index 80eaf88..fdebc1d 100644 --- a/api.txt +++ b/api.txt @@ -230,8 +230,6 @@ functions needed for the mob to work properly which contains the following: 'rotate' custom model rotation, 0 = front, 90 = side, 180 = back, 270 = other side. 'glow' has mob glow without light source, 0 to 15 or nil to disable - 'double_melee_attack' when true has the api choose between 'punch' and - 'punch2' animations. [DEPRECATED] 'animation' holds a table containing animation names and settings for use with mesh models: diff --git a/compatibility.lua b/compatibility.lua index 1c01d28..8a54334 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -10,3 +10,32 @@ function mobs.compatibility_check(self) if self.floats == 1 then self.floats = true elseif self.floats == 0 then self.floats = false end end + +-- deprecated functions + +function mobs:yaw(entity, yaw, delay) + entity:set_yaw(yaw, delay) +end + +function mobs:set_animation(entity, anim) + entity:set_animation(anim) +end + +function mobs:line_of_sight(entity, pos1, pos2) + return entity:line_of_sight(pos1, pos2) +end + +function mobs:yaw_to_pos(entity, target, rot) + return entity:yaw_to_pos(target, rot) +end + +function mobs:register_spawn(name, nodes, max_light, min_light, chance, + active_object_count, max_height, day_toggle) + + mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, + chance, active_object_count, -31000, max_height, day_toggle) +end + +function mobs:explosion(pos, radius) + mobs:boom({sounds = {explode = "tnt_explode"}}, pos, radius, radius, "tnt_smoke.png") +end