-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'OnNotContaining' StatusEffect ActionType. #14261
base: master
Are you sure you want to change the base?
Conversation
Truly the best cooking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted one issue that seems like it could have some negative performance implications.
I'm also fairly sure this doesn't work properly: the effects are executed in Update
, but there's no guarantee that the item is active (= that Update
gets called) when it has these types of effects active. See line 656 for example, on which the component may get deactivated.
I think performance also needs to be taken into account here: having these sorts of effects should not force the component to always stay active, but the component should only be forced active if any of these effects can currently execute.
|
||
for (int i = 0; i < slotRestrictions.Length; i++) | ||
{ | ||
foreach (StatusEffect effect in slotRestrictions[i].ContainableItems.SelectMany(ci => ci.StatusEffects.Where(se => se.type == ActionType.OnNotContaining && Inventory.GetItemsAt(i).None(ci.MatchesItem)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generates a ton of garbage due to the captured variables. Particularly bad in this case, because this executes potentially tons of times per frame.
Adds a new StatusEffect ActionType called
OnNotContaining
that is the opposite ofOnContaining
.