From c0c4c3ea48540b970ac165423def79509dd3d475 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Thu, 15 May 2025 14:34:38 +0100 Subject: [PATCH] tweak general_attack --- api.lua | 5 +++-- api.txt | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api.lua b/api.lua index 8a24164..d5cccc7 100644 --- a/api.lua +++ b/api.lua @@ -18,7 +18,7 @@ end -- global table mobs = { - mod = "redo", version = "20250511", + mod = "redo", version = "20250515", spawning_mobs = {}, translate = S, node_snow = has(core.registered_aliases["mapgen_snow"]) or has("mcl_core:snow") or has("default:snow") or "air", @@ -1692,7 +1692,8 @@ function mob_class:general_attack() -- remove from list if invisible or unable to attack if not damage_enabled or self.attack_players == false - or (self.owner and self.type ~= "monster") + or self.owner == objs[n]:get_player_name() +-- or (self.owner and self.type ~= "monster") or is_invisible(self, objs[n]:get_player_name()) or (self.specific_attack and not check_for("player", self.specific_attack)) then objs[n] = nil diff --git a/api.txt b/api.txt index fdebc1d..e7405d5 100644 --- a/api.txt +++ b/api.txt @@ -102,7 +102,8 @@ functions needed for the mob to work properly which contains the following: 'docile_by_day' when true has mobs wandering around during daylight hours and only attacking player at night or when provoked. - 'attack_chance' 0 to 100 chance the mob will attack (default is 5). + 'attack_chance' 0 to 100 chance the mob will attack (default is 5), + set to 100 so that mob needs to be provoked to attack. 'attack_patience' Time in seconds before mob gives up attacking if player isn't seen (Defaults to 11). 'attack_monsters' when true mob will attack monsters.