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

Cannibalism checks as a vitamin #72224

Merged
merged 10 commits into from
Mar 20, 2024

Conversation

RenechCDDA
Copy link
Member

@RenechCDDA RenechCDDA commented Mar 7, 2024

Summary

Infrastructure "Cannibalism checks converted to vitamin, accessible by mods and other content"

Purpose of change

Flag inheritance is difficult to expand, item flags disappear along with the item, and there's no JSON-side way to track if cannibalism has occurred.

Describe the solution

Convert the flag into a (very long-lasting) vitamin. From there it can be queried by mods, so e.g. @Standing-Storm can have MoM detect if a Homullus has consumed human flesh.

Added a new conditional to conditional names, VITAMIN. True if item has of the supplied vitamin_id, including from inheritance. This is used to replace the previous flag-based condition.

As a vitamin, json can also muck with the decay rate and otherwise do EOC math to add effects as appropriate.

The maximum 'stored' human_flesh_vitamin and its 'rate' are arbitrary numbers, just meant as a very persistent tracker. But again, because they are in json they can be easily modified by other contributors if need be.

Describe alternatives you've considered

All allergies as vitamins :)

Maybe soon, needs some more infrastructure work first.

Testing

2024-03-07.07-31-14.mp4

image

image

Additional context

Note: This removes cannibalism from the "mutant_human_blood" item. mutant_human_blood was previously flagged cannibal due to having the hblood material type. But this ONLY applied to mutant human blood, not mutant human flesh.

Instead of adding cannibal vitamin to the blood (which copies from mutant_human_flesh), I chose to just nix this discrepancy.

Presumably people were not in the habit of bleeding slain mutant humans, an already rare encounter, which is why this was not discovered before.

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Mar 7, 2024
@RenechCDDA
Copy link
Member Author

RenechCDDA commented Mar 7, 2024

Boo this breaks conditional names completely, not just after 2 layers of crafting. Investigating. Resolved.

@RenechCDDA RenechCDDA marked this pull request as draft March 7, 2024 12:03
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Mar 7, 2024
@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. Mods Issues related to mods or modding Items: Food / Vitamins Comestibles and drinks Spawn Creatures, items, vehicles, locations appearing on map [Markdown] Markdown issues and PRs Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Xedra Evolved Anything to do with Xedra Evolved labels Mar 7, 2024
@RenechCDDA RenechCDDA marked this pull request as ready for review March 7, 2024 13:36
@github-actions github-actions bot requested review from KorGgenT and Maleclypse March 7, 2024 13:37
@RenechCDDA
Copy link
Member Author

I've cleared the hurdles I consider blockers, but there is still some unintended changes from this switch.

First, the secret cannibal stash(???) in one version of the hunting lodge no longer has food made out of people, because CANNIBALISM just isn't a flag anymore.

Second, the orc villages in Magiclysm have had the same fate, their "smoked suckers" being replaced with regular smoked meat.

I don't see any reasonable way to keep those while making the change to vitamins, but I'm open to ideas.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@RedMisao
Copy link
Contributor

RedMisao commented Mar 7, 2024

I don't see any reasonable way to keep those while making the change to vitamins, but I'm open to ideas.

Keep the CANNIBALISM flag as mapgen only, so flagged items have an equivalent (or arbitrary) amount of the new vitamin.

@RenechCDDA
Copy link
Member Author

Keeping the cannibalism flag around and applying it would be easy enough, but it would not be able to confer the vitamin without some hackery that strikes me as a bad idea. Food basically has two ways of having vitamins: The default vitamins, or the inherited vitamins when it's made of components.

A similar not-in-scope solution is "Just allow mapgen to arbitrarily insert components", so you could have an item group which has { "item": "hamburger"}, "components" { "human_flesh", "bread" } or whatever.

@PatrikLundell
Copy link
Contributor

Is it possible to define item variants with differing "vitamin" (or other parameter) content and then specify the variant at placement?

@RenechCDDA
Copy link
Member Author

No, and variants should not have this capacity (they are cosmetic-only).

@RenechCDDA
Copy link
Member Author

Keeping the cannibalism flag around and applying it would be easy enough, but it would not be able to confer the vitamin without some hackery that strikes me as a bad idea. Food basically has two ways of having vitamins: The default vitamins, or the inherited vitamins when it's made of components.

A similar not-in-scope solution is "Just allow mapgen to arbitrarily insert components", so you could have an item group which has { "item": "hamburger"}, "components" { "human_flesh", "bread" } or whatever.

Well I made this, which is absolutely terrible with no safety checks whatsoever. But it does work.

master...RenechCDDA:Cataclysm-DDA:mapgen_components

It'd still require remaking the preserved_food and dry_goods groups because you need to define components per-item. So really all it does is preserve the meat entries in the orc camp.

...but it's something.

Unknown if I'm going to work on this further or what. It's definitely not going into this PR.

@RenechCDDA RenechCDDA force-pushed the cannibalism_as_a_vitamin branch from 313a872 to d5394f8 Compare March 9, 2024 12:05
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 9, 2024
@RenechCDDA RenechCDDA force-pushed the cannibalism_as_a_vitamin branch from c61d9b9 to 334f12b Compare March 12, 2024 14:18
@RenechCDDA RenechCDDA force-pushed the cannibalism_as_a_vitamin branch from 334f12b to 0a2fb45 Compare March 12, 2024 14:32
@kevingranade kevingranade merged commit e3cebbc into CleverRaven:master Mar 20, 2024
22 of 27 checks passed
@RenechCDDA RenechCDDA deleted the cannibalism_as_a_vitamin branch March 20, 2024 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. Items: Food / Vitamins Comestibles and drinks [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Xedra Evolved Anything to do with Xedra Evolved Mods Issues related to mods or modding Spawn Creatures, items, vehicles, locations appearing on map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants