tModLoader

tModLoader

评价数不足
Summoner taggable neutral/passive NPCs
   
奖励
收藏
已收藏
取消收藏
模组功能: 实用辅助, 游戏调整
tModLoader版本: 1.4.4
文件大小
发表于
25.853 KB
2024 年 10 月 24 日 上午 4:51
1 项改动说明 ( 查看 )

订阅以下载
Summoner taggable neutral/passive NPCs

描述
Description
By default, Summoners can't target certain NPCs, think Training Dummies, Critters, Mysterious Tablet Devotees and likely other examples I can't think of at this moment.
This mod offers a solution for that by making Summoner Tags (Whip attack/Minion-summoning staff Right-Click) applicable to them. That way there aren't any happy little accidents summoning bosses unprovoked by just making minions or sentries able to target them by default.
Also comes with Guide/Clothier Voodoo Doll and Mod compatibility.

Issues
Please report any crashes that happen when you try to enable this mod with other mods, otherwise only report bugs caused by any Vanilla features!
Mod minions/sentries not attacking tagged targets likely means they have been setup wrong and I have no capability to fix that. Report it to the minion's/sentry's mod's author and if they need help send them here.

For Modders

Minion/Sentry issues
If your minions/sentries are copies of vanilla minions or are using vanilla systems (which you are likely already doing) you should be fine, here's a checklist of what should be done
  • Your summon should set Projectile.minion or Projectile.sentry to true based on what it is
  • If it shoots anything remember to register it in ProjectileID.Sets.MinionShot and ProjectileID.Sets.SentryShot accordingly.
  • Use Projectile.Minion_FindTargetInRange or at least NPC.CanBeChasedBy when checking for targets, remember to pass your projectile into the attacker arg when calling NPC.CanBeChasedBy

Alternatively you can always use Mod.Call to fetch the logic used, the mod's internal ID is 'NeutralMinionTargeting' and has 2 callables.
bool CanBeChasedByMinion(NPC victim, Projectile attacker, bool ignoreDontTakeDamage = false)
returns whether the minion/sentry can attack the NPC despite its vanilla rules saying otherwise
bool IsValidOwnerMinionTarget(NPC victim, object attacker = null, bool ignoreDontTakeDamage = false)
returns whether the victim is valid for tagging despite vanilla rules saying otherwise. For player sensitive things, attacker should be either the Player or Minion/Sentry itself. Will still return true if the victim is not a NPCID.Sets.ProjectileNPC, NPCID.Sets.CountsAsCritter and NPC.friendly, as well as NPC.dontTakeDamage (unless ignored).

Designing custom ways for hitting certain NPCs
You should be fine as long as you implement it into any of the following methods; ModPlayer.CanHitNPCWithProj, GlobalProjectile.CanHitNPC, ModProjectile.CanHitNPC, GlobalNPC.CanBeHitByProjectile, ModNPC.CanBeHitByProjectile.
Due to some limitations on my part, the passed Projectile to each of these methods is not the actual minion, but a dummy with the following settings instead:
  • Projectile.type = ProjectileID.None
  • Projectile.minion = true
  • Projectile.sentry = true
  • Projectile.owner = <owner's whoAmI>
引用自 tModLoader NeutralMinionTargeting
Developed By Fuffles