-
Notifications
You must be signed in to change notification settings - Fork 504
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
Relationship/kin thought weights | Option to save dead relationships #2476
Open
Snowstar38
wants to merge
29
commits into
ClanGenOfficial:development
Choose a base branch
from
Snowstar38:Relationship-thoughts
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
3cf52b3
Kin and relationship thoughts, retain death relationships
Snowstar38 a830bef
Merge branch 'ClanGenOfficial:development' into development
Snowstar38 609ddd5
Fix game setting crash
Snowstar38 fde35e4
Merge branch 'development' of https://github.com/Snowstar38/clangen i…
Snowstar38 cafa66f
Update ProfileScreen.py
Snowstar38 668b9e4
remove print
Snowstar38 0d3af92
Merge branch 'ClanGenOfficial:development' into development
Snowstar38 a77e2e5
Merge branch 'Clangen' into development
Snowstar38 a00f8a6
Merge branch 'ClanGenOfficial:development' into development
Snowstar38 fb5c788
Add description for new function
Snowstar38 583f574
Fixing dead relations
Snowstar38 7077ef7
Inheritance/family tree fix
Snowstar38 f7cdcda
Polish
Snowstar38 961f534
add description
Snowstar38 6d54c25
plurality
Snowstar38 8ecf4d6
Weight based rolls
Snowstar38 bc50b5d
Update cats.py
Snowstar38 c0c8f83
Update game_config.json
Snowstar38 92b5d33
pylint pls
Snowstar38 8a9a70e
surprise, I'm just dumb
Snowstar38 496672e
Update cats.py
Snowstar38 4ada0c5
consarn it
Snowstar38 1929beb
tidying up get_kin_groups
Snowstar38 7d2feaa
Fix for other_cat being self
Snowstar38 fda32d0
Merge branch 'ClanGenOfficial:development' into Relationship-thoughts
Snowstar38 8c25287
Lixxis requests :)
Snowstar38 6486866
self > cat
Snowstar38 072fd0b
Merge branch 'ClanGenOfficial:development' into Relationship-thoughts
Snowstar38 a36aa48
Merge branch 'ClanGenOfficial:development' into Relationship-thoughts
Snowstar38 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1665,6 +1665,43 @@ def change_relationship_values( | |
if log_text not in rel.log: | ||
rel.log.append(log_text) | ||
|
||
def get_kin_groups(cat, include_dead=True): | ||
""" | ||
Retrieves the kin groups (close kin, kin, and distant kin) for the cat. | ||
:param include_dead: Whether to include dead cats in the kin groups (default: True). | ||
:return: A tuple containing three dictionaries: close_kin, kin, and distant_kin. | ||
- close_kin: Dictionary of close kin groups (parents, siblings, children, mates, former mates). | ||
- kin: Dictionary of kin groups (grandparents, aunts/uncles, cousins, grandkits). | ||
- distant_kin: Dictionary of distant kin groups. | ||
""" | ||
close_kin = { | ||
"gen_parents": [cat.all_cats.get(cat_id) for cat_id in cat.get_parents()], | ||
"gen_siblings": [cat.all_cats.get(cat_id) for cat_id in cat.get_siblings()], | ||
"gen_children": [cat.all_cats.get(cat_id) for cat_id in cat.get_children()], | ||
"gen_mates": [cat.all_cats.get(cat_id) for cat_id in cat.mate], | ||
"gen_former_mates": [cat.all_cats.get(cat_id) for cat_id in cat.previous_mates] | ||
} | ||
|
||
kin = { | ||
"gen_grandparents": [cat.all_cats.get(cat_id) for cat_id in cat.all_cats if cat.all_cats.get(cat_id).is_grandparent(cat)], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "get_kin_groups" function is not very performant. To improve it at least a little add the new "kin" to the inheritance class. It seems it was done but not used? |
||
"gen_auntuncle": [cat.all_cats.get(cat_id) for cat_id in cat.all_cats if cat.is_uncle_aunt(cat.all_cats.get(cat_id))], | ||
"gen_cousin": [cat.all_cats.get(cat_id) for cat_id in cat.all_cats if cat.is_cousin(cat.all_cats.get(cat_id))], | ||
"gen_grandkits": [cat.all_cats.get(cat_id) for cat_id in cat.get_grandkits()] | ||
} | ||
|
||
distant_kin = { | ||
"gen_distantkin": [cat.all_cats.get(cat_id) for cat_id in cat.get_distant_kin()] | ||
} | ||
|
||
if not include_dead: | ||
for group in close_kin.values(): | ||
group[:] = [cat for cat in group if not cat.dead] | ||
for group in kin.values(): | ||
group[:] = [cat for cat in group if not cat.dead] | ||
for group in distant_kin.values(): | ||
group[:] = [cat for cat in group if not cat.dead] | ||
|
||
return close_kin, kin, distant_kin | ||
|
||
# ---------------------------------------------------------------------------- # | ||
# Text Adjust # | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it important at this point to already have the cat class? It would be more performant to just use the id's as long as possible and then fetch the cat, when the information from them is needed.