-
Notifications
You must be signed in to change notification settings - Fork 202
feat(engine): ai_spawn triggers, 0 xp spawnhitting bug, and process order of npc hunt's #994
Conversation
src/lostcity/entity/Npc.ts
Outdated
| } | ||
| this.resetHeroPoints(); | ||
| this.queue.clear(); | ||
| this.vars = new Int32Array(VarNpcType.count); |
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.
do this instead:
this.vars.fill(0);
this.varsString.fill(undefined);
idk why they aren't but these should be readonly
readonly vars: Int32Array;
readonly varsString: string[];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.
Thank you! I ended up doing this because undefined wouldn't work:
this.vars.fill(0);
this.varsString.fill('');
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.
Probably bcuz varsString isnt typed properly. this.varsString.fill(''); isn't right either. My original comment is the technical correct way.
Idk js doesnt make any sense actually.
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.
Yeah Im pretty sure its this.varsString.fill(undefined);
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.
And do something like this?
readonly vars: Int32Array;
readonly varsString: Array<string | undefined>;
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, thank you. Done
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.
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 explicitly having undefined there is overly verbose. It's not in the strict language rules for a reason. In JS/TS it's also not the array itself storing undefined, but the array access returning undefined.
Is the goal of filling the var array to keep any original references to it? GC is kicking in regardless otherwise, is it so bad to new Array(...);?
If you're really serious about it @ultraviolet-jordan we should turn on noUncheckedIndexedAccess: true in tsconfig.
microsoft/TypeScript#49169
microsoft/TypeScript#39560
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.
imo indexing out of bounds in an array should be illegal and should crash the program
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.
We've reached 1000 PRs! Sincerest appreciation to all contributors that are working on this. ## Content Changes ### Features * #968 * #991 ### Fixes * #989 * #990 * #998 * #1000 * #1003 ## Engine Changes ### Features * #992 * #994 * #996 * #1001 * Automatic image quantization. We use the original packed sprites, so this code only runs when custom images are added to the data folder. ### Fixes * #993 * #995 * #1002 * Jagfile decompression could fail using standard libbz2 due to a packing oversight. The client was unaffected. * Removed quotes from constants referenced in scripts.


0 xp spawnhitting:
tf8sgb_1.mp4
Respawn is moved to processNpcs() because:
2024-11-12.13-24-57.mp4
2024-11-12.13-54-54.mp4
Obj/npc/loc hunting was moved to processNpcs() because:
od3gps_2.mp4