191 Commits

Author SHA1 Message Date
Michael Basala a65401424e Minor change updating a var name in the npc_test.cpp file. Windows defines a macro called far, so the variable name far causes a namespace collision. 2026-11-09 12:31:56 -05:00
dobbry-vechur 800fb1dd06 Followers pushed aside keep their task when no door is behind them
- start the close-door activity on the left tile only when it holds a door or vehicle part to close
- a builder shoved off plain ground keeps its build and its construction task in the backlog
2026-10-31 02:09:36 +04:00
dobbry-vechur 5c21b4c359 Set minus thirty Celsius in NPC cold weather tests
- -30_C negates an absolute temperature and gives -303.15 K, far below minus thirty Celsius
- use units::from_celsius( -30 ) in the behavior tree score test and four preemption sections
2026-10-31 02:09:36 +04:00
dobbry-vechur 8a34eed64e NPCs check the hearth again before their fire takes
- run npc::check_fire_spot for an NPC in fire_start_activity_actor::finish before lighting
- end the activity unlit on a failed hearth check and tell a player who sees the NPC
2026-10-31 01:34:54 +04:00
dobbry-vechur da40eac4f2 Harvesting finishes on its own tile after the map shifts or a save loads
- store the harvest target as an absolute position and save it under a new key
- read a bubble position from older harvest saves against the map loaded at its origin
2026-10-31 01:34:54 +04:00
dobbry-vechur 7aed0ed4f2 Camp members ordered to guard keep guarding after a reload 2026-10-28 00:21:58 +04:00
dobbry-vechur 4cf6dc8245 Followers and guards keep to their obligations when getting food
- food options judged against obligations when found and when started
- an NPC that overrides its obligations for food says why
- a hungry follower whose obligations keep it from food says it is hungry
2026-10-25 10:58:47 +04:00
dobbry-vechur 8f731cf178 Item sources are judged alike when found and when taken
- food scans and the meal that takes an item share one filter and one access check
- a faction that shares public goods lets others pour a drink from its containers
- meal checked against NPC diet before it starts
2026-10-25 10:58:47 +04:00
dobbry-vechur 4450eb2b74 Intake stops when more is of no use
- every intake stops at a full stomach, food also at a meal already eaten
- drinks stop at the full line, before the engorged one
- a harvest is eaten later, like carried food
2026-10-25 10:58:47 +04:00
dobbry-vechur 07910a5d8c Meals take real time and give way to harm and orders
- a decision that acted keeps its move surplus or debt into the next turn
- dropped meals are never resumed
- a meal or fire cut short by harm or an order hands back to its task
2026-10-25 10:58:47 +04:00
dobbry-vechur c1d0852084 Drinking from terrain and putting on clothes take time
- a drink from a water source comes a sip per turn
- putting on clothes costs the time wearing them takes
2026-10-25 10:41:21 +04:00
dobbry-vechur 1931de1008 Camp meals report only what is eaten and take time
- a hungry NPC at a healthy weight gets a routine camp meal
- a camp meal the NPC would refuse is never served
- camp food and camp water take the time eating and drinking them takes
2026-10-25 10:41:21 +04:00
dobbry-vechur 5f669eb1e7 The warmth need is named temperature regulation
- need, goal, executor, plan use temperature name
- behavior tree nodes, predicates and test goals use the same name
2026-10-25 10:41:21 +04:00
dobbry-vechur e20bd74d70 Only tests set a committed goal directly
- tests commit a goal without ending the old pursuit
- the game commits a goal only through arbitration
2026-10-25 10:41:20 +04:00
dobbry-vechur b78a94937e NPCs finish what they pick up on the way to a task
- an activity picked up during a walk runs before the walk goes on
- the walk and the task at its end resume after that activity
- a walking NPC shows its task again after a picked-up activity ends or is cancelled
2026-10-24 20:16:22 +04:00
dobbry-vechur c5d03ec220 NPCs light fires only in a hearth
- fire goes only in a hearth: fireplace, stove, brazier, fire ring or clay oven
- fuel is the NPC's own burnable firewood, or firewood or tinder in the hearth it may use
- a hearth that is a firewood pile, busy, off-limits, unburnable or full is skipped
2026-10-23 23:05:42 +04:00
dobbry-vechur e76a1f4585 NPCs leave other factions' goods alone unless shared or hostile
- an owner sharing its stuff with the NPC, or hostile, may be taken from
- the rule covers the item, its containers and its carrying vehicle
- same rule applies to pickup, food, clothing searches
2026-10-23 23:05:42 +04:00
dobbry-vechur a7d96b438c Inventory supplies count only when they can really be consumed
- a carried supply counts for a need only if the NPC would eat or drink it
- food and drink sources skip what a craft has reserved
2026-10-23 18:25:20 +04:00
dobbry-vechur 1854f1753e A guard told to craft crafts, then goes back to its post
- guard on a player's task is off duty until the task ends
- NPC whose task is cancelled gets its mission and attitude back at once
- guard stays a guard when its task ends
2026-10-18 06:49:11 +04:00
dobbry-vechur 6384011b1e Camp guard transition test crosses a real overmap tile boundary 2026-10-18 06:47:19 +04:00
dobbry-vechur aaf1aefa11 Camp meals give the calories they take from the larder
- camp meal gives the eater the calories and vitamins it takes from the larder
- refused personal meal goes back to the larder stock it came from
- food paid for a mission stays spent, eaten or not
2026-10-18 06:47:19 +04:00
dobbry-vechur be6a869b86 NPCs keep the splint they take off
- NPC stows, wields or drops garment it takes off
- NPC owns garment it takes off
2026-10-17 21:18:11 +04:00
dobbry-vechur 88dbc8c8c1 NPCs are not asked the player's theft question
- NPC skips player's theft prompt and stored answer
- player is asked, and stored "never" refuses the player
2026-10-17 21:18:11 +04:00
dobbry-vechur fb4f5cdff2 NPCs that can't fall asleep don't try to sleep
- can_sleep predicate checks CANNOT_SLEEP instead of meth only
- sleep executor, address_needs() and sleep resume in move() skip it too
- a settling NPC gets up when CANNOT_SLEEP appears
2026-10-13 18:58:35 +04:00
dobbry-vechur 38ef247130 Disable NPC Needs leaves NPCs tired, never harmed
- awake sleepiness caps at DEAD_TIRED - 1 instead of TIRED
- sleep deprivation stays at zero without needs
- added no_npc_food_sleepiness_stops_short_of_dead_tired
2026-10-13 18:58:35 +04:00
dobbry-vechur 82b334d96c Closing the door of a car that has moved on ends without a crash
- close_tile_activity_actor::finish looks the part up again on the tile
- ends the activity when nothing there can be closed
2026-10-13 18:58:35 +04:00
dobbry-vechur d7285d19d3 NPCs finish closing a door before deciding anything else
- npc::move runs a pending ACT_CLOSE_TILE before the decision tree
- added follower_closing_a_door_stays_a_follower
2026-10-13 18:58:35 +04:00
dobbry-vechur d4bcc0ad8c Settling NPCs react to danger, needs and orders
- an NPC lying down awake ignored everything until it fell asleep
- each turn it gets up for a hostile in view, a stronger need or an order
- one that keeps lying down past an obligation says so
- added sleep and settling cases to the NPC trip bench
2026-10-13 17:45:18 +04:00
dobbry-vechur e2cbe75164 Followers and guards sleep only where their obligations allow
- sleep search stays inside the reach and skips spots the NPC may not use
- the npc_sleep action asks the same permission as the behavior tree
- an NPC that sleeps past an obligation says so
- a failed sleep search pauses sleep a minute unless something changes
2026-10-13 17:45:17 +04:00
dobbry-vechur ae227c21d9 NPC tiredness labels use the thresholds NPCs act on
- tiredness labels compare with >= instead of >
- added npc_tiredness_reading_matches_the_threshold
2026-10-12 23:39:51 +04:00
dobbry-vechur 7f4a4421b0 Allies speak loud enough to be heard
- ally indoor_voice adds weather sound_attn plus one
- added follower_speech_reaches_the_player
2026-10-12 23:39:51 +04:00
dobbry-vechur 2b2d3d84c6 NPCs drink within what their obligations allow
- added npc_intention, adopted before every dispatch
- goal commitment uses should_interrupt and end_need_pursuit
- water candidates filtered by need_view
- address_needs walks and forage/harvest gated by obligations
- added water_out_of_reach complaint and override speech
- idle followers call complain()
2026-10-12 23:39:51 +04:00
dobbry-vechur 3a1018da0a Self-care walks end where the NPC can act
- added npc_trip_spec with stand_on, within_range, legacy_nearest_passable
- added npc::resolve_trip, nearest interaction tile first
- added endpoint and step checks against get_path_avoid and terrain
- added map::can_pass, sharing route's stair and ramp steps
- move_to_and_verify takes a spec and reuses the kept path
- is_valid_sleep_candidate uses resolve_trip
- added movement tests: floors, doors, fire, path reuse
2026-10-11 18:16:47 +04:00
Kromgart 09a75ac67d Fix item duplication from spilling (#88854)
* Fix item duplication from spilling

* IWYU again

* Appease clang-tidy, who doesn't agree with IWYU
2026-10-05 15:38:14 +02:00
Curtis Merrill 258b80d42b change visitable to item_location, remove item inheritance from visitable, and add item_location inheritance from visitable.
Co-Authored-By: dobbry-vechur <259678433+dobbry-vechur@users.noreply.github.com>
2026-09-30 21:34:09 -04:00
Kai Maier 57d2a3a010 - Moved the marloss and mycus stuff to EOC's
- Since the marloss stuff did a lot of stuff i had to add a few new affects to not change the old logic
- These include: u_add_addiction, u_lose_addiction, u_vomit (that one is evil :o ), u_fall_asleep, u_heal_all, u_hurt_all, u_set_hunger, u_mod_healthy, u_fil_stomach, u_marlossify (i went of the name already existing for that) and u_add_memorial
- I also added what they do to the documentation EFFECT_ON_CONDITION.md

- The reason for that is that the callback functions that triggered the effect on eating a seed or beery were not called anymore aka dead code

- I also saw that the EOC's for the addictions already existed and used those.
- This allowed me to remove the old / dead code from the iuse.h and iuse.cpp. Same thing in the item_factory.cpp

- The f_map_is_passible function in condition.cpp is supposed to make the spores skip walls like the old code does

- Ah yes and a few tests so i dont go insane testing it manually

- I am also very thankful (!) to the Magiclism and Mind over Matter people since i was able to use that as a reference
- Also whoever made the Docs is amazing too!

This took in fact 9 hours of my life... just for anyone wondering

Changes after feedback:

Fixed the janky broken map logic i created to keep the iuse rng logic
Removed the boolean parameter for vomit and marlossify since it did nothing
Moved the daily_health and hunger assertions to math like suggested
Fixed the eating order issue and now it uses a MARLOSS guard in the can_eat function like suggested
Renamed the NPC_AUTOCONSUME flag to MARLOSS to better reflect the actual usage
Adjustd my existing tests and also added for the order of eating and blacking out. This now uses the time_in_future to keep it in a safe order
Also added a test for the marloss refusal
Added tests in for the new hunger and daily heath math parsers
2026-09-24 19:10:29 +02:00
Curtis Merrill 63be141baf remove inventory class and reimplement invlets under avatar
stash starting inv that doesn't fit

fix save load order

initialize string hint in android build to none

reuse free assigned invlet and move it

Update npc.cpp

Update character_inventory.cpp

Update src/avatar.cpp

Update src/npc.cpp

Update src/avatar.cpp

Co-Authored-By: dobbry-vechur <dumbkevin@proton.me>
2026-09-21 16:15:22 -04:00
RenechCDDA da2aaffffd Add quick setup option to clear map 2026-06-22 15:07:51 -04:00
dumb-kevin e9a7af4fc6 Upgrade vendored plf_colony to v7.6.13, plf_list to v2.8.02
- Replace src/third-party/plf/{colony,list}.h with upstream verbatim
- Add cata:: index<->iterator free helpers (plf removed members)
- Rename plf-facing get_iterator_from_pointer to get_iterator
- Switch deallocating clear() calls to reset() in map and item_wakeup
- Drop const from local map_stack in pickup autopickup
- Migrate colony_test and list_test for reshape, splice, ADL friends
- Add IWYU mapping for plf::void_cast in list.h and colony.h
2026-05-19 18:06:07 +04:00
dumb-kevin 661b45d89c Vendor plf_colony/plf_list verbatim under src/third-party/plf/
- Add upstream plf_colony v5.10 and plf_list v1.60 verbatim
- Add upstream zLib LICENSE
- Replace src/colony.h with thin cata::colony alias wrapper
- Replace src/list.h with thin cata::list alias wrapper
- Drop colony|list path from .clang-tidy header exclude regex
- Suppress Win32 test-exe abort dialog via _set_abort_behavior
2026-05-18 21:56:09 +04:00
RenechCDDA cb924413e4 Move init_veh_status to an enum (oh god) 2026-05-17 23:11:41 -04:00
dobbry-vechur ba5ee659f4 Revert "Process contents_change_handler in contents_change_activity_actor" 2026-04-28 16:56:04 +04:00
Maleclypse f150134a2b Merge pull request #86713 from dobbry-vechur/improve/npc-bt-cascade-cleanup 2026-04-27 19:25:41 -05:00
ShnitzelX2 a3a39cbc7d process contents_change_handler in activity
for supporting multi-turn fill_liquid_activity_actor
2026-04-27 01:08:47 -04:00
dumb-kevin 7ad1c6a114 NPC: wait while player is in a moving vehicle
- added player_moving_vehicle helper in oracle
- gated npc_is_following on moving-vehicle check
- gated npc_should_embark on moving-vehicle check
- paused npc_follow_embarked dispatch when vehicle moves
- added vehicle yield integration test
2026-04-27 00:37:17 +04:00
dumb-kevin 28b79d5c9c NPC: move follow_embarked into BT, drop cascade follow duplicates
- added npc_should_embark predicate and npc_embark_urgency score
- added npc_follow_embarked node under npc_priorities
- routed follow_embarked through BT dispatch and goal commitment
- mapped follow_embarked to decision_category::follow
- removed cascade duplicates for goto_to_this_pos, follow_embarked, follow_player
- gated combat hook on passive actions, is_following, and same-vehicle
2026-04-26 23:54:56 +04:00
dumb-kevin 693c472c54 NPC: split follower state from spacing rule, suppress duty under follow
- replace should_follow_close with can_follow_player_now and desired_follow_radius
- gate on_shift, displaced_from_post, duty_urgency on is_walking_with
- drop guard_post early-return from npc_is_following
- pause under hold_position and guarding-idle when address_needs undecided
- update tests for new follower-vs-duty arbitration
2026-04-26 11:15:51 -07:00
Andrew Krieger 29c6a2ae26 More older ms compiler/sdk fixes. 2026-04-09 16:04:05 -07:00
Maleclypse 5ad8869a7f Fix faction-hostile NPCs sleeping instead of fighting (#86316)
- assess_danger() uses guaranteed_hostile() instead of is_enemy()
- Re-run regen_ai_cache() after attitude flip in move()
- Added two tests for faction-hostile NPC threat detection

Co-authored-by: dumb-kevin <dumb-kevin@users.noreply.github.com>
2026-04-08 18:29:11 -05:00
dumb-kevin 828ac66bb3 Fix faction-hostile NPCs sleeping instead of fighting
- assess_danger() uses guaranteed_hostile() instead of is_enemy()
- Re-run regen_ai_cache() after attitude flip in move()
- Added two tests for faction-hostile NPC threat detection
2026-04-07 16:55:50 +04:00