-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
JSONify activity text widget #55138
JSONify activity text widget #55138
Conversation
51304ae
to
ce8c4c5
Compare
ce8c4c5
to
b88e735
Compare
There's a test failure in CI that I can reproduce locally with |
I tried using the same method as the activity tracker test and it seems to fix the issue (at least on my machine): diffdiff --git a/tests/widget_test.cpp b/tests/widget_test.cpp
index 458c7292b6..ede43629bd 100644
--- a/tests/widget_test.cpp
+++ b/tests/widget_test.cpp
@@ -594,27 +594,30 @@ TEST_CASE( "widgets showing activity level", "[widget][activity]" )
widget activity_w = widget_test_activity_clauses.obj();
ava.reset_activity_level();
- ava.set_activity_level( NO_EXERCISE );
+ activity_tracker &tracker = ava.activity_history;
+
+ tracker.new_turn();
+ tracker.log_activity( NO_EXERCISE );
CHECK( activity_w.layout( ava ) == "Activity: <color_c_light_gray>None</color>" );
- ava.reset_activity_level();
- ava.set_activity_level( LIGHT_EXERCISE );
+ tracker.new_turn();
+ tracker.log_activity( LIGHT_EXERCISE );
CHECK( activity_w.layout( ava ) == "Activity: <color_c_yellow>Light</color>" );
- ava.reset_activity_level();
- ava.set_activity_level( MODERATE_EXERCISE );
+ tracker.new_turn();
+ tracker.log_activity( MODERATE_EXERCISE );
CHECK( activity_w.layout( ava ) == "Activity: <color_c_yellow>Moderate</color>" );
- ava.reset_activity_level();
- ava.set_activity_level( BRISK_EXERCISE );
+ tracker.new_turn();
+ tracker.log_activity( BRISK_EXERCISE );
CHECK( activity_w.layout( ava ) == "Activity: <color_c_light_red>Brisk</color>" );
- ava.reset_activity_level();
- ava.set_activity_level( ACTIVE_EXERCISE );
+ tracker.new_turn();
+ tracker.log_activity( ACTIVE_EXERCISE );
CHECK( activity_w.layout( ava ) == "Activity: <color_c_light_red>Active</color>" );
- ava.reset_activity_level();
- ava.set_activity_level( EXTRA_EXERCISE );
+ tracker.new_turn();
+ tracker.log_activity( EXTRA_EXERCISE );
CHECK( activity_w.layout( ava ) == "Activity: <color_c_red>Extreme</color>" );
} I think it's also possible that the test could need the activity changes spaced out by something like |
b88e735
to
89a821a
Compare
Summary
None
Purpose of change
Contribute to #55076 by converting the "activity text" variable to a widget with JSONized conditional clauses.
Describe the solution
Character::activity_level_index()
returning 0-5 (half ofinstantaneous_activity_level
)get_activity_level()
totalker
and implement it intalker_character
, using the above functionu_var
"activity_level" returning thatget_activity_level
valueDescribe alternatives you've considered
It's a little jarring just how instantaneously-changing this widget is (in both the old and new versions). Simply walking around switches between "None" and "Moderate", and running goes straight to "Active". It might be nice if it were smoothed out over several turns.
Testing
Walk, run, dig pits. See activity level change in realtime.
Additional context
I couldn't get "Light" or "Brisk" to appear, but here are the others: