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

YACM #9

Merged
merged 165 commits into from
Mar 27, 2022
Merged

Conversation

a-chancey
Copy link
Owner

Summary

Category "Brief description"

Purpose of change

Describe the solution

Describe alternatives you've considered

Testing

Additional context

IvanShestakov and others added 30 commits March 6, 2022 21:40
In base game, there are 5 types of funnels, and only 2 were used in the recipes.
This PR adds other types, mainly to various sausage recipes.
* Fixes #56131 using actual densities
Qrox and others added 13 commits March 26, 2022 19:06
* Add documentation for `ui_manager`
Co-authored-by: Kevin Granade <[email protected]>
Replace the old "torso or arms or legs, and then head if you got a good
hit" logic with an anatomy dependent projectile targeting function, to
move us towards being able to change our anatomies.

This function uses the connection relationships of the body parts in the
anatomy to generate a graph. At the center of the graph is the body part
with the largest hitsize, Which is treated as the center of mass.
To select a bodypart, a path to an end of the graph is first chosen,
with what branch to take chosen in a random fashion, weighted by the
relative hitsize of the possible next limbs.
Then, the total weight of that path is determined, and used to scale the
accuracy value passed in. Based on the accuracy value (lower is closer
to center of mass), we walk down the path, stopping on whatever bodypart
is the last one before it is too expensive to continue.

For random shots, this results in these percentage chances to hit various
bodyparts:
hands:  0.69%
feet :  0.91%
arms :  5.98%
legs :  5.92%
mouth:  0.04%
eyes :  0.04%
head :  0.71%
torso: 72.22%

In practice, the effective result is that body parts other than the
torso are rarely hit. It may make sense in the future to use some other
value than hit_size for weighting.

This also means that monsters will only be able to bleed on their torso
and head, as they are the only parts of a monster anatomy.
* Tacoma clinic/nurse updates

* Tweak furniture and item placement. Cleanup mapgen

* Set faction for mission spawns. Fix containers not getting assigned a faction.
…Slime (#56231)

* Added monster support and Slime Ocularium

Currently the Ocularium cannot be created, this is intentional - Slimewave is still useful through slime minions from Omnicellular

* Large camera and rendering changes

Makes cameras independent from player vision radius limits, dirties vision cache while cameras are active, and adds better vision falloff to cameras.
In addition, removes recalculation of seen_cache during long activities except on refresh frames - an optimization that arose from camera needs.

* Updates tests, bugfixes player half-seeing monsters

Player was able to detect a monster existed, especially on the compass, but not see their location, when the mosnter was outside of sight_max range (usually 9999, but sometimes much smaller for certain mutations and effects)

* Vision lightcasting now checks sightmax first

Also upped MYOPIC vision radius, preventing an adverse effect of excessive blindness - and somehow making a much nicer vision effect for short-sighted characters.

Mirrors were giving inaccurate vision ranges - also I nerfed mirrors because its now possible to nerf mirrors.

Co-authored-by: bombasticSlacks <[email protected]>
Co-authored-by: Kevin Granade <[email protected]>
Three new animist spells, revolving around shadows and spirts
Crafting: add support for byproduct item groups
@a-chancey a-chancey merged commit 50037a0 into a-chancey:TailoringRecipeOverhaul-Cotton Mar 27, 2022
a-chancey pushed a commit that referenced this pull request Nov 29, 2023
* Prevents game occasionally seemingly hanging when moving to new submaps

The reason for the previous problem was an infinite loop caused by:
1. `map::spawn_monsters_submap` for-loops the list of `current_submap->spawns`
2. for every spawned monster, it calls `monster::on_load`
3. `monster::on_load` calls `monster::try_reproduce`, which in turn calls
   `map::add_spawn`
4. So a new spawn is added, thus invalidating the iterator used in step 1
5. Undefined behavior caused by using invaliated iterators.

On my compiler (gcc 13.2.0), the above problem had the following effect:
* The reference `spawn_point &i` pointed to something totally different, so
  that in particular, `i.count` had garbage values
* Instead of `i.count` being reasonable values such as `3` or `1`, the above
  undefined behavior made it have values such as `925969776` or `-632214304`
* `i.count` is the upper bound for the inner for-loop in
  `map::spawn_monsters_submap`, so depending on the garbage value, it might
  seem like an infinite loop.

Stacktrace of app when frozen and problem happened:
```
 #0  0x000055a1eaf36dcb in creature_tracker::find(coords::coord_point<tripoint, (coords::origin)1, (coords::scale)0> const&) const ()
 #1  0x000055a1eaf39253 in Creature* creature_tracker::creature_at<Creature>(coords::coord_point<tripoint, (coords::origin)1, (coords::scale)0> const&, bool) ()
 #2  0x000055a1eaf393b5 in Creature* creature_tracker::creature_at<Creature>(tripoint const&, bool) ()
 #3  0x000055a1eb357a53 in map::spawn_monsters_submap(tripoint const&, bool, bool)::{lambda(tripoint const&)#1}::operator()(tripoint const&) const ()
 #4  0x000055a1eb3a976e in random_point(tripoint_range<tripoint> const&, std::function<bool (tripoint const&)> const&) ()
 #5  0x000055a1eb37dd2d in map::spawn_monsters_submap(tripoint const&, bool, bool) ()
 #6  0x000055a1eb37de77 in map::spawn_monsters(bool, bool) ()
 #7  0x000055a1eb093981 in game::update_map(int&, int&, bool) ()
 #8  0x000055a1eb094451 in game::update_map(Character&, bool) ()
 #9  0x000055a1eb09530f in game::place_player(tripoint const&, bool) ()
 #10 0x000055a1eb0b3a0e in game::walk_move(tripoint const&, bool, bool) ()
 #11 0x000055a1ead27490 in avatar_action::move(avatar&, map&, tripoint const&) ()
 #12 0x000055a1eb0f338c in game::do_regular_action(action_id&, avatar&, std::optional<tripoint> const&) ()
 #13 0x000055a1eb0f6e63 in game::handle_action() ()
 CleverRaven#14 0x000055a1eafbd9ea in do_turn() ()
 CleverRaven#15 0x000055a1eaa5ec13 in main ()
```

This commit instead changes the loop in step 1 above so that it explicitly
*not* uses iterators, but instead old-fashioned indexed loop. The intention
with the change is to allow other parts of the code to add items to the vector
`current_submap->spawns` while we are iterating it here. If new items are
added, they will be handled in later steps of the loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment