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

Add widgets for movement mode, bodypart status, weather, and vehicle #53874

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 65 additions & 0 deletions data/json/ui/bodyparts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[
{
"id": "bodypart_status_text",
"//": "Base widget for showing body part status; needs bodypart field defined in derived widget.",
"type": "widget",
"style": "text",
"var": "bp_status_text"
},
{
"id": "bp_status_head_text",
"type": "widget",
"label": "HEAD",
"bodypart": "head",
"copy-from": "bodypart_status_text"
},
{
"id": "bp_status_torso_text",
"type": "widget",
"label": "TORSO",
"bodypart": "torso",
"copy-from": "bodypart_status_text"
},
{
"id": "bp_status_left_arm_text",
"type": "widget",
"label": "L ARM",
"bodypart": "arm_l",
"copy-from": "bodypart_status_text"
},
{
"id": "bp_status_right_arm_text",
"type": "widget",
"label": "R ARM",
"bodypart": "arm_r",
"copy-from": "bodypart_status_text"
},
{
"id": "bp_status_left_leg_text",
"type": "widget",
"label": "L LEG",
"bodypart": "leg_l",
"copy-from": "bodypart_status_text"
},
{
"id": "bp_status_right_leg_text",
"type": "widget",
"label": "R LEG",
"bodypart": "leg_r",
"copy-from": "bodypart_status_text"
},
{
"id": "bodypart_status_top_layout",
"type": "widget",
"style": "layout",
"arrange": "columns",
"widgets": [ "bp_status_left_arm_text", "bp_status_head_text", "bp_status_right_arm_text" ]
},
{
"id": "bodypart_status_bottom_layout",
"type": "widget",
"style": "layout",
"arrange": "columns",
"widgets": [ "bp_status_left_leg_text", "bp_status_torso_text", "bp_status_right_leg_text" ]
}
]
47 changes: 47 additions & 0 deletions data/json/ui/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,22 @@
"var": "moon_phase_text",
"//": "Uses display::get_moon"
},
{
"id": "move_mode_letter",
"type": "widget",
"label": "Mode",
"style": "text",
"var": "move_mode_letter",
"//": "Single-letter W/R/C/P, from display::move_mode_letter_color"
},
{
"id": "move_mode_desc",
"type": "widget",
"label": "Mode",
"style": "text",
"var": "move_mode_text",
"//": "Full movement mode name, from display::move_mode_text_color"
},
{
"id": "pain_desc",
"type": "widget",
Expand Down Expand Up @@ -694,6 +710,30 @@
"var": "weary_malus_text",
"//": "Uses display::weary_malus_text_color"
},
{
"id": "vehicle_azimuth_desc",
"type": "widget",
"label": "Azimuth",
"style": "text",
"var": "veh_azimuth_text",
"//": "Uses display::vehicle_azimuth_text"
},
{
"id": "vehicle_cruise_desc",
"type": "widget",
"label": "Vehicle Speed",
"style": "text",
"var": "veh_cruise_text",
"//": "Current/target vehicle cruising speed from display::vehicle_cruise_text_color"
},
{
"id": "vehicle_fuel_desc",
"type": "widget",
"label": "Vehicle Fuel",
"style": "text",
"var": "veh_fuel_text",
"//": "Current/max fuel for active vehicle engine from display::vehicle_fuel_text_color"
},
{
"id": "weariness_desc",
"type": "widget",
Expand Down Expand Up @@ -751,6 +791,13 @@
"style": "text",
"var": "wind_text"
},
{
"id": "weather_desc",
"type": "widget",
"label": "Weather",
"style": "text",
"var": "weather_text"
},
{
"id": "lighting_desc",
"type": "widget",
Expand Down
65 changes: 65 additions & 0 deletions data/mods/TEST_DATA/widgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@
"var": "focus",
"style": "number"
},
{
"id": "test_health_num",
"type": "widget",
"label": "HEALTH",
"var": "health",
"style": "number"
},
{
"id": "test_health_text",
"type": "widget",
"label": "HEALTH",
"var": "health_text",
"style": "text"
},
{
"id": "test_mana_num",
"type": "widget",
Expand All @@ -85,6 +99,20 @@
"var": "rad_badge_text",
"style": "text"
},
{
"id": "test_pain_num",
"type": "widget",
"label": "PAIN",
"var": "pain",
"style": "number"
},
{
"id": "test_pain_text",
"type": "widget",
"label": "PAIN",
"var": "pain_text",
"style": "text"
},
{
"id": "test_speed_num",
"type": "widget",
Expand Down Expand Up @@ -124,6 +152,20 @@
"var": "move",
"style": "number"
},
{
"id": "test_move_mode_text",
"type": "widget",
"label": "MODE",
"var": "move_mode_text",
"style": "text"
},
{
"id": "test_move_mode_letter",
"type": "widget",
"label": "MODE",
"var": "move_mode_letter",
"style": "text"
},
{
"id": "test_str_num",
"type": "widget",
Expand Down Expand Up @@ -152,6 +194,13 @@
"var": "stat_per",
"style": "number"
},
{
"id": "test_weather_text",
"type": "widget",
"label": "Weather",
"var": "weather_text",
"style": "text"
},
{
"id": "test_weariness_num",
"type": "widget",
Expand Down Expand Up @@ -194,6 +243,22 @@
"bodypart": "torso",
"style": "number"
},
{
"id": "test_status_torso_text",
"type": "widget",
"label": "TORSO STATUS",
"var": "bp_status_text",
"bodypart": "torso",
"style": "text"
},
{
"id": "test_status_left_arm_text",
"type": "widget",
"label": "LEFT ARM STATUS",
"var": "bp_status_text",
"bodypart": "arm_l",
"style": "text"
},
{
"id": "test_stat_panel",
"type": "widget",
Expand Down
17 changes: 17 additions & 0 deletions src/move_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@ std::string move_mode::name() const
return _name.translated();
}

std::string move_mode::type_name() const
{
switch( _type ) {
case move_mode_type::PRONE:
return "prone";
case move_mode_type::CROUCHING:
return "crouching";
case move_mode_type::WALKING:
return "walking";
case move_mode_type::RUNNING:
return "running";
default:
// Shouldn't happen, but make it visible if it does
return "bugging out";
}
}

std::string move_mode::change_message( bool success, steed_type steed ) const
{
if( steed == steed_type::NUM ) {
Expand Down
3 changes: 3 additions & 0 deletions src/move_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ class move_mode

move_mode() = default;

// name: walk, run, crouch, prone
std::string name() const;
// type name: walking, running, crouching, prone
std::string type_name() const;
std::string change_message( bool success, steed_type steed ) const;

move_mode_id cycle() const;
Expand Down
Loading