1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-07-02 00:10:21 +02:00

increase go_to time to 20 and add force flag to do_attack

This commit is contained in:
tenplus1
2024-05-25 07:50:16 +01:00
parent 1536b9a5fc
commit 313382dcaa
2 changed files with 8 additions and 6 deletions

11
api.lua
View File

@ -14,7 +14,7 @@ local use_vh1 = minetest.get_modpath("visual_harm_1ndicators")
-- Global
mobs = {
mod = "redo",
version = "20240524",
version = "20240525",
translate = S,
invis = minetest.global_exists("invisibility") and invisibility or {},
node_snow = minetest.registered_aliases["mapgen_snow"]
@ -225,9 +225,9 @@ end
-- attack player/mob
function mob_class:do_attack(player)
function mob_class:do_attack(player, force)
if self.state == "attack" then
if self.state == "attack" and not force then
return
end
@ -1872,11 +1872,12 @@ minetest.register_entity("mobs:_pos", {
visual = "sprite", texture = "", hp_max = 1, physical = false,
static_save = false, pointable = false, is_visible = false
}, health = 1, _cmi_is_mob = true,
on_step = function(self, dtime)
self.counter = (self.counter or 0) + dtime
if self.counter > 10 then
if self.counter > 20 then
self.object:remove()
end
end
@ -1888,7 +1889,7 @@ function mob_class:go_to(pos)
local obj = minetest.add_entity(pos, "mobs:_pos")
if obj and obj:get_luaentity() then
self:do_attack(obj)
self:do_attack(obj, true)
end
end