-
Notifications
You must be signed in to change notification settings - Fork 22
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 combat event hooks #222
Conversation
47cf701
to
ff757f8
Compare
ff757f8
to
f3d9f08
Compare
if (!this.#check.additionalData[TRAITS]) { | ||
this.#check.additionalData[TRAITS] = []; | ||
} | ||
traits.forEach((t) => this.#check.additionalData[TRAITS].push(t)); |
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.
maybe use a concat method?
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.
ah looks like an alternative is
this.#check.additionalData[TRAITS].push(...traits);
As a general comment, I'm not sure the JSDoc typedefs are working, but that could also be my VSCode acting up. |
f3d9f08
to
5eb236b
Compare
Oh I definitely had issues referencing types in VScode; hence my switch to Webstorm. |
5eb236b
to
d54ca2e
Compare
044a507
to
d11b7b9
Compare
83c42d2
to
67bfa49
Compare
*/ | ||
function attack(inspector, actor, item) { | ||
const traits = inspector.getTraits(); | ||
const targets = inspector.getTargets(); |
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.
I think getTraits and getTargets can return null. In these cases it looks like there might be exceptions thrown?
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.
A while ago they would, but now they return empty arrays if nothing instead. I updated the comments.
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.
getTargets returns an empty array, but getTraits still returns null doesnt it?
getTraits() {
return this.#check.additionalData[TRAITS] ?? null;
}
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.
I see it.
Add a variety of combat event hooks that can be used by modules (and the system) . These can all be found in
FUHooks
.Examples