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

#1 make NPCs sleep properly #67

Merged
merged 1 commit into from Jan 18, 2021
Merged

#1 make NPCs sleep properly #67

merged 1 commit into from Jan 18, 2021

Conversation

szapp
Copy link
Collaborator

@szapp szapp commented Jan 16, 2021

This PR is not ready for merging yet. The issue below should be addressed first.

Are you sure this works as expected? A check against Npc_GetBodyState rarely renders true, because the body state is a bitfield, a combination of multiple active body states. That's why there is the function C_BodyStateContains. Is there a particular reason why you used Npc_GetBodyState?

Originally posted by @szapp in #1 (comment)

To test this fix, manual confirmation is required: When running test 1 from the console, the hero is teleported to a hut at night. The user can confirm if the NPC inside remains asleep.

@AmProsius AmProsius linked an issue Jan 17, 2021 that may be closed by this pull request
@szapp szapp marked this pull request as ready for review January 18, 2021 16:47
@szapp
Copy link
Collaborator Author

szapp commented Jan 18, 2021

Ready for merge

@AmProsius
Copy link
Owner

@szapp can you resolve the conflicts? I'm not sure about the contents of misc.d.

@szapp szapp merged commit d28d481 into master Jan 18, 2021
@szapp szapp deleted the bug001 branch January 18, 2021 21:36
@AmProsius
Copy link
Owner

I'm not sure if that's the intended behavior: When I run test 1, I'm teleported in front of a hut, the NPC inside is awake in the middle of the hut and immediately goes to bed. If I run test 1 again, the NPC is resetted to the middle of the hut and goes to bed again.

@szapp
Copy link
Collaborator Author

szapp commented Jan 18, 2021

Yes, this seems correct. The test is a bit "light" and depends pretty much on observation. The thing to look out for is whether the NPC stays asleep or immediately gets up out of bed again and stands around. There are no prints or anything automatic to double check that.

You can remove the fix and run the test again to compare. To do so, comment out/remove this line:

Ninja_G1CP_001_FixNpcSleep(); // #1

@AmProsius
Copy link
Owner

Thanks, I will try that.

@AmProsius
Copy link
Owner

AmProsius commented Jan 18, 2021

I can now confirm that this fix works as intended. Without the fix, the NPC gets out of bed and with the fix the NPC remains sleeping. Great work!

@szapp
Copy link
Collaborator Author

szapp commented Jan 18, 2021

Thanks for double checking. That was the first test with "manual confirmation" that I wrote, that's why the automation and instruction was lacking a bit.

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.

NPCs wake up immediately
2 participants