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

Optional worldmod to disable lifting requirements (strength and lifting quality) #24053

Closed
wants to merge 8 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
15 changes: 15 additions & 0 deletions data/mods/No_Lift_Requirements/modinfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"type": "MOD_INFO",
"ident": "disable_lifting",
"name": "No Lifting Reqs",
"authors": "Wad67",
"description": "Strength checks and lifting qualities are no longer required for installing or removing vehicle parts.",
"category": "rebalance",
"dependencies": [ "dda" ]
},
{
"type": "WORLD_OPTION",
"options": [ "DISABLE_LIFTING" ]
}
]
9 changes: 8 additions & 1 deletion src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ void options_manager::init()
translate_marker( "A scaling factor that determines density of monster spawns." ),
0.0, 50.0, 1.0, 0.1
);

add( "CARRION_SPAWNRATE", "world_default", translate_marker( "Carrion spawn rate scaling factor" ),
translate_marker( "A scaling factor that determines how often creatures spawn from rotting material." ),
0, 1000, 100, COPT_NO_HIDE, "%i%%"
Expand Down Expand Up @@ -1593,6 +1593,13 @@ void options_manager::init()
false, COPT_ALWAYS_HIDE
);

mOptionsSort["world_default"]++;

add( "DISABLE_LIFTING", "world_default", translate_marker( "Disables lifting requirements for vehicle parts." ),
translate_marker( "If true, strength checks and/or lifting qualities no longer need to be met in order to change parts." ),
false, COPT_ALWAYS_HIDE
);

for (unsigned i = 0; i < vPages.size(); ++i) {
mPageItems[i].resize(mOptionsSort[vPages[i].first]);
}
Expand Down
41 changes: 27 additions & 14 deletions src/veh_interact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,20 @@ bool veh_interact::can_install_part() {
str = veh->lift_strength();
use_aid = max_jack >= lvl;
use_str = g->u.can_lift( *veh );
} else {
qual = LIFT;
lvl = std::ceil( units::quantity<double, units::mass::unit_type>( base.weight() ) / TOOL_LIFT_FACTOR );
str = base.lift_strength();
use_aid = max_lift >= lvl;
use_str = g->u.can_lift( base );
}
} else if( get_option<bool>( "DISABLE_LIFTING" ) ) {
qual = LIFT;
lvl = std::ceil( units::quantity<double, units::mass::unit_type>( base.weight() ) / TOOL_LIFT_FACTOR );
str = base.lift_strength();
use_aid = true;
use_str = true;
} else {
qual = LIFT;
lvl = std::ceil( units::quantity<double, units::mass::unit_type>( base.weight() ) / TOOL_LIFT_FACTOR );
str = base.lift_strength();
use_aid = max_lift >= lvl;
use_str = g->u.can_lift( base );
}


if( !( use_aid || use_str ) ) {
ok = false;
Expand Down Expand Up @@ -1296,13 +1303,19 @@ bool veh_interact::can_remove_part( int idx ) {
str = veh->lift_strength();
use_aid = max_jack >= lvl;
use_str = g->u.can_lift( *veh );
} else {
qual = LIFT;
lvl = ceil( units::quantity<double, units::mass::unit_type>( base.weight() ) / TOOL_LIFT_FACTOR );
str = base.lift_strength();
use_aid = max_lift >= lvl;
use_str = g->u.can_lift( base );
}
} else if( get_option<bool>( "DISABLE_LIFTING" ) ) {
qual = LIFT;
lvl = std::ceil( units::quantity<double, units::mass::unit_type>( base.weight() ) / TOOL_LIFT_FACTOR );
str = base.lift_strength();
use_aid = true;
use_str = true;
} else {
qual = LIFT;
lvl = std::ceil( units::quantity<double, units::mass::unit_type>( base.weight() ) / TOOL_LIFT_FACTOR );
str = base.lift_strength();
use_aid = max_lift >= lvl;
use_str = g->u.can_lift( base );
}

if( !( use_aid || use_str ) ) {
ok = false;
Expand Down