This was implemenet last autumn and should be working.
cargo_lock is vehicle part with CARGO_LOCKING flag. This flag prevents access for npc to vehicle parts with LOCKABLE_CARGO flag. This part can be installed only to on_lockable_cargo locations (hatches, trunks, boxes).
vehicle.cpp
// Cargo locks must go on lockable cargo containers
// TODO: do this automatically using "location":"on_mountpoint"
if(part.has_flag("CARGO_LOCKING")) {
bool anchor_found = false;
for( std::vector<int>::const_iterator it = parts_in_square.begin();
it != parts_in_square.end(); ++it ) {
if(part_info(*it).has_flag("LOCKABLE_CARGO")) {
anchor_found = true;
}
}
if(!anchor_found) {
return false;
}
}
npcmove.cpp
const optional_vpart_position vp = g->m.veh_at( p );
if( !vp || vp->vehicle().velocity != 0 || !sees( p ) ) {
continue;
}
vehicle *const veh = &vp->vehicle();
int veh_part = veh->part_with_feature( vp->part_index(), VPFLAG_CARGO, true );
static const std::string locked_string( "LOCKED" );
//TODO Let player know what parts are safe from NPC thieves
if( veh_part < 0 || veh->part_flag( veh_part, locked_string ) ) {
continue;
}
static const std::string cargo_locking_string( "CARGO_LOCKING" );
if( veh->part_with_feature( veh_part, cargo_locking_string, true ) != -1 ) {
continue;
}