From deee28fc59d88cf0a95c5dbfdf4f75d287b42eed Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sun, 1 Aug 2021 18:58:21 +0100 Subject: [PATCH] added 'arrow_override' function to mob definition --- api.lua | 9 ++++++++- api.txt | 2 ++ readme.MD | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index 5a2f0bb..7ecc0e4 100644 --- a/api.lua +++ b/api.lua @@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20210731", + version = "20210801", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {} } @@ -2703,6 +2703,12 @@ function mob_class:do_states(dtime) local obj = minetest.add_entity(p, self.arrow) local ent = obj:get_luaentity() local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5 + + -- check for custom override for arrow + if self.arrow_override then + self.arrow_override(ent) + end + local v = ent.velocity or 1 -- or set to default ent.switch = 1 @@ -3573,6 +3579,7 @@ minetest.register_entity(name, setmetatable({ armor = def.armor, on_rightclick = def.on_rightclick, arrow = def.arrow, + arrow_override = def.arrow_override, shoot_interval = def.shoot_interval, sounds = def.sounds, animation = def.animation, diff --git a/api.txt b/api.txt index 5a4f7cb..772f76a 100644 --- a/api.txt +++ b/api.txt @@ -123,6 +123,8 @@ functions needed for the mob to work properly which contains the following: continue chasing. 'arrow' holds the pre-defined arrow object to shoot when attacking. + 'arrow_override' function that allows tweaking of arrow entity from + inside mob definition (self) passed to function. 'dogshoot_switch' allows switching between attack types by using timers (1 for shoot, 2 for dogfight) 'dogshoot_count_max' contains how many seconds before switching from diff --git a/readme.MD b/readme.MD index a2bfba7..d0f062f 100644 --- a/readme.MD +++ b/readme.MD @@ -23,6 +23,7 @@ Lucky Blocks: 9 Changelog: +- 1.56 - Added arrow_override function to mob definition to tweak arrow entity settings, tamed monsters no longer despawn when outside loaded map area. - 1.55 - Add 'peaceful_player' privelage and setting so mobs don't attack specific players (thanks sfence), add support for MarkBu's pathfinder mod, remove need for default mod - 1.54 - Simplified animal breeding function, added editable settings (thanks Wuzzy), Child mobs now take 20 mins to grow up, reverted to simple mob spawning with setting to use area checks, on_flop added, air_damage added. - 1.53 - Added 'on_map_load' settings to mobs:spawn so that mobs will only spawn when new areas of map are loaded.