Exclude traps and technical objects from NPC levels

This commit is contained in:
WorldBosse committed 2026-10-31 03:57:46 +04:00
1 parent 6adc6dbc73
commit b920fe9bf5
1 file changed
+29 -1
+29 -1
View File
@@ -95,7 +95,7 @@ module MobHitBars
"MobEliseGagCrazy" => "Безумец", "MobEliseGagCrazy" => "Безумец",
"NeutralBSHumanwhoreF" => "Проститутка", "NeutralBSHumanwhoreF" => "Проститутка",
"NeutralHumanGraveKeeper" => "Могильщик", "NeutralHumanGraveKeeper" => "Могильщик",
"NeutralHumanKidRack" => "Пыточная стойка", "NeutralHumanKidRack" => "Ребёнок",
"SaintHumanRake" => "Распутник", "SaintHumanRake" => "Распутник",
"SaintHumanWhip" => "Бичеватель", "SaintHumanWhip" => "Бичеватель",
"WildAnimalRattus" => "Крыса", "WildAnimalRattus" => "Крыса",
@@ -187,11 +187,39 @@ module MobHitBars
[/Undead/i, "Нежить"] [/Undead/i, "Нежить"]
] ]
NON_LEVEL_RACES = [
"Missile", "Bomb", "Mine", "SkillDummy", "AreaDot", "Overmap", "Johnson"
]
NON_LEVEL_AI = [
"GameTrap",
"Game_DestroyableObject",
"Game_DestroyableSkillDummy",
"Game_SandboxObject",
"Game_PorjectileCharacter",
"Game_FireballPorjectile",
"Game_OvermapChar"
]
def self.level_bearing_actor?(actor)
data = actor.respond_to?(:npc) ? actor.npc : nil
return true unless data
return false if data.respond_to?(:is_object) && data.is_object == true
race = data.respond_to?(:race) ? data.race.to_s : ""
return false if NON_LEVEL_RACES.include?(race)
ai = data.respond_to?(:ai) ? data.ai.to_s : ""
return false if NON_LEVEL_AI.include?(ai)
true
rescue
true
end
def self.npc_actor(character) def self.npc_actor(character)
return nil unless character.is_a?(Game_Event) return nil unless character.is_a?(Game_Event)
return nil unless character.respond_to?(:npc?) && character.npc? return nil unless character.respond_to?(:npc?) && character.npc?
actor = character.actor actor = character.actor
return nil unless actor && actor.respond_to?(:battle_stat) return nil unless actor && actor.respond_to?(:battle_stat)
return nil unless level_bearing_actor?(actor)
actor actor
rescue rescue
nil nil