The Fill Can is long overdue for an overhaul. The code itself is terribly formatted. The Max Filled Limit variable could be set to an RTB preference. There is similar code repeating which could be optimized. I think the actual searching system for same-colored bricks is overcomplicated.
As a start, this is what I put together for the RTB hook:
Note: I know I'm usually against promoting RTB for unrelated Add-Ons as if it were almost build in, but I do see the usefulness.
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs")) {
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("Max Filled Bricks", "Fill Can", "FillCan::MaxBricks", "int 1 128000", "Tool_Fill_Can", 500, 0, 0);
}
else
$Pref::FillCan::MaxBricks = 500;
Edit: This is a example of confusing over-complication:
%list.obj[-1+%list.count++]=%target;