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