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

Basecamp job rework - wandering/sitting/job priorities. #38248

Merged
merged 9 commits into from Apr 2, 2020
Merged

Basecamp job rework - wandering/sitting/job priorities. #38248

merged 9 commits into from Apr 2, 2020

Conversation

ghost
Copy link

@ghost ghost commented Feb 22, 2020

Summary

SUMMARY: Features "Basecamp job rework - wandering/sitting/job priorities."

Purpose of change

This is a combination of #37330 and #37325 , and a new feature of adding differing priorities to basecamp jobs.

Normally I wouldnt like to mush PRs together, but they were all chaining building on from one another, all caught up in freeze, rebasing wa sa nightmare, and as I worked on the 3rd one in the chain, I was discovering I had to rework the entire thing anyway which made the previous 2 PRs obsolete. So here it is.

Ive changed how jobs work - now it is its own class, not with an enum list of jobs, but an entry for each type of activity, which can then be given a priority each. This makes things more robust going forward with adding new tasks etc.

Ive changed how being assigned to a camp works, before it was an NPC mission, which conflicted with other stuff like the missoin for GUARD_ALLY and so on, it was best if being assigned to camp was a seperate thing that was more explicit, so NPCs didnt get confused about what to do.

Due to adding job priorities ive had to change how the activity code works a bit, so now they can just scan if an activity is possible, before they do it, if it isnt possible, they scan the next activity in their list.

Ive added them wandering and finding chairs to sit on when they dont have any tasks to do.

Also allowed activities to use the basecamp storage zone for the job components/fetching.

I dont think there will be any problems migrating from the previous job system in older saves, it should validate and the worst that would happen is that they dont do any jobs until you assign new priorities at the camp board, but im willing to accept ideas for how to migrate this fast moving mess a bit smoother.

This is something im laying some foundations for more flexible camps , where camp upgrades lay down construction zones, for this to work, it needs to be a bit smarter in how camp workers are assigned and do their jobs.

Describe the solution

As above

Describe alternatives you've considered

N/A

Testing

Made lots of new camps, assigned workers, killed them, checked if they were removed, told them to leave, made them mutiny, assigned jobs, assigned different priorities, layed down various types of tasks ( vehicle deconstruction and construction zones for example ) , chjecked to see they were performed in order, checked to see if they wandered around when thewy werent working.

Checked to see if th enew camp mission for "assign workers" worked by only showing followers, made sure that everything was serialized and deserialized correctly.

Additional context

N/A

@ghost ghost requested a review from mlangsdorf February 22, 2020 22:48
src/basecamp.cpp Outdated Show resolved Hide resolved
@ghost ghost added 0.E Feature Freeze <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. Mechanics: Character / Player Character / Player mechanics NPC / Factions NPCs, AI, Speech, Factions, Ownership Player Faction Base / Camp All about the player faction base/camp/site labels Feb 24, 2020
@Funguss
Copy link
Contributor

Funguss commented Feb 27, 2020

So will job priorities be NPC specific? i.e. can I make Helen prioritise vehicle maintenance while Larry does some cooking then goes off to hunt?

@ghost
Copy link
Author

ghost commented Feb 29, 2020

So will job priorities be NPC specific? i.e. can I make Helen prioritise vehicle maintenance while Larry does some cooking then goes off to hunt?

Yes. Each NPC will have their list of jobs with each having its own priority, like Rimworld.

@ghost ghost requested review from I-am-Erk and John-Candlebury as code owners March 6, 2020 19:19
@ghost ghost changed the base branch from master to dev March 6, 2020 19:19
@ZhilkinSerg ZhilkinSerg force-pushed the dev branch 2 times, most recently from aa39539 to 9761f13 Compare March 10, 2020 09:21
@ZhilkinSerg ZhilkinSerg force-pushed the dev branch 6 times, most recently from 924f105 to 39e00e3 Compare March 18, 2020 07:00
@ZhilkinSerg ZhilkinSerg force-pushed the dev branch 3 times, most recently from ad63e77 to 8e68539 Compare April 1, 2020 12:18
@kevingranade kevingranade force-pushed the dev branch 4 times, most recently from 621a68e to b7106d0 Compare April 2, 2020 07:42
@ZhilkinSerg ZhilkinSerg force-pushed the dev branch 3 times, most recently from 0f30a43 to d432807 Compare April 2, 2020 12:55
@ZhilkinSerg ZhilkinSerg changed the base branch from dev to master April 2, 2020 14:31
@ghost
Copy link
Author

ghost commented Apr 2, 2020

Rebased, cleaned up, little bug fixed, tested, working.

@ZhilkinSerg ZhilkinSerg merged commit 9f859d8 into CleverRaven:master Apr 2, 2020
@Qrox
Copy link
Contributor

Qrox commented Apr 3, 2020

This is causing debug message to show when loading saves from 0.D experimental

 DEBUG    : Failed to read from "./save/Landrum/o.0.-1": line 31:7736: tried to start object, but found '0', not '{'

_coords":[233,-3],"last_player_seen_pos":null,"goalx":-2147483648,"goaly":-2147483648,"goalz":-2147483648,"guardx":-2147483648,"guardy":-2147483648,"guardz":-2147483648,"current_activity_id":"ACT_NULL","pulp_location":null,"mission":3,"job":0
                                                                                                                                                                                                                                                ^
                                                                                                                                                                                                                                                 ,"previous_mission":0,"faction_api_ver":2,"my_fac":"no_faction","attitude":0,"previous_attitude":0,"op_of_u":{"trust":0,"fear":0,"value":0,"anger":0,"owed":0},"chatbin":{"first_topic":"TALK_BUNKER_MERCHANT","skill":"none","style":"","missio


 FUNCTION : bool read_from_file(const string&, const std::function<void(std::basic_istream<char>&)>&)
 FILE     : *snip*/src/cata_utility.cpp
 LINE     : 434

Seems that "job" was changed from an int to an object but the deserialization code wasn't made back-compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Info / User Interface Game - player communication, menus, etc. Mechanics: Character / Player Character / Player mechanics NPC / Factions NPCs, AI, Speech, Factions, Ownership Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants