Skip to content

Applying shaders to NPC's based on HasBuff causes Mod NPC's to also have the shader applied to them. #4

@alexwilk19

Description

@alexwilk19

Title says it all really, but heres a bit more detail, Code:
public override int NPCShader(NPC npc, SpriteBatch spriteBatch, Color drawColor)
{
if (npc.townNPC)
return base.NPCShader(npc, spriteBatch, drawColor);
var gnpc = npc.GetGlobalNPC();

        bool hasFoulSpirit = gnpc.DoT_Handler.Any(x => x.Type == ModContent.BuffType<FoulSpiritDebuff>());
        if (hasFoulSpirit)
            return 114;
        if (npc.HasBuff(ModContent.BuffType<NecroPoisonDebuff>()))
            return 67;
        
        return base.NPCShader(npc, spriteBatch, drawColor);
    }

Will cause my mod town NPC's to be affected by the same shader. I've checked to see if(npc.townNPC) is hit, it is. Shaders are still being applied to the wrong NPC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions