Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG Report] 'PowerCreep.ticksToLive' returns broken 'null' value on an unsapwned power-creep #144

Open
HerrKai opened this issue Jul 30, 2024 · 0 comments

Comments

@HerrKai
Copy link

HerrKai commented Jul 30, 2024

When a power-creep is not spawned in, it's ticksToLive property returns null, however, this value is somehow broken. While it does show up correctly when saved to memory or logged to the console, it somehow causes an evaluation against null to be false. Example:

var powerCreep = Game.powerCreeps[Object.keys(Game.powerCreeps)[0]];
console.log("---before---");
console.log(powerCreep.ticksToLive)
console.log(powerCreep.ticksToLive == null)
console.log("---after---");

This will yield the following output:

[19:43:02][shard1]---before---
[19:43:02][shard1]null
[19:43:02][shard1]false
[19:43:02][shard1]---after---

The expected behaviour would be Game.powerCreeps[Object.keys(Game.powerCreeps)[0]].ticksToLive == null to be true in the case of Game.powerCreeps[Object.keys(Game.powerCreeps)[0]].ticksToLive being null. I've also checked and in this case the value is NOT a string that just sais "null".

I don't know a fix for this, however someone in discord suggested this was the cause:

ticksToLive: (o) => o.ageTime - runtimeData.time,

The start of this conversation in the official discord can be found with this link: https://discord.com/channels/860665589738635336/866441713383637032/1267538335002529853

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant