Skip to content
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

WIP move createFlag code to RoomPosition #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sparr
Copy link
Contributor

@sparr sparr commented Sep 28, 2017

This almost works. It seems to work in all the situations where the old code works, and it claims to work when I don't have vision on the target room, returning the name of the new flag. It just fails to actually create the flag :( WIP until I figure that out.

Fixes #24

@Mototroller
Copy link
Contributor

@sparr, Hi! I faced with the same problem, too. I tried to do pretty same things you've been committed, and when I called
(new RoomPosition(...no-vision...)).createFlag(...),
it returned successfully with a flag name, but flag has been appeared in the game after several (30+) ticks. Looks like it's an issue with intents applying for non-constructed Rooms, but it should be investigated more carefully.

@Mototroller
Copy link
Contributor

Mototroller commented Nov 17, 2017

@sparr, got it: seems like this is because intents are not passed to makePos (link), so here can be unexpected troubles with require caching (RoomPosition.prototype.createFlag will use outdated/dangling intents reference).

@artch: please, glance at this issue if you can. The question: why not to recache Room + RoomPosition with one single require('./rooms').make(runtimeData, intents, register, globals) call here? It will allow to consistently update intents from Room and RoomPosition member functions, and helps to resolve this issue.

Otherwise, I suggest to pass intents reference to makePos and save it into RoomPosition own closure.

UPDATE: even by moving RoomPosition to the same scope (exports.make() {...}) with Room I still can't force intents to be applied next tick for rooms with no vision 😕. Seems like the problem is more complicated.

@TheRealMaxion
Copy link

Rooms with no players in them are only run occasionally. This is why even removing an existing flag without vision can take several ticks before it actually disappears.
So you would have the same issue with creating most likely.
Would be nice if we could make it work in the same way the client does it when placing them manually, but I think that is a very different way.

@sparr
Copy link
Contributor Author

sparr commented Nov 17, 2017

Do we have any info on how the client accomplishes one-tick no-vision flag creation?

@Mototroller
Copy link
Contributor

@sparr, seems like it is

@o4kapuk o4kapuk self-assigned this Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't create flag in room with no creeps in it.
4 participants