FurryEskimo Posted December 30, 2023 Share Posted December 30, 2023 (edited) Thought I sorted this out a long time ago, but I recently got a report that this code might have stopped working, so I'm looking to confirm or deny those claims.. Basically, I made it so that when a hound is trained, it won't cause other players to go insane. Recently, hounds were updated slightly, and the code was updated to try and account for possessed vargs, but am I missing something? -- Function to remove sanity aura local removeSanityAura = function(inst) if inst.components.sanityaura then local aurafn_orig = inst.components.sanityaura.aurafn local aurafn_new = function(inst, observer) -- Trained hounds will not cause players to go insane. --Wild hounds will not cause this player to go insane --Note: This may be overpowered, but it is intended to make training hounds easier. if not inst:HasTag("hound_mutated") and not inst:HasTag("lunar_aligned") and (inst:HasTag("trainedhound") or inst:HasTag("ex_trained") or observer:HasTag("houndtamer")) then return 0 end if aurafn_orig then return aurafn_orig(inst, observer) end return inst.components.sanityaura.aura end inst.components.sanityaura.aurafn = aurafn_new end end AddHoundPostInit(removeSanityAura) I suppose I should add this code to the prefabs of vargs too, but I vaguely recall this having simply worked, and Wirra and other characters weren't being impacted. (It's been a bit tricky to test because Wirra's still immune, but others have reported problems.) Edited December 31, 2023 by FurryEskimo Link to comment Share on other sites More sharing options...
FurryEskimo Posted December 31, 2023 Author Share Posted December 31, 2023 I received one DM, saying that to grant temporary immunity to specific sanity aura, instead of adding prefabpostinit to specific prefabs, they'd have probably just modify the function that calculates sanity aura inside the sanity component. This way they could future-proof it by just making it do the calculations depending on tags. (I currently don't know how to do this, lol, but I'm trying to learn, and any help would be appreciated.) Link to comment Share on other sites More sharing options...
FurryEskimo Posted January 2 Author Share Posted January 2 Ok, well I found the original code designed to grant sanity aura immunities: function Sanity:AddSanityAuraImmunity(tag) if self.sanity_aura_immunities == nil then self.sanity_aura_immunities = {} end self.sanity_aura_immunities[tag] = true end Obvious downside is that it's so broad. It grants an immunity to a tag, full stop. My code is more, nuanced, and will change the sanity effect based on factors, real time. Good news is, I may have figured out the issue, maybe.. The code does appear to work, so there's likely another mod adding a "removeSanityAura" function (since it's a really generic name), and it could be overriding my code. I suppose at this point it's a case of trial and error to find out, unless I can determine which other mod is the issue. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now