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

feat: add reproduce area options in debug-map menu #4311

Merged
merged 3 commits into from
Mar 8, 2024

Conversation

ekaratzas
Copy link
Contributor

@ekaratzas ekaratzas commented Mar 8, 2024

Extends the map submenu of the debug menu with an option to force monsters in a rectangular area to reproduce.

cow goes moo, sheep goes bah

Purpose of change

Purpose is to ease debugging of hard-to-reproduce corner-cases such as what happens when a monster reproduces and spawns offspring.

Describe the solution

Solution works by extending map sub menu of debug menu with an option to force all monsters in an area to reproduce. This can actually be triggered multiple times in the row in order to quickly create a huge flock of creatures out of a specific parent. The forcing of reproduction works by splitting try_reproduce into 2 parts, try() and actual reproduce()

Note that the solution does not cause eggs to hatch as that is based on the rot-timer functionality which is in a different part of the codebase altogether. TODO for future PR.

Describe alternatives you've considered

Testing

spawn creatures. use new debug command to get them to spawn other creatures. then use debug command to kill in area to check that we didnt break that as well due to refactoring. moo

Additional context

Checklist

Extends the map submenu of the debug menu with an option to force
monsters in a rectangular area to reproduce.

cow goes moo, sheep goes bah
@github-actions github-actions bot added the src changes related to source code. label Mar 8, 2024
@ekaratzas
Copy link
Contributor Author

@chaosvolt / @scarf005 fyi

@scarf005 scarf005 self-requested a review March 8, 2024 05:10
@scarf005 scarf005 self-assigned this Mar 8, 2024
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build fails in lua bindings due to change in function signature.

/home/scarf/repo/cata/Cataclysm/src/catalua_bindings_creature.cpp:285:9: error: no matching function for call to 'resolve'
  285 |         SET_FX_T( try_reproduce, void() );
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/scarf/repo/cata/Cataclysm/src/catalua_bindings_utils.h:28:9: note: expanded from macro 'SET_FX_T'
   28 |         sol::resolve< func_type >( &UT_CLASS::func_name))
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/scarf/repo/cata/Cataclysm/src/sol/sol.hpp:19779:14: note: candidate function template not viable: no known conversion from 'void (monster::*)(const bool)' to 'void (*)()' for 1st argument
 19779 |         inline Sig* resolve(Sig* fun_ptr) {
       |                     ^       ~~~~~~~~~~~~
/home/scarf/repo/cata/Cataclysm/src/sol/sol.hpp:19774:14: note: candidate template ignored: could not match 'R (*)(void (*)(), Args...)' against 'void (monster::*)(const bool)'
 19774 |         inline auto resolve(R fun_ptr(Args...)) -> R (*)(Args...) {
       |                     ^
/home/scarf/repo/cata/Cataclysm/src/sol/sol.hpp:19784:14: note: candidate template ignored: could not match 'void (*)()' against 'bool'
 19784 |         inline auto resolve(R (C::*mem_ptr)(Args...)) -> R (C::*)(Args...) {
       |                     ^
/home/scarf/repo/cata/Cataclysm/src/sol/sol.hpp:19789:17: note: candidate template ignored: failed template argument deduction
 19789 |         inline Sig C::*resolve(Sig C::*mem_ptr) {
       |                        ^
/home/scarf/repo/cata/Cataclysm/src/sol/sol.hpp:19794:14: note: candidate template ignored: substitution failure [with Sig = <void ()>, F = void (monster::*)(const bool)]: no matching function for call to 'resolve_i'
 19794 |         inline auto resolve(F&& f) -> decltype(detail::resolve_i(types<Sig...>(), std::forward<F>(f))) {
       |                     ^                          ~~~~~~
1 error generated.

src/monster.h Outdated Show resolved Hide resolved
@ekaratzas
Copy link
Contributor Author

@scarf005 just tested again on top of latest changes.

@scarf005
Copy link
Member

scarf005 commented Mar 8, 2024

image

you can also re-request reviews here.

@ekaratzas ekaratzas requested a review from scarf005 March 8, 2024 06:58
@ekaratzas
Copy link
Contributor Author

good point, still rusty with github

Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

chicken eggs spawned via this way seems to have negative birthday.

@ekaratzas
Copy link
Contributor Author

@scarf005 did you reproduce this on top of just this PR or with extra code you added to force rotting of eggs?

@scarf005
Copy link
Member

scarf005 commented Mar 8, 2024

with the extra code. i guess this is because baby timer isn't initialized cotrectly

@ekaratzas
Copy link
Contributor Author

yes just saw that

@ekaratzas
Copy link
Contributor Author

@scarf005 curious, I can't seem to repro your issue. I tried causing friendly and not friendly chickens to spawn eggs and i move to their tile to pick up the eggs 1 turn afterwards and examine the items. The age always seems to be '1', not a negative value.

What am I missing in the repro steps? :S

egg_age

@scarf005
Copy link
Member

scarf005 commented Mar 8, 2024

hmm strange, can't reproduce.

@scarf005 scarf005 merged commit c8d4601 into cataclysmbnteam:main Mar 8, 2024
13 checks passed
@ekaratzas ekaratzas deleted the debug-menu-reproduce branch March 10, 2024 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants