function LuckUser:_UpdateLuck_Internal() local luck = self:GetLuck() -- if luck < 0 then local unlucky_mult = 1 + math.abs(luck) local houndedtarget = self.inst.components.houndedtarget or self.inst:AddComponent("houndedtarget") houndedtarget.target_weight_mult:SetModifier(self.inst, unlucky_mult, MODIFIER_SOURCE) houndedtarget.hound_thief = luck <= -1 and true or nil else if self.inst.components.houndedtarget then self.inst.components.houndedtarget.target_weight_mult:RemoveModifier(self.inst, MODIFIER_SOURCE) -- need to also clear hound thief here! end end end
Do keep in mind that Wes can also have this property removed by picking up and dropping a Black Catfish. I know he'll eventually get more in-depth stuff from the commented out Wes misfortune code, but you might either use a temporary measure, or you might want to let the houndedtarget component handle the hound thief property rather than externally like how it's being done here.
Have hound_thief update based on what target_weight_mult returns when it's updated. Though you might want to use a function for when setting or removing a modifier, rather than grabbing the source list modifier externally like luckuser is currently doing.
Also, related to this component while at it, it's missing an OnRemoveFromEntity function to handle updating luck on removal of the component for external stuff (like houndedtarget, or other potential stuff for later on). That and, the _UpdateLuck_Internal function should also probably be sanitized to not add a houndedtarget component to non-players if the component is missing (not that it'll do anything).
While the component is currently expected only on players here, there's nothing besides these two things that strictly says otherwise. Addressing this would be in line with how the componentutil luck functions don't have any restrictions that say "this all is only for players". Could have some entities that just have some natural high or low luck, even if it'd never be used, or if it'd be used under very specific circumstances, it'd be a nice touch regardless.
Plus, you never know, could be funny to mod in an entity with insanely high luck, that's also very slow and extremely frail and will die to any damage, or something silly like that.
- Leave a stack of 10 Lucky Horseshoes on the ground.
- Put 4 Black Catfishes in your inventory.
- Pick up the Lucky Horseshoes.
- You should now have positive luck, but still be set as a "hound thief".
-
2
A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.
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