Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

This.findHazards() buggy imo


in some level, i’m building firetraps (this.buildXY(“fire-trap”,x,y)), then checking hazards (this.findHazards()) to avoid stepping on my own traps. So far all good. However, when my firetraps detonate, findHazards() still holds items.
IMO, either detonated firetraps should be removed from hazards array, or firetrap objects should have a method to check if they’re active or already detonated.
Am i missing something ?


i think you have, but better to ask: you have asked findHazards() after the fire Trap explodes again?


yes, i’m checking this.findHazards().length and it’s !=0 even after the trap has detonated


What exactly does your code look like?

this.say(this.findHazards().length); //Returns 1
//Firetrap explodes
this.say(this.findHazards().length); //Should return 0


var hazards = this.findHazards();
this.say(hazards.length); //Returns 1
//Firetrap explodes
this.say(hazards.length); //Should return 1, because you didn't search for hazards again


option 1

i’m doing something around :

loop {

and my dude says 1, then 2, then 3, although the traps are detonating between the loops


I can confirm this:

  • Build a trap
  • this.say(this.getHazards().length) “1”
  • Walk away
  • Walk Back (It explodes)
  • this.say(this.getHazards().length) “1”
  • Build a trap
  • this.say(this.getHazards().length) “2”
  • Repeat.

And I offered a patch to solve this.

Also if you see something buggy, feel free to report it in the issues of the GitHub: Helps me find problems like these.


Is there a chance this bug is fixed soon?