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

feat: JSONize activity speed/movecost #6064

Open
wants to merge 77 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
360c76a
mroe based_on speed
Goredell Feb 10, 2025
af5632b
tmp
Goredell Feb 10, 2025
0256563
temp
Goredell Feb 10, 2025
d171125
json tidy
Goredell Feb 10, 2025
96f605a
restructure #1
Goredell Feb 10, 2025
6c9d0da
more fields
Goredell Feb 10, 2025
a774d9f
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 10, 2025
9125a95
wb_wrapper
Goredell Feb 11, 2025
c9885df
speed recalc
Goredell Feb 11, 2025
a2a78de
speed calculation overhaul pt.1
Goredell Feb 11, 2025
26322ca
json overhaul #2
Goredell Feb 12, 2025
7ae94e3
minor logic fixes
Goredell Feb 12, 2025
202288a
revert crafting changes (for now)
Goredell Feb 12, 2025
0bb78e9
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 12, 2025
e527bb0
Merge branch 'main' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 12, 2025
289c25d
Resolving reviews
Goredell Feb 12, 2025
089f2ac
missied a spot
Goredell Feb 12, 2025
60aa333
consistency with player_activity constructor
Goredell Feb 13, 2025
10e2c0e
total moves must be set
Goredell Feb 13, 2025
a938e34
Activity message
Goredell Feb 13, 2025
1f4a1c2
some saved info
Goredell Feb 13, 2025
0ba1f82
damn optional
Goredell Feb 13, 2025
c2be686
static
Goredell Feb 13, 2025
728757a
Revert "consistency with player_activity constructor"
Goredell Feb 13, 2025
7c21211
remove balance changes for now
Goredell Feb 13, 2025
f57b032
bool speacial and some other vals
Goredell Feb 14, 2025
8b6a747
complex progress calc
Goredell Feb 14, 2025
b95a656
Merge branch 'main' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 14, 2025
91cefc6
fix tests to use new value
Goredell Feb 14, 2025
638bd67
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 14, 2025
e43cce6
possible test fix
Goredell Feb 14, 2025
ff7ac94
I don't like this
Goredell Feb 14, 2025
f3546df
i don't like this less
Goredell Feb 14, 2025
a2a0d71
stats, skills and qualities
Goredell Feb 17, 2025
4314a64
Merge branch 'main' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 17, 2025
d63a467
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 17, 2025
77be800
fix json
Goredell Feb 17, 2025
d212109
commentaries and json de//serializers
Goredell Feb 17, 2025
7ed34fd
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 17, 2025
2aa9852
fix de//serialization try 1
Goredell Feb 17, 2025
0a3dcce
Merge branch '6002' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 17, 2025
8ef51de
minor fixes
Goredell Feb 17, 2025
09df0f1
deserialize done right
Goredell Feb 17, 2025
c687792
Merge branch 'main' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 17, 2025
991f0ab
docs
Goredell Feb 17, 2025
cde17a6
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 17, 2025
6b37405
data migration
Goredell Feb 17, 2025
ee3e573
Merge branch '6002' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 17, 2025
b14ccc5
fix migration
Goredell Feb 18, 2025
e1265b0
Update src/activity_actor.cpp
Goredell Feb 18, 2025
fcb8390
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 18, 2025
68aec4d
remove default constructor
Goredell Feb 18, 2025
93ae382
Merge branch '6002' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 18, 2025
1e94ee3
reviews
Goredell Feb 18, 2025
55dc949
Apply suggestions from code review
Goredell Feb 19, 2025
ad23453
Update src/activity_actor.cpp
Goredell Feb 19, 2025
6527b7c
review suggestions
Goredell Feb 19, 2025
d0091cf
Update src/activity_actor.cpp
Goredell Feb 19, 2025
29bd8fb
more suggestions
Goredell Feb 19, 2025
b372ebb
Merge branch '6002' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 19, 2025
aaba91c
move progress to actor
Goredell Feb 19, 2025
3d62b53
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 19, 2025
8deeedd
back to deque
Goredell Feb 19, 2025
becb229
Merge branch '6002' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 19, 2025
60ee637
Merge branch 'main' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 19, 2025
81b1c63
forgotten returns
Goredell Feb 19, 2025
a63478d
fix endless gates
Goredell Feb 19, 2025
3e66a52
fucking type
Goredell Feb 19, 2025
ba3ddc0
json additions
Goredell Feb 21, 2025
1ed024b
docs
Goredell Feb 21, 2025
305bf79
style(autofix.ci): automated formatting
autofix-ci[bot] Feb 21, 2025
ffb5a2f
Apply suggestions from code review
Goredell Feb 21, 2025
8e32a0f
empty() and debugmsg
Goredell Feb 21, 2025
f0d5cb5
Merge branch '6002' of https://github.com/Goredell/Cataclysm-BN into …
Goredell Feb 21, 2025
b3f55f9
Merge remote-tracking branch 'upstream/main' into pr/6064
chaosvolt Feb 21, 2025
5cca8db
removed debug msg
Goredell Feb 21, 2025
db215fa
shuffle funcs
Goredell Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
287 changes: 152 additions & 135 deletions data/json/player_activities.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,49 @@ something that takes more than just one turn.
roots into the ground. Should be true if the activity lasts longer than a few minutes, and can
always be accomplished without moving your feet.

- based_on: Can be 'time', 'speed', or 'neither'.

- time: The amount that `player_activity::moves_left` is decremented by is independent from the
character's speed.

- speed: `player_activity::moves_left` may be decremented faster or slower, depending on the
character's speed.

- neither: `moves_left` will not be decremented. Thus you must define a do_turn function;
otherwise the activity will never end!
- special (false): activity is considered special and expects to have unconventional logic,
compared to other activities

- complex_moves(false):
- if false - activity expects to have no speed calculations and do 100 moves per turn,
in JSON it's specified by absence of `complex_moves` block;
- if true - activity expects to have complex speed/moves calculations, based on several factors:
- assistable(false): activity can be assisted by other creatures;
- bench(false): activity can be done using workbench;
- light(false): activity speed is affected by current light level;
- speed(false): activity speed is affected by creature's speed;
- skills: activity speed is affected by skills provided in by pairs `skill_name: modifier`
or `"skills": true` if u want to explicitely show that activity expects to have modifications
based on skills, but those will have to be determine on go (like crafting or constructing):
- `"skills": true`
- `"skills": ["fabrication", "5"]`
- stats: activity speed is affected by skills provided in by pairs `stat_name: modifier`
or `"stats": true` if u want to explicitely show that activity expects to have modifications
based on stats, but those will have to be determine on go (like crafting or constructing):
- `"stats": true`
- `"stats": ["DEX", "5"]`
- qualities: activity speed is affected by qualities provided in by pairs `q_name: modifier`
or `"qualities": true` if u want to explicitely show that activity expects to have modifications
based on qualities, but those will have to be determine on go (like crafting or constructing):
- `"qualities": true`
- `"qualities": ["CUT_FINE", "5"]`
- morale(false): activity speed is affected by creature's current morale level.

Example for whole block:
"complex_moves": {
"assistable": true,
"bench": true,
"light": true,
"speed": true,
"stats": true,
"skills": [ ], - //same as `"skills": true`
"qualities": [ ["CUT_FINE", "5"] ],
"morale": true
}

- morale_blocked(false): activity won't be performed if creature's morale level is below certain level.

- verbose_tooltip(true): activity will have an expanded progress window, showing a lot of information

- no_resume (false): Rather than resuming, you must always restart the activity from scratch.

Expand Down Expand Up @@ -76,12 +109,31 @@ There are several ways an activity can be ended:
should call `set_to_null()`. If there isn't a finish function, `set_to_null()` will be called for
you (from activity_actor::do_turn).

3. `Character::cancel_activity`
3. `progress.complete()`

Basically the same as `moves_left` <= 0, but with extra checks and using a progress system.

4. `Character::cancel_activity`

Canceling an activity prevents the `activity_actor::finish` function from running, and the
activity does therefore not yield a result. Instead, `activity_actor::canceled` is called. If
activity is suspendable, a copy of it is written to `Character::backlog`.

## Progress

`progress_counter` - class specialize on tracking progress of and activity

- targets: queue of targets that are expected to be processed, stores target name, moves_total and
moves_left for the target;

- moves_total (0): Total number of moves required to complete the activity aka all the tasks;

- moves_left (): The number of moves remaining in this activity before it is complete aka all the tasks;

- idx (1): 1-based index of currently prcessing task;

- total_tasks (0): Counts total amount of tasks - done and in queue.

## Notes

While the character performs the activity, `activity_actor::do_turn` is called on each turn.
Expand Down Expand Up @@ -110,9 +162,7 @@ based on time or speed.

To prevent an infinite loop, ensure that one of the following is satisfied:

- The `based_on` JSON property is `speed` or `time`

- The `player_activity::moves_left` is decreased in `do_turn`
- The `player_activity::progress.moves_left` is decreased in `do_turn`

- The the activity is stopped in `do_turn` (see 'Termination' above)

Expand Down
Loading
Loading