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: friendly wildlife mammals spawn friendly offspring #4287

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

ekaratzas
Copy link
Contributor

@ekaratzas ekaratzas commented Mar 2, 2024

Players usually tame wildlife that can be considered 'farm-animals'. It's tedious to require the player to keep taming offspring of the animals they have already tamed in the first place so this change addresses that. Mostly meant as QoL change for farm players.

Purpose of change

This change is meant as a simple QoL improvement, mostly aimed at farm players. It makes is so that wildlife mammals that have been tamed and are friendly to the player produce equally friendly offspring that doesn't need to also be tamed with food as that's tedious.

This change works well alongside generic culling process that already exists for pets: 8c42631

Describe the solution

Fix is really easy for mammals. Just check if parent monster is wildlife creature + friendly to player and then make offspring inherit their attitude towards the player. This fix doesn't currently address creatures reproducing via eggs, e.g. chickens. TODO for tomorrow.

Describe alternatives you've considered

I've considered making one larger change that affects both mammals + wildlife creatures that lay eggs but though I'd test waters first with a smaller change.

Also considered not limiting this to WILDLIFE category for animals but I think it's a good idea to do so as I didn't want to affect behavior of weird inter-dimensional scifi creatures that I'm not that familiar with in the first place. However I'm not opposed to expanding the scope of which creatures are affected, just thought this was a safe start.

Testing

Testing is a bit hard because creatures only spawn based on chance + correct conditions. Need to hack the code a bit to make them spawn more reliably every time the submap is loaded. The following hack works for that: 3236ddb

With that hack in place:

Spawn cow. Tame cow. Go away (like 120 tiles or something) and come back so submap gets reloaded.

Cow will have spawned friendly calf.

friendly_cow_spawn_moo

Also. Spawn cow. Don't tame cow. Go away and come back.

Cow will have spawned a neutral calf.

The testing patch also provides useful messages when this takes place.

Additional context

Checklist

@github-actions github-actions bot added the src changes related to source code. label Mar 2, 2024
src/monster.cpp Outdated Show resolved Hide resolved
Players usually tame wildlife that can be considered 'farm-animals'.
It's tedious to require the player to keep taming offspring of the
animals they have already tamed in the first place so this change
addresses that. Mostly meant as QoL change for farm players.
@ekaratzas ekaratzas force-pushed the friendly-spawns-mammals branch from 941e2dd to 5edce19 Compare March 3, 2024 00:51
@scarf005 scarf005 self-requested a review March 3, 2024 00:52
@scarf005 scarf005 merged commit 729b2b5 into cataclysmbnteam:main Mar 3, 2024
13 checks passed
@ekaratzas ekaratzas deleted the friendly-spawns-mammals 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