if event.type == "train" then
  local rc = get_rc()
  if rc:find("apprentice_unload") ~= nil then
    rc = rc:gsub("apprentice_unload", "apprentice_load")
  elseif rc:find("apprentice_load") ~= nil then
    rc = rc:gsub("apprentice_load", "apprentice_leave")
  end
  set_rc(rc)
end