TooAngel / screeps

TooAngel NPC / bot / source code for screeps
https://screeps.com
GNU Affero General Public License v3.0
600 stars 154 forks source link

[SEVERE]Fix claimer code changed by wilken which cause can never claim any room when config.nextRoom.resourceStats be false, which be default... #657

Closed XenoAmess closed 1 year ago

XenoAmess commented 2 years ago

@TooAngel I cannot say there be 0 possibility that it be a bug, but I really think it possibly be a hacking-attack to this repo.

please review as soon as possible, thanks.

only when Memory.myRooms.length < 0 can we claim new room, yep a negative array!

XenoAmess commented 1 year ago

you should change config.nextRoom.maxRooms to be like max(8 (default), Game.gcl.level / 1.5) or something like this

image

What you said is reasonable, but you would see there already be existed codes in nextroomers, means max(config.nextRoom.maxRooms, Game.gcl.level)

Which is the only place where we call this function in the codes.

XenoAmess commented 1 year ago

@mschultheiss83 please reply and re-review, thanks.

mschultheiss83 commented 1 year ago

if you have 2 or more nextroomer in 2 different rooms the following line ensures that the first nextroomer wins if (Memory.myRooms.length >= Game.gcl.level) {

XenoAmess commented 1 year ago

looks good to me, but we should change the config.js

    maxRooms: Math.max(8, Game.gcl.level),

nope as the config will only run once, would never recalculate when you upgrade gcl level.

XenoAmess commented 1 year ago

if you have 2 or more nextroomer in 2 different rooms the following line ensures that the first nextroomer wins if (Memory.myRooms.length >= Game.gcl.level) {

yes, it already have such limits. so I don't think we need to add another.

mschultheiss83 commented 1 year ago

nope as the config will only run once, would never recalculate when you upgrade gcl level.

we could update it in brain.prepareMemory

mschultheiss83 commented 1 year ago

yes, it already have such limits. so I don't think we need to add another. it for after respawn like me GCL 28 but like 6 rooms so maxRooms should be near you GCL. i have faced some memory issues when i had more than 20 rooms so i added config.nextRoom.maxRooms = Math.max(8, Game.gcl.level / 1.5); to the brain.prepareMemory function

XenoAmess commented 1 year ago

yes, it already have such limits. so I don't think we need to add another. it for after respawn like me GCL 28 but like 6 rooms so maxRooms should be near you GCL. i have faced some memory issues when i had more than 20 rooms so i added config.nextRoom.maxRooms = Math.max(8, Game.gcl.level / 1.5); to the brain.prepareMemory function

@mschultheiss83 I understood what you wanna. please have a look at the latest version, I added a dynamic config stage machenism, and IMO it can do.

XenoAmess commented 1 year ago

@dependabot use this milestone

TooAngel commented 1 year ago

This pull request was merged by worlddriven.